public abstract class ModificationStatement extends java.lang.Object implements CQLStatement
Modifier and Type | Class and Description |
---|---|
static class |
ModificationStatement.Parsed |
static class |
ModificationStatement.StatementType |
Modifier and Type | Field and Description |
---|---|
Attributes |
attrs |
CFMetaData |
cfm |
protected java.util.Map<ColumnIdentifier,Restriction> |
processedKeys |
ModificationStatement.StatementType |
type |
Constructor and Description |
---|
ModificationStatement(ModificationStatement.StatementType type,
int boundTerms,
CFMetaData cfm,
Attributes attrs) |
Modifier and Type | Method and Description |
---|---|
void |
addCondition(ColumnCondition cond) |
void |
addConditions(Composite clusteringPrefix,
CQL3CasRequest request,
QueryOptions options) |
void |
addKeyValue(ColumnDefinition def,
Term value) |
void |
addOperation(Operation op) |
abstract void |
addUpdateForKey(ColumnFamily updates,
java.nio.ByteBuffer key,
Composite prefix,
UpdateParameters params) |
protected boolean |
appliesOnlyToStaticColumns()
Checks that the modification only apply to static columns.
|
protected boolean |
appliesToRegularColumns()
Checks that the modification apply to regular columns.
|
static ResultSet |
buildCasResultSet(java.lang.String ksName,
java.nio.ByteBuffer key,
java.lang.String cfName,
ColumnFamily cf,
java.lang.Iterable<ColumnDefinition> columnsWithConditions,
boolean isBatch,
QueryOptions options) |
java.util.List<java.nio.ByteBuffer> |
buildPartitionKeyNames(QueryOptions options) |
void |
checkAccess(ClientState state)
Perform any access verification necessary for the statement.
|
java.lang.String |
columnFamily() |
Composite |
createClusteringPrefix(QueryOptions options) |
ResultMessage |
execute(QueryState queryState,
QueryOptions options)
Execute the statement and return the resulting result or null if there is no result.
|
ResultMessage |
executeInternal(QueryState queryState,
QueryOptions options)
Variant of execute used for internal query against the system tables, and thus only query the local node.
|
ResultMessage |
executeInternalWithCondition(QueryState state,
QueryOptions options) |
ResultMessage |
executeInternalWithoutCondition(QueryState queryState,
QueryOptions options) |
ResultMessage |
executeWithCondition(QueryState queryState,
QueryOptions options) |
int |
getBoundTerms()
Returns the number of bound terms in this statement.
|
java.lang.Iterable<ColumnDefinition> |
getColumnsWithConditions() |
protected ColumnDefinition |
getFirstEmptyKey() |
java.lang.Iterable<Function> |
getFunctions()
Return an Iterable over all of the functions (both native and user-defined) used by any component
of the statement
|
java.util.List<Operation> |
getOperations() |
long |
getTimestamp(long now,
QueryOptions options) |
int |
getTimeToLive(QueryOptions options) |
boolean |
hasConditions() |
boolean |
hasIfExistCondition() |
boolean |
hasIfNotExistCondition() |
boolean |
hasRegularConditions() |
boolean |
hasStaticConditions() |
boolean |
isCounter() |
boolean |
isTimestampSet() |
java.lang.String |
keyspace() |
UpdateParameters |
makeUpdateParameters(java.util.Collection<java.nio.ByteBuffer> keys,
Composite prefix,
QueryOptions options,
boolean local,
long now) |
void |
processWhereClause(java.util.List<Relation> whereClause,
VariableSpecifications names) |
protected java.util.Map<java.nio.ByteBuffer,CQL3Row> |
readRequiredRows(java.util.Collection<java.nio.ByteBuffer> partitionKeys,
Composite clusteringPrefix,
boolean local,
ConsistencyLevel cl) |
abstract boolean |
requireFullClusteringKey() |
boolean |
requiresRead() |
void |
setIfExistCondition() |
void |
setIfNotExistCondition() |
void |
validate(ClientState state)
Perform additional validation required by the statment.
|
protected void |
validateWhereClauseForConditions()
If there are conditions on the statement, this is called after the where clause and conditions have been
processed to check that they are compatible.
|
public final ModificationStatement.StatementType type
public final CFMetaData cfm
public final Attributes attrs
protected final java.util.Map<ColumnIdentifier,Restriction> processedKeys
public ModificationStatement(ModificationStatement.StatementType type, int boundTerms, CFMetaData cfm, Attributes attrs)
public java.lang.Iterable<Function> getFunctions()
CQLStatement
getFunctions
in interface CQLStatement
public abstract boolean requireFullClusteringKey()
public abstract void addUpdateForKey(ColumnFamily updates, java.nio.ByteBuffer key, Composite prefix, UpdateParameters params) throws InvalidRequestException
InvalidRequestException
public int getBoundTerms()
CQLStatement
getBoundTerms
in interface CQLStatement
public java.lang.String keyspace()
public java.lang.String columnFamily()
public boolean isCounter()
public long getTimestamp(long now, QueryOptions options) throws InvalidRequestException
InvalidRequestException
public boolean isTimestampSet()
public int getTimeToLive(QueryOptions options) throws InvalidRequestException
InvalidRequestException
public void checkAccess(ClientState state) throws InvalidRequestException, UnauthorizedException
CQLStatement
checkAccess
in interface CQLStatement
state
- the current client stateInvalidRequestException
UnauthorizedException
public void validate(ClientState state) throws InvalidRequestException
CQLStatement
validate
in interface CQLStatement
state
- the current client stateInvalidRequestException
public void addOperation(Operation op)
public java.util.List<Operation> getOperations()
public java.lang.Iterable<ColumnDefinition> getColumnsWithConditions()
public void addCondition(ColumnCondition cond)
public void setIfNotExistCondition()
public boolean hasIfNotExistCondition()
public void setIfExistCondition()
public boolean hasIfExistCondition()
public boolean hasStaticConditions()
public boolean hasRegularConditions()
public void addKeyValue(ColumnDefinition def, Term value) throws InvalidRequestException
InvalidRequestException
public void processWhereClause(java.util.List<Relation> whereClause, VariableSpecifications names) throws InvalidRequestException
InvalidRequestException
public java.util.List<java.nio.ByteBuffer> buildPartitionKeyNames(QueryOptions options) throws InvalidRequestException
InvalidRequestException
public Composite createClusteringPrefix(QueryOptions options) throws InvalidRequestException
InvalidRequestException
protected boolean appliesOnlyToStaticColumns()
true
if the modification only apply to static columns, false
otherwise.protected boolean appliesToRegularColumns()
true
if the modification apply to regular columns, false
otherwise.protected ColumnDefinition getFirstEmptyKey()
public boolean requiresRead()
protected java.util.Map<java.nio.ByteBuffer,CQL3Row> readRequiredRows(java.util.Collection<java.nio.ByteBuffer> partitionKeys, Composite clusteringPrefix, boolean local, ConsistencyLevel cl) throws RequestExecutionException, RequestValidationException
public boolean hasConditions()
public ResultMessage execute(QueryState queryState, QueryOptions options) throws RequestExecutionException, RequestValidationException
CQLStatement
execute
in interface CQLStatement
queryState
- the current query stateoptions
- options for this query (consistency, variables, pageSize, ...)RequestExecutionException
RequestValidationException
public ResultMessage executeWithCondition(QueryState queryState, QueryOptions options) throws RequestExecutionException, RequestValidationException
public void addConditions(Composite clusteringPrefix, CQL3CasRequest request, QueryOptions options) throws InvalidRequestException
InvalidRequestException
public static ResultSet buildCasResultSet(java.lang.String ksName, java.nio.ByteBuffer key, java.lang.String cfName, ColumnFamily cf, java.lang.Iterable<ColumnDefinition> columnsWithConditions, boolean isBatch, QueryOptions options) throws InvalidRequestException
InvalidRequestException
public ResultMessage executeInternal(QueryState queryState, QueryOptions options) throws RequestValidationException, RequestExecutionException
CQLStatement
executeInternal
in interface CQLStatement
queryState
- the current query stateRequestValidationException
RequestExecutionException
public ResultMessage executeInternalWithoutCondition(QueryState queryState, QueryOptions options) throws RequestValidationException, RequestExecutionException
public ResultMessage executeInternalWithCondition(QueryState state, QueryOptions options) throws RequestValidationException, RequestExecutionException
public UpdateParameters makeUpdateParameters(java.util.Collection<java.nio.ByteBuffer> keys, Composite prefix, QueryOptions options, boolean local, long now) throws RequestExecutionException, RequestValidationException
protected void validateWhereClauseForConditions() throws InvalidRequestException
InvalidRequestException
Copyright © 2016 The Apache Software Foundation