Search in sources :

Example 21 with TupleDescriptor

use of org.apache.derby.iapi.sql.dictionary.TupleDescriptor in project derby by apache.

the class DataDictionaryImpl method getTriggerDescriptor.

/**
 * Get a TriggerDescriptor given its UUID.
 *
 * @param uuid	The UUID
 *
 * @return The TriggerDescriptor for the constraint.
 *
 * @exception StandardException		Thrown on failure
 */
public TriggerDescriptor getTriggerDescriptor(UUID uuid) throws StandardException {
    TabInfoImpl ti = getNonCoreTI(SYSTRIGGERS_CATALOG_NUM);
    DataValueDescriptor triggerIdOrderable = getIDValueAsCHAR(uuid);
    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(1);
    keyRow.setColumn(1, triggerIdOrderable);
    return getDescriptorViaIndex(SYSTRIGGERSRowFactory.SYSTRIGGERS_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, TriggerDescriptor.class, false);
}
Also used : TupleDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Example 22 with TupleDescriptor

use of org.apache.derby.iapi.sql.dictionary.TupleDescriptor in project derby by apache.

the class DataDictionaryImpl method getSPSDescriptorIndex1Scan.

/**
 * Scan sysschemas_index1 (stmtname, schemaid) for a match.
 *
 * @return SPSDescriptor	The matching descriptor, if any.
 *
 * @exception StandardException		Thrown on failure
 */
private SPSDescriptor getSPSDescriptorIndex1Scan(String stmtName, String schemaUUID) throws StandardException {
    DataValueDescriptor schemaIDOrderable;
    DataValueDescriptor stmtNameOrderable;
    TabInfoImpl ti = getNonCoreTI(SYSSTATEMENTS_CATALOG_NUM);
    /* Use stmtNameOrderable and schemaIdOrderable in both start 
		 * and stop position for scan. 
		 */
    stmtNameOrderable = new SQLVarchar(stmtName);
    schemaIDOrderable = new SQLChar(schemaUUID);
    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(2);
    keyRow.setColumn(1, stmtNameOrderable);
    keyRow.setColumn(2, schemaIDOrderable);
    SPSDescriptor spsd = getDescriptorViaIndex(SYSSTATEMENTSRowFactory.SYSSTATEMENTS_INDEX2_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, SPSDescriptor.class, false);
    /*
		** Set up the parameter defaults.  We are only
		** doing this when we look up by name because
		** this is the only time we cache, and it can
		** be foolish to look up the parameter defaults
		** for someone that doesn't need them.
		*/
    if (spsd != null) {
        List<DataValueDescriptor> tmpDefaults = new ArrayList<DataValueDescriptor>();
        spsd.setParams(getSPSParams(spsd, tmpDefaults));
        Object[] defaults = tmpDefaults.toArray();
        spsd.setParameterDefaults(defaults);
    }
    return spsd;
}
Also used : TupleDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor) SQLChar(org.apache.derby.iapi.types.SQLChar) ArrayList(java.util.ArrayList) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) SQLVarchar(org.apache.derby.iapi.types.SQLVarchar) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow) SPSDescriptor(org.apache.derby.iapi.sql.dictionary.SPSDescriptor)

Example 23 with TupleDescriptor

use of org.apache.derby.iapi.sql.dictionary.TupleDescriptor in project derby by apache.

the class DataDictionaryImpl method locateSchemaRow.

/**
 * Get the target schema by searching for a matching row
 * in SYSSCHEMAS by schema name.  Read only scan.
 *
 * @param schemaName	The name of the schema we're interested in.
 *						If schemaId is null, used to qual.
 *
 * @param tc			TransactionController.  If null, one
 *						is gotten off of the language connection context.
 *
 * @return	The row for the schema
 *
 * @exception StandardException		Thrown on error
 */
