use of org.hsqldb_voltpatches.HSQLInterface in project voltdb by VoltDB.
the class TestDDLCompiler method testTooManyColumnTable.
//
// Note, this should succeed as HSQL doesn't have a hard limit
// on the number of columns. The test in TestVoltCompiler will
// fail on 1025 columns.
// @throws HSQLParseException
//
public void testTooManyColumnTable() throws IOException, HSQLParseException {
String schemaPath = "";
URL url = TestVoltCompiler.class.getResource("toowidetable-ddl.sql");
schemaPath = URLDecoder.decode(url.getPath(), "UTF-8");
FileReader fr = new FileReader(new File(schemaPath));
BufferedReader br = new BufferedReader(fr);
String ddl1 = "";
String line;
while ((line = br.readLine()) != null) {
ddl1 += line + "\n";
}
br.close();
HSQLInterface hsql = HSQLInterface.loadHsqldb();
hsql.runDDLCommand(ddl1);
VoltXMLElement xml = hsql.getXMLFromCatalog();
System.out.println(xml);
assertTrue(xml != null);
}
use of org.hsqldb_voltpatches.HSQLInterface in project voltdb by VoltDB.
the class TestDDLCompiler method testSimpleDDLCompiler.
public void testSimpleDDLCompiler() throws HSQLParseException {
String ddl1 = "CREATE TABLE warehouse ( " + "w_id integer default '0' NOT NULL, " + "w_name varchar(16) default NULL, " + "w_street_1 varchar(32) default NULL, " + "w_street_2 varchar(32) default NULL, " + "w_city varchar(32) default NULL, " + "w_state varchar(2) default NULL, " + "w_zip varchar(9) default NULL, " + "w_tax float default NULL, " + "PRIMARY KEY (w_id) " + ");";
HSQLInterface hsql = HSQLInterface.loadHsqldb();
hsql.runDDLCommand(ddl1);
VoltXMLElement xml = hsql.getXMLFromCatalog();
System.out.println(xml);
assertTrue(xml != null);
}
use of org.hsqldb_voltpatches.HSQLInterface in project voltdb by VoltDB.
the class VoltCompiler method compileDatabaseNode.
/**
* Load a ddl file with full support for VoltDB extensions (partitioning, procedures,
* export), AND full support for input via a project xml file's "database" node.
* @param database catalog-related info parsed from a project file
* @param ddlReaderList Reader objects for ddl files.
* @param jarOutput The in-memory jar to populate or null if the caller doesn't provide one.
* @throws VoltCompilerException
*/
private void compileDatabaseNode(VoltCompilerReader cannonicalDDLIfAny, Database previousDBIfAny, final List<VoltCompilerReader> ddlReaderList, final InMemoryJarfile jarOutput) throws VoltCompilerException {
final ArrayList<Class<?>> classDependencies = new ArrayList<>();
final VoltDDLElementTracker voltDdlTracker = new VoltDDLElementTracker(this);
Database db = initCatalogDatabase(m_catalog);
// shutdown and make a new hsqldb
HSQLInterface hsql = HSQLInterface.loadHsqldb();
compileDatabase(db, hsql, voltDdlTracker, cannonicalDDLIfAny, previousDBIfAny, ddlReaderList, classDependencies, DdlProceduresToLoad.ALL_DDL_PROCEDURES, jarOutput);
}
use of org.hsqldb_voltpatches.HSQLInterface in project voltdb by VoltDB.
the class TestDeterminism method testDeterminismReadOnlyNoWarning.
/*
* A test that runs some read-only non-deterministic DDLs, check that the output does not contain
* any ND warnings
*/
public void testDeterminismReadOnlyNoWarning() throws Exception {
// Should the members be reused here?
HSQLInterface hsql = HSQLInterface.loadHsqldb();
VoltCompiler compiler = new VoltCompiler(false);
VoltCompiler.DdlProceduresToLoad all_procs = DdlProceduresToLoad.NO_DDL_PROCEDURES;
URL path = TestDeterminism.class.getResource("testplans-determinism-read-only.sql");
String pathStr = URLDecoder.decode(path.getPath(), "UTF-8");
compiler.loadSchema(hsql, all_procs, pathStr);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
compiler.summarizeSuccess(new PrintStream(outputStream), null, "");
System.out.println(outputStream.toString());
// There is no warnings generated for read-only ND queries
String msg = outputStream.toString();
assertFalse(stringContains(msg, "ND"));
assertFalse(stringContains(msg, "WARN"));
assertTrue(stringContains(msg, "Successfully created"));
assertTrue(stringContains(msg, "Catalog contains"));
outputStream.close();
}
use of org.hsqldb_voltpatches.HSQLInterface in project voltdb by VoltDB.
the class TestDDLCompiler method testCharIsNotAllowed.
public void testCharIsNotAllowed() {
String ddl1 = "CREATE TABLE warehouse ( " + "w_street_1 char(32) default NULL, " + ");";
HSQLInterface hsql = HSQLInterface.loadHsqldb();
try {
hsql.runDDLCommand(ddl1);
} catch (HSQLParseException e) {
assertTrue(true);
return;
}
fail();
}
Aggregations