Package com.datastax.driver.core

Examples of com.datastax.driver.core.ResultSet.all()


        "Cannot get value from SystemTable instance in state %s.", state);
    ResultSet resultSet = mAdmin.execute(mPreparedStatementGetValue.bind(key));

    // Extra the value from the byte buffer, otherwise return this empty buffer
    // TODO: Some additional sanity checks here?
    List<Row> rows = resultSet.all();
    Preconditions.checkArgument(
        rows.size() <= 1, "Expected to get 0 or 1 rows from system table, but got %s.", rows);
    if (rows.size() == 1) {
      Row row = rows.get(0);
      return ByteUtils.toBytes(row.getBytes(VALUE_COLUMN));
View Full Code Here


   * @return A list of C* rows for the query.
   */
  private List<Row> getRows(String table, String key, int numVersions) {
    Preconditions.checkArgument(numVersions >= 1"numVersions must be positive");
    ResultSet resultSet = mAdmin.execute(mGetRowsStatement.bind(table, key, numVersions));
    return resultSet.all();
  }

  /** {@inheritDoc} */
  @Override
  public List<byte[]> getValues(String table, String key, int numVersions) throws IOException {
View Full Code Here

  public Set<String> keySet(String table) throws IOException {
    // Just return a set of in-use keys
    final ResultSet resultSet = mAdmin.execute(mKeySetStatement.bind(table));

    final Set<String> keys = new HashSet<String>();
    for (Row row: resultSet.all()) {
      keys.add(row.getString(KV_COLUMN_KEY));
    }
    return keys;
}
View Full Code Here

    // Just return a set of in-use tables
    final String queryText = String.format("SELECT %s FROM %s", KV_COLUMN_TABLE, mTable);
    final ResultSet resultSet = mAdmin.execute(queryText);

    final Set<String> keys = new HashSet<String>();
    for (Row row: resultSet.all()) {
      final String tableName = row.getString(KV_COLUMN_TABLE);
      keys.add(tableName);
    }
    return keys;
  }
View Full Code Here

     */
    public Long count(Class<?> bean, Session session,
            ConsistencyLevel consistency) {
        Select select = prepareCount(bean, consistency);
        ResultSet resultSet = session.execute(select);
        return resultSet.all().get(0).getLong(0);
    }

    protected Select prepareCount(Class<?> bean, ConsistencyLevel consistency) {
        ClassInformation classInformation = ClassInformations.INSTACE.getClass(bean);
        KeySpaceInformation key = classInformation.getKeySpace(keySpace);
View Full Code Here

        @Override
        public void run() {
            ResultSet result;
            try {
                result = resultSetFuture.get();
                callBack.result(result.all().get(0).getLong(0));
            } catch (InterruptedException | ExecutionException exception) {
                throw new AsyncExecption(exception);
            }
        }
View Full Code Here

        public boolean run() throws Exception
        {
            ResultSet rs = client.getSession().execute(bindRandom(partitions.get(0)));
            validate(rs);
            rowCount = rs.all().size();
            partitionCount = Math.min(1, rowCount);
            return true;
        }
    }
View Full Code Here

        batch.endBatch(successCallBack, errorCallBack);

        latch.await();

        final ResultSet resultSet = manager.getNativeSession().execute("SELECT id,favoriteTweets,followers,friends,age_in_years,name,welcomeTweet,label,preferences FROM CompleteBean WHERE id=:id", bean.getId());
        assertThat(resultSet.all()).hasSize(1);

        foundBean = manager.find(CompleteBean.class, bean.getId()).getImmediately();
        foundTweet1 = manager.find(Tweet.class, tweet1.getId()).getImmediately();
        foundTweet2 = manager.find(Tweet.class, tweet2.getId()).getImmediately();
        foundUser = manager.find(User.class, user.getId()).getImmediately();
View Full Code Here

        // Flush
        batch.endBatch();

        final ResultSet resultSet = manager.getNativeSession().execute("SELECT id,favoriteTweets,followers,friends,age_in_years,name,welcomeTweet,label,preferences FROM CompleteBean WHERE id=:id", bean.getId());
        assertThat(resultSet.all()).hasSize(1);

        foundBean = manager.find(CompleteBean.class, bean.getId());
        foundTweet1 = manager.find(Tweet.class, tweet1.getId());
        foundTweet2 = manager.find(Tweet.class, tweet2.getId());
        foundUser = manager.find(User.class, user.getId());
View Full Code Here

    Statement query = QueryBuilder.select().from("system", "schema_columns")
        .where(eq("keyspace_name", keyspaceName))
        .and(eq("columnfamily_name", cfName));
   
    ResultSet rs = session.execute(query);
    List<Row> rows = rs.all();
    if (rows != null && rows.size() > 0) {
     
      List<CqlColumnDefinitionImpl> tmpList = new ArrayList<CqlColumnDefinitionImpl>();
     
      for (Row row : rows) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.