Search in sources :

Example 11 with TupleDescriptor

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

the class DataDictionaryImpl method getFileInfoDescriptorIndex1Scan.

/**
 * Scan sysfiles_index1 (schemaid,name) for a match.
 * @return The matching descriptor or null.
 * @exception StandardException		Thrown on failure
 */
private FileInfoDescriptor getFileInfoDescriptorIndex1Scan(UUID schemaId, String name) throws StandardException {
    DataValueDescriptor schemaIDOrderable;
    DataValueDescriptor nameOrderable;
    TabInfoImpl ti = getNonCoreTI(SYSFILES_CATALOG_NUM);
    nameOrderable = new SQLVarchar(name);
    schemaIDOrderable = getIDValueAsCHAR(schemaId);
    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(2);
    keyRow.setColumn(1, nameOrderable);
    keyRow.setColumn(2, schemaIDOrderable);
    FileInfoDescriptor r = getDescriptorViaIndex(SYSFILESRowFactory.SYSFILES_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, FileInfoDescriptor.class, false);
    return r;
}
Also used : FileInfoDescriptor(org.apache.derby.iapi.sql.dictionary.FileInfoDescriptor) 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 12 with TupleDescriptor

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

the class DataDictionaryImpl method getAllDependencyDescriptorsList.

/**
 * Build and return an List with DependencyDescriptors for
 * all of the stored dependencies.
 * This is useful for consistency checking.
 *
 * @return List		List of all DependencyDescriptors.
 *
 * @exception StandardException		Thrown on failure
 */
public List<TupleDescriptor> getAllDependencyDescriptorsList() throws StandardException {
    ScanController scanController;
    TransactionController tc;
    ExecRow outRow;
    ExecRow templateRow;
    List<TupleDescriptor> ddl = newSList();
    TabInfoImpl ti = getNonCoreTI(SYSDEPENDS_CATALOG_NUM);
    SYSDEPENDSRowFactory rf = (SYSDEPENDSRowFactory) ti.getCatalogRowFactory();
    // Get the current transaction controller
    tc = getTransactionCompile();
    outRow = rf.makeEmptyRow();
    scanController = tc.openScan(// conglomerate to open
    ti.getHeapConglomerate(), // don't hold open across commit
    false, // for read
    0, // scans entire table.
    TransactionController.MODE_TABLE, TransactionController.ISOLATION_REPEATABLE_READ, // all fields as objects
    (FormatableBitSet) null, // start position - first row
    null, // startSearchOperation
    ScanController.GE, null, // stop position - through last row
    null, // stopSearchOperation
    ScanController.GT);
    while (scanController.fetchNext(outRow.getRowArray())) {
        DependencyDescriptor dependencyDescriptor;
        dependencyDescriptor = (DependencyDescriptor) rf.buildDescriptor(outRow, (TupleDescriptor) null, this);
        ddl.add(dependencyDescriptor);
    }
    scanController.close();
    return ddl;
}
Also used : ScanController(org.apache.derby.iapi.store.access.ScanController) DependencyDescriptor(org.apache.derby.iapi.sql.dictionary.DependencyDescriptor) TupleDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor) ExecRow(org.apache.derby.iapi.sql.execute.ExecRow) FormatableBitSet(org.apache.derby.iapi.services.io.FormatableBitSet) TransactionController(org.apache.derby.iapi.store.access.TransactionController)

Example 13 with TupleDescriptor

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

the class DataDictionaryImpl method getConglomerateDescriptor.

/**
 * Gets a conglomerate descriptor for the named index in the given schema,
 * getting an exclusive row lock on the matching row in
 * sys.sysconglomerates (for DDL concurrency) if requested.
 *
 * @param indexName	The name of the index we're looking for
 * @param sd		The schema descriptor
 * @param forUpdate	Whether or not to get an exclusive row
 *					lock on the row in sys.sysconglomerates.
 *
 * @return	A ConglomerateDescriptor describing the requested
 *		conglomerate. Returns NULL if no such conglomerate.
 *
 * @exception StandardException		Thrown on failure
 */
