use of org.apache.derby.iapi.services.io.FormatableBitSet in project derby by apache.
the class UpdateResultSet method checkStreamCols.
/* Following 2 methods are for checking and make sure we don't have one un-objectified stream
* to be inserted into 2 temp table rows for deferred update. Otherwise it would cause problem
* when writing to disk using the stream a second time. In other cases we don't want to
* unnecessarily objectify the stream. beetle 4896.
*/
private FormatableBitSet checkStreamCols() {
DataValueDescriptor[] cols = row.getRowArray();
FormatableBitSet streamCols = null;
for (int i = 0; i < numberOfBaseColumns; i++) {
if (// check new values
cols[i + numberOfBaseColumns] instanceof StreamStorable) {
if (streamCols == null)
streamCols = new FormatableBitSet(numberOfBaseColumns);
streamCols.set(i);
}
}
return streamCols;
}
use of org.apache.derby.iapi.services.io.FormatableBitSet in project derby by apache.
the class DeleteResultSet method deleteDeferredRows.
// delete the rows that in case deferred case and
// during cascade delete (All deletes are deferred during cascade action)
void deleteDeferredRows() throws StandardException {
DataValueDescriptor rlColumn;
RowLocation baseRowLocation;
ExecRow defRLRow;
deferredBaseCC = tc.openCompiledConglomerate(false, (TransactionController.OPENMODE_FORUPDATE | TransactionController.OPENMODE_SECONDARY_LOCKED), lockMode, TransactionController.ISOLATION_SERIALIZABLE, constants.heapSCOCI, heapDCOCI);
CursorResultSet rs = rowHolder.getResultSet();
try {
/*
** We need to do a fetch doing a partial row
** read. We need to shift our 1-based bit
** set to a zero based bit set like the store
** expects.
*/
FormatableBitSet readBitSet = RowUtil.shift(baseRowReadList, 1);
rs.open();
while ((defRLRow = rs.getNextRow()) != null) {
rlColumn = defRLRow.getColumn(rlColumnNumber);
baseRowLocation = (RowLocation) (rlColumn).getObject();
/* Get the base row at the given RowLocation */
boolean row_exists = deferredBaseCC.fetch(baseRowLocation, deferredSparseRow.getRowArray(), readBitSet);
// the rows before the dependent result get a chance to delete
if (cascadeDelete && !row_exists)
continue;
if (SanityManager.DEBUG) {
if (!row_exists) {
SanityManager.THROWASSERT("could not find row " + baseRowLocation);
}
}
rc.deleteRow(deferredBaseRow, baseRowLocation);
source.markRowAsDeleted();
}
} finally {
rs.close();
}
}
use of org.apache.derby.iapi.services.io.FormatableBitSet 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.services.io.FormatableBitSet in project derby by apache.
the class T_ConsistencyChecker method getIndexTemplateRow.
/* Get a template row for the specified index */
private ExecRow getIndexTemplateRow(RowLocation baseRL) throws StandardException {
int[] baseColumnPositions;
int baseColumns = 0;
ExecRow indexScanTemplate;
baseColumnPositions = id.getIndexDescriptor().baseColumnPositions();
baseColumns = baseColumnPositions.length;
FormatableBitSet indexColsBitSet = new FormatableBitSet();
for (int i = 0; i < baseColumns; i++) {
indexColsBitSet.grow(baseColumnPositions[i]);
indexColsBitSet.set(baseColumnPositions[i] - 1);
}
/* Get a row template */
indexScanTemplate = lcc.getLanguageConnectionFactory().getExecutionFactory().getValueRow(baseColumns + 1);
/* Fill the row with nulls of the correct type */
for (int column = 0; column < baseColumns; column++) {
/* Column positions in the data dictionary are one-based */
ColumnDescriptor cd = td.getColumnDescriptor(baseColumnPositions[column]);
DataTypeDescriptor dts = cd.getType();
indexScanTemplate.setColumn(column + 1, dts.getNull());
}
/* Set the row location in the last column of the index row */
indexScanTemplate.setColumn(baseColumns + 1, baseRL);
return indexScanTemplate;
}
use of org.apache.derby.iapi.services.io.FormatableBitSet in project derby by apache.
the class FormatableBitSetTest method testORWithNull.
// Test cases for or(FormatableBitSet)
public void testORWithNull() {
FormatableBitSet cpy = new FormatableBitSet(bitset18);
assertTrue(cpy.invariantHolds());
bitset18.or(null);
assertEquals(9, bitset18.getNumBitsSet());
assertTrue(cpy.equals(bitset18));
}
Aggregations