use of org.voltdb.sysprocs.AdHocNTBase.AdHocPlanningException in project voltdb by VoltDB.
the class CatalogSpecificPlanner method plan.
public AdHocPlannedStmtBatch plan(String sql, Object[] userParams, boolean singlePartition) throws AdHocPlanningException {
List<String> sqlStatements = new ArrayList<>();
AdHocSQLMix mix = AdHocNTBase.processAdHocSQLStmtTypes(sql, sqlStatements);
switch(mix) {
case EMPTY:
throw new AdHocPlanningException("No valid SQL found.");
case ALL_DDL:
case MIXED:
throw new AdHocPlanningException("DDL not supported in stored procedures.");
default:
break;
}
if (sqlStatements.size() != 1) {
throw new AdHocPlanningException("Only one statement is allowed in stored procedure, but received " + sqlStatements.size());
}
sql = sqlStatements.get(0);
// any object will signify SP
Object partitionKey = singlePartition ? "1" : null;
List<AdHocPlannedStatement> stmts = new ArrayList<>();
AdHocPlannedStatement result = null;
result = AdHocNTBase.compileAdHocSQL(m_catalogContext, sql, false, partitionKey, ExplainMode.NONE, false, userParams);
stmts.add(result);
return new AdHocPlannedStmtBatch(userParams, stmts, -1, null, null, userParams);
}
Aggregations