Search in sources :

Example 1 with ReceiverImpl

use of io.mycat.commands.ReceiverImpl in project Mycat2 by MyCATApache.

the class MycatVertxMySQLHandler method handlePrepareStatementExecute.

private Future<Void> handlePrepareStatementExecute(long statementId, byte flags, int[] params, BindValue[] values, MycatVertxMysqlSession MycatMysqlSession) throws Exception {
    MetadataManager metadataManager = MetaClusterCurrent.wrapper(MetadataManager.class);
    MycatDataContext dataContext = session.getDataContext();
    Map<Long, io.mycat.PreparedStatement> longPreparedStatementMap = dataContext.getPrepareInfo();
    io.mycat.PreparedStatement preparedStatement = longPreparedStatementMap.get(statementId);
    SQLStatement statement = preparedStatement.getSQLStatementByBindValue(values);
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("preparestatement:{}", statement);
    }
    SQLStatement typeStatement = metadataManager.typeInferenceUpdate(statement, dataContext.getDefaultSchema());
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("typeInferenceUpdate:{}", typeStatement);
    }
    Response receiver = new ReceiverImpl(session, 1, true);
    IOExecutor ioExecutor = MetaClusterCurrent.wrapper(IOExecutor.class);
    return ioExecutor.executeBlocking(event -> MycatdbCommand.execute(dataContext, receiver, typeStatement).onComplete(event));
}
Also used : io.mycat(io.mycat) ProxyReceiverImpl(io.mycat.commands.ProxyReceiverImpl) ReceiverImpl(io.mycat.commands.ReceiverImpl) SQLStatement(com.alibaba.druid.sql.ast.SQLStatement)

Aggregations

SQLStatement (com.alibaba.druid.sql.ast.SQLStatement)1 io.mycat (io.mycat)1 ProxyReceiverImpl (io.mycat.commands.ProxyReceiverImpl)1 ReceiverImpl (io.mycat.commands.ReceiverImpl)1