@Test public void testExecute() { assertStatement("EXECUTE myquery", new Execute(identifier("myquery"), emptyList())); }
@Override public Node visitExecute(SqlBaseParser.ExecuteContext context) { return new Execute( getLocation(context), (Identifier) visit(context.identifier()), visit(context.expression(), Expression.class)); }
@Test public void testPrepareInvalidStatement() { Statement statement = new Execute(identifier("foo"), emptyList()); String sqlString = "PREPARE my_query FROM EXECUTE foo"; try { executePrepare("my_query", statement, sqlString, TEST_SESSION); fail("expected exception"); } catch (PrestoException e) { assertEquals(e.getErrorCode(), NOT_SUPPORTED.toErrorCode()); assertEquals(e.getMessage(), "Invalid statement type for prepared statement: EXECUTE"); } }
@Test public void testExecuteWithUsing() { assertStatement("EXECUTE myquery USING 1, 'abc', ARRAY ['hello']", new Execute(identifier("myquery"), ImmutableList.of(new LongLiteral("1"), new StringLiteral("abc"), new ArrayConstructor(ImmutableList.of(new StringLiteral("hello")))))); }
@Test public void testExecute() { assertStatement("EXECUTE myquery", new Execute(identifier("myquery"), emptyList())); }
@Override public Node visitExecute(SqlBaseParser.ExecuteContext context) { return new Execute( getLocation(context), (Identifier) visit(context.identifier()), visit(context.expression(), Expression.class)); }
@Test public void testExecuteWithUsing() { assertStatement("EXECUTE myquery USING 1, 'abc', ARRAY ['hello']", new Execute(identifier("myquery"), ImmutableList.of(new LongLiteral("1"), new StringLiteral("abc"), new ArrayConstructor(ImmutableList.of(new StringLiteral("hello")))))); }