示例#1
0
 static {
   int i = 0;
   byte packetId = 0;
   header.packetId = ++packetId;
   fields[i] = PacketUtil.getField("processor", Fields.FIELD_TYPE_VAR_STRING);
   fields[i++].packetId = ++packetId;
   fields[i] = PacketUtil.getField("id", Fields.FIELD_TYPE_LONG);
   fields[i++].packetId = ++packetId;
   fields[i] = PacketUtil.getField("mysqlId", Fields.FIELD_TYPE_LONG);
   fields[i++].packetId = ++packetId;
   fields[i] = PacketUtil.getField("host", Fields.FIELD_TYPE_VAR_STRING);
   fields[i++].packetId = ++packetId;
   fields[i] = PacketUtil.getField("port", Fields.FIELD_TYPE_LONG);
   fields[i++].packetId = ++packetId;
   fields[i] = PacketUtil.getField("l_port", Fields.FIELD_TYPE_LONG);
   fields[i++].packetId = ++packetId;
   fields[i] = PacketUtil.getField("net_in", Fields.FIELD_TYPE_LONGLONG);
   fields[i++].packetId = ++packetId;
   fields[i] = PacketUtil.getField("net_out", Fields.FIELD_TYPE_LONGLONG);
   fields[i++].packetId = ++packetId;
   fields[i] = PacketUtil.getField("life", Fields.FIELD_TYPE_LONGLONG);
   fields[i++].packetId = ++packetId;
   fields[i] = PacketUtil.getField("closed", Fields.FIELD_TYPE_VAR_STRING);
   fields[i++].packetId = ++packetId;
   // fields[i] = PacketUtil.getField("run", Fields.FIELD_TYPE_VAR_STRING);
   // fields[i++].packetId = ++packetId;
   fields[i] = PacketUtil.getField("borrowed", Fields.FIELD_TYPE_VAR_STRING);
   fields[i++].packetId = ++packetId;
   fields[i] = PacketUtil.getField("SEND_QUEUE", Fields.FIELD_TYPE_LONG);
   fields[i++].packetId = ++packetId;
   fields[i] = PacketUtil.getField("schema", Fields.FIELD_TYPE_VAR_STRING);
   fields[i++].packetId = ++packetId;
   fields[i] = PacketUtil.getField("charset", Fields.FIELD_TYPE_VAR_STRING);
   fields[i++].packetId = ++packetId;
   fields[i] = PacketUtil.getField("txlevel", Fields.FIELD_TYPE_VAR_STRING);
   fields[i++].packetId = ++packetId;
   fields[i] = PacketUtil.getField("autocommit", Fields.FIELD_TYPE_VAR_STRING);
   fields[i++].packetId = ++packetId;
   eof.packetId = ++packetId;
 }
示例#2
0
 public static void execute(ManagerConnection c) {
   ByteBuffer buffer = c.allocate();
   buffer = header.write(buffer, c, true);
   for (FieldPacket field : fields) {
     buffer = field.write(buffer, c, true);
   }
   buffer = eof.write(buffer, c, true);
   byte packetId = eof.packetId;
   String charset = c.getCharset();
   for (NIOProcessor p : MycatServer.getInstance().getProcessors()) {
     for (BackendConnection bc : p.getBackends().values()) {
       if (bc != null) {
         RowDataPacket row = getRow(bc, charset);
         row.packetId = ++packetId;
         buffer = row.write(buffer, c, true);
       }
     }
   }
   EOFPacket lastEof = new EOFPacket();
   lastEof.packetId = ++packetId;
   buffer = lastEof.write(buffer, c, true);
   c.write(buffer);
 }