A statement object is an executable query. It represents either a regular (adhoc) statment or a prepared statement. It maitains 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

( CassString query, cass_size_t parameter_count )

Creates a new query statement.

Parameters:
Name Type Details
in query CassString

The query is copied into the statement object; the memory pointed to by this parameter can be freed after this call.

in parameter_count cass_size_t

The number of bound parameters.

Returns:
Type Details
CassStatement *

Returns a statement that must be freed.

See Also:
void

cass_statement_free

( CassStatement * statement )

Frees a statement instance. Statements can be immediately freed after being prepared, executed or added to a batch.

Parameters:
Name Type Details
in statement CassStatement *
CassError

cass_statement_add_key_index

( CassStatement * statement, cass_size_t 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.

Parameters:
Name Type Details
in statement CassStatement *
in index cass_size_t
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_set_keyspace

( CassStatement * statement, const char * keyspace )

Sets the statement’s keyspace for use with token-aware routing.

This is not necessary for prepared statements, as the keyspace is determined in the metadata processed in the prepare phase.

Parameters:
Name Type Details
in statement CassStatement *
in keyspace const char *
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_set_consistency

( CassStatement * statement, CassConsistency consistency )

Sets the statement’s consistency level.

Default: CASS_CONSISTENCY_ONE

Parameters:
Name Type Details
in statement CassStatement *
in consistency CassConsistency
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_set_serial_consistency

( CassStatement * statement, CassConsistency serial_consistency )

Sets the statement’s serial consistency level.

Default: Not set

Parameters:
Name Type Details
in statement CassStatement *
in serial_consistency CassConsistency
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_set_paging_size

( CassStatement * statement, int page_size )

Sets the statement’s page size.

Default: -1 (Disabled)

Parameters:
Name Type Details
in statement CassStatement *
in page_size int
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_set_paging_state

( CassStatement * statement, const CassResult * result )

Sets the statement’s paging state.

Parameters:
Name Type Details
in statement CassStatement *
in result const CassResult *
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_null

( CassStatement * statement, cass_size_t index )

Binds null to a query or bound statement at the specified index.

Parameters:
Name Type Details
in statement CassStatement *
in index cass_size_t
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_int32

( CassStatement * statement, cass_size_t index, cass_int32_t value )

Binds an “int” to a query or bound statement at the specified index.

Parameters:
Name Type Details
in statement CassStatement *
in index cass_size_t
in value cass_int32_t
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_int64

( CassStatement * statement, cass_size_t index, cass_int64_t value )

Binds a “bigint”, “counter” or “timestamp” to a query or bound statement at the specified index.

Parameters:
Name Type Details
in statement CassStatement *
in index cass_size_t
in value cass_int64_t
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_float

( CassStatement * statement, cass_size_t index, cass_float_t value )

Binds a “float” to a query or bound statement at the specified index.

Parameters:
Name Type Details
in statement CassStatement *
in index cass_size_t
in value cass_float_t
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_double

( CassStatement * statement, cass_size_t index, cass_double_t value )

Binds a “double” to a query or bound statement at the specified index.

Parameters:
Name Type Details
in statement CassStatement *
in index cass_size_t
in value cass_double_t
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_bool

( CassStatement * statement, cass_size_t index, cass_bool_t value )

Binds a “boolean” to a query or bound statement at the specified index.

Parameters:
Name Type Details
in statement CassStatement *
in index cass_size_t
in value cass_bool_t
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_string

( CassStatement * statement, cass_size_t index, CassString value )

Binds a “ascii”, “text” or “varchar” to a query or bound statement at the specified index.

Parameters:
Name Type Details
in statement CassStatement *
in index cass_size_t
in value CassString

The value is copied into the statement object; the memory pointed to by this parameter can be freed after this call.

Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_bytes

( CassStatement * statement, cass_size_t index, CassBytes value )

Binds a “blob” or “varint” to a query or bound statement at the specified index.

Parameters:
Name Type Details
in statement CassStatement *
in index cass_size_t
in value CassBytes

The value is copied into the statement object; the memory pointed to by this parameter can be freed after this call.

Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_uuid

( CassStatement * statement, cass_size_t index, CassUuid value )

Binds a “uuid” or “timeuuid” to a query or bound statement at the specified index.

Parameters:
Name Type Details
in statement CassStatement *
in index cass_size_t
in value CassUuid
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_inet

( CassStatement * statement, cass_size_t index, CassInet value )

Binds an “inet” to a query or bound statement at the specified index.

Parameters:
Name Type Details
in statement CassStatement *
in index cass_size_t
in value CassInet
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_decimal

( CassStatement * statement, cass_size_t index, CassDecimal value )

Bind a “decimal” to a query or bound statement at the specified index.

Parameters:
Name Type Details
in statement CassStatement *
in index cass_size_t
in value CassDecimal

The value is copied into the statement object; the memory pointed to by this parameter can be freed after this call.

Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_custom

( CassStatement * statement, cass_size_t index, cass_size_t size, cass_byte_t ** output )

Binds any type to a query or bound statement at the specified index. A value can be copied into the resulting output buffer. This is normally reserved for large values to avoid extra memory copies.

Parameters:
Name Type Details
in statement CassStatement *
in index cass_size_t
in size cass_size_t
out output cass_byte_t **
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_collection

( CassStatement * statement, cass_size_t index, const CassCollection * collection )

Bind a “list”, “map”, or “set” to a query or bound statement at the specified index.

Parameters:
Name Type Details
in statement CassStatement *
in index cass_size_t
in collection const CassCollection *

The collection can be freed after this call.

Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_int32_by_name

( CassStatement * statement, const char * name, cass_int32_t 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.

Parameters:
Name Type Details
in statement CassStatement *
in name const char *
in value cass_int32_t
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_int64_by_name

( CassStatement * statement, const char * name, cass_int64_t value )

Binds a “bigint”, “counter” or “timestamp” to all values with the specified name.

This can only be used with statements created by CassPrepared::cass_prepared_bind.

Parameters:
Name Type Details
in statement CassStatement *
in name const char *
in value cass_int64_t
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_float_by_name

( CassStatement * statement, const char * name, cass_float_t 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.

Parameters:
Name Type Details
in statement CassStatement *
in name const char *
in value cass_float_t
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_double_by_name

( CassStatement * statement, const char * name, cass_double_t 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.

Parameters:
Name Type Details
in statement CassStatement *
in name const char *
in value cass_double_t
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_bool_by_name

( CassStatement * statement, const char * name, cass_bool_t 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.

Parameters:
Name Type Details
in statement CassStatement *
in name const char *
in value cass_bool_t
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_string_by_name

( CassStatement * statement, const char * name, CassString value )

Binds a “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.

Parameters:
Name Type Details
in statement CassStatement *
in name const char *
in value CassString

The value is copied into the statement object; the memory pointed to by this parameter can be freed after this call.

Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_bytes_by_name

( CassStatement * statement, const char * name, CassBytes value )

Binds a “blob” or “varint” to all the values with the specified name.

This can only be used with statements created by CassPrepared::cass_prepared_bind.

Parameters:
Name Type Details
in statement CassStatement *
in name const char *
in value CassBytes

The value is copied into the statement object; the memory pointed to by this parameter can be freed after this call.

Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_uuid_by_name

( CassStatement * statement, const char * name, CassUuid 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.

Parameters:
Name Type Details
in statement CassStatement *
in name const char *
in value CassUuid
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_inet_by_name

( CassStatement * statement, const char * name, CassInet 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.

Parameters:
Name Type Details
in statement CassStatement *
in name const char *
in value CassInet
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_decimal_by_name

( CassStatement * statement, const char * name, CassDecimal value )

Binds a “decimal” to all the values with the specified name.

This can only be used with statements created by CassPrepared::cass_prepared_bind.

Parameters:
Name Type Details
in statement CassStatement *
in name const char *
in value CassDecimal

The value is copied into the statement object; the memory pointed to by this parameter can be freed after this call.

Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_custom_by_name

( CassStatement * statement, const char * name, cass_size_t size, cass_byte_t ** output )

Binds any type to all the values with the specified name. A value can be copied into the resulting output buffer. This is normally reserved for large values to avoid extra memory copies.

This can only be used with statements created by CassPrepared::cass_prepared_bind.

Parameters:
Name Type Details
in statement CassStatement *
in name const char *
in size cass_size_t
out output cass_byte_t **
Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.

CassError

cass_statement_bind_collection_by_name

( CassStatement * statement, const char * name, const CassCollection * 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.

Parameters:
Name Type Details
in statement CassStatement *
in name const char *
in collection const CassCollection *

The collection can be freed after this call.

Returns:
Type Details
CassError

CASS_OK if successful, otherwise an error occurred.