use of io.mycat.net.mysql.PreparedOkPacket in project Mycat_plus by coderczp.
the class PreparedStmtResponse method response.
public static void response(PreparedStatement pstmt, FrontendConnection c) {
byte packetId = 0;
// write preparedOk packet
PreparedOkPacket preparedOk = new PreparedOkPacket();
preparedOk.packetId = ++packetId;
preparedOk.statementId = pstmt.getId();
preparedOk.columnsNumber = pstmt.getColumnsNumber();
preparedOk.parametersNumber = pstmt.getParametersNumber();
ByteBuffer buffer = preparedOk.write(c.allocate(), c, true);
// write parameter field packet
int parametersNumber = preparedOk.parametersNumber;
if (parametersNumber > 0) {
for (int i = 0; i < parametersNumber; i++) {
FieldPacket field = new FieldPacket();
field.packetId = ++packetId;
buffer = field.write(buffer, c, true);
}
EOFPacket eof = new EOFPacket();
eof.packetId = ++packetId;
buffer = eof.write(buffer, c, true);
}
// write column field packet
int columnsNumber = preparedOk.columnsNumber;
if (columnsNumber > 0) {
for (int i = 0; i < columnsNumber; i++) {
FieldPacket field = new FieldPacket();
field.packetId = ++packetId;
buffer = field.write(buffer, c, true);
}
EOFPacket eof = new EOFPacket();
eof.packetId = ++packetId;
buffer = eof.write(buffer, c, true);
}
// send buffer
c.write(buffer);
}
use of io.mycat.net.mysql.PreparedOkPacket in project Mycat-Server by MyCATApache.
the class PreparedStmtResponse method response.
public static void response(PreparedStatement pstmt, FrontendConnection c) {
byte packetId = 0;
// write preparedOk packet
PreparedOkPacket preparedOk = new PreparedOkPacket();
preparedOk.packetId = ++packetId;
preparedOk.statementId = pstmt.getId();
preparedOk.columnsNumber = pstmt.getColumnsNumber();
preparedOk.parametersNumber = pstmt.getParametersNumber();
ByteBuffer buffer = preparedOk.write(c.allocate(), c, true);
// write parameter field packet
int parametersNumber = preparedOk.parametersNumber;
if (parametersNumber > 0) {
for (int i = 0; i < parametersNumber; i++) {
FieldPacket field = new FieldPacket();
field.packetId = ++packetId;
buffer = field.write(buffer, c, true);
}
EOFPacket eof = new EOFPacket();
eof.packetId = ++packetId;
buffer = eof.write(buffer, c, true);
}
// write column field packet
int columnsNumber = preparedOk.columnsNumber;
if (columnsNumber > 0) {
for (int i = 0; i < columnsNumber; i++) {
FieldPacket field = new FieldPacket();
field.packetId = ++packetId;
buffer = field.write(buffer, c, true);
}
EOFPacket eof = new EOFPacket();
eof.packetId = ++packetId;
buffer = eof.write(buffer, c, true);
}
// send buffer
c.write(buffer);
}
Aggregations