Batch statements are used to execute a series of simple or prepared statements.

There are 3 types of batch statements:

  • Dse::BATCH_LOGGED - this is the default batch type. This batch guarantees that either all or none of its statements will be executed. This behavior is achieved by writing a batch log on the coordinator, which slows down the execution somewhat.
  • Dse::BATCH_UNLOGGED - this batch will not be verified when executed, which makes it faster than a LOGGED batch, but means that some of its statements might fail, while others - succeed.
  • Dse::BATCH_COUNTER - this batch is used for counter updates, which are, unlike other writes, not idempotent.
See Also:

Implements

Methods

__construct

( int $type )

Creates a new batch statement.

Parameters:
Name Type Details
$type int

must be one of Dse::BATCH_* (default: Dse::BATCH_LOGGED).

Dse\BatchStatement

add

( mixed $statement, array $arguments )

Adds a statement to this batch.

Parameters:
Name Type Details
$statement string|Dse\Statement

string or statement to add

$arguments array

positional or named arguments (optional)

Throws:
Type Details
Exception\InvalidArgumentException
Returns:
Type Details
Dse\BatchStatement

self