command.setSql(StringColumn.valueOf("select * from test.abc where id < 6".getBytes()));
transport.getOutputStream().writePacket(command);
transport.getOutputStream().flush();
//
Packet packet = transport.getInputStream().readPacket();
if(packet.getPacketBody()[0] == ErrorPacket.PACKET_MARKER) {
final ErrorPacket error = ErrorPacket.valueOf(packet);
LOGGER.info("{}", error);
return;
}
//
final ResultSetHeaderPacket header = ResultSetHeaderPacket.valueOf(packet);
LOGGER.info("{}", header);
//
while(true) {
packet = transport.getInputStream().readPacket();
if(packet.getPacketBody()[0] == EOFPacket.PACKET_MARKER) {
EOFPacket eof = EOFPacket.valueOf(packet);
LOGGER.info("{}", eof);
break;
} else {
ResultSetFieldPacket field = ResultSetFieldPacket.valueOf(packet);
LOGGER.info("{}", field);
}
}
//
while(true) {
packet = transport.getInputStream().readPacket();
if(packet.getPacketBody()[0] == EOFPacket.PACKET_MARKER) {
EOFPacket eof = EOFPacket.valueOf(packet);
LOGGER.info("{}", eof);
break;
} else {
ResultSetRowPacket row = ResultSetRowPacket.valueOf(packet);