A group of statements that are executed as a single batch.

Note: Batches are not supported by the binary protocol version 1.

Requires Cassandra: 2.0+

Functions

CassBatch *

cass_batch_new

( CassBatchType type )

Creates a new batch statement with batch type.

Requires Cassandra: 2.0+

Parameters:
Name Type Details
in type CassBatchType
Returns:
Type Details
CassBatch *

Returns a batch statement that must be freed.

See Also:
void

cass_batch_free

( CassBatch * batch )

Frees a batch instance. Batches can be immediately freed after being executed.

Requires Cassandra: 2.0+

Parameters:
Name Type Details
in batch CassBatch *
CassError

cass_batch_set_consistency

( CassBatch * batch, CassConsistency consistency )

Sets the batch’s consistency level

Requires Cassandra: 2.0+

Parameters:
Name Type Details
in batch CassBatch *
in consistency CassConsistency

The batch’s write consistency.

Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_batch_set_serial_consistency

( CassBatch * batch, CassConsistency serial_consistency )

Sets the batch’s serial consistency level.

Requires Cassandra: 2.0+

Default: Not set

Parameters:
Name Type Details
in batch CassBatch *
in serial_consistency CassConsistency
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_batch_set_timestamp

( CassBatch * batch, cass_int64_t timestamp )

Sets the batch’s timestamp.

Requires Cassandra: 2.1+

Parameters:
Name Type Details
in batch CassBatch *
in timestamp cass_int64_t
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_batch_set_request_timeout

( CassBatch * batch, cass_uint64_t timeout_ms )

Sets the batch’s timeout for waiting for a response from a node.

Default: Disabled (use the cluster-level request timeout)

Parameters:
Name Type Details
in batch CassBatch *
in timeout_ms cass_uint64_t

Request timeout in milliseconds. Use 0 for no timeout or CASS_UINT64_MAX to disable (to use the cluster-level request timeout).

Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

See Also:
CassError

cass_batch_set_is_idempotent

( CassBatch * batch, cass_bool_t is_idempotent )

Sets whether the statements in a batch are idempotent. Idempotent batches are able to be automatically retried after timeouts/errors and can be speculatively executed.

Parameters:
Name Type Details
in batch CassBatch *
in is_idempotent cass_bool_t
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

See Also:
CassError

cass_batch_set_retry_policy

( CassBatch * batch, CassRetryPolicy * retry_policy )

Sets the batch’s retry policy.

Requires Cassandra: 2.0+

Parameters:
Name Type Details
in batch CassBatch *
in retry_policy CassRetryPolicy *
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_batch_set_custom_payload

( CassBatch * batch, const CassCustomPayload * payload )

Sets the batch’s custom payload.

Requires Cassandra: 2.2+

Parameters:
Name Type Details
in batch CassBatch *
in payload const CassCustomPayload *
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_batch_add_statement

( CassBatch * batch, CassStatement * statement )

Adds a statement to a batch.

Requires Cassandra: 2.0+

Parameters:
Name Type Details
in batch CassBatch *
in statement CassStatement *
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.