Package com.datastax.driver.core

Examples of com.datastax.driver.core.ResultSet$FetchingState


    sb.append("SELECT id from \"");
    sb.append(cm.getRhombusKeyspaceName());
    sb.append("\".\"__keyspace_definitions\" where name='");
    sb.append(NewKeyspaceDefinition.getName());
    sb.append("';");
    ResultSet resultSet = session.execute(sb.toString());
    Iterator<Row> rsIter = resultSet.iterator();
    int counter = 0;
    while(rsIter.hasNext()) {
      counter++;
      rsIter.next();
    }
View Full Code Here


      // If we are within a shard already, get more results from this shard
      Row row = page.get(nextItem);
      UUID uuid = row.getUUID("id");
      statementIterator.setNextUuid(uuid);
      CQLStatement cql = statementIterator.next();
      ResultSet resultSet = cqlExecutor.executeSync(cql);
      statementNumber++;
      populatePage(resultSet);
      if (page.size() > pageSize) {
        moreResultsInShard = true;
      } else {
        moreResultsInShard = false;
      }
      nextItem = 0;
    } else {
      // Reset our current shard state
      nextItem = 0;
      page = null;
      moreResultsInShard = false;

      // Start going through the remaining shards until we find one with results or hit the last one
      while (statementIterator.hasNext()) {
        // Move to the next shard in the iterator and reset the limits and stuff
        statementIterator.setLimit(pageSize + 1l);
        statementIterator.nextShard();
        statementIterator.setNextUuid(null);
        CQLStatement cql = statementIterator.next();
        ResultSet resultSet = cqlExecutor.executeSync(cql);
        statementNumber++;
        if (!resultSet.isExhausted()) {
          populatePage(resultSet);
          if (page.size() > pageSize) {
            moreResultsInShard = true;
          } else {
            moreResultsInShard = false;
View Full Code Here

    LOG.debug("Executing CQL: {}", query);
    if (query.type == CqlQueryType.USE) {
      setActiveKeySpace(query);
    }

    ResultSet cqlResult = execute(query.part);
    if (cqlResult == null || cqlResult.isExhausted()) {
      return CqlQueryResult.EMPTY;
    }

    Map<String, CqlColumnType> typeMap = createTypeMap(query);
    Row firstRow = cqlResult.one();
    CqlRowMetadata rowMetadata = extractRowMetadata(firstRow, typeMap);

    RowIterator rowIterator = new RowIterator(cqlResult.iterator(), firstRow);
    CqlQueryResult result = new CqlQueryResult(rowIterator, rowMetadata);
    return result;
  }
View Full Code Here

  }

  protected Optional<ResultSet> executeSilent(String cql) {

    LOG.debug("Executing: {}", cql);
    ResultSet resultSet = null;
    try {
      resultSet = session.getSession().execute(cql);
    } catch (Exception e) {
      LOG.warn("Error executing CQL: '" + cql + "', reason: " + e.getMessage());
      LOG.debug(e.getMessage(), e);
View Full Code Here

  }

  protected ResultSet execute(String cql) {

    LOG.debug("Executing: {} ", cql);
    ResultSet resultSet;
    try {
      resultSet = session.getSession().execute(cql);
    } catch (Exception e) {
      throw new QueryException("Error executing CQL: '" + cql + "', reason: " + e.getMessage(), e);
    }
View Full Code Here

    Set<String> partitionKeys = findPartitionKeyNamesLc(table.get());
    for (String pk : partitionKeys) {
      types.put(pk, CqlColumnType.PARTITION_KEY);
    }

    ResultSet result = execute("select column_name from system.schema_columns where columnfamily_name='"
        + table.get().part + "' allow filtering");

    for (Row row : result) {
      String name = StringUtils.trimToNull(row.getString("column_name"));
      if (name == null) {
View Full Code Here

    }
    @Override
    public String listRow(String db, String table, String keycol, String key) {
        // TODO Auto-generated method stub
        String query = select().all().from(db, table).where(eq(keycol,key)).getQueryString();
        ResultSet rs = session.execute(query);
        return convertResultSet(rs);
    }
View Full Code Here

          query, db + "." + table, keycol, key, keyvals[0],
          keyvals[1])));
    } else {
      String query = QueryFactory.BuildQuery(QueryType.SELECT,
          StorageType.CASSANDRA);
      ResultSet rs = session.execute(String.format(query, db + "."
          + table, keycol, key));
      if (rs != null && rs.all().size() > 0)
        return QueryUtils.formatQueryResult(rs);
      return "{\"msg\":\"Nothing is found\"}";
    }
  }
View Full Code Here

        LoadDbToTimeSeriesMap();
        LoadStorage();
        LoadTableToStorage();
    }
    private void LoadTableToStorage() {
        ResultSet rs = session
                .execute("select column1, value from "+MetaConstants.META_KEY_SPACE+"."+MetaConstants.META_COLUMN_FAMILY+ " where key='"+MetaConstants.STAASH_TABLE_ENTITY_TYPE+"';");
        List<Row> rows = rs.all();
        for (Row row : rows) {
            String field = row.getString(0);
            JsonObject val = new JsonObject(row.getString(1));
            String storage = val.getField("storage");
            tableToStorageMap.put(field, storage);
View Full Code Here

            String storage = val.getField("storage");
            tableToStorageMap.put(field, storage);
        }
    }
    public  Map<String,JsonObject> LoadStorage() {
        ResultSet rs = session
                .execute("select column1, value from "+MetaConstants.META_KEY_SPACE+"."+MetaConstants.META_COLUMN_FAMILY+ " where key='"+MetaConstants.STAASH_STORAGE_TYPE_ENTITY+"';");
        List<Row> rows = rs.all();
        Map<String,JsonObject> storageMap = new HashMap<String,JsonObject>();
        for (Row row : rows) {
            String field = row.getString(0);
            JsonObject val = new JsonObject(row.getString(1));
            jsonStorage.putObject(field, val);
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.ResultSet$FetchingState

Copyright © 2018 www.massapicom. 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.