本文整理汇总了Java中org.opencloudb.net.mysql.RowDataPacket.add方法的典型用法代码示例。如果您正苦于以下问题:Java RowDataPacket.add方法的具体用法?Java RowDataPacket.add怎么用?Java RowDataPacket.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opencloudb.net.mysql.RowDataPacket
的用法示例。
在下文中一共展示了RowDataPacket.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRow
import org.opencloudb.net.mysql.RowDataPacket; //导入方法依赖的package包/类
private static RowDataPacket getRow(FrontendConnection c, String charset) {
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(c.getProcessor().getName().getBytes());
row.add(LongUtil.toBytes(c.getId()));
row.add(StringUtil.encode(c.getHost(), charset));
row.add(IntegerUtil.toBytes(c.getPort()));
row.add(IntegerUtil.toBytes(c.getLocalPort()));
row.add(StringUtil.encode(c.getSchema(), charset));
row.add(StringUtil.encode(c.getCharset(), charset));
row.add(LongUtil.toBytes(c.getNetInBytes()));
row.add(LongUtil.toBytes(c.getNetOutBytes()));
row.add(LongUtil.toBytes((TimeUtil.currentTimeMillis() - c
.getStartupTime()) / 1000L));
ByteBuffer bb = c.getReadBuffer();
row.add(IntegerUtil.toBytes(bb == null ? 0 : bb.capacity()));
BufferQueue bq = c.getWriteQueue();
row.add(IntegerUtil.toBytes(bq == null ? 0 : bq.snapshotSize()));
return row;
}
示例2: response
import org.opencloudb.net.mysql.RowDataPacket; //导入方法依赖的package包/类
public static void response(ServerConnection 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;
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(StringUtil.encode(c.getSchema(), c.getCharset()));
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);
}
示例3: response
import org.opencloudb.net.mysql.RowDataPacket; //导入方法依赖的package包/类
public static void response(ServerConnection 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;
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(LongUtil.toBytes(1));
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);
}
示例4: response
import org.opencloudb.net.mysql.RowDataPacket; //导入方法依赖的package包/类
public static void response(ServerConnection c) {
ByteBuffer buffer = c.allocate();
buffer = header.write(buffer, c);
for (FieldPacket field : fields) {
buffer = field.write(buffer, c);
}
buffer = eof.write(buffer, c);
byte packetId = eof.packetId;
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(LongUtil.toBytes(1));
row.packetId = ++packetId;
buffer = row.write(buffer, c);
EOFPacket lastEof = new EOFPacket();
lastEof.packetId = ++packetId;
buffer = lastEof.write(buffer, c);
c.write(buffer);
}
示例5: response
import org.opencloudb.net.mysql.RowDataPacket; //导入方法依赖的package包/类
public static void response(ServerConnection c) {
if (MycatServer.getInstance().isOnline()) {
ByteBuffer buffer = c.allocate();
buffer = header.write(buffer, c);
for (FieldPacket field : fields) {
buffer = field.write(buffer, c);
}
buffer = eof.write(buffer, c);
byte packetId = eof.packetId;
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(getUser(c));
row.packetId = ++packetId;
buffer = row.write(buffer, c);
EOFPacket lastEof = new EOFPacket();
lastEof.packetId = ++packetId;
buffer = lastEof.write(buffer, c);
c.write(buffer);
} else {
error.write(c);
}
}
示例6: response
import org.opencloudb.net.mysql.RowDataPacket; //导入方法依赖的package包/类
public static void response(ServerConnection 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;
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(Versions.SERVER_VERSION);
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);
}
示例7: getRow
import org.opencloudb.net.mysql.RowDataPacket; //导入方法依赖的package包/类
private static RowDataPacket getRow(FrontendConnection c, String charset) {
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(LongUtil.toBytes(c.getId()));
row.add(StringUtil.encode(c.getHost(), charset));
row.add(StringUtil.encode(c.getSchema(), charset));
row.add(LongUtil.toBytes(c.getLastReadTime()));
long rt = c.getLastReadTime();
long wt = c.getLastWriteTime();
row.add(LongUtil.toBytes((wt > rt) ? (wt - rt) : (TimeUtil.currentTimeMillis() - rt)));
row.add(null);
return row;
}
示例8: getRow
import org.opencloudb.net.mysql.RowDataPacket; //导入方法依赖的package包/类
private static RowDataPacket getRow(String charset) {
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(null);
row.add(null);
row.add(null);
row.add(null);
row.add(null);
row.add(null);
row.add(null);
return row;
}
示例9: execute
import org.opencloudb.net.mysql.RowDataPacket; //导入方法依赖的package包/类
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;
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(Versions.SERVER_VERSION);
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);
}
示例10: getRow
import org.opencloudb.net.mysql.RowDataPacket; //导入方法依赖的package包/类
private static RowDataPacket getRow(SQLRecord sql, String charset) {
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(StringUtil.encode(sql.host, charset));
row.add(StringUtil.encode(sql.schema, charset));
row.add(StringUtil.encode(sql.dataNode, charset));
row.add(IntegerUtil.toBytes(sql.dataNodeIndex));
row.add(LongUtil.toBytes(sql.startTime));
row.add(LongUtil.toBytes(sql.executeTime));
row.add(StringUtil.encode(sql.statement, charset));
return row;
}
示例11: execute
import org.opencloudb.net.mysql.RowDataPacket; //导入方法依赖的package包/类
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;
Map<String, SchemaConfig> schemas = MycatServer.getInstance().getConfig().getSchemas();
for (String name : new TreeSet<String>(schemas.keySet())) {
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(StringUtil.encode(name, 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);
}
示例12: getRows
import org.opencloudb.net.mysql.RowDataPacket; //导入方法依赖的package包/类
private static List<RowDataPacket> getRows() {
List<RowDataPacket> list = new LinkedList<RowDataPacket>();
MycatConfig conf = MycatServer.getInstance().getConfig();
// host nodes
Map<String, PhysicalDBPool> dataHosts = conf.getDataHosts();
for (PhysicalDBPool pool : dataHosts.values()) {
for (PhysicalDatasource ds : pool.getAllDataSources()) {
DBHeartbeat hb = ds.getHeartbeat();
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(ds.getName().getBytes());
row.add(ds.getConfig().getDbType().getBytes());
if (hb != null) {
row.add(ds.getConfig().getIp().getBytes());
row.add(IntegerUtil.toBytes(ds.getConfig().getPort()));
row.add(IntegerUtil.toBytes(hb.getStatus()));
row.add(IntegerUtil.toBytes(hb.getErrorCount()));
row.add(hb.isChecking() ? "checking".getBytes() : "idle"
.getBytes());
row.add(LongUtil.toBytes(hb.getTimeout()));
row.add(hb.getRecorder().get().getBytes());
String lat = hb.getLastActiveTime();
row.add(lat == null ? null : lat.getBytes());
row.add(hb.isStop() ? "true".getBytes() : "false"
.getBytes());
} else {
row.add(null);
row.add(null);
row.add(null);
row.add(null);
row.add(null);
row.add(null);
row.add(null);
row.add(null);
row.add(null);
}
list.add(row);
}
}
return list;
}
示例13: getRow
import org.opencloudb.net.mysql.RowDataPacket; //导入方法依赖的package包/类
private static RowDataPacket getRow(String poolName,
CacheStatic cacheStatic, String charset) {
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(StringUtil.encode(poolName, charset));
// max size
row.add(LongUtil.toBytes(cacheStatic.getMaxSize()));
row.add(LongUtil.toBytes(cacheStatic.getItemSize()));
row.add(LongUtil.toBytes(cacheStatic.getAccessTimes()));
row.add(LongUtil.toBytes(cacheStatic.getHitTimes()));
row.add(LongUtil.toBytes(cacheStatic.getPutTimes()));
row.add(LongUtil.toBytes(cacheStatic.getLastAccesTime()));
row.add(LongUtil.toBytes(cacheStatic.getLastPutTime()));
return row;
}
示例14: getRow
import org.opencloudb.net.mysql.RowDataPacket; //导入方法依赖的package包/类
private static RowDataPacket getRow(PhysicalDBNode node, String charset) {
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.add(StringUtil.encode(node.getName(), charset));
row.add(StringUtil.encode(node.getDbPool().getHostName()+'/'+node.getDatabase(), charset));
PhysicalDBPool pool=node.getDbPool();
PhysicalDatasource ds = pool.getSource();
if (ds != null) {
row.add(IntegerUtil.toBytes(pool.getActivedIndex()));
row.add(StringUtil.encode(ds.getConfig().getDbType(),charset));
row.add(IntegerUtil.toBytes(ds.getActiveCount()));
row.add(IntegerUtil.toBytes(ds.getIdleCount()));
row.add(IntegerUtil.toBytes(ds.getSize()));
} else {
row.add(null);
row.add(null);
row.add(null);
row.add(null);
row.add(null);
}
row.add(LongUtil.toBytes(node.getExecuteCount()));
row.add(StringUtil.encode(nf.format(0), charset));
row.add(StringUtil.encode(nf.format(0), charset));
row.add(LongUtil.toBytes(0));
long recoveryTime = pool.getSource().getHeartbeatRecoveryTime() - TimeUtil.currentTimeMillis();
row.add(LongUtil.toBytes(recoveryTime > 0 ? recoveryTime / 1000L : -1L));
return row;
}
示例15: execute
import org.opencloudb.net.mysql.RowDataPacket; //导入方法依赖的package包/类
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;
RowDataPacket row = new RowDataPacket(FIELD_COUNT);
row.packetId = ++packetId;
row.add(LongUtil.toBytes(1));
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);
}