use of org.apache.ignite.internal.processors.query.h2.opt.GridH2Table in project ignite by apache.
the class GridSqlQueryParser method tablesForDml.
/**
* Extract all tables participating in DML statement.
*
* @return List of tables participate at query.
* @throws IgniteSQLException in case query contains virtual tables.
*/
public List<GridH2Table> tablesForDml() throws IgniteSQLException {
Collection<?> parserObjects = h2ObjToGridObj.values();
List<GridH2Table> tbls = new ArrayList<>(parserObjects.size());
// check all involved caches
for (Object o : parserObjects) {
if (o instanceof GridSqlMerge)
o = ((GridSqlMerge) o).into();
else if (o instanceof GridSqlInsert)
o = ((GridSqlInsert) o).into();
else if (o instanceof GridSqlUpdate)
o = ((GridSqlUpdate) o).target();
else if (o instanceof GridSqlDelete)
o = ((GridSqlDelete) o).from();
if (o instanceof GridSqlAlias)
o = GridSqlAlias.unwrap((GridSqlAst) o);
if (o instanceof GridSqlTable) {
GridH2Table h2tbl = ((GridSqlTable) o).dataTable();
if (h2tbl == null) {
// Check for virtual tables.
throw new IgniteSQLException("Operation not supported for table '" + ((GridSqlTable) o).tableName() + "'", IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
}
tbls.add(h2tbl);
}
}
return tbls;
}
Aggregations