org.apache.cassandra.cql3.statements
Class ModificationStatement
java.lang.Object
org.apache.cassandra.cql3.statements.ParsedStatement
org.apache.cassandra.cql3.statements.CFStatement
org.apache.cassandra.cql3.statements.ModificationStatement
- All Implemented Interfaces:
- CQLStatement
- Direct Known Subclasses:
- BatchStatement, DeleteStatement, UpdateStatement
public abstract class ModificationStatement
- extends CFStatement
- implements CQLStatement
Abstract class for statements that apply on a given column family.
Method Summary |
void |
checkAccess(ClientState state)
Perform any access verification necessary for the statement. |
ResultMessage |
execute(ConsistencyLevel cl,
QueryState queryState,
java.util.List<java.nio.ByteBuffer> variables)
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. |
protected abstract java.util.Collection<? extends IMutation> |
getMutations(java.util.List<java.nio.ByteBuffer> variables,
boolean local,
ConsistencyLevel cl,
long now)
Convert statement into a list of mutations to apply on the server |
long |
getTimestamp(long now)
|
int |
getTimeToLive()
|
boolean |
isSetTimestamp()
|
abstract ParsedStatement.Prepared |
prepare(ColumnSpecification[] boundNames)
|
protected java.util.Map<java.nio.ByteBuffer,ColumnGroupMap> |
readRows(java.util.List<java.nio.ByteBuffer> keys,
ColumnNameBuilder builder,
java.util.Set<java.nio.ByteBuffer> toRead,
CompositeType composite,
boolean local,
ConsistencyLevel cl)
|
void |
setTimestamp(long timestamp)
|
void |
validate(ClientState state)
Perform additional validation required by the statment. |
protected abstract void |
validateConsistency(ConsistencyLevel cl)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
defaultConsistency
public static final ConsistencyLevel defaultConsistency
type
protected ModificationStatement.Type type
ModificationStatement
public ModificationStatement(CFName name,
Attributes attrs)
ModificationStatement
public ModificationStatement(CFName name,
java.lang.Long timestamp,
int timeToLive)
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
validateConsistency
protected abstract void validateConsistency(ConsistencyLevel cl)
throws InvalidRequestException
- Throws:
InvalidRequestException
execute
public ResultMessage execute(ConsistencyLevel cl,
QueryState queryState,
java.util.List<java.nio.ByteBuffer> variables)
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
queryState
- the current query statevariables
- the values for bounded variables. The implementation
can assume that each bound term have a corresponding value.
- Throws:
RequestExecutionException
RequestValidationException
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
getTimestamp
public long getTimestamp(long now)
setTimestamp
public void setTimestamp(long timestamp)
isSetTimestamp
public boolean isSetTimestamp()
getTimeToLive
public int getTimeToLive()
readRows
protected java.util.Map<java.nio.ByteBuffer,ColumnGroupMap> readRows(java.util.List<java.nio.ByteBuffer> keys,
ColumnNameBuilder builder,
java.util.Set<java.nio.ByteBuffer> toRead,
CompositeType composite,
boolean local,
ConsistencyLevel cl)
throws RequestExecutionException,
RequestValidationException
- Throws:
RequestExecutionException
RequestValidationException
getMutations
protected abstract java.util.Collection<? extends IMutation> getMutations(java.util.List<java.nio.ByteBuffer> variables,
boolean local,
ConsistencyLevel cl,
long now)
throws RequestExecutionException,
RequestValidationException
- Convert statement into a list of mutations to apply on the server
- Parameters:
variables
- value for prepared statement markerslocal
- if true, any requests (for collections) performed by getMutation should be done locally only.cl
- the consistency to use for the potential reads involved in generating the mutations (for lists set/delete operations)now
- the current timestamp in microseconds to use if no timestamp is user provided.
- Returns:
- list of the mutations
- Throws:
InvalidRequestException
- on invalid requests
RequestExecutionException
RequestValidationException
prepare
public abstract ParsedStatement.Prepared prepare(ColumnSpecification[] boundNames)
throws InvalidRequestException
- Throws:
InvalidRequestException
Copyright © 2013 The Apache Software Foundation