Package com.datastax.driver.core

Examples of com.datastax.driver.core.Statement


  }

  @Override
  public String getVersion() throws ConnectionException {
   
    Statement query = QueryBuilder.select("release_version")
                  .from("system", "local")
                  .where(eq("key", "local"));
   
    return session.execute(query).one().getString("release_version");
  }
View Full Code Here


    throw new UnsupportedOperationException("Operation not supported");
  }

  @Override
  public String describePartitioner() throws ConnectionException {
    Statement query = QueryBuilder.select("partitioner")
        .from("system", "local")
        .where(eq("key", "local"));

    return session.execute(query).one().getString("partitioner");
  }
View Full Code Here

  }

  @Override
  public List<KeyspaceDefinition> describeKeyspaces() throws ConnectionException {
   
    Statement query = QueryBuilder.select().all().from("system", "schema_keyspaces");

    List<KeyspaceDefinition> ksDefs = new ArrayList<KeyspaceDefinition>();
    try {
      for(Row row : session.execute(query).all()) {
        String keyspaceName = row.getString("keyspace_name");
View Full Code Here

    return this;
  }

  @Override
  public RowSliceColumnCountQuery<K> getColumnCounts() {
    Statement query = new InternalRowQueryExecutionImpl(this).getQuery();
    return new CqlRowSliceColumnCountQueryImpl<K>(ksContext, cfContext, query);
  }
View Full Code Here

    }

    @Override
    public Statement getQuery() {
     
      Statement stmt = cfDef.getRowQueryGenerator().getQueryStatement(rowQuery, useCaching);
      // Translate the column limit to the fetch size. This is useful for pagination
      if (paginationContext.isPaginating() && columnSlice.isRangeQuery()) {
//        if (columnSlice.getFetchSize() > 0) {
//          stmt.setFetchSize(columnSlice.getFetchSize() + 1);
//        }
View Full Code Here

  */
 
  private void readColDefinitions() {
   
    // VALUE COLUMNS AND COLUMNS THAT ARE NOT PART OF THE PRIMARY KEY
    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();
View Full Code Here

    }
  }

  @Override
  public String describePartitioner() throws ConnectionException {
    Statement q = QueryBuilder.select("partitioner").from("system", "local");
    ResultSet result = session.execute(q);
    com.datastax.driver.core.Row row = result.one();
    if (row == null) {
      throw new RuntimeException("Missing paritioner");
    }
View Full Code Here

  }

  @Override
  public KeyspaceDefinition describeKeyspace() throws ConnectionException {
   
    Statement query = QueryBuilder.select().from("system", "schema_keyspaces").where(eq("keyspace_name", keyspaceName));
    Row row = session.execute(query).one();
    if (row == null) {
      throw new RuntimeException("Keyspace not found: " + keyspaceName);
    }
    return (new CqlKeyspaceDefinitionImpl(session, row));
View Full Code Here

    } else {
      tracer = tracerFactory.newTracer(getOperationType());
    }
   
    tracer.start();
    Statement query = getQuery();
   
    if (LOG.isDebugEnabled()) {
      LOG.debug("Query: " + query);
    }
   
        // Set the consistency level on the query
        query.setConsistencyLevel(clLevel);

        // Set the retry policy on the query
        if (retry instanceof JavaDriverBasedRetryPolicy) {
          JavaDriverBasedRetryPolicy jdRetryPolicy = (JavaDriverBasedRetryPolicy) retry;
          query.setRetryPolicy(jdRetryPolicy.getJDRetryPolicy());
        }

        ResultSet resultSet = session.execute(query);
        R result = parseResultSet(resultSet);
    OperationResult<R> opResult = new CqlOperationResultImpl<R>(resultSet, result);
View Full Code Here

  @Override
  public ListenableFuture<OperationResult<R>> executeAsync() throws ConnectionException {
    final CassandraOperationTracer tracer = tracerFactory.newTracer(getOperationType());
    tracer.start();
   
    Statement query = getQuery();
   
    if (LOG.isDebugEnabled()) {
      LOG.debug("Query: " + query);
    }
   
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.Statement

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.