static_info,
dynamic_info);
// Create a row.
T_AccessRow r1 = new T_AccessRow(1);
SQLInteger c1 = new SQLInteger(value);
r1.setCol(0, c1);
// Get a location template
RowLocation rowloc = cc.newRowLocationTemplate();
// Insert the row and remember its location.
cc.insertAndFetchLocation(r1.getRowArray(), rowloc);
// quick test to make sure we can hash insert and find row location.
Hashtable test_rowloc_hash = new Hashtable();
test_rowloc_hash.put(rowloc, rowloc);
RowLocation hash_find = (RowLocation) test_rowloc_hash.get(rowloc);
if (!hash_find.equals(rowloc))
throw T_Fail.testFailMsg("(insertAndFetch) bad hash lookup 1");
hash_find = (RowLocation) test_rowloc_hash.remove(rowloc);
if (!hash_find.equals(rowloc))
throw T_Fail.testFailMsg("(insertAndFetch) bad hash lookup 2");
hash_find = (RowLocation) test_rowloc_hash.remove(rowloc);
if (hash_find != null)
throw T_Fail.testFailMsg("(insertAndFetch) bad hash lookup 3");
// Create a new row of the same type (since the interface expects
// the callers to be keeping the row types straight), but with
// a different column value.
T_AccessRow r2 = new T_AccessRow(1);
SQLInteger c2 = new SQLInteger(0);
r2.setCol(0, c2);
// Fetch the stored value.
if (!cc.fetch(rowloc, r2.getRowArray(), (FormatableBitSet) null))
{
throw T_Fail.testFailMsg("(insertAndFetch) fetch found no row.");
}
// Fetch using the fetch partial column interface
SQLInteger c3 = new SQLInteger(0);
FormatableBitSet singleColumn = new FormatableBitSet(1);
singleColumn.set(0);
DataValueDescriptor[] c3row = new DataValueDescriptor[1];
c3row[0] = c3;
if (!cc.fetch(rowloc, c3row, singleColumn))
{
throw T_Fail.testFailMsg("(insertAndFetch) fetch found no row.");
}
// Close the conglomerate.
cc.close();
// Make sure we read back the value we wrote.
if (c2.getInt() != value)
throw T_Fail.testFailMsg("(insertAndFetch) Fetched value != inserted value.");
if (c3.getInt() != value)
throw T_Fail.testFailMsg("(insertAndFetch) Fetched value != inserted value.");
return true;
}