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;
}
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;
}
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) {
ParsedStatement.Prepared prepared = prepareInternal(query);
ResultMessage result = prepared.statement.executeInternal(internalQueryState(), makeInternalOptions(prepared, values));
if (result instanceof ResultMessage.Rows)
return UntypedResultSet.create(((ResultMessage.Rows) result).result);
else
return null;
}
use of org.apache.cassandra.transport.messages.ResultMessage in project cassandra by apache.
the class SchemaAlteringStatement method execute.
public ResultMessage execute(QueryState state, QueryOptions options, long queryStartNanoTime) throws RequestValidationException {
// If an IF [NOT] EXISTS clause was used, this may not result in an actual schema change. To avoid doing
// extra work in the drivers to handle schema changes, we return an empty message in this case. (CASSANDRA-7600)
Event.SchemaChange ce = announceMigration(state, false);
if (ce == null)
return new ResultMessage.Void();
// when a schema alteration results in a new db object being created, we grant permissions on the new
// object to the user performing the request if:
// * the user is not anonymous
// * the configured IAuthorizer supports granting of permissions (not all do, AllowAllAuthorizer doesn't and
// custom external implementations may not)
AuthenticatedUser user = state.getClientState().getUser();
if (user != null && !user.isAnonymous() && ce.change == Event.SchemaChange.Change.CREATED) {
try {
grantPermissionsToCreator(state);
} catch (UnsupportedOperationException e) {
// not a problem, grant is an optional method on IAuthorizer
}
}
return new ResultMessage.SchemaChange(ce);
}
Aggregations