本文整理汇总了Java中org.apache.cassandra.cql3.ResultSet类的典型用法代码示例。如果您正苦于以下问题:Java ResultSet类的具体用法?Java ResultSet怎么用?Java ResultSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResultSet类属于org.apache.cassandra.cql3包,在下文中一共展示了ResultSet类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: colValue
import org.apache.cassandra.cql3.ResultSet; //导入依赖的package包/类
public static String colValue(ResultSet results, List<ByteBuffer> row, int i) throws Exception {
ByteBuffer v = row.get(i).duplicate();
String ret = "null";
if (v != null) {
EnumSet<ResultSet.Flag> flags = (EnumSet<ResultSet.Flag>) CassandraUtils.readPrivate(results.metadata, "flags");
if (flags.contains(ResultSet.Flag.NO_METADATA)) {
ret = "0x" + ByteBufferUtil.bytesToHex(v);
} else if (results.metadata.names.get(i).type.isCollection()) {
ret = results.metadata.names.get(i).type.getSerializer().deserialize(v).toString();
} else {
ret = results.metadata.names.get(i).type.getString(v);
}
}
return ret;
}
开发者ID:tolbertam,项目名称:sstable-tools,代码行数:16,代码来源:TableTransformer.java
示例2: testSelectCount
import org.apache.cassandra.cql3.ResultSet; //导入依赖的package包/类
@Test
public void testSelectCount() throws Exception {
File path = Utils.getSSTable("ma", 3);
String query = String.format("SELECT count(*) FROM \"%s\"", path);
CFMetaData cfdata = CassandraUtils.tableFromCQL(new ByteArrayInputStream(Utils.CQL3.getBytes()));
Query q = new Query(query, Collections.singleton(path), cfdata);
ResultSet result = q.getResults().getResultSet();
Assert.assertEquals(1, result.rows.size());
Assert.assertEquals("count", result.metadata.names.get(0).name.toString());
TableTransformer.dumpResults(cfdata, result, System.out);
}
开发者ID:tolbertam,项目名称:sstable-tools,代码行数:12,代码来源:TestSelect.java
示例3: testSelectGroupBy
import org.apache.cassandra.cql3.ResultSet; //导入依赖的package包/类
@Test
public void testSelectGroupBy() throws Exception {
File path = Utils.getSSTable("mc", 1);
String query = String.format("SELECT weatherstation_id, date, AVG(temperature) AS avg FROM \"%s\" GROUP BY weatherstation_id, date", path);
CFMetaData cfdata = CassandraUtils.tableFromCQL(new ByteArrayInputStream(Utils.CQL5.getBytes()));
Query q = new Query(query, Collections.singleton(path), cfdata);
ResultSet result = q.getResults().getResultSet();
Assert.assertEquals(2, result.rows.size());
Assert.assertEquals("2016-04-03", TableTransformer.colValue(result, result.rows.get(0), 1));
Assert.assertEquals("71.5", TableTransformer.colValue(result, result.rows.get(0), 2));
Assert.assertEquals("2016-04-04", TableTransformer.colValue(result, result.rows.get(1), 1));
Assert.assertEquals("73.5", TableTransformer.colValue(result, result.rows.get(1), 2));
TableTransformer.dumpResults(cfdata, result, System.out);
}
开发者ID:tolbertam,项目名称:sstable-tools,代码行数:16,代码来源:TestSelect.java
示例4: testSelectCompositeFromSSTable
import org.apache.cassandra.cql3.ResultSet; //导入依赖的package包/类
@Test
public void testSelectCompositeFromSSTable() throws Exception {
File path = Utils.getSSTable("ma", 1);
String query = String.format("SELECT * FROM \"%s\"", path);
CFMetaData cfdatatrue = CassandraUtils.tableFromCQL(new ByteArrayInputStream(Utils.CQL1.getBytes()));
CFMetaData cfdata = CassandraUtils.tableFromSSTable(Utils.getSSTable("ma", 1));
Query q = new Query(query, Collections.singleton(path), cfdata);
ResultSet result = q.getResults().getResultSet();
Assert.assertEquals(2, result.rows.size());
TableTransformer.dumpResults(cfdata, result, System.out);
}
开发者ID:tolbertam,项目名称:sstable-tools,代码行数:12,代码来源:TestSelect.java
示例5: testSelectCollections
import org.apache.cassandra.cql3.ResultSet; //导入依赖的package包/类
@Test
public void testSelectCollections() throws Exception {
File path = Utils.getSSTable("ma", 4);
String query = String.format("SELECT * FROM \"%s\"", path);
CFMetaData cfdata = CassandraUtils.tableFromCQL(new ByteArrayInputStream(Utils.CQL4.getBytes()));
Query q = new Query(query, Collections.singleton(path), cfdata);
ResultSet result = q.getResults().getResultSet();
Assert.assertEquals(1, result.rows.size());
TableTransformer.dumpResults(cfdata, result, System.out);
}
开发者ID:tolbertam,项目名称:sstable-tools,代码行数:11,代码来源:TestSelect.java
示例6: resultMessage
import org.apache.cassandra.cql3.ResultSet; //导入依赖的package包/类
private ResultMessage resultMessage(List<PermissionDetails> details)
{
if (details.isEmpty())
return new ResultMessage.Void();
ResultSet result = new ResultSet(metadata);
for (PermissionDetails pd : details)
{
result.addColumnValue(UTF8Type.instance.decompose(pd.username));
result.addColumnValue(UTF8Type.instance.decompose(pd.resource.toString()));
result.addColumnValue(UTF8Type.instance.decompose(pd.permission.toString()));
}
return new ResultMessage.Rows(result);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:15,代码来源:ListPermissionsStatement.java
示例7: Prepared
import org.apache.cassandra.cql3.ResultSet; //导入依赖的package包/类
private Prepared(MD5Digest statementId, int thriftStatementId, ResultSet.Metadata metadata, ResultSet.Metadata resultMetadata)
{
super(Kind.PREPARED);
this.statementId = statementId;
this.thriftStatementId = thriftStatementId;
this.metadata = metadata;
this.resultMetadata = resultMetadata;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:9,代码来源:ResultMessage.java
示例8: extractResultMetadata
import org.apache.cassandra.cql3.ResultSet; //导入依赖的package包/类
private static ResultSet.Metadata extractResultMetadata(CQLStatement statement)
{
if (!(statement instanceof SelectStatement))
return ResultSet.Metadata.EMPTY;
return ((SelectStatement)statement).getResultMetadata();
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:8,代码来源:ResultMessage.java
示例9: getMaxKey
import org.apache.cassandra.cql3.ResultSet; //导入依赖的package包/类
private int getMaxKey(ResultSet rs)
{
int maxKey = ByteBufferUtil.toInt(rs.rows.get(0).get(0));
for (List<ByteBuffer> row : rs.rows)
{
int currentKey = ByteBufferUtil.toInt(row.get(0));
if (currentKey > maxKey)
maxKey = currentKey;
}
return maxKey;
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:14,代码来源:CqlIndexedRangeSlicer.java
示例10: formatResults
import org.apache.cassandra.cql3.ResultSet; //导入依赖的package包/类
@Override
protected ResultMessage formatResults(List<RoleResource> sortedRoles)
{
ResultSet result = new ResultSet(metadata);
IRoleManager roleManager = DatabaseDescriptor.getRoleManager();
for (RoleResource role : sortedRoles)
{
if (!roleManager.canLogin(role))
continue;
result.addColumnValue(UTF8Type.instance.decompose(role.getRoleName()));
result.addColumnValue(BooleanType.instance.decompose(Roles.hasSuperuserStatus(role)));
}
return new ResultMessage.Rows(result);
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:16,代码来源:ListUsersStatement.java
示例11: Prepared
import org.apache.cassandra.cql3.ResultSet; //导入依赖的package包/类
private Prepared(MD5Digest statementId, int thriftStatementId, ResultSet.PreparedMetadata metadata, ResultSet.ResultMetadata resultMetadata)
{
super(Kind.PREPARED);
this.statementId = statementId;
this.thriftStatementId = thriftStatementId;
this.metadata = metadata;
this.resultMetadata = resultMetadata;
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:9,代码来源:ResultMessage.java
示例12: extractResultMetadata
import org.apache.cassandra.cql3.ResultSet; //导入依赖的package包/类
private static ResultSet.ResultMetadata extractResultMetadata(CQLStatement statement)
{
if (!(statement instanceof SelectStatement))
return ResultSet.ResultMetadata.EMPTY;
return ((SelectStatement)statement).getResultMetadata();
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:8,代码来源:ResultMessage.java
示例13: process
import org.apache.cassandra.cql3.ResultSet; //导入依赖的package包/类
private ResultSet process(List<Row> rows, Selection selection, long now) throws InvalidRequestException
{
Selection.ResultSetBuilder result = selection.resultSetBuilder(now);
for (org.apache.cassandra.db.Row row : rows)
{
if (row.cf == null)
continue;
processColumnFamily(row.key.getKey(), row.cf, selection, now, result);
}
ResultSet cqlRows = result.build();
return cqlRows;
}
开发者ID:daidong,项目名称:GraphTrek,代码行数:13,代码来源:ReceiveStartReadShuffleCommandVerbHandler.java
示例14: Prepared
import org.apache.cassandra.cql3.ResultSet; //导入依赖的package包/类
private Prepared(MD5Digest statementId, int thriftStatementId, ResultSet.Metadata metadata)
{
super(Kind.PREPARED);
this.statementId = statementId;
this.thriftStatementId = thriftStatementId;
this.metadata = metadata;
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:8,代码来源:ResultMessage.java
示例15: ResultSetData
import org.apache.cassandra.cql3.ResultSet; //导入依赖的package包/类
public ResultSetData(ResultSet resultSet, PagingData pagingData) {
this.resultSet = resultSet;
this.pagingData = pagingData;
}
开发者ID:tolbertam,项目名称:sstable-tools,代码行数:5,代码来源:ResultSetData.java
示例16: getResultSet
import org.apache.cassandra.cql3.ResultSet; //导入依赖的package包/类
public ResultSet getResultSet() {
return resultSet;
}
开发者ID:tolbertam,项目名称:sstable-tools,代码行数:4,代码来源:ResultSetData.java
示例17: Rows
import org.apache.cassandra.cql3.ResultSet; //导入依赖的package包/类
public Rows(ResultSet result)
{
super(Kind.ROWS);
this.result = result;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:6,代码来源:ResultMessage.java
注:本文中的org.apache.cassandra.cql3.ResultSet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论