Search in sources :

Example 11 with ResultMessage

use of org.apache.cassandra.transport.messages.ResultMessage in project cassandra by apache.

the class QueryProcessor method executeOnceInternal.

/**
     * Same than executeInternal, but to use for queries we know are only executed once so that the
     * created statement object is not cached.
     */
public static UntypedResultSet executeOnceInternal(String query, Object... values) {
    ParsedStatement.Prepared prepared = parseStatement(query, internalQueryState());
    prepared.statement.validate(internalQueryState().getClientState());
    ResultMessage result = prepared.statement.executeInternal(internalQueryState(), makeInternalOptions(prepared, values));
    if (result instanceof ResultMessage.Rows)
        return UntypedResultSet.create(((ResultMessage.Rows) result).result);
    else
        return null;
}
Also used : ResultMessage(org.apache.cassandra.transport.messages.ResultMessage)

Example 12 with ResultMessage

use of org.apache.cassandra.transport.messages.ResultMessage in project cassandra by apache.

the class CQLTester method assertSchemaChange.

protected static void assertSchemaChange(String query, Event.SchemaChange.Change expectedChange, Event.SchemaChange.Target expectedTarget, String expectedKeyspace, String expectedName, String... expectedArgTypes) {
    ResultMessage actual = schemaChange(query);
    Assert.assertTrue(actual instanceof ResultMessage.SchemaChange);
    Event.SchemaChange schemaChange = ((ResultMessage.SchemaChange) actual).change;
    Assert.assertSame(expectedChange, schemaChange.change);
    Assert.assertSame(expectedTarget, schemaChange.target);
    Assert.assertEquals(expectedKeyspace, schemaChange.keyspace);
    Assert.assertEquals(expectedName, schemaChange.name);
    Assert.assertEquals(expectedArgTypes != null ? Arrays.asList(expectedArgTypes) : null, schemaChange.argTypes);
}
Also used : ResultMessage(org.apache.cassandra.transport.messages.ResultMessage)

Example 13 with ResultMessage

use of org.apache.cassandra.transport.messages.ResultMessage in project cassandra by apache.

the class QueryProcessor method executeInternal.

public static UntypedResultSet executeInternal(String query, Object... values) {
    Prepared prepared = prepareInternal(query);
    ResultMessage result = prepared.statement.executeLocally(internalQueryState(), makeInternalOptions(prepared.statement, values));
    if (result instanceof ResultMessage.Rows)
        return UntypedResultSet.create(((ResultMessage.Rows) result).result);
    else
        return null;
}
Also used : ResultMessage(org.apache.cassandra.transport.messages.ResultMessage)

Example 14 with ResultMessage

use of org.apache.cassandra.transport.messages.ResultMessage in project cassandra by apache.

the class CustomPayloadMirroringQueryHandler method process.

public ResultMessage process(CQLStatement statement, QueryState state, QueryOptions options, Map<String, ByteBuffer> customPayload, long queryStartNanoTime) {
    ResultMessage result = queryProcessor.process(statement, state, options, customPayload, queryStartNanoTime);
    result.setCustomPayload(customPayload);
    return result;
}
Also used : ResultMessage(org.apache.cassandra.transport.messages.ResultMessage)

Example 15 with ResultMessage

use of org.apache.cassandra.transport.messages.ResultMessage in project cassandra by apache.

the class CustomPayloadMirroringQueryHandler method processPrepared.

public ResultMessage processPrepared(CQLStatement statement, QueryState state, QueryOptions options, Map<String, ByteBuffer> customPayload, long queryStartNanoTime) {
    ResultMessage result = queryProcessor.processPrepared(statement, state, options, customPayload, queryStartNanoTime);
    result.setCustomPayload(customPayload);
    return result;
}
Also used : ResultMessage(org.apache.cassandra.transport.messages.ResultMessage)

Aggregations

ResultMessage (org.apache.cassandra.transport.messages.ResultMessage)20 ClientState (org.apache.cassandra.service.ClientState)4 ByteBuffer (java.nio.ByteBuffer)3 CQLStatement (org.apache.cassandra.cql3.CQLStatement)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 AuthenticatedUser (org.apache.cassandra.auth.AuthenticatedUser)2 DatabaseDescriptor (org.apache.cassandra.config.DatabaseDescriptor)2 InvalidRequestException (org.apache.cassandra.exceptions.InvalidRequestException)2 org.apache.cassandra.schema (org.apache.cassandra.schema)2 QueryState (org.apache.cassandra.service.QueryState)2 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 String.format (java.lang.String.format)1 BindException (java.net.BindException)1 java.util (java.util)1 Set (java.util.Set)1 TimeoutException (java.util.concurrent.TimeoutException)1 BiFunction (java.util.function.BiFunction)1 Collectors (java.util.stream.Collectors)1