public ConglomerateDescriptor getConglomerateDescriptor(String indexName, SchemaDescriptor sd, boolean forUpdate) throws StandardException {
    ExecIndexRow keyRow2 = null;
    DataValueDescriptor nameOrderable;
    DataValueDescriptor schemaIDOrderable = null;
    TabInfoImpl ti = coreInfo[SYSCONGLOMERATES_CORE_NUM];
    nameOrderable = new SQLVarchar(indexName);
    schemaIDOrderable = getIDValueAsCHAR(sd.getUUID());
    /* Set up the start/stop position for the scan */
    keyRow2 = exFactory.getIndexableRow(2);
    keyRow2.setColumn(1, nameOrderable);
    keyRow2.setColumn(2, schemaIDOrderable);
    return getDescriptorViaIndex(SYSCONGLOMERATESRowFactory.SYSCONGLOMERATES_INDEX2_ID, keyRow2, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, ConglomerateDescriptor.class, forUpdate);
}
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 14 with TupleDescriptor

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

the class DataDictionaryImpl method getTableDescriptorIndex2Scan.

/**
 * Scan systables_index2 (tableid) for a match.
 *
 * @return TableDescriptor	The matching descriptor, if any.
 *
 * @exception StandardException		Thrown on failure
 */
private TableDescriptor getTableDescriptorIndex2Scan(String tableUUID) throws StandardException {
    DataValueDescriptor tableIDOrderable;
    TableDescriptor td;
    TabInfoImpl ti = coreInfo[SYSTABLES_CORE_NUM];
    /* Use tableIDOrderable in both start and stop position for scan.
		 */
    tableIDOrderable = new SQLChar(tableUUID);
    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(1);
    keyRow.setColumn(1, tableIDOrderable);
    td = getDescriptorViaIndex(SYSTABLESRowFactory.SYSTABLES_INDEX2_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, TableDescriptor.class, false);
    return finishTableDescriptor(td);
}
Also used : TupleDescriptor(org.apache.derby.iapi.sql.dictionary.TupleDescriptor) SQLChar(org.apache.derby.iapi.types.SQLChar) ScanQualifier(org.apache.derby.iapi.sql.execute.ScanQualifier) ColumnDescriptorList(org.apache.derby.iapi.sql.dictionary.ColumnDescriptorList) ConglomerateDescriptorList(org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptorList) ArrayList(java.util.ArrayList) TriggerDescriptorList(org.apache.derby.iapi.sql.dictionary.TriggerDescriptorList) List(java.util.List) ConstraintDescriptorList(org.apache.derby.iapi.sql.dictionary.ConstraintDescriptorList) LinkedList(java.util.LinkedList) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor) ExecIndexRow(org.apache.derby.iapi.sql.execute.ExecIndexRow) TableDescriptor(org.apache.derby.iapi.sql.dictionary.TableDescriptor)

Example 15 with TupleDescriptor

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

the class DataDictionaryImpl method locateSchemaRowBody.

private SchemaDescriptor locateSchemaRowBody(UUID schemaId, int isolationLevel, TransactionController tc) throws StandardException {
    DataValueDescriptor UUIDStringOrderable;
    TabInfoImpl ti = coreInfo[SYSSCHEMAS_CORE_NUM];
    /* Use UUIDStringOrderable in both start and stop positions for scan */
    UUIDStringOrderable = getIDValueAsCHAR(schemaId);
    /* Set up the start/stop position for the scan */
    ExecIndexRow keyRow = exFactory.getIndexableRow(1);
    keyRow.setColumn(1, UUIDStringOrderable);
    return getDescriptorViaIndex(SYSSCHEMASRowFactory.SYSSCHEMAS_INDEX2_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, SchemaDescriptor.class, false, isolationLevel, tc);
}
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)

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