@Test public void testCannotCreateTable() { FilesFacade ff = new FilesFacadeImpl() { @Override public int mkdirs(LPSZ path, int mode) { return -1; } }; CairoConfiguration configuration = new DefaultCairoConfiguration(root) { @Override public FilesFacade getFilesFacade() { return ff; } }; CairoEngine engine = new CairoEngine(configuration); SqlCompiler compiler = new SqlCompiler(engine); try { compiler.compile("create table x (a int)", sqlExecutionContext); Assert.fail(); } catch (SqlException e) { Assert.assertEquals(13, e.getPosition()); TestUtils.assertContains(e.getMessage(), "Could not create table"); } }
@NotNull public CompiledQuery compile(@NotNull CharSequence query, @NotNull SqlExecutionContext executionContext) throws SqlException { clear(); lexer.of(query); final CharSequence tok = SqlUtil.fetchNext(lexer); if (tok == null) { throw SqlException.$(0, "empty query"); } final KeywordBasedExecutor executor = keywordBasedExecutors.get(tok); if (executor == null) { return compileUsingModel(executionContext); } return executor.execute(executionContext); }
SqlCompiler implements Closeable { @NotNull public CompiledQuery compile(@NotNull CharSequence query, @NotNull SqlExecutionContext executionContext) throws SqlException { clear(); lexer.of(query); final CharSequence tok = SqlUtil.fetchNext(lexer); if (tok == null) { throw SqlException.$(0, "empty query"); } final KeywordBasedExecutor executor = keywordBasedExecutors.get(tok); if (executor == null) { return compileUsingModel(executionContext); } return executor.execute(executionContext); } }
SqlCompiler implements Closeable { @NotNull public CompiledQuery compile(@NotNull CharSequence query, @NotNull SqlExecutionContext executionContext) throws SqlException { clear(); lexer.of(query); final CharSequence tok = SqlUtil.fetchNext(lexer); if (tok == null) { throw SqlException.$(0, "empty query"); } final KeywordBasedExecutor executor = keywordBasedExecutors.get(tok); if (executor == null) { return compileUsingModel(executionContext); } return executor.execute(executionContext); } SqlCompiler(CairoEngine engine);  SqlCompiler(CairoEngine engine, @Nullable MessageBus messageBus, @Nullable FunctionFactoryCache functionFactoryCache); }
SqlCompiler implements Closeable { @NotNull public CompiledQuery compile(@NotNull CharSequence query, @NotNull SqlExecutionContext executionContext) throws SqlException { clear(); lexer.of(query); final CharSequence tok = SqlUtil.fetchNext(lexer); if (tok == null) { throw SqlException.$(0, "empty query"); } final KeywordBasedExecutor executor = keywordBasedExecutors.get(tok); if (executor == null) { return compileUsingModel(executionContext); } return executor.execute(executionContext); } SqlCompiler(CairoEngine engine);  SqlCompiler(CairoEngine engine, @Nullable MessageBus messageBus, @Nullable FunctionFactoryCache functionFactoryCache); static void configureLexer(GenericLexer lexer); static boolean isAssignableFrom(int to, int from); @Override void close(); @NotNull CompiledQuery compile(@NotNull CharSequence query, @NotNull SqlExecutionContext executionContext); CairoEngine getEngine(); }
SqlCompiler implements Closeable { @NotNull public CompiledQuery compile(@NotNull CharSequence query, @NotNull SqlExecutionContext executionContext) throws SqlException { clear(); lexer.of(query); final CharSequence tok = SqlUtil.fetchNext(lexer); if (tok == null) { throw SqlException.$(0, "empty query"); } final KeywordBasedExecutor executor = keywordBasedExecutors.get(tok); if (executor == null) { return compileUsingModel(executionContext); } return executor.execute(executionContext); } SqlCompiler(CairoEngine engine);  SqlCompiler(CairoEngine engine, @Nullable MessageBus messageBus, @Nullable FunctionFactoryCache functionFactoryCache); static void configureLexer(GenericLexer lexer); static boolean isAssignableFrom(int to, int from); @Override void close(); @NotNull CompiledQuery compile(@NotNull CharSequence query, @NotNull SqlExecutionContext executionContext); CairoEngine getEngine(); static final ObjList<String> sqlControlSymbols; }