當前位置: 首頁>>代碼示例>>Java>>正文


Java RowDataPacket.add方法代碼示例

本文整理匯總了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;
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:21,代碼來源:ShowConnection.java

示例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);
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:18,代碼來源:SelectDatabase.java

示例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);
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:18,代碼來源:SessionIncrement.java

示例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);
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:18,代碼來源:SessionIncrement.java

示例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);
    }
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:22,代碼來源:SelectUser.java

示例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);
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:18,代碼來源:SelectVersion.java

示例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;
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:13,代碼來源:ShowConnectionSQL.java

示例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;
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:12,代碼來源:ShowParser.java

示例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);
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:30,代碼來源:ShowVersion.java

示例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;
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:12,代碼來源:ShowSQLSlow.java

示例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);
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:33,代碼來源:ShowDatabase.java

示例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;
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:41,代碼來源:ShowHeartbeat.java

示例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;
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:15,代碼來源:ShowCache.java

示例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;
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:28,代碼來源:ShowDataNode.java

示例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);
}
 
開發者ID:youngor,項目名稱:openclouddb,代碼行數:30,代碼來源:SelectSessionAutoIncrement.java


注:本文中的org.opencloudb.net.mysql.RowDataPacket.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。