int indexNumber
)
throws StandardException
{
long indexConglomerateNumber = tabInfo.getIndexConglomerate( indexNumber );
IndexRowGenerator indexRowGenerator = tabInfo.getIndexRowGenerator( indexNumber );
CatalogRowFactory rowFactory = tabInfo.getCatalogRowFactory();
ExecRow heapRow = rowFactory.makeEmptyRow();
ExecIndexRow indexableRow = indexRowGenerator.getIndexRowTemplate();
ScanController heapScan =
tc.openScan(
heapConglomerateNumber, // conglomerate to open
false, // don't hold open across commit
0, // for read
TransactionController.MODE_TABLE,
TransactionController.ISOLATION_REPEATABLE_READ,
(FormatableBitSet) null, // all fields as objects
null, // start position - first row
ScanController.GE, // startSearchOperation
null, //scanQualifier,
null, //stop position-through last row
ScanController.GT); // stopSearchOperation
RowLocation heapLocation =
heapScan.newRowLocationTemplate();
ConglomerateController indexController =
tc.openConglomerate(
indexConglomerateNumber,
false,
TransactionController.OPENMODE_FORUPDATE,
TransactionController.MODE_TABLE,
TransactionController.ISOLATION_REPEATABLE_READ);
while ( heapScan.fetchNext(heapRow.getRowArray()) )
{
heapScan.fetchLocation( heapLocation );
indexRowGenerator.getIndexRow( heapRow, heapLocation, indexableRow, (FormatableBitSet) null );
indexController.insert(indexableRow.getRowArray());
}
indexController.close();