org.apache.cassandra.cql
Class UpdateStatement

java.lang.Object
  extended by org.apache.cassandra.cql.AbstractModification
      extended by org.apache.cassandra.cql.UpdateStatement

public class UpdateStatement
extends AbstractModification

An UPDATE statement parsed from a CQL query statement.


Field Summary
 
Fields inherited from class org.apache.cassandra.cql.AbstractModification
cLevel, columnFamily, defaultConsistency, keyName, keyspace, timestamp, timeToLive
 
Constructor Summary
UpdateStatement(java.lang.String keyspace, java.lang.String columnFamily, java.lang.String keyName, java.util.List<Term> columnNames, java.util.List<Term> columnValues, java.util.List<Term> keys, Attributes attrs)
          Creates a new UpdateStatement from a column family name, a consistency level, key, and lists of column names and values.
UpdateStatement(java.lang.String keyspace, java.lang.String columnFamily, java.lang.String keyName, java.util.Map<Term,Operation> columns, java.util.List<Term> keys, Attributes attrs)
          Creates a new UpdateStatement from a column family name, columns map, consistency level, and key term.
 
Method Summary
 java.lang.String getColumnFamily()
           
 java.util.List<Term> getColumnNames()
           
 java.util.Map<Term,Operation> getColumns()
           
 java.util.List<Term> getColumnValues()
           
 AbstractType<?> getComparator(java.lang.String keyspace)
           
 ConsistencyLevel getConsistencyLevel()
          Returns the consistency level of this UPDATE statement, either one parsed from the CQL statement, or the default level otherwise.
 java.util.List<Term> getKeys()
           
 AbstractType<?> getKeyType(java.lang.String keyspace)
           
 AbstractType<?> getValueValidator(java.lang.String keyspace, java.nio.ByteBuffer column)
           
 boolean isSetConsistencyLevel()
          True if an explicit consistency level was parsed from the statement.
 java.util.List<IMutation> prepareRowMutations(java.lang.String keyspace, ThriftClientState clientState, java.util.List<java.nio.ByteBuffer> variables)
          Convert statement into a list of mutations to apply on the server
 java.util.List<IMutation> prepareRowMutations(java.lang.String keyspace, ThriftClientState clientState, java.lang.Long timestamp, java.util.List<java.nio.ByteBuffer> variables)
          Convert statement into a list of mutations to apply on the server
 java.lang.String toString()
           
 
Methods inherited from class org.apache.cassandra.cql.AbstractModification
getKeyspace, getTimestamp, getTimeToLive, isSetTimestamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UpdateStatement

public UpdateStatement(java.lang.String keyspace,
                       java.lang.String columnFamily,
                       java.lang.String keyName,
                       java.util.Map<Term,Operation> columns,
                       java.util.List<Term> keys,
                       Attributes attrs)
Creates a new UpdateStatement from a column family name, columns map, consistency level, and key term.

Parameters:
keyspace - Keyspace (optional)
columnFamily - column family name
keyName - alias key name
columns - a map of column name/values pairs
keys - the keys to update
attrs - additional attributes for statement (CL, timestamp, timeToLive)

UpdateStatement

public UpdateStatement(java.lang.String keyspace,
                       java.lang.String columnFamily,
                       java.lang.String keyName,
                       java.util.List<Term> columnNames,
                       java.util.List<Term> columnValues,
                       java.util.List<Term> keys,
                       Attributes attrs)
Creates a new UpdateStatement from a column family name, a consistency level, key, and lists of column names and values. It is intended for use with the alternate update format, INSERT.

Parameters:
keyspace - Keyspace (optional)
columnFamily - column family name
keyName - alias key name
columnNames - list of column names
columnValues - list of column values (corresponds to names)
keys - the keys to update
attrs - additional attributes for statement (CL, timestamp, timeToLive)
Method Detail

getConsistencyLevel

public ConsistencyLevel getConsistencyLevel()
Returns the consistency level of this UPDATE statement, either one parsed from the CQL statement, or the default level otherwise.

Overrides:
getConsistencyLevel in class AbstractModification
Returns:
the consistency level as a Thrift enum.

isSetConsistencyLevel

public boolean isSetConsistencyLevel()
True if an explicit consistency level was parsed from the statement.

Overrides:
isSetConsistencyLevel in class AbstractModification
Returns:
true if a consistency was parsed, false otherwise.

prepareRowMutations

public java.util.List<IMutation> prepareRowMutations(java.lang.String keyspace,
                                                     ThriftClientState clientState,
                                                     java.util.List<java.nio.ByteBuffer> variables)
                                              throws InvalidRequestException,
                                                     UnauthorizedException
Convert statement into a list of mutations to apply on the server

Specified by:
prepareRowMutations in class AbstractModification
Parameters:
keyspace - The working keyspace
clientState - current client status
Returns:
list of the mutations
Throws:
InvalidRequestException - on the wrong request
UnauthorizedException

prepareRowMutations

public java.util.List<IMutation> prepareRowMutations(java.lang.String keyspace,
                                                     ThriftClientState clientState,
                                                     java.lang.Long timestamp,
                                                     java.util.List<java.nio.ByteBuffer> variables)
                                              throws InvalidRequestException,
                                                     UnauthorizedException
Convert statement into a list of mutations to apply on the server

Specified by:
prepareRowMutations in class AbstractModification
Parameters:
keyspace - The working keyspace
clientState - current client status
timestamp - global timestamp to use for all mutations
Returns:
list of the mutations
Throws:
InvalidRequestException - on the wrong request
UnauthorizedException

getColumnFamily

public java.lang.String getColumnFamily()
Overrides:
getColumnFamily in class AbstractModification

getKeys

public java.util.List<Term> getKeys()

getColumns

public java.util.Map<Term,Operation> getColumns()
                                         throws InvalidRequestException
Throws:
InvalidRequestException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getKeyType

public AbstractType<?> getKeyType(java.lang.String keyspace)

getComparator

public AbstractType<?> getComparator(java.lang.String keyspace)

getValueValidator

public AbstractType<?> getValueValidator(java.lang.String keyspace,
                                         java.nio.ByteBuffer column)

getColumnNames

public java.util.List<Term> getColumnNames()

getColumnValues

public java.util.List<Term> getColumnValues()


Copyright © 2012 The Apache Software Foundation