private SchemaDescriptor locateSchemaRow(String schemaName, TransactionController tc) throws StandardException {
    DataValueDescriptor schemaNameOrderable;
    TabInfoImpl ti = coreInfo[SYSSCHEMAS_CORE_NUM];
    /* Use aliasNameOrderable in both start 
		 * and stop position for scan. 
		 */
    schemaNameOrderable = new SQLVarchar(schemaName);
    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(1);
    keyRow.setColumn(1, schemaNameOrderable);
    return getDescriptorViaIndex(SYSSCHEMASRowFactory.SYSSCHEMAS_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, SchemaDescriptor.class, false, TransactionController.ISOLATION_REPEATABLE_READ, tc);
}
Also used : TupleDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) SQLVarchar(org.apache.derby.iapi.types.SQLVarchar) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Example 24 with TupleDescriptor

use of org.apache.derby.iapi.sql.dictionary.TupleDescriptor in project derby by apache.

the class DataDictionaryImpl method getFileInfoDescriptorIndex2Scan.

/**
 * Scan sysfiles_index2 (id) for a match.
 * @return TableDescriptor	The matching descriptor, or null.
 * @exception StandardException		Thrown on failure
 */
private FileInfoDescriptor getFileInfoDescriptorIndex2Scan(UUID id) throws StandardException {
    DataValueDescriptor idOrderable;
    TabInfoImpl ti = getNonCoreTI(SYSFILES_CATALOG_NUM);
    idOrderable = getIDValueAsCHAR(id);
    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(1);
    keyRow.setColumn(1, idOrderable);
    return getDescriptorViaIndex(SYSFILESRowFactory.SYSFILES_INDEX2_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, FileInfoDescriptor.class, false);
}
Also used : TupleDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Example 25 with TupleDescriptor

use of org.apache.derby.iapi.sql.dictionary.TupleDescriptor in project derby by apache.

the class DataDictionaryImpl method getSequenceDescriptor.

public SequenceDescriptor getSequenceDescriptor(UUID uuid) throws StandardException {
    DataValueDescriptor UUIDStringOrderable;
    TabInfoImpl ti = getNonCoreTI(SYSSEQUENCES_CATALOG_NUM);
    /* Use UUIDStringOrderable in both start and stop position for
           * scan.
           */
    UUIDStringOrderable = getIDValueAsCHAR(uuid);
    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(1);
    keyRow.setColumn(1, UUIDStringOrderable);
    SequenceDescriptor sequenceDescriptor = getDescriptorViaIndex(SYSSEQUENCESRowFactory.SYSSEQUENCES_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, SequenceDescriptor.class, false);
    putSequenceID(sequenceDescriptor);
    return sequenceDescriptor;
}
Also used : TupleDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) SequenceDescriptor(org.apache.derby.iapi.sql.dictionary.SequenceDescriptor) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow)

Aggregations

TupleDescriptor (org.apache.derby.iapi.sql.dictionary.TupleDescriptor)30 ExecIndexRow (org.apache.derby.iapi.sql.execute.ExecIndexRow)27 DataValueDescriptor (org.apache.derby.iapi.types.DataValueDescriptor)24 SQLVarchar (org.apache.derby.iapi.types.SQLVarchar)13 SQLChar (org.apache.derby.iapi.types.SQLChar)8 ArrayList (java.util.ArrayList)5 ScanQualifier (org.apache.derby.iapi.sql.execute.ScanQualifier)5 LinkedList (java.util.LinkedList)4 List (java.util.List)4 ColumnDescriptorList (org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList)4 ConglomerateDescriptorList (org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptorList)4 ConstraintDescriptorList (org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList)4 TableDescriptor (org.apache.derby.iapi.sql.dictionary.TableDescriptor)4 TriggerDescriptorList (org.apache.derby.iapi.sql.dictionary.TriggerDescriptorList)4 UUID (org.apache.derby.catalog.UUID)3 AliasDescriptor (org.apache.derby.iapi.sql.dictionary.AliasDescriptor)3 SequenceDescriptor (org.apache.derby.iapi.sql.dictionary.SequenceDescriptor)3 ExecRow (org.apache.derby.iapi.sql.execute.ExecRow)3 FormatableBitSet (org.apache.derby.iapi.services.io.FormatableBitSet)2 SPSDescriptor (org.apache.derby.iapi.sql.dictionary.SPSDescriptor)2