Search in sources :

Example 11 with ResultSetHeaderPacket

use of io.mycat.net.mysql.ResultSetHeaderPacket in project Mycat-Server by MyCATApache.

the class MysqlProcHandler method handle.

public static void handle(String stmt, ServerConnection c) {
    ByteBuffer buffer = c.allocate();
    // write header
    ResultSetHeaderPacket header = PacketUtil.getHeader(FIELD_COUNT);
    byte packetId = header.packetId;
    buffer = header.write(buffer, c, true);
    // write fields
    for (FieldPacket field : fields) {
        field.packetId = ++packetId;
        buffer = field.write(buffer, c, true);
    }
    // write eof
    EOFPacket eof = new EOFPacket();
    eof.packetId = ++packetId;
    buffer = eof.write(buffer, c, true);
    // write last eof
    EOFPacket lastEof = new EOFPacket();
    lastEof.packetId = ++packetId;
    buffer = lastEof.write(buffer, c, true);
    // post write
    c.write(buffer);
}
Also used : ResultSetHeaderPacket(io.mycat.net.mysql.ResultSetHeaderPacket) EOFPacket(io.mycat.net.mysql.EOFPacket) ByteBuffer(java.nio.ByteBuffer) FieldPacket(io.mycat.net.mysql.FieldPacket)

Aggregations

ResultSetHeaderPacket (io.mycat.net.mysql.ResultSetHeaderPacket)11 EOFPacket (io.mycat.net.mysql.EOFPacket)10 FieldPacket (io.mycat.net.mysql.FieldPacket)9 ByteBuffer (java.nio.ByteBuffer)9 RowDataPacket (io.mycat.net.mysql.RowDataPacket)7 DataRow (io.mycat.backend.postgresql.packet.DataRow)1 RowDescription (io.mycat.backend.postgresql.packet.RowDescription)1 BufferArray (io.mycat.buffer.BufferArray)1 Procedure (io.mycat.route.Procedure)1 ProcedureParameter (io.mycat.route.ProcedureParameter)1 RouteResultset (io.mycat.route.RouteResultset)1 RouteResultsetNode (io.mycat.route.RouteResultsetNode)1 ServerConnection (io.mycat.server.ServerConnection)1 ArrayList (java.util.ArrayList)1