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`

### Field Summary

Fields
`CFMetaData` `cfm`
`static java.lang.String` `CUSTOM_EXPRESSIONS_NOT_ALLOWED`
`protected static org.slf4j.Logger` `logger`
`protected StatementType` `type`

### Constructor Summary

Constructors
Constructor and Description
`ModificationStatement(StatementType type, int boundTerms, CFMetaData cfm, Operations operations, StatementRestrictions restrictions, Conditions conditions, Attributes attrs)`

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
`void` `addConditions(Clustering clustering, CQL3CasRequest request, QueryOptions options)`
`void` `addFunctionsTo(java.util.List<Function> functions)`
`abstract void` `addUpdateForKey(PartitionUpdate update, Clustering clustering, UpdateParameters params)`
`abstract void` `addUpdateForKey(PartitionUpdate update, Slice slice, UpdateParameters params)`
`java.lang.Iterable<Operation>` `allOperations()`
`static boolean` `appliesOnlyToStaticColumns(Operations operation, Conditions conditions)` Checks that the specified operations and conditions only apply to static columns.
`static ResultSet` `buildCasResultSet(java.lang.String ksName, java.lang.String tableName, RowIterator partition, 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()`
`PartitionColumns` `conditionColumns()`
`java.util.NavigableSet<Clustering>` `createClustering(QueryOptions options)`
`ResultMessage` `execute(QueryState queryState, QueryOptions options, long queryStartNanoTime)` 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, long queryStartNanoTime)`
`ResultMessage` `executeWithCondition(QueryState queryState, QueryOptions options, long queryStartNanoTime)`
`int` `getBoundTerms()` Returns the number of bound terms in this statement.
`java.lang.Iterable<ColumnDefinition>` `getColumnsWithConditions()`
`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>` `getRegularOperations()`
`StatementRestrictions` `getRestrictions()`
`java.util.List<Operation>` `getStaticOperations()`
`long` `getTimestamp(long now, QueryOptions options)`
`int` `getTimeToLive(QueryOptions options)`
`boolean` `hasConditions()`
`boolean` `hasIfExistCondition()`
`boolean` `hasIfNotExistCondition()`
`boolean` `hasSlices()`
`boolean` `isCounter()`
`boolean` `isTimestampSet()`
`boolean` `isView()`
`java.lang.String` `keyspace()`
`boolean` `requiresRead()`
`PartitionColumns` `updatedColumns()`
`boolean` `updatesRegularRows()`
`boolean` `updatesStaticRow()`
`void` `validate(ClientState state)` Perform additional validation required by the statment.

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

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

### Field Detail

#### logger

    protected static final org.slf4j.Logger logger

#### CUSTOM_EXPRESSIONS_NOT_ALLOWED

    public static final java.lang.String CUSTOM_EXPRESSIONS_NOT_ALLOWED

See Also:
  Constant Field Values

#### type

    protected final StatementType type

#### cfm

    public final CFMetaData cfm

### Constructor Detail

#### ModificationStatement

    public ModificationStatement(StatementType type,
                                 int boundTerms,
                                 CFMetaData cfm,
                                 Operations operations,
                                 StatementRestrictions restrictions,
                                 Conditions conditions,
                                 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)

#### addFunctionsTo

    public void addFunctionsTo(java.util.List<Function> functions)

#### getRestrictions

    public StatementRestrictions getRestrictions()

#### addUpdateForKey

    public abstract void addUpdateForKey(PartitionUpdate update,
                                         Clustering clustering,
                                         UpdateParameters params)

#### addUpdateForKey

    public abstract void addUpdateForKey(PartitionUpdate update,
                                         Slice slice,
                                         UpdateParameters params)

#### 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()

#### isView

    public boolean isView()

#### 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`

#### updatedColumns

    public PartitionColumns updatedColumns()

#### conditionColumns

    public PartitionColumns conditionColumns()

#### updatesRegularRows

    public boolean updatesRegularRows()

#### updatesStaticRow

    public boolean updatesStaticRow()

#### getRegularOperations

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

#### getStaticOperations

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

#### allOperations

    public java.lang.Iterable<Operation> allOperations()

#### getColumnsWithConditions

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

#### hasIfNotExistCondition

    public boolean hasIfNotExistCondition()

#### hasIfExistCondition

    public boolean hasIfExistCondition()

#### buildPartitionKeyNames

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

Throws:
  `InvalidRequestException`

#### createClustering

    public java.util.NavigableSet<Clustering> createClustering(QueryOptions options)
                                                        throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### appliesOnlyToStaticColumns

    public static boolean appliesOnlyToStaticColumns(Operations operation,
                                                     Conditions conditions)

Checks that the specified operations and conditions only apply to static columns.

Returns:
  `true` if the specified operations and conditions only apply to static columns, `false` otherwise.

#### requiresRead

    public boolean requiresRead()

#### hasConditions

    public boolean hasConditions()

#### hasSlices

    public boolean hasSlices()

#### execute

    public ResultMessage execute(QueryState queryState,
                                 QueryOptions options,
                                 long queryStartNanoTime)
                          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, ...)
  `queryStartNanoTime` - the timestamp returned by System.nanoTime() when this statement was received
Throws:
  `RequestExecutionException`
  `RequestValidationException`

#### executeWithCondition

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

Throws:
  `RequestExecutionException`
  `RequestValidationException`

#### addConditions

    public void addConditions(Clustering clustering,
                              CQL3CasRequest request,
                              QueryOptions options)
                       throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### buildCasResultSet

    public static ResultSet buildCasResultSet(java.lang.String ksName,
                                              java.lang.String tableName,
                                              RowIterator partition,
                                              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,
                                                         long queryStartNanoTime)
                                                  throws RequestValidationException,
                                                         RequestExecutionException

Throws:
  `RequestValidationException`
  `RequestExecutionException`

#### executeInternalWithCondition

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

Throws:
  `RequestValidationException`
  `RequestExecutionException`