org.apache.cassandra.cql3.statements

## Class ModificationStatement

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

All Implemented Interfaces:
  CQLStatement, MeasurableForPreparedCache

Direct Known Subclasses:
  DeleteStatement, UpdateStatement

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

### Nested Class Summary

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

### Field Summary

Fields
`Attributes` `attrs`
`CFMetaData` `cfm`
`ModificationStatement.StatementType` `type`

### Constructor Summary

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

### Method Summary

Methods
`void` `addCondition(ColumnCondition cond)`
`void` `addKeyValue(CFDefinition.Name name, Term value)`
`void` `addOperation(Operation op)`
`abstract void` `addUpdateForKey(ColumnFamily updates, java.nio.ByteBuffer key, ColumnNameBuilder builder, UpdateParameters params)`
`void` `addUpdatesAndConditions(java.nio.ByteBuffer key, ColumnNameBuilder clusteringPrefix, ColumnFamily updates, CQL3CasConditions conditions, java.util.List<java.nio.ByteBuffer> variables, long now)`
`static ResultSet` `buildCasResultSet(java.lang.String ksName, java.nio.ByteBuffer key, java.lang.String cfName, ColumnFamily cf, java.lang.Iterable<ColumnIdentifier> columnsWithConditions, boolean isBatch)`
`java.util.List<java.nio.ByteBuffer>` `buildPartitionKeyNames(java.util.List<java.nio.ByteBuffer> variables)`
`void` `checkAccess(ClientState state)` Perform any access verification necessary for the statement.
`java.lang.String` `columnFamily()`
`ColumnNameBuilder` `createClusteringPrefixBuilder(java.util.List<java.nio.ByteBuffer> variables)`
`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)` Variante of execute used for internal query against the system tables, and thus only query the local node.
`ResultMessage` `executeWithCondition(QueryState queryState, QueryOptions options)`
`int` `getBoundTerms()` Returns the number of bound terms in this statement.
`java.lang.Iterable<ColumnIdentifier>` `getColumnsWithConditions()`
`protected CFDefinition.Name` `getFirstEmptyKey()`
`java.util.List<Operation>` `getOperations()`
`long` `getTimestamp(long now, java.util.List<java.nio.ByteBuffer> variables)`
`int` `getTimeToLive(java.util.List<java.nio.ByteBuffer> variables)`
`boolean` `hasConditions()`
`boolean` `hasIfNotExistCondition()`
`boolean` `isCounter()`
`boolean` `isStatic(java.nio.ByteBuffer name)`
`boolean` `isTimestampSet()`
`java.lang.String` `keyspace()`
`UpdateParameters` `makeUpdateParameters(java.util.Collection<java.nio.ByteBuffer> keys, ColumnNameBuilder prefix, java.util.List<java.nio.ByteBuffer> variables, boolean local, ConsistencyLevel cl, long now)`
`long` `measureForPreparedCache(org.github.jamm.MemoryMeter meter)`
`void` `processWhereClause(java.util.List<Relation> whereClause, VariableSpecifications names)`
`protected java.util.Map<java.nio.ByteBuffer,ColumnGroupMap>` `readRequiredRows(java.util.Collection<java.nio.ByteBuffer> partitionKeys, ColumnNameBuilder clusteringPrefix, boolean local, ConsistencyLevel cl)`
`abstract boolean` `requireFullClusteringKey()`
`void` `setIfNotExistCondition()`
`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

#### type

    public final ModificationStatement.StatementType type

#### cfm

    public final CFMetaData cfm

#### attrs

    public final Attributes attrs

### Constructor Detail

#### ModificationStatement

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

### Method Detail

#### measureForPreparedCache

    public long measureForPreparedCache(org.github.jamm.MemoryMeter meter)

Specified by:
  `measureForPreparedCache` in interface `MeasurableForPreparedCache`

#### requireFullClusteringKey

    public abstract boolean requireFullClusteringKey()

#### addUpdateForKey

    public abstract void addUpdateForKey(ColumnFamily updates,
                       java.nio.ByteBuffer key,
                       ColumnNameBuilder builder,
                       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,
                    java.util.List<java.nio.ByteBuffer> variables)
                      throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### isTimestampSet

    public boolean isTimestampSet()

#### getTimeToLive

    public int getTimeToLive(java.util.List<java.nio.ByteBuffer> variables)
                      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<ColumnIdentifier> getColumnsWithConditions()

#### addCondition

    public void addCondition(ColumnCondition cond)
                      throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### setIfNotExistCondition

    public void setIfNotExistCondition()

#### hasIfNotExistCondition

    public boolean hasIfNotExistCondition()

#### addKeyValue

    public void addKeyValue(CFDefinition.Name name,
                   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(java.util.List<java.nio.ByteBuffer> variables)
                                                               throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### createClusteringPrefixBuilder

    public ColumnNameBuilder createClusteringPrefixBuilder(java.util.List<java.nio.ByteBuffer> variables)
                                                    throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### isStatic

    public boolean isStatic(java.nio.ByteBuffer name)

#### getFirstEmptyKey

    protected CFDefinition.Name getFirstEmptyKey()

#### readRequiredRows

    protected java.util.Map<java.nio.ByteBuffer,ColumnGroupMap> readRequiredRows(java.util.Collection<java.nio.ByteBuffer> partitionKeys,
                                                                     ColumnNameBuilder 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`

#### addUpdatesAndConditions

    public void addUpdatesAndConditions(java.nio.ByteBuffer key,
                               ColumnNameBuilder clusteringPrefix,
                               ColumnFamily updates,
                               CQL3CasConditions conditions,
                               java.util.List<java.nio.ByteBuffer> variables,
                               long now)
                                 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<ColumnIdentifier> columnsWithConditions,
                              boolean isBatch)
                                       throws InvalidRequestException

Throws:
  `InvalidRequestException`

#### executeInternal

    public ResultMessage executeInternal(QueryState queryState)
                                  throws RequestValidationException,
                                         RequestExecutionException

Description copied from interface: `CQLStatement`
Variante 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`

#### makeUpdateParameters

    public UpdateParameters makeUpdateParameters(java.util.Collection<java.nio.ByteBuffer> keys,
                                        ColumnNameBuilder prefix,
                                        java.util.List<java.nio.ByteBuffer> variables,
                                        boolean local,
                                        ConsistencyLevel cl,
                                        long now)
                                          throws RequestExecutionException,
                                                 RequestValidationException

Throws:
  `RequestExecutionException`
  `RequestValidationException`