Class BatchStatement
A statement that groups a number of BoundStatement and / or SimpleStatement so they get executed as a batch.
Implements
Inherited Members
Namespace: Dse
Assembly: Dse.dll
Syntax
public class BatchStatement : Statement, IStatement
Properties
BatchType
Gets the batch type
Declaration
public BatchType BatchType { get; }
Property Value
Type | Description |
---|---|
BatchType |
IsEmpty
Determines if the batch does not contain any query
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Keyspace
Declaration
public override string Keyspace { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
RoutingKey
Gets the routing key for the query.
Routing key can be provided using the SetRoutingValues(Object[]) method.
Declaration
public override RoutingKey RoutingKey { get; }
Property Value
Type | Description |
---|---|
RoutingKey |
Overrides
Methods
Add(Statement)
Adds a new statement to this batch.
Note that statement can be any Statement
. It is allowed to mix SimpleStatement and BoundStatement in the same BatchStatement
in particular.
Please note that the options of the added Statement
(all those defined directly by the Statement class: consistency level, fetch size, tracing, ...) will be ignored for the purpose of the execution of the Batch. Instead, the options used are the one of this BatchStatement
object.
Declaration
public BatchStatement Add(Statement statement)
Parameters
Type | Name | Description |
---|---|---|
Statement | statement | Statement to add to the batch |
Returns
Type | Description |
---|---|
BatchStatement | The Batch statement |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown when trying to add more than |
SetBatchType(BatchType)
Sets the BatchType
Declaration
public BatchStatement SetBatchType(BatchType batchType)
Parameters
Type | Name | Description |
---|---|---|
BatchType | batchType |
Returns
Type | Description |
---|---|
BatchStatement |
SetKeyspace(String)
Sets the keyspace this batch operates on. The keyspace should only be set when the statements in this batch apply to a different keyspace to the logged keyspace of the ISession.
Declaration
public BatchStatement SetKeyspace(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The keyspace name. |
Returns
Type | Description |
---|---|
BatchStatement |
SetRoutingKey(RoutingKey[])
Set the routing key for this query.
This method allows to manually provide a routing key for this query. It is thus optional since the routing key is only an hint for token aware load balancing policy but is never mandatory.
If the partition key for the query is composite, use the
#setRoutingKey(ByteBuffer...) method instead to build the routing key.Declaration
public BatchStatement SetRoutingKey(params RoutingKey[] routingKeyComponents)
Parameters
Type | Name | Description |
---|---|---|
RoutingKey[] | routingKeyComponents | the raw (binary) values to compose to obtain the routing key. |
Returns
Type | Description |
---|---|
BatchStatement | this |
SetRoutingValues(Object[])
Sets the partition key values in order to route the query to the correct replicas.
For simple partition keys, set the partition key value.
For composite partition keys, set the multiple the partition key values in correct order.
Declaration
public BatchStatement SetRoutingValues(params object[] keys)
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | keys |
Returns
Type | Description |
---|---|
BatchStatement |