CQL for Cassandra 2.0

Prepared statement batch message


Using a CQL native protocol version 2 connection, you can execute a BATCH message containing a list of prepared DML statements. Construct a message having a body in this format:

  • type is of data type byte and indicates the type of batch to use: If type is 0, the batch is logged. This is equivalent to a normal CQL batch statement. If type is 1, the batch is unlogged. If type is 2, the batch is a counter batch (and non-counter statements are rejected).
  • n is a [short] indicating the number of following queries.
  • query_1...query_n are the queries to execute.
A query_i must be of the form:
  • kind is of type byte indicating whether the following query is a prepared one or not. The value is either 0 or 1.
  • string_or_id depends on the value of kind:

    If kind is 0, string_or_id is a query string of type long string and might contain bind markers. Otherwise, if kind is 1, string_or_id is of type short bytes representing a prepared query ID.

  • n is of type short indicating the number (possibly 0) of following values.
  • value_1...value_n are the bytes to use for bound variables.

Ensure that there is no newline at end of file containing the prepared query.