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);
}
});
}
Aggregations