use of org.apache.derby.iapi.store.access.ScanController in project derby by apache.
the class GenericRIChecker method close.
/**
* Clean up all scan controllers
*
* @exception StandardException on error
*/
void close() throws StandardException {
Enumeration<ScanController> e = scanControllers.elements();
while (e.hasMoreElements()) {
ScanController scan = e.nextElement();
scan.close();
}
scanControllers.clear();
}
use of org.apache.derby.iapi.store.access.ScanController in project derby by apache.
the class T_ConsistencyChecker method nullFirstHeapRow.
/**
* Set all of the columns in the first row from
* the heap to null, without
* updating the indexes on the table.
*
* @param schemaName The schema name.
* @param tableName The table name.
*
* @exception StandardException Thrown on error
*/
public static void nullFirstHeapRow(String schemaName, String tableName) throws StandardException {
T_ConsistencyChecker t_cc = new T_ConsistencyChecker(schemaName, tableName, null);
t_cc.getContexts();
t_cc.getDescriptors();
/* Open a scan on the heap */
ScanController heapScan = t_cc.openUnqualifiedHeapScan();
// Move to the 1st row in the heap
heapScan.next();
// Get the RowLocation
RowLocation baseRL = heapScan.newRowLocationTemplate();
heapScan.fetchLocation(baseRL);
// Replace the current row with nulls
heapScan.replace(t_cc.getHeapRowOfNulls().getRowArray(), (FormatableBitSet) null);
heapScan.close();
}
use of org.apache.derby.iapi.store.access.ScanController in project derby by apache.
the class T_ConsistencyChecker method insertBadRowLocation.
/**
* Get the first row from the heap and insert it into
* the specified index, with a bad row location, without
* inserting it into the heap or the other indexes on the table.
*
* @param schemaName The schema name.
* @param tableName The table name.
* @param indexName The specified index.
*
* @exception StandardException Thrown on error
*/
public static void insertBadRowLocation(String schemaName, String tableName, String indexName) throws StandardException {
T_ConsistencyChecker t_cc = new T_ConsistencyChecker(schemaName, tableName, indexName);
t_cc.getContexts();
t_cc.getDescriptors();
/* Open a scan on the heap */
ScanController heapScan = t_cc.openUnqualifiedHeapScan();
// Get the RowLocation
RowLocation baseRL = heapScan.newRowLocationTemplate();
RowLocation badRL = heapScan.newRowLocationTemplate();
heapScan.close();
/* Open a scan on the index */
ExecRow indexRow = t_cc.getIndexTemplateRow(baseRL);
ScanController indexScan = t_cc.openUnqualifiedIndexScan();
// Move to the 1st row in the index
indexScan.next();
// Fetch the 1st row
indexScan.fetch(indexRow.getRowArray());
indexScan.close();
// Insert another copy of the 1st row into the index with a bad row location
int keyLength = t_cc.getIndexDescriptor().getIndexDescriptor().baseColumnPositions().length;
indexRow.setColumn(keyLength + 1, badRL);
ConglomerateController indexCC = t_cc.openIndexCC();
indexCC.insert(indexRow.getRowArray());
indexCC.close();
}
use of org.apache.derby.iapi.store.access.ScanController in project derby by apache.
the class T_ConsistencyChecker method openUnqualifiedIndexScan.
/* Open an unqualified scan on the index for update */
private ScanController openUnqualifiedIndexScan() throws StandardException {
ScanController indexScan;
indexScan = tc.openScan(id.getConglomerateNumber(), // hold
false, // forUpdate
TransactionController.OPENMODE_FORUPDATE, TransactionController.MODE_TABLE, TransactionController.ISOLATION_SERIALIZABLE, (FormatableBitSet) null, // startKeyValue
null, // not used with null start posn.
0, // qualifier
null, // stopKeyValue
null, // not used with null stop posn.
0);
return indexScan;
}
use of org.apache.derby.iapi.store.access.ScanController in project derby by apache.
the class T_ConsistencyChecker method reinsertFirstHeapRow.
/**
* Get the first row from the heap and insert it into
* the heap again, without
* inserting it from the indexes on the table.
*
* @param schemaName The schema name.
* @param tableName The table name.
*
* @exception StandardException Thrown on error
*/
public static void reinsertFirstHeapRow(String schemaName, String tableName) throws StandardException {
T_ConsistencyChecker t_cc = new T_ConsistencyChecker(schemaName, tableName, null);
t_cc.getContexts();
t_cc.getDescriptors();
/* Open a scan on the heap */
ScanController heapScan = t_cc.openUnqualifiedHeapScan();
// Move to the 1st row in the heap
heapScan.next();
// Fetch the 1st row
ExecRow firstRow = t_cc.getHeapRowOfNulls();
heapScan.fetch(firstRow.getRowArray());
heapScan.close();
// Insert another copy of the 1st row into the heap
ConglomerateController heapCC = t_cc.openHeapCC();
heapCC.insert(firstRow.getRowArray());
heapCC.close();
}
Aggregations