Search in sources :

Example 1 with TextResultSetHandler

use of io.mycat.proxy.handler.backend.TextResultSetHandler in project Mycat2 by MyCATApache.

the class MySQLAPIImpl method query.

@Override
public void query(String sql, ResultSetCollector collector, MySQLAPIExceptionCallback exceptionCollector) {
    TextResultSetTransforCollector transfor = new TextResultSetTransforCollector(collector);
    TextResultSetHandler queryResultSetTask = new TextResultSetHandler(transfor);
    queryResultSetTask.request(mySQLClientSession, MySQLCommandType.COM_QUERY, sql.getBytes(), new ResultSetCallBack<MySQLClientSession>() {

        @Override
        public void onFinishedSendException(Exception exception, Object sender, Object attr) {
            exceptionCollector.onException(exception, MySQLAPIImpl.this);
        }

        @Override
        public void onFinishedException(Exception exception, Object sender, Object attr) {
            exceptionCollector.onException(exception, MySQLAPIImpl.this);
        }

        @Override
        public void onFinished(boolean monopolize, MySQLClientSession mysql, Object sender, Object attr) {
            exceptionCollector.onFinished(monopolize, MySQLAPIImpl.this);
        }

        @Override
        public void onErrorPacket(ErrorPacketImpl errorPacket, boolean monopolize, MySQLClientSession mysql, Object sender, Object attr) {
            exceptionCollector.onErrorPacket(errorPacket, monopolize, MySQLAPIImpl.this);
        }
    });
}
Also used : TextResultSetTransforCollector(io.mycat.api.collector.TextResultSetTransforCollector) TextResultSetHandler(io.mycat.proxy.handler.backend.TextResultSetHandler) ErrorPacketImpl(io.mycat.beans.mysql.packet.ErrorPacketImpl) MySQLClientSession(io.mycat.proxy.session.MySQLClientSession)

Aggregations

TextResultSetTransforCollector (io.mycat.api.collector.TextResultSetTransforCollector)1 ErrorPacketImpl (io.mycat.beans.mysql.packet.ErrorPacketImpl)1 TextResultSetHandler (io.mycat.proxy.handler.backend.TextResultSetHandler)1 MySQLClientSession (io.mycat.proxy.session.MySQLClientSession)1