use of org.apache.derby.iapi.sql.execute.ScanQualifier in project derby by apache.
the class DataDictionaryImpl method hashAllConglomerateDescriptorsByNumber.
/**
* Get all of the ConglomerateDescriptors in the database and
* hash them by conglomerate number.
* This is useful as a performance optimization for the locking VTIs.
* NOTE: This method will scan SYS.SYSCONGLOMERATES at READ UNCOMMITTED.
*
* @param tc TransactionController for the transaction
*
* @return A Hashtable with all of the ConglomerateDescriptors
* in the database hashed by conglomerate number.
*
* @exception StandardException Thrown on failure
*/
public Hashtable<Long, ConglomerateDescriptor> hashAllConglomerateDescriptorsByNumber(TransactionController tc) throws StandardException {
Hashtable<Long, ConglomerateDescriptor> ht = new Hashtable<Long, ConglomerateDescriptor>();
ConglomerateDescriptor cd = null;
ScanController scanController;
ExecRow outRow;
TabInfoImpl ti = coreInfo[SYSCONGLOMERATES_CORE_NUM];
SYSCONGLOMERATESRowFactory rf = (SYSCONGLOMERATESRowFactory) ti.getCatalogRowFactory();
outRow = rf.makeEmptyRow();
scanController = tc.openScan(// conglomerate to open
ti.getHeapConglomerate(), // don't hold open across commit
false, // for read
0, // scans whole table.
TransactionController.MODE_RECORD, TransactionController.ISOLATION_READ_UNCOMMITTED, // all fields as objects
(FormatableBitSet) null, // keyRow.getRowArray(), // start position - first row
(DataValueDescriptor[]) null, // startSearchOperation
ScanController.GE, (ScanQualifier[][]) null, // keyRow.getRowArray(), // stop position - through last row
(DataValueDescriptor[]) null, // stopSearchOperation
ScanController.GT);
// fetch() may find the row deleted or purged from the table.
while (scanController.fetchNext(outRow.getRowArray())) {
cd = (ConglomerateDescriptor) rf.buildDescriptor(outRow, (TupleDescriptor) null, this);
Long hashKey = cd.getConglomerateNumber();
ht.put(hashKey, cd);
}
scanController.close();
return ht;
}
use of org.apache.derby.iapi.sql.execute.ScanQualifier in project derby by apache.
the class DataDictionaryImpl method computeSequenceRowLocation.
/**
* Computes the RowLocation in SYSSEQUENCES for a particular sequence. Also
* constructs the sequence descriptor.
*
* @param tc Transaction Controller to use.
* @param sequenceIDstring UUID of the sequence as a string
* @param rowLocation OUTPUT param for returing the row location
* @param sequenceDescriptor OUTPUT param for return the sequence descriptor
*
* @exception StandardException thrown on failure.
*/
public void computeSequenceRowLocation(TransactionController tc, String sequenceIDstring, RowLocation[] rowLocation, SequenceDescriptor[] sequenceDescriptor) throws StandardException {
TabInfoImpl ti = getNonCoreTI(SYSSEQUENCES_CATALOG_NUM);
ExecIndexRow keyRow = null;
keyRow = (ExecIndexRow) exFactory.getIndexableRow(1);
keyRow.setColumn(1, new SQLChar(sequenceIDstring));
rowLocation[0] = ti.getRowLocation(tc, keyRow, SYSSEQUENCESRowFactory.SYSSEQUENCES_INDEX1_ID);
sequenceDescriptor[0] = getDescriptorViaIndex(SYSSEQUENCESRowFactory.SYSSEQUENCES_INDEX1_ID, keyRow, (ScanQualifier[][]) null, ti, (TupleDescriptor) null, (List<TupleDescriptor>) null, SequenceDescriptor.class, false, TransactionController.ISOLATION_REPEATABLE_READ, tc);
}
Aggregations