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;
}
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;
}
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);
}
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);
}
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);
}
Aggregations