use of org.hsqldb_voltpatches.HSQLInterface.HSQLParseException in project voltdb by VoltDB.
the class TestHSQLDB method setupTPCCDDL.
public HSQLInterface setupTPCCDDL() {
HSQLInterface hsql = HSQLInterface.loadHsqldb();
URL url = getClass().getResource("hsqltest-ddl.sql");
try {
hsql.runDDLFile(URLDecoder.decode(url.getPath(), "UTF-8"));
} catch (HSQLParseException e) {
e.printStackTrace();
fail();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
fail();
}
return hsql;
}
use of org.hsqldb_voltpatches.HSQLInterface.HSQLParseException in project voltdb by VoltDB.
the class TestHSQLDB method testVarbinary.
public void testVarbinary() {
HSQLInterface hsql = HSQLInterface.loadHsqldb();
URL url = getClass().getResource("hsqltest-varbinaryddl.sql");
try {
hsql.runDDLFile(URLDecoder.decode(url.getPath(), "UTF-8"));
} catch (Exception e) {
e.printStackTrace();
fail();
}
String sql = "SELECT * FROM BT;";
VoltXMLElement xml = null;
try {
xml = hsql.getXMLCompiledStatement(sql);
assertNotNull(xml);
} catch (HSQLParseException e1) {
e1.printStackTrace();
fail();
}
//* enable to debug */ System.out.println(xml);
sql = "INSERT INTO BT VALUES (?, ?, ?);";
xml = null;
try {
xml = hsql.getXMLCompiledStatement(sql);
assertNotNull(xml);
} catch (HSQLParseException e1) {
e1.printStackTrace();
fail();
}
//* enable to debug */ System.out.println(xml);
}
use of org.hsqldb_voltpatches.HSQLInterface.HSQLParseException in project voltdb by VoltDB.
the class PlannerTool method planSqlCore.
/**
* Stripped down compile that is ONLY used to plan default procedures.
*/
public synchronized CompiledPlan planSqlCore(String sql, StatementPartitioning partitioning) {
TrivialCostModel costModel = new TrivialCostModel();
DatabaseEstimates estimates = new DatabaseEstimates();
QueryPlanner planner = new QueryPlanner(sql, "PlannerTool", "PlannerToolProc", m_database, partitioning, m_hsql, estimates, !VoltCompiler.DEBUG_MODE, AD_HOC_JOINED_TABLE_LIMIT, costModel, null, null, DeterminismMode.FASTER);
CompiledPlan plan = null;
try {
// do the expensive full planning.
planner.parse();
plan = planner.plan();
assert (plan != null);
} catch (Exception e) {
/*
* Don't log PlanningErrorExceptions or HSQLParseExceptions, as they
* are at least somewhat expected.
*/
String loggedMsg = "";
if (!(e instanceof PlanningErrorException || e instanceof HSQLParseException)) {
logException(e, "Error compiling query");
loggedMsg = " (Stack trace has been written to the log.)";
}
throw new RuntimeException("Error compiling query: " + e.toString() + loggedMsg, e);
}
if (plan == null) {
throw new RuntimeException("Null plan received in PlannerTool.planSql");
}
return plan;
}
Aggregations