// select entire data set into a hash table, with first column key
int[] keyColumns = new int[1];
keyColumns[0] = 0;
BackingStoreHashtable result_set =
tc.createBackingStoreHashtableFromScan(
conglomid,
0,
TransactionController.MODE_TABLE,
TransactionController.ISOLATION_SERIALIZABLE,
(FormatableBitSet) null,
start_key, start_op,
qualifier,
stop_key, stop_op,
-1, // no limit on total rows.
keyColumns, // first column is hash key column
false, // don't remove duplicates
-1, // no estimate of rows
-1, // put it all into memory
-1, // use default initial capacity
-1, // use default load factor
false, // don't maintain runtime statistics
false, // don't skip null key columns
false, // don't keep after commit
false); // don't include row locations
// make sure the expected result set is the same as the actual result
// set.
Enumeration e = result_set.elements();
while (e.hasMoreElements())
{
Object obj;
DataValueDescriptor[] row = null;
if ((obj = e.nextElement()) instanceof DataValueDescriptor[] )
{
row = (DataValueDescriptor[] ) obj;
key = ((SQLLongint)(row[2])).getLong();
if (!set.remove(new Long(key)))
{
return(
fail("(t_scanFetchHashtable-obj) wrong key, expected (" +
input_expect_key + ")" +
"but got (" + key + ")."));
}
numrows++;
}
else if (obj instanceof List)
{
List row_vect = (List) obj;
for (int i = 0; i < row_vect.size(); i++)
{
row = (DataValueDescriptor[]) row_vect.get(i);
key = ((SQLLongint)(row[2])).getLong();
if (!set.remove(new Long(key)))
{
return(fail(
"(t_scanFetchHashtable-vector) wrong key, expected (" +
input_expect_key + ")" +
"but got (" + key + ")."));
}
numrows++;
}
}
else
{
return(fail(
"(t_scanFetchHashtable) got bad type for data: " + obj));
}
}
if (numrows != expect_numrows)
{
return(
fail(
"(t_scanFetchHashtable) wrong number of rows. Expected " +
expect_numrows + " rows, but got " + numrows + "rows."));
}
result_set.close();
// select entire data set into a hash table, with key being
// the third column, which is the unique id used to verify the
// right result set is being returned.:
// open a new scan
keyColumns[0] = 2;
result_set =
tc.createBackingStoreHashtableFromScan(
conglomid,
0,
TransactionController.MODE_TABLE,
TransactionController.ISOLATION_SERIALIZABLE,
(FormatableBitSet) null,
start_key, start_op,
qualifier,
stop_key, stop_op,
-1, // no limit on total rows.
keyColumns, // third column is hash key column
false, // don't remove duplicates
-1, // no estimate of rows
-1, // put it all into memory
-1, // use default initial capacity
-1, // use default load factor
false, // don't maintain runtime statistics
false, // don't skip null key columns
false, // don't keep after commit
false); // don't include row locations
Object removed_obj;
for (numrows = 0; numrows < expect_numrows; numrows++)
{
long exp_key ;
if (order == ORDER_DESC)
exp_key = input_expect_key - numrows;
else
exp_key = input_expect_key + numrows;
if ((removed_obj =
result_set.remove(
new SQLLongint(exp_key))) == null)
{
fail("(t_scanFetchHashtable-2-vector) wrong key, expected (" +
(exp_key) + ")" +
"but did not find it.");