use of com.facebook.presto.sql.tree.Deallocate in project presto by prestodb.
the class TestDeallocateTask method executeDeallocate.
private Set<String> executeDeallocate(String statementName, String sqlString, Session session) {
TransactionManager transactionManager = createTestTransactionManager();
QueryStateMachine stateMachine = createQueryStateMachine(sqlString, session, false, transactionManager, executor, metadata);
Deallocate deallocate = new Deallocate(new Identifier(statementName));
DeallocateTask deallocateTask = new DeallocateTask();
deallocateTask.execute(deallocate, transactionManager, metadata, new AllowAllAccessControl(), stateMachine, emptyList());
return stateMachine.getDeallocatedPreparedStatements();
}
use of com.facebook.presto.sql.tree.Deallocate in project presto by prestodb.
the class PrepareTask method execute.
@Override
public ListenableFuture<?> execute(Prepare prepare, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine queryStateMachine, List<Expression> parameters) {
Statement statement = prepare.getStatement();
if ((statement instanceof Prepare) || (statement instanceof Execute) || (statement instanceof Deallocate)) {
String type = statement.getClass().getSimpleName().toUpperCase(ENGLISH);
throw new PrestoException(NOT_SUPPORTED, "Invalid statement type for prepared statement: " + type);
}
String sql = getFormattedSql(statement, sqlParser, Optional.empty());
queryStateMachine.addPreparedStatement(prepare.getName().getValue(), sql);
return immediateFuture(null);
}
Aggregations