use of io.questdb.cairo.TableModel in project questdb by bluestreak01.
the class AbstractSqlParserTest method assertSyntaxError.
private static void assertSyntaxError(SqlCompiler compiler, String query, int position, String contains, TableModel... tableModels) throws Exception {
try {
assertMemoryLeak(() -> {
try {
for (int i = 0, n = tableModels.length; i < n; i++) {
CairoTestUtils.create(tableModels[i]);
}
compiler.compile(query, sqlExecutionContext);
Assert.fail("Exception expected");
} catch (SqlException e) {
Assert.assertEquals(position, e.getPosition());
TestUtils.assertContains(e.getFlyweightMessage(), contains);
}
});
} finally {
for (int i = 0, n = tableModels.length; i < n; i++) {
TableModel tableModel = tableModels[i];
Path path = tableModel.getPath().of(tableModel.getConfiguration().getRoot()).concat(tableModel.getName()).slash$();
Assert.assertEquals(0, configuration.getFilesFacade().rmdir(path));
tableModel.close();
}
}
}
use of io.questdb.cairo.TableModel in project questdb by bluestreak01.
the class AbstractSqlParserTest method createModelsAndRun.
private void createModelsAndRun(SqlParserTest.CairoAware runnable, TableModel... tableModels) throws SqlException {
try {
for (int i = 0, n = tableModels.length; i < n; i++) {
CairoTestUtils.create(tableModels[i]);
}
runnable.run();
} finally {
Assert.assertTrue(engine.releaseAllReaders());
for (int i = 0, n = tableModels.length; i < n; i++) {
TableModel tableModel = tableModels[i];
Path path = tableModel.getPath().of(tableModel.getConfiguration().getRoot()).concat(tableModel.getName()).slash$();
Assert.assertEquals(0, configuration.getFilesFacade().rmdir(path));
tableModel.close();
}
}
}
Aggregations