@Test public void testDuplicateTableName() throws Exception { compiler.compile( "create table x (" + "a INT, " + "b BYTE, " + "t TIMESTAMP, " + "y BOOLEAN) " + "timestamp(t) " + "partition by MONTH", sqlExecutionContext ); assertFailure(13, "table already exists", "create table x (" + "t TIMESTAMP, " + "y BOOLEAN) " + "timestamp(t) " + "partition by MONTH"); }
@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; }