use of io.shardingjdbc.proxy.transport.mysql.packet.MySQLPacketPayload in project sharding-jdbc by shardingjdbc.
the class MySQLFrontendHandler method auth.
@Override
protected void auth(final ChannelHandlerContext context, final ByteBuf message) {
MySQLPacketPayload mysqlPacketPayload = new MySQLPacketPayload(message);
// TODO use authPluginData to auth
HandshakeResponse41Packet response41 = new HandshakeResponse41Packet(mysqlPacketPayload);
context.writeAndFlush(new OKPacket(response41.getSequenceId() + 1, 0L, 0L, StatusFlag.SERVER_STATUS_AUTOCOMMIT.getValue(), 0, ""));
}
use of io.shardingjdbc.proxy.transport.mysql.packet.MySQLPacketPayload in project sharding-jdbc by shardingjdbc.
the class MySQLFrontendHandler method executeCommand.
@Override
protected void executeCommand(final ChannelHandlerContext context, final ByteBuf message) {
MySQLPacketPayload mysqlPacketPayload = new MySQLPacketPayload(message);
int sequenceId = mysqlPacketPayload.readInt1();
CommandPacket commandPacket = CommandPacketFactory.getCommandPacket(sequenceId, mysqlPacketPayload);
for (DatabaseProtocolPacket each : commandPacket.execute()) {
context.write(each);
}
context.flush();
}
use of io.shardingjdbc.proxy.transport.mysql.packet.MySQLPacketPayload in project sharding-jdbc by shardingjdbc.
the class MySQLPacketCodec method doEncode.
@Override
protected void doEncode(final ChannelHandlerContext context, final MySQLPacket message, final ByteBuf out) {
MySQLPacketPayload mysqlPacketPayload = new MySQLPacketPayload(context.alloc().buffer());
message.write(mysqlPacketPayload);
out.writeMediumLE(mysqlPacketPayload.getByteBuf().readableBytes());
out.writeByte(message.getSequenceId());
out.writeBytes(mysqlPacketPayload.getByteBuf());
}
Aggregations