final TableIds tids = createTables();
Schema schema = SchemaCache.globalSchema(ddl().getAIS(session()));
RowType cType = schema.tableRowType(getTable(tids.c));
RowType oType = schema.tableRowType(getTable(tids.o));
RowType iType = schema.tableRowType(getTable(tids.i));
StoreAdapter adapter = newStoreAdapter(schema);
Object[] o1Cols = { 10, 1 };
Object[] cCols = { 2, "c2" };
Object[] oCols = { 20, 2 };
Object[] iCols = { 200, 20, "i200" };
TestRow o1Row = new TestRow(oType, o1Cols);
TestRow cRow = new TestRow(cType, cCols);
TestRow oRow = new TestRow(oType, oCols);
TestRow iRow = new TestRow(iType, iCols);
writeRow(tids.o, o1Cols);
writeRow(tids.c, cCols);
writeRow(tids.o, oCols);
writeRow(tids.i, iCols);
compareRows( new Row[] { o1Row, cRow, oRow, iRow }, adapter.newGroupCursor(cType.table().getGroup()) );
deleteRow(tids.c, cCols);
compareRows( new Row[] { o1Row, oRow, iRow }, adapter.newGroupCursor(cType.table().getGroup()) );
// Delete o => i.cid becomes null
deleteRow(tids.o, oCols);
compareRows( new Row[] { iRow, o1Row }, adapter.newGroupCursor(cType.table().getGroup()) );
deleteRow(tids.i, iCols);
compareRows( new Row[] { o1Row }, adapter.newGroupCursor(cType.table().getGroup()) );
deleteRow(tids.o, o1Cols);
compareRows( new Row[] { }, adapter.newGroupCursor(cType.table().getGroup()) );
}