org.apache.cassandra.cql3.statements

## Class ModificationStatement

- java.lang.Object
- - org.apache.cassandra.cql3.statements.ModificationStatement

All Implemented Interfaces:
  CQLStatement

Direct Known Subclasses:
  DeleteStatement, UpdateStatement

    public abstract class ModificationStatement
    extends java.lang.Object
    implements CQLStatement

### Nested Class Summary

Nested Classes
`static class` `ModificationStatement.Parsed`
`static class` `ModificationStatement.StatementType`

### Field Summary

Fields
`Attributes` `attrs`
`CFMetaData` `cfm`
`protected java.util.Map<ColumnIdentifier,Restriction>` `processedKeys`
`ModificationStatement.StatementType` `type`

### Constructor Summary

Constructors
Constructor and Description
`ModificationStatement(ModificationStatement.StatementType type, int boundTerms, CFMetaData cfm, Attributes attrs)`

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
`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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### type

    public final ModificationStatement.StatementType type

#### cfm

    public final CFMetaData cfm

#### attrs

    public final Attributes attrs

#### processedKeys

    protected final java.util.Map<ColumnIdentifier,Restriction> processedKeys

### Constructor Detail

#### ModificationStatement

    public ModificationStatement(ModificationStatement.StatementType type,
                                 int boundTerms,
                                 CFMetaData cfm,
                                 Attributes attrs)

### Method Detail

#### getFunctions

    public java.lang.Iterable<Function> getFunctions()

Description copied from interface: `CQLStatement`
Return an Iterable over all of the functions (both native and user-defined) used by any component of the statement

Specified by:
  `getFunctions` in interface `CQLStatement`
Returns:
  functions all functions found (may contain duplicates)

#### requireFullClusteringKey

    public abstract boolean requireFullClusteringKey()

#### addUpdateForKey

    public abstract void addUpdateForKey(ColumnFamily updates,
                                         java.nio.ByteBuffer key,
                                         Composite prefix,
                                         UpdateParameters params)
                                  throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### getBoundTerms

    public int getBoundTerms()

Description copied from interface: `CQLStatement`
Returns the number of bound terms in this statement.

Specified by:
  `getBoundTerms` in interface `CQLStatement`

#### keyspace

    public java.lang.String keyspace()

#### columnFamily

    public java.lang.String columnFamily()

#### isCounter

    public boolean isCounter()

#### getTimestamp

    public long getTimestamp(long now,
                             QueryOptions options)
                      throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### isTimestampSet

    public boolean isTimestampSet()

#### getTimeToLive

    public int getTimeToLive(QueryOptions options)
                      throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### checkAccess

    public void checkAccess(ClientState state)
                     throws InvalidRequestException,
                            UnauthorizedException

Description copied from interface: `CQLStatement`
Perform any access verification necessary for the statement.

Specified by:
  `checkAccess` in interface `CQLStatement`
Parameters:
  `state` - the current client state
Throws:
  `InvalidRequestException`
  `UnauthorizedException`

#### validate

    public void validate(ClientState state)
                  throws InvalidRequestException

Description copied from interface: `CQLStatement`
Perform additional validation required by the statment. To be overriden by subclasses if needed.

Specified by:
  `validate` in interface `CQLStatement`
Parameters:
  `state` - the current client state
Throws:
  `InvalidRequestException`

#### addOperation

    public void addOperation(Operation op)

#### getOperations

    public java.util.List<Operation> getOperations()

#### getColumnsWithConditions

    public java.lang.Iterable<ColumnDefinition> getColumnsWithConditions()

#### addCondition

    public void addCondition(ColumnCondition cond)

#### setIfNotExistCondition

    public void setIfNotExistCondition()

#### hasIfNotExistCondition

    public boolean hasIfNotExistCondition()

#### setIfExistCondition

    public void setIfExistCondition()

#### hasIfExistCondition

    public boolean hasIfExistCondition()

#### hasStaticConditions

    public boolean hasStaticConditions()

#### hasRegularConditions

    public boolean hasRegularConditions()

#### addKeyValue

    public void addKeyValue(ColumnDefinition def,
                            Term value)
                     throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### processWhereClause

    public void processWhereClause(java.util.List<Relation> whereClause,
                                   VariableSpecifications names)
                            throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### buildPartitionKeyNames

    public java.util.List<java.nio.ByteBuffer> buildPartitionKeyNames(QueryOptions options)
                                                               throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### createClusteringPrefix

    public Composite createClusteringPrefix(QueryOptions options)
                                     throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### appliesOnlyToStaticColumns

    protected boolean appliesOnlyToStaticColumns()

Checks that the modification only apply to static columns.

Returns:
  `true` if the modification only apply to static columns, `false` otherwise.

#### appliesToRegularColumns

    protected boolean appliesToRegularColumns()

Checks that the modification apply to regular columns.

Returns:
  `true` if the modification apply to regular columns, `false` otherwise.

#### getFirstEmptyKey

    protected ColumnDefinition getFirstEmptyKey()

#### requiresRead

    public boolean requiresRead()

#### readRequiredRows

    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

Throws:
  `RequestExecutionException`
  `RequestValidationException`

#### hasConditions

    public boolean hasConditions()

#### execute

    public ResultMessage execute(QueryState queryState,
                                 QueryOptions options)
                          throws RequestExecutionException,
                                 RequestValidationException

Description copied from interface: `CQLStatement`
Execute the statement and return the resulting result or null if there is no result.

Specified by:
  `execute` in interface `CQLStatement`
Parameters:
  `queryState` - the current query state
  `options` - options for this query (consistency, variables, pageSize, ...)
Throws:
  `RequestExecutionException`
  `RequestValidationException`

#### executeWithCondition

    public ResultMessage executeWithCondition(QueryState queryState,
                                              QueryOptions options)
                                       throws RequestExecutionException,
                                              RequestValidationException

Throws:
  `RequestExecutionException`
  `RequestValidationException`

#### addConditions

    public void addConditions(Composite clusteringPrefix,
                              CQL3CasRequest request,
                              QueryOptions options)
                       throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### buildCasResultSet

    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

Throws:
  `InvalidRequestException`

#### executeInternal

    public ResultMessage executeInternal(QueryState queryState,
                                         QueryOptions options)
                                  throws RequestValidationException,
                                         RequestExecutionException

Description copied from interface: `CQLStatement`
Variant of execute used for internal query against the system tables, and thus only query the local node.

Specified by:
  `executeInternal` in interface `CQLStatement`
Parameters:
  `queryState` - the current query state
Throws:
  `RequestValidationException`
  `RequestExecutionException`

#### executeInternalWithoutCondition

    public ResultMessage executeInternalWithoutCondition(QueryState queryState,
                                                         QueryOptions options)
                                                  throws RequestValidationException,
                                                         RequestExecutionException

Throws:
  `RequestValidationException`
  `RequestExecutionException`

#### executeInternalWithCondition

    public ResultMessage executeInternalWithCondition(QueryState state,
                                                      QueryOptions options)
                                               throws RequestValidationException,
                                                      RequestExecutionException

Throws:
  `RequestValidationException`
  `RequestExecutionException`

#### makeUpdateParameters

    public UpdateParameters makeUpdateParameters(java.util.Collection<java.nio.ByteBuffer> keys,
                                                 Composite prefix,
                                                 QueryOptions options,
                                                 boolean local,
                                                 long now)
                                          throws RequestExecutionException,
                                                 RequestValidationException

Throws:
  `RequestExecutionException`
  `RequestValidationException`

#### validateWhereClauseForConditions

    protected void validateWhereClauseForConditions()
                                             throws InvalidRequestException

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.

Throws:
  `InvalidRequestException`