{
Operator plan = PlanGenerator.generateBranchPlan(table.getAIS(), table);
StoreAdapter adapter = createAdapter(session, SchemaCache.globalSchema(table.getAIS()));
QueryContext queryContext = new SimpleQueryContext(adapter);
QueryBindings queryBindings = queryContext.createBindings();
Cursor cursor = API.cursor(plan, queryContext, queryBindings);
List<Column> lookupCols = table.getPrimaryKeyIncludingInternal().getColumns();
RowDataValueSource pSource = new RowDataValueSource();
for(int i = 0; i < lookupCols.size(); ++i) {
Column col = lookupCols.get(i);
pSource.bind(col.getFieldDef(), rowData);
queryBindings.setValue(i, pSource);
}
try {
Row row;
cursor.openTopLevel();
while((row = cursor.next()) != null) {
Table aTable = row.rowType().table();
RowData data = adapter.rowData(aTable.rowDef(), row, new RowDataCreator());
maintainGroupIndexes(session,
aTable,
aTable.getGroupIndexes(),
data,
null,
StoreGIHandler.forTable(this, session, table),
StoreGIHandler.Action.CASCADE);
}
} finally {
cursor.closeTopLevel();
}
}