use of io.mycat.backend.mysql.MySQLMessage in project Mycat_plus by coderczp.
the class OkPacket method read.
public void read(BinaryPacket bin) {
packetLength = bin.packetLength;
packetId = bin.packetId;
MySQLMessage mm = new MySQLMessage(bin.data);
fieldCount = mm.read();
affectedRows = mm.readLength();
insertId = mm.readLength();
serverStatus = mm.readUB2();
warningCount = mm.readUB2();
if (mm.hasRemaining()) {
this.message = mm.readBytesWithLength();
}
}
use of io.mycat.backend.mysql.MySQLMessage in project Mycat_plus by coderczp.
the class MySQLMessageTest method testReadBytesWithNull.
@Test
public void testReadBytesWithNull() {
byte[] bytes = new byte[] { 1, 2, 3, 0, 5 };
MySQLMessage message = new MySQLMessage(bytes);
byte[] ab = message.readBytesWithNull();
Assert.assertEquals(3, ab.length);
Assert.assertEquals(4, message.position());
}
use of io.mycat.backend.mysql.MySQLMessage in project Mycat_plus by coderczp.
the class MySQLMessageTest method testReadBytesWithNull3.
@Test
public void testReadBytesWithNull3() {
byte[] bytes = new byte[] {};
MySQLMessage message = new MySQLMessage(bytes);
byte[] ab = message.readBytesWithNull();
Assert.assertEquals(0, ab.length);
Assert.assertEquals(0, message.position());
}
use of io.mycat.backend.mysql.MySQLMessage in project Mycat_plus by coderczp.
the class ResetPacket method read.
public void read(byte[] data) {
MySQLMessage mm = new MySQLMessage(data);
packetLength = mm.readUB3();
packetId = mm.read();
byte code = mm.read();
assert code == PACKET_FALG;
pstmtId = mm.readUB4();
}
use of io.mycat.backend.mysql.MySQLMessage in project Mycat_plus by coderczp.
the class RowDataPacket method read.
public void read(byte[] data) {
value = data;
MySQLMessage mm = new MySQLMessage(data);
packetLength = mm.readUB3();
packetId = mm.read();
for (int i = 0; i < fieldCount; i++) {
fieldValues.add(mm.readBytesWithLength());
}
}
Aggregations