Example usage for org.apache.cassandra.cql3 QueryProcessor instance

List of usage examples for org.apache.cassandra.cql3 QueryProcessor instance

Introduction

In this page you can find the example usage for org.apache.cassandra.cql3 QueryProcessor instance.

Prototype

QueryProcessor instance

To view the source code for org.apache.cassandra.cql3 QueryProcessor instance.

Click Source Link

Usage

From source file:com.stratio.cassandra.lucene.IndexQueryHandler.java

License:Apache License

@Override
/** {@inheritDoc} */
public ResultMessage.Prepared prepare(String query, QueryState state, Map<String, ByteBuffer> customPayload) {
    return QueryProcessor.instance.prepare(query, state);
}

From source file:com.stratio.cassandra.lucene.IndexQueryHandler.java

License:Apache License

@Override
/** {@inheritDoc} */
public ParsedStatement.Prepared getPrepared(MD5Digest id) {
    return QueryProcessor.instance.getPrepared(id);
}

From source file:com.stratio.cassandra.lucene.IndexQueryHandler.java

License:Apache License

@Override
/** {@inheritDoc} */
public ParsedStatement.Prepared getPreparedForThrift(Integer id) {
    return QueryProcessor.instance.getPreparedForThrift(id);
}

From source file:com.stratio.cassandra.lucene.IndexQueryHandler.java

License:Apache License

@Override
/** {@inheritDoc} */
public ResultMessage processBatch(BatchStatement statement, QueryState state, BatchQueryOptions options,
        Map<String, ByteBuffer> customPayload) {
    return QueryProcessor.instance.processBatch(statement, state, options, customPayload);
}

From source file:org.elassandra.cluster.InternalCassandraClusterService.java

License:Apache License

public UntypedResultSet process(final ConsistencyLevel cl, final ConsistencyLevel serialConsistencyLevel,
        final String query, Long writetime, final Object... values)
        throws RequestExecutionException, RequestValidationException, InvalidRequestException {
    if (logger.isDebugEnabled()) {
        logger.debug("processing CL={} SERIAL_CL={} query=[{}] values={} ", cl, serialConsistencyLevel, query,
                Arrays.toString(values));
    }/* w w w. j  av  a2s .  c o m*/
    ParsedStatement.Prepared prepared = QueryProcessor.getStatement(query, ClientState.forInternalCalls());
    List<ByteBuffer> boundValues = new ArrayList<ByteBuffer>(values.length);
    for (int i = 0; i < values.length; i++) {
        Object v = values[i];
        AbstractType type = prepared.boundNames.get(i).type;
        boundValues.add(v instanceof ByteBuffer || v == null ? (ByteBuffer) v : type.decompose(v));
    }
    QueryState queryState = QueryState.forInternalCalls();
    QueryOptions queryOptions = QueryOptions.forInternalCalls(cl, serialConsistencyLevel, boundValues);
    ResultMessage result = QueryProcessor.instance.process(query, queryState, queryOptions);
    writetime = queryState.getTimestamp();
    if (result instanceof ResultMessage.Rows)
        return UntypedResultSet.create(((ResultMessage.Rows) result).result);
    else
        return null;
}

From source file:org.elasticsearch.cassandra.cluster.InternalCassandraClusterService.java

License:Apache License

public UntypedResultSet process(final ConsistencyLevel cl, final ConsistencyLevel serialConsistencyLevel,
        final String query, Long writetime, final Object... values)
        throws RequestExecutionException, RequestValidationException, InvalidRequestException {
    if (logger.isDebugEnabled()) {
        logger.debug("processing CL={} SERIAL_CL={} query=[{}] values={} ", cl, serialConsistencyLevel, query,
                Arrays.toString(values));
    }/*  w  ww .  j  a v a 2 s  .c o m*/
    ParsedStatement.Prepared prepared = QueryProcessor.getStatement(query, ClientState.forInternalCalls());
    List<ByteBuffer> boundValues = new ArrayList<ByteBuffer>(values.length);
    for (int i = 0; i < values.length; i++) {
        Object v = values[i];
        AbstractType type = prepared.boundNames.get(i).type;
        boundValues.add(v instanceof ByteBuffer || v == null ? (ByteBuffer) v : type.decompose(v));
    }
    QueryState queryState = QueryState.forInternalCalls();
    ResultMessage result = QueryProcessor.instance.process(query, queryState,
            QueryOptions.forInternalCalls(cl, serialConsistencyLevel, boundValues));
    writetime = queryState.getTimestamp();
    if (result instanceof ResultMessage.Rows)
        return UntypedResultSet.create(((ResultMessage.Rows) result).result);
    else
        return null;
}

From source file:org.elasticsearch.cassandra.cluster.InternalCassandraClusterService.java

License:Apache License

@Override
public UntypedResultSet fetchRowInternal(final String index, final String cfName,
        final Collection<String> requiredColumns, final Object[] pkColumns)
        throws ConfigurationException, IOException {
    return QueryProcessor.instance.executeInternal(buildFetchQuery(index, cfName, requiredColumns), pkColumns);
}