null, //column sort order - not required for heap
null, // default properties
TransactionController.IS_DEFAULT); // not temporary
// Open the base table
ConglomerateController base_cc =
tc.openConglomerate(
base_conglomid,
false,
TransactionController.OPENMODE_FORUPDATE,
TransactionController.MODE_RECORD,
TransactionController.ISOLATION_SERIALIZABLE);
// initialize the secondary index row - pointing it at base row
index_row.init(base_row, base_cc.newRowLocationTemplate(), 5);
Properties properties =
createProperties(
null, // no current properties list
false, // don't allow duplicates
5, // 4 columns in index row
5, // non-unique index
true, // maintain parent links
base_conglomid, // base conglom id
4); // row loc in last column
// create the index with all the columns in descending order
ColumnOrdering order[] = new ColumnOrdering[5];
order[0] = new T_ColumnOrderingImpl(0, false); // Descending
order[1] = new T_ColumnOrderingImpl(1, true); // Ascending
order[2] = new T_ColumnOrderingImpl(2, true); // Ascending
order[3] = new T_ColumnOrderingImpl(3, false); // descending
order[4] = new T_ColumnOrderingImpl(4, true); // asccending
long index_conglomid =
tc.createConglomerate(
"BTREE", // create a btree secondary
index_row.getRow(), // row template
order, //column sort order - default
properties, // properties
TransactionController.IS_DEFAULT); // not temporary
// Open the conglomerate.
ConglomerateController index_cc =
tc.openConglomerate(
index_conglomid,
false,
TransactionController.OPENMODE_FORUPDATE,
TransactionController.MODE_RECORD,
TransactionController.ISOLATION_SERIALIZABLE);
// Create a row.
T_SecondaryIndexRow template = new T_SecondaryIndexRow();
RowLocation row_loc = base_cc.newRowLocationTemplate();
template.init(base_row, row_loc, 5);
// insert them in reverse order just to make sure btree is sorting them
for (int i = col1.length - 1; i >= 0; i--)
{
((SQLLongint)(template.getRow()[0])).setValue(col1[i]);
((SQLLongint)(template.getRow()[1])).setValue(col2[i]);
((SQLLongint)(template.getRow()[2])).setValue(col3[i]);
base_row[3] = new SQLChar(string_1500char);
base_cc.insertAndFetchLocation(base_row, row_loc);
// Insert the row.
// System.out.println("Adding record (" + -(i - (col1.length -1)) +
// ")" + template);
if (index_cc.insert(template.getRow()) != 0)
throw T_Fail.testFailMsg("insert failed");
}
index_cc.checkConsistency();
((B2IController)index_cc).debugConglomerate();
ret_val = t_ascdesc1_scan_test_cases(tc, index_conglomid, template);
// insert and delete some interesting rows, deleted space management
// may or may not clean these up.
for (int i = d_col1.length - 1; i >= 0; i--)
{
((SQLLongint)(template.getRow()[0])).setValue(d_col1[i]);
((SQLLongint)(template.getRow()[1])).setValue(d_col2[i]);
((SQLLongint)(template.getRow()[2])).setValue(d_col3[i]);
base_row[3] = new SQLChar(string_1500char);
base_cc.insertAndFetchLocation(base_row, row_loc);
// Insert the row.
// System.out.println("Adding record (" + -(i - (col1.length -1)) +
// ")" + template);
if (index_cc.insert(template.getRow()) != 0)
throw T_Fail.testFailMsg("insert failed");
// now delete the row.
base_cc.delete(row_loc);
ScanController delete_scan =
tc.openScan(index_conglomid, false,
TransactionController.OPENMODE_FORUPDATE,
TransactionController.MODE_RECORD,
TransactionController.ISOLATION_SERIALIZABLE,
(FormatableBitSet) null,
template.getRow(), ScanController.GE,
null,
template.getRow(), ScanController.GT);
if (!delete_scan.next())
{
throw T_Fail.testFailMsg("delete could not find key");
}
else
{
delete_scan.delete();
if (delete_scan.next())
throw T_Fail.testFailMsg("delete found more than one key");
}
delete_scan.close();
}
ret_val = t_ascdesc1_scan_test_cases(tc, index_conglomid, template);
// Close the conglomerate.
index_cc.close();
tc.commit();
REPORT("Ending t_019");
return(ret_val);