use of io.mycat.net.mysql.FieldPacket in project Mycat-Server by MyCATApache.
the class ShowSysParam method execute.
public static void execute(ManagerConnection c) {
ByteBuffer buffer = c.allocate();
// write header
buffer = header.write(buffer, c, true);
// write fields
for (FieldPacket field : fields) {
buffer = field.write(buffer, c, true);
}
// write eof
buffer = eof.write(buffer, c, true);
// write rows
byte packetId = eof.packetId;
SystemConfig sysConfig = MycatServer.getInstance().getConfig().getSystem();
List<String> paramValues = new ArrayList<String>();
paramValues.add(sysConfig.getProcessors() + "");
paramValues.add(sysConfig.getBufferPoolChunkSize() + "B");
paramValues.add(sysConfig.getBufferPoolPageSize() + "B");
paramValues.add(sysConfig.getProcessorBufferLocalPercent() + "");
paramValues.add(sysConfig.getProcessorExecutor() + "");
paramValues.add(sysConfig.getSequnceHandlerType() == 1 ? "数据库方式" : "本地文件方式");
paramValues.add(sysConfig.getPacketHeaderSize() + "B");
paramValues.add(sysConfig.getMaxPacketSize() / 1024 / 1024 + "M");
paramValues.add(sysConfig.getIdleTimeout() / 1000 / 60 + "分钟");
paramValues.add(sysConfig.getCharset() + "");
paramValues.add(ISOLATIONS[sysConfig.getTxIsolation()]);
paramValues.add(sysConfig.getSqlExecuteTimeout() + "秒");
paramValues.add(sysConfig.getProcessorCheckPeriod() / 1000 + "秒");
paramValues.add(sysConfig.getDataNodeIdleCheckPeriod() / 1000 + "秒");
paramValues.add(sysConfig.getDataNodeHeartbeatPeriod() / 1000 + "秒");
paramValues.add(sysConfig.getBindIp() + "");
paramValues.add(sysConfig.getServerPort() + "");
paramValues.add(sysConfig.getManagerPort() + "");
for (int i = 0; i < PARAMNAMES.length; i++) {
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(StringUtil.encode(PARAMNAMES[i], c.getCharset()));
row.add(StringUtil.encode(paramValues.get(i), c.getCharset()));
row.add(StringUtil.encode(PARAM_DESCRIPTION[i], c.getCharset()));
row.packetId = ++packetId;
buffer = row.write(buffer, c, true);
}
// write last eof
EOFPacket lastEof = new EOFPacket();
lastEof.packetId = ++packetId;
buffer = lastEof.write(buffer, c, true);
// write buffer
c.write(buffer);
}
use of io.mycat.net.mysql.FieldPacket in project Mycat-Server by MyCATApache.
the class ShowThreadPool method execute.
public static void execute(ManagerConnection c) {
ByteBuffer buffer = c.allocate();
// write header
buffer = header.write(buffer, c, true);
// write fields
for (FieldPacket field : fields) {
buffer = field.write(buffer, c, true);
}
// write eof
buffer = eof.write(buffer, c, true);
// write rows
byte packetId = eof.packetId;
List<NameableExecutor> executors = getExecutors();
for (NameableExecutor exec : executors) {
if (exec != null) {
RowDataPacket row = getRow(exec, c.getCharset());
row.packetId = ++packetId;
buffer = row.write(buffer, c, true);
}
}
// write last eof
EOFPacket lastEof = new EOFPacket();
lastEof.packetId = ++packetId;
buffer = lastEof.write(buffer, c, true);
// write buffer
c.write(buffer);
}
use of io.mycat.net.mysql.FieldPacket in project Mycat-Server by MyCATApache.
the class ShowHelp method execute.
public static void execute(ManagerConnection c) {
ByteBuffer buffer = c.allocate();
// write header
buffer = header.write(buffer, c, true);
// write fields
for (FieldPacket field : fields) {
buffer = field.write(buffer, c, true);
}
// write eof
buffer = eof.write(buffer, c, true);
// write rows
byte packetId = eof.packetId;
for (String key : keys) {
RowDataPacket row = getRow(key, helps.get(key), c.getCharset());
row.packetId = ++packetId;
buffer = row.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);
}
use of io.mycat.net.mysql.FieldPacket in project Mycat-Server by MyCATApache.
the class ShowParser method execute.
public static void execute(ManagerConnection c) {
ByteBuffer buffer = c.allocate();
// write header
buffer = header.write(buffer, c, true);
// write fields
for (FieldPacket field : fields) {
buffer = field.write(buffer, c, true);
}
// write eof
buffer = eof.write(buffer, c, true);
// write rows
byte packetId = eof.packetId;
for (int i = 0; i < 1; i++) {
RowDataPacket row = getRow(c.getCharset());
row.packetId = ++packetId;
buffer = row.write(buffer, c, true);
}
// write last eof
EOFPacket lastEof = new EOFPacket();
lastEof.packetId = ++packetId;
buffer = lastEof.write(buffer, c, true);
// write buffer
c.write(buffer);
}
use of io.mycat.net.mysql.FieldPacket in project Mycat-Server by MyCATApache.
the class ShowProcessor method execute.
public static void execute(ManagerConnection c) {
ByteBuffer buffer = c.allocate();
// write header
buffer = header.write(buffer, c, true);
// write fields
for (FieldPacket field : fields) {
buffer = field.write(buffer, c, true);
}
// write eof
buffer = eof.write(buffer, c, true);
// write rows
byte packetId = eof.packetId;
for (NIOProcessor p : MycatServer.getInstance().getProcessors()) {
RowDataPacket row = getRow(p, c.getCharset());
row.packetId = ++packetId;
buffer = row.write(buffer, c, true);
}
// write last eof
EOFPacket lastEof = new EOFPacket();
lastEof.packetId = ++packetId;
buffer = lastEof.write(buffer, c, true);
// write buffer
c.write(buffer);
}
Aggregations