struct CassStatement
A statement object is an executable query. It represents either a regular (adhoc) statement or a prepared statement. It maintains the queries’ parameter values along with query options (consistency level, paging state, etc.)
Note: Parameters for regular queries are not supported by the binary protocol version 1.
Functions
CassStatement *
cass_statement_new
( query, parameter_count )Creates a new query statement.
CassStatement *
cass_statement_new_n
( query, query_length, parameter_count )Same as CassStatement::cass_statement_new
, but with lengths for string parameters.
CassError
cass_statement_reset_parameters
( statement, count )Clear and/or resize the statement’s parameters.
void
cass_statement_free
( statement )Frees a statement instance. Statements can be immediately freed after being prepared, executed or added to a batch.
CassError
cass_statement_add_key_index
( statement, index )Adds a key index specifier to this a statement. When using token-aware routing, this can be used to tell the driver which parameters within a non-prepared, parameterized statement are part of the partition key.
Use consecutive calls for composite partition keys.
This is not necessary for prepared statements, as the key parameters are determined in the metadata processed in the prepare phase.
CassError
cass_statement_set_keyspace
( statement, keyspace )Sets the statement’s keyspace. This is used for token-aware routing and when using protocol v5 or greater it also overrides the session’s current keyspace for the statement.
This is not necessary and will not work for bound statements, as the keyspace is determined by the prepared statement metadata.
CassError
cass_statement_set_keyspace_n
( statement, keyspace, keyspace_length )Same as CassStatement::cass_statement_set_keyspace
, but with lengths for string parameters.
CassError
cass_statement_set_consistency
( statement, consistency )Sets the statement’s consistency level.
Default: CASS_CONSISTENCY_LOCAL_ONE
CassError
cass_statement_set_serial_consistency
( statement, serial_consistency )Sets the statement’s serial consistency level.
Requires Cassandra: 2.0+
Default: Not set
CassError
cass_statement_set_paging_size
( statement, page_size )Sets the statement’s page size.
Requires Cassandra: 2.0+
Default: -1 (Disabled)
CassError
cass_statement_set_paging_state
( statement, result )Sets the statement’s paging state. This can be used to get the next page of data in a multi-page query.
Requires Cassandra: 2.0+
CassError
cass_statement_set_paging_state_token
( statement, paging_state, paging_state_size )Sets the statement’s paging state. This can be used to get the next page of data in a multi-page query.
Requires Cassandra: 2.0+
Warning: The paging state should not be exposed to or come from untrusted environments. The paging state could be spoofed and potentially used to gain access to other data.
CassError
cass_statement_set_timestamp
( statement, timestamp )Sets the statement’s timestamp.
Requires Cassandra: 2.1+
CassError
cass_statement_set_request_timeout
( statement, timeout_ms )Sets the statement’s timeout for waiting for a response from a node.
Default: Disabled (use the cluster-level request timeout)
CassError
cass_statement_set_is_idempotent
( statement, is_idempotent )Sets whether the statement is idempotent. Idempotent statements are able to be automatically retried after timeouts/errors and can be speculatively executed.
CassError
cass_statement_set_retry_policy
( statement, retry_policy )Sets the statement’s retry policy.
CassError
cass_statement_set_custom_payload
( statement, payload )Sets the statement’s custom payload.
Requires Cassandra: 2.2+
CassError
cass_statement_bind_null
( statement, index )Binds null to a query or bound statement at the specified index.
CassError
cass_statement_bind_null_by_name
( statement, name )Binds a null to all the values with the specified name.
This can only be used with statements created by CassPrepared::cass_prepared_bind
when using Cassandra 2.0 or earlier.
CassError
cass_statement_bind_null_by_name_n
( statement, name, name_length )Same as CassStatement::cass_statement_bind_null_by_name
, but with lengths for string parameters.
CassError
cass_statement_bind_int8
( statement, index, value )Binds a “tinyint” to a query or bound statement at the specified index.
Requires Cassandra: 2.2+
CassError
cass_statement_bind_int8_by_name
( statement, name, value )Binds a “tinyint” to all the values with the specified name.
Requires Cassandra: 2.2+
CassError
cass_statement_bind_int8_by_name_n
( statement, name, name_length, value )Same as CassStatement::cass_statement_bind_int8_by_name
, but with lengths for string parameters.
Requires Cassandra: 2.2+
CassError
cass_statement_bind_int16
( statement, index, value )Binds an “smallint” to a query or bound statement at the specified index.
Requires Cassandra: 2.2+
CassError
cass_statement_bind_int16_by_name
( statement, name, value )Binds an “smallint” to all the values with the specified name.
Requires Cassandra: 2.2+
CassError
cass_statement_bind_int16_by_name_n
( statement, name, name_length, value )Same as CassStatement::cass_statement_bind_int16_by_name
, but with lengths for string parameters.
Requires Cassandra: 2.2+
CassError
cass_statement_bind_int32
( statement, index, value )Binds an “int” to a query or bound statement at the specified index.
CassError
cass_statement_bind_int32_by_name
( statement, name, value )Binds an “int” to all the values with the specified name.
This can only be used with statements created by CassPrepared::cass_prepared_bind
when using Cassandra 2.0 or earlier.
CassError
cass_statement_bind_int32_by_name_n
( statement, name, name_length, value )Same as CassStatement::cass_statement_bind_int32_by_name
, but with lengths for string parameters.
CassError
cass_statement_bind_uint32
( statement, index, value )Binds a “date” to a query or bound statement at the specified index.
Requires Cassandra: 2.2+
CassError
cass_statement_bind_uint32_by_name
( statement, name, value )Binds a “date” to all the values with the specified name.
Requires Cassandra: 2.2+
CassError
cass_statement_bind_uint32_by_name_n
( statement, name, name_length, value )Same as CassStatement::cass_statement_bind_uint32_by_name
, but with lengths for string parameters.
Requires Cassandra: 2.2+
CassError
cass_statement_bind_int64
( statement, index, value )Binds a “bigint”, “counter”, “timestamp” or “time” to a query or bound statement at the specified index.
CassError
cass_statement_bind_int64_by_name
( statement, name, value )Binds a “bigint”, “counter”, “timestamp” or “time” to all values with the specified name.
This can only be used with statements created by CassPrepared::cass_prepared_bind
when using Cassandra 2.0 or earlier.
CassError
cass_statement_bind_int64_by_name_n
( statement, name, name_length, value )Same as CassStatement::cass_statement_bind_int64_by_name
, but with lengths for string parameters.
CassError
cass_statement_bind_float
( statement, index, value )Binds a “float” to a query or bound statement at the specified index.
CassError
cass_statement_bind_float_by_name
( statement, name, value )Binds a “float” to all the values with the specified name.
This can only be used with statements created by CassPrepared::cass_prepared_bind
when using Cassandra 2.0 or earlier.
CassError
cass_statement_bind_float_by_name_n
( statement, name, name_length, value )Same as CassStatement::cass_statement_bind_float_by_name
, but with lengths for string parameters.
CassError
cass_statement_bind_double
( statement, index, value )Binds a “double” to a query or bound statement at the specified index.
CassError
cass_statement_bind_double_by_name
( statement, name, value )Binds a “double” to all the values with the specified name.
This can only be used with statements created by CassPrepared::cass_prepared_bind
when using Cassandra 2.0 or earlier.
CassError
cass_statement_bind_double_by_name_n
( statement, name, name_length, value )Same as CassStatement::cass_statement_bind_double_by_name
, but with lengths for string parameters.
CassError
cass_statement_bind_bool
( statement, index, value )Binds a “boolean” to a query or bound statement at the specified index.
CassError
cass_statement_bind_bool_by_name
( statement, name, value )Binds a “boolean” to all the values with the specified name.
This can only be used with statements created by CassPrepared::cass_prepared_bind
when using Cassandra 2.0 or earlier.
CassError
cass_statement_bind_bool_by_name_n
( statement, name, name_length, value )Same as CassStatement::cass_statement_bind_bool_by_name
, but with lengths for string parameters.
CassError
cass_statement_bind_string
( statement, index, value )Binds an “ascii”, “text” or “varchar” to a query or bound statement at the specified index.
CassError
cass_statement_bind_string_n
( statement, index, value, value_length )Same as CassStatement::cass_statement_bind_string
, but with lengths for string parameters.
CassError
cass_statement_bind_string_by_name
( statement, name, value )Binds an “ascii”, “text” or “varchar” to all the values with the specified name.
This can only be used with statements created by CassPrepared::cass_prepared_bind
when using Cassandra 2.0 or earlier.
CassError
cass_statement_bind_string_by_name_n
( statement, name, name_length, value, value_length )Same as CassStatement::cass_statement_bind_string_by_name
, but with lengths for string parameters.
CassError
cass_statement_bind_bytes
( statement, index, value, value_size )Binds a “blob”, “varint” or “custom” to a query or bound statement at the specified index.
CassError
cass_statement_bind_bytes_by_name
( statement, name, value, value_size )Binds a “blob”, “varint” or “custom” to all the values with the specified name.
This can only be used with statements created by CassPrepared::cass_prepared_bind
when using Cassandra 2.0 or earlier.
CassError
cass_statement_bind_bytes_by_name_n
( statement, name, name_length, value, value_size )Same as CassStatement::cass_statement_bind_bytes_by_name
, but with lengths for string parameters.
CassError
cass_statement_bind_custom
( statement, index, class_name, value, value_size )Binds a “custom” to a query or bound statement at the specified index.
CassError
cass_statement_bind_custom_n
( statement, index, class_name, class_name_length, value, value_size )Same as CassStatement::cass_statement_bind_custom
, but with lengths for string parameters.
CassError
cass_statement_bind_custom_by_name
( statement, name, class_name, value, value_size )Binds a “custom” to all the values with the specified name.
This can only be used with statements created by CassPrepared::cass_prepared_bind
when using Cassandra 2.0 or earlier.
CassError
cass_statement_bind_custom_by_name_n
( statement, name, name_length, class_name, class_name_length, value, value_size )Same as CassStatement::cass_statement_bind_custom_by_name
, but with lengths for string parameters.
CassError
cass_statement_bind_uuid
( statement, index, value )Binds a “uuid” or “timeuuid” to a query or bound statement at the specified index.
CassError
cass_statement_bind_uuid_by_name
( statement, name, value )Binds a “uuid” or “timeuuid” to all the values with the specified name.
This can only be used with statements created by CassPrepared::cass_prepared_bind
when using Cassandra 2.0 or earlier.
CassError
cass_statement_bind_uuid_by_name_n
( statement, name, name_length, value )Same as CassStatement::cass_statement_bind_uuid_by_name
, but with lengths for string parameters.
CassError
cass_statement_bind_inet
( statement, index, value )Binds an “inet” to a query or bound statement at the specified index.
CassError
cass_statement_bind_inet_by_name
( statement, name, value )Binds an “inet” to all the values with the specified name.
This can only be used with statements created by CassPrepared::cass_prepared_bind
when using Cassandra 2.0 or earlier.
CassError
cass_statement_bind_inet_by_name_n
( statement, name, name_length, value )Same as CassStatement::cass_statement_bind_inet_by_name
, but with lengths for string parameters.
CassError
cass_statement_bind_decimal
( statement, index, varint, varint_size, scale )Bind a “decimal” to a query or bound statement at the specified index.
CassError
cass_statement_bind_decimal_by_name
( statement, name, varint, varint_size, scale )Binds a “decimal” to all the values with the specified name.
This can only be used with statements created by CassPrepared::cass_prepared_bind
when using Cassandra 2.0 or earlier.
CassError
cass_statement_bind_decimal_by_name_n
( statement, name, name_length, varint, varint_size, scale )Same as CassStatement::cass_statement_bind_decimal_by_name
, but with lengths for string parameters.
CassError
cass_statement_bind_duration
( statement, index, months, days, nanos )Binds a “duration” to a query or bound statement at the specified index.
Requires Cassandra: 3.10+
CassError
cass_statement_bind_duration_by_name
( statement, name, months, days, nanos )Binds a “duration” to all the values with the specified name.
Requires Cassandra: 3.10+
CassError
cass_statement_bind_duration_by_name_n
( statement, name, name_length, months, days, nanos )Same as CassStatement::cass_statement_bind_duration_by_name
, but with lengths for string parameters.
Requires Cassandra: 3.10+
CassError
cass_statement_bind_collection
( statement, index, collection )Bind a “list”, “map” or “set” to a query or bound statement at the specified index.
CassError
cass_statement_bind_collection_by_name
( statement, name, collection )Bind a “list”, “map” or “set” to all the values with the specified name.
This can only be used with statements created by CassPrepared::cass_prepared_bind
when using Cassandra 2.0 or earlier.
CassError
cass_statement_bind_collection_by_name_n
( statement, name, name_length, collection )Same as CassStatement::cass_statement_bind_collection_by_name
, but with lengths for string parameters.
CassError
cass_statement_bind_tuple
( statement, index, tuple )Bind a “tuple” to a query or bound statement at the specified index.
Requires Cassandra: 2.1+
CassError
cass_statement_bind_tuple_by_name
( statement, name, tuple )Bind a “tuple” to all the values with the specified name.
Requires Cassandra: 2.1+
CassError
cass_statement_bind_tuple_by_name_n
( statement, name, name_length, tuple )Same as CassStatement::cass_statement_bind_tuple_by_name
, but with lengths for string parameters.
Requires Cassandra: 2.1+
CassError
cass_statement_bind_user_type
( statement, index, user_type )Bind a user defined type to a query or bound statement at the specified index.
Requires Cassandra: 2.1+
CassError
cass_statement_bind_user_type_by_name
( statement, name, user_type )Bind a user defined type to a query or bound statement with the specified name.
Requires Cassandra: 2.1+
CassError
cass_statement_bind_user_type_by_name_n
( statement, name, name_length, user_type )Same as CassStatement::cass_statement_bind_user_type_by_name
, but with lengths for string parameters.
Requires Cassandra: 2.1+