use of com.alibaba.cobar.net.mysql.RowDataPacket in project cobar by alibaba.
the class ShowProcessor method execute.
public static void execute(ManagerConnection c) {
ByteBuffer buffer = c.allocate();
// write header
buffer = header.write(buffer, c);
// write fields
for (FieldPacket field : fields) {
buffer = field.write(buffer, c);
}
// write eof
buffer = eof.write(buffer, c);
// write rows
byte packetId = eof.packetId;
for (NIOProcessor p : CobarServer.getInstance().getProcessors()) {
RowDataPacket row = getRow(p, c.getCharset());
row.packetId = ++packetId;
buffer = row.write(buffer, c);
}
// write last eof
EOFPacket lastEof = new EOFPacket();
lastEof.packetId = ++packetId;
buffer = lastEof.write(buffer, c);
// write buffer
c.write(buffer);
}
use of com.alibaba.cobar.net.mysql.RowDataPacket in project cobar by alibaba.
the class ShowProcessor method getRow.
private static RowDataPacket getRow(NIOProcessor processor, String charset) {
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(processor.getName().getBytes());
row.add(LongUtil.toBytes(processor.getNetInBytes()));
row.add(LongUtil.toBytes(processor.getNetOutBytes()));
row.add(LongUtil.toBytes(processor.getReactCount()));
row.add(IntegerUtil.toBytes(processor.getRegisterQueueSize()));
row.add(IntegerUtil.toBytes(processor.getWriteQueueSize()));
row.add(IntegerUtil.toBytes(processor.getBufferPool().size()));
row.add(IntegerUtil.toBytes(processor.getBufferPool().capacity()));
row.add(IntegerUtil.toBytes(processor.getFrontends().size()));
row.add(IntegerUtil.toBytes(processor.getBackends().size()));
return row;
}
use of com.alibaba.cobar.net.mysql.RowDataPacket in project cobar by alibaba.
the class ShowRouter method getRow.
private static RowDataPacket getRow(NIOProcessor processor, String charset) {
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(processor.getName().getBytes());
row.add(null);
row.add(null);
row.add(null);
row.add(null);
return row;
}
use of com.alibaba.cobar.net.mysql.RowDataPacket in project cobar by alibaba.
the class ShowSQL method getRow.
private static RowDataPacket getRow(long sql, String charset) {
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(LongUtil.toBytes(sql));
row.add(StringUtil.encode("insert into T (...", charset));
return row;
}
use of com.alibaba.cobar.net.mysql.RowDataPacket in project cobar by alibaba.
the class ShowCollation method execute.
public static void execute(ManagerConnection c) {
ByteBuffer buffer = c.allocate();
// write header
buffer = header.write(buffer, c);
// write fields
for (FieldPacket field : fields) {
buffer = field.write(buffer, c);
}
// write eof
buffer = eof.write(buffer, c);
// write rows
byte packetId = eof.packetId;
RowDataPacket row = getRow(c.getCharset());
row.packetId = ++packetId;
buffer = row.write(buffer, c);
// write lastEof
EOFPacket lastEof = new EOFPacket();
lastEof.packetId = ++packetId;
buffer = lastEof.write(buffer, c);
// write buffer
c.write(buffer);
}
Aggregations