Struct cassandra_cpp::Statement
source · pub struct Statement(_);
Expand description
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.
Implementations§
source§impl Statement
impl Statement
sourcepub fn add_key_index(&mut self, index: usize) -> Result<&mut Self>
pub fn add_key_index(&mut self, index: usize) -> Result<&mut Self>
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.
sourcepub fn set_keyspace(&mut self, keyspace: String) -> Result<&mut Self>
pub fn set_keyspace(&mut self, keyspace: String) -> Result<&mut Self>
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.
sourcepub fn set_consistency(&mut self, consistency: Consistency) -> Result<&mut Self>
pub fn set_consistency(&mut self, consistency: Consistency) -> Result<&mut Self>
Sets the statement’s consistency level.
Default: CASS_CONSISTENCY_LOCAL_ONE
sourcepub fn set_serial_consistency(
&mut self,
serial_consistency: Consistency
) -> Result<&mut Self>
pub fn set_serial_consistency(
&mut self,
serial_consistency: Consistency
) -> Result<&mut Self>
Sets the statement’s serial consistency level.
Default: Not set
sourcepub fn set_paging_size(&mut self, page_size: i32) -> Result<&mut Self>
pub fn set_paging_size(&mut self, page_size: i32) -> Result<&mut Self>
Sets the statement’s page size.
Default: -1 (Disabled)
sourcepub fn set_paging_state(&mut self, result: CassResult) -> Result<&mut Self>
pub fn set_paging_state(&mut self, result: CassResult) -> Result<&mut Self>
Sets the statement’s paging state. This can be used to get the next page of data in a multi-page query.
sourcepub fn set_paging_state_token(&mut self, paging_state: &str) -> Result<&mut Self>
pub fn set_paging_state_token(&mut self, paging_state: &str) -> Result<&mut Self>
Sets the statement’s paging state. This can be used to get the next page of data in a multi-page query.
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.
sourcepub fn set_timestamp(&mut self, timestamp: i64) -> Result<&mut Self>
pub fn set_timestamp(&mut self, timestamp: i64) -> Result<&mut Self>
Sets the statement’s timestamp.
sourcepub fn set_statement_request_timeout(
&mut self,
timeout: Option<Duration>
) -> &mut Self
pub fn set_statement_request_timeout(
&mut self,
timeout: Option<Duration>
) -> &mut Self
Sets the statement’s timeout for waiting for a response from a node. Some(Duration::milliseconds(0)) sets no timeout, and None disables it (to use the cluster-level request timeout).
sourcepub fn set_retry_policy(
&mut self,
retry_policy: RetryPolicy
) -> Result<&mut Self>
pub fn set_retry_policy(
&mut self,
retry_policy: RetryPolicy
) -> Result<&mut Self>
Sets the statement’s retry policy.
sourcepub fn set_custom_payload(&mut self, payload: CustomPayload) -> Result<&mut Self>
pub fn set_custom_payload(&mut self, payload: CustomPayload) -> Result<&mut Self>
Sets the statement’s custom payload.
sourcepub fn bind_null(&mut self, index: usize) -> Result<&mut Self>
pub fn bind_null(&mut self, index: usize) -> Result<&mut Self>
Binds null to a query or bound statement at the specified index.
sourcepub fn bind_null_by_name(&mut self, name: &str) -> Result<&mut Self>
pub fn bind_null_by_name(&mut self, name: &str) -> Result<&mut Self>
Binds a null to all the values with the specified name.
This can only be used with statements created by cass_prepared_bind().
sourcepub fn bind_int8(&mut self, index: usize, value: i8) -> Result<&mut Self>
pub fn bind_int8(&mut self, index: usize, value: i8) -> Result<&mut Self>
Binds a “tinyint” to a query or bound statement at the specified index.
sourcepub fn bind_int8_by_name(&mut self, name: &str, value: i8) -> Result<&mut Self>
pub fn bind_int8_by_name(&mut self, name: &str, value: i8) -> Result<&mut Self>
Binds a “tinyint” to all the values with the specified name.
sourcepub fn bind_int16(&mut self, index: usize, value: i16) -> Result<&mut Self>
pub fn bind_int16(&mut self, index: usize, value: i16) -> Result<&mut Self>
Binds an “smallint” to a query or bound statement at the specified index.
sourcepub fn bind_int16_by_name(&mut self, name: &str, value: i16) -> Result<&mut Self>
pub fn bind_int16_by_name(&mut self, name: &str, value: i16) -> Result<&mut Self>
Binds a “smallint” to all the values with the specified name.
sourcepub fn bind_int32(&mut self, index: usize, value: i32) -> Result<&mut Self>
pub fn bind_int32(&mut self, index: usize, value: i32) -> Result<&mut Self>
Binds an “int” to a query or bound statement at the specified index.
sourcepub fn bind_int32_by_name(&mut self, name: &str, value: i32) -> Result<&mut Self>
pub fn bind_int32_by_name(&mut self, name: &str, value: i32) -> Result<&mut Self>
Binds an “int” to all the values with the specified name.
sourcepub fn bind_uint32(&mut self, index: usize, value: u32) -> Result<&mut Self>
pub fn bind_uint32(&mut self, index: usize, value: u32) -> Result<&mut Self>
Binds a “date” to a query or bound statement at the specified index.
sourcepub fn bind_uint32_by_name(&mut self, name: &str, value: u32) -> Result<&mut Self>
pub fn bind_uint32_by_name(&mut self, name: &str, value: u32) -> Result<&mut Self>
Binds a “date” to all the values with the specified name.
This can only be used with statements created by cass_prepared_bind().
sourcepub fn bind_int64(&mut self, index: usize, value: i64) -> Result<&mut Self>
pub fn bind_int64(&mut self, index: usize, value: i64) -> Result<&mut Self>
Binds a “bigint”, “counter”, “timestamp” or “time” to a query or bound statement at the specified index.
sourcepub fn bind_int64_by_name(&mut self, name: &str, value: i64) -> Result<&mut Self>
pub fn bind_int64_by_name(&mut self, name: &str, value: i64) -> Result<&mut Self>
Binds a “bigint”, “counter”, “timestamp” or “time” to all values with the specified name.
sourcepub fn bind_float(&mut self, index: usize, value: f32) -> Result<&mut Self>
pub fn bind_float(&mut self, index: usize, value: f32) -> Result<&mut Self>
Binds a “float” to a query or bound statement at the specified index.
sourcepub fn bind_float_by_name(&mut self, name: &str, value: f32) -> Result<&mut Self>
pub fn bind_float_by_name(&mut self, name: &str, value: f32) -> Result<&mut Self>
Binds a “float” to all the values with the specified name.
This can only be used with statements created by cass_prepared_bind().
sourcepub fn bind_double(&mut self, index: usize, value: f64) -> Result<&mut Self>
pub fn bind_double(&mut self, index: usize, value: f64) -> Result<&mut Self>
Binds a “double” to a query or bound statement at the specified index.
sourcepub fn bind_double_by_name(&mut self, name: &str, value: f64) -> Result<&mut Self>
pub fn bind_double_by_name(&mut self, name: &str, value: f64) -> Result<&mut Self>
Binds a “double” to all the values with the specified name.
This can only be used with statements created by cass_prepared_bind().
sourcepub fn bind_bool(&mut self, index: usize, value: bool) -> Result<&mut Self>
pub fn bind_bool(&mut self, index: usize, value: bool) -> Result<&mut Self>
Binds a “boolean” to a query or bound statement at the specified index.
sourcepub fn bind_bool_by_name(&mut self, name: &str, value: bool) -> Result<&mut Self>
pub fn bind_bool_by_name(&mut self, name: &str, value: bool) -> Result<&mut Self>
Binds a “boolean” to all the values with the specified name.
This can only be used with statements created by cass_prepared_bind().
sourcepub fn bind_string(&mut self, index: usize, value: &str) -> Result<&mut Self>
pub fn bind_string(&mut self, index: usize, value: &str) -> Result<&mut Self>
Binds an “ascii”, “text” or “varchar” to a query or bound statement at the specified index.
sourcepub fn bind_string_by_name(
&mut self,
name: &str,
value: &str
) -> Result<&mut Self>
pub fn bind_string_by_name(
&mut self,
name: &str,
value: &str
) -> Result<&mut Self>
Binds an “ascii”, “text” or “varchar” to all the values with the specified name.
This can only be used with statements created by cass_prepared_bind().
sourcepub fn bind_bytes(&mut self, index: usize, value: Vec<u8>) -> Result<&mut Self>
pub fn bind_bytes(&mut self, index: usize, value: Vec<u8>) -> Result<&mut Self>
Binds a “blob”, “varint” or “custom” to a query or bound statement at the specified index.
sourcepub fn bind_bytes_by_name(
&mut self,
name: &str,
value: Vec<u8>
) -> Result<&mut Self>
pub fn bind_bytes_by_name(
&mut self,
name: &str,
value: Vec<u8>
) -> Result<&mut Self>
Binds a “blob”, “varint” or “custom” to all the values with the specified name.
This can only be used with statements created by cass_prepared_bind().
sourcepub fn bind_uuid(&mut self, index: usize, value: Uuid) -> Result<&mut Self>
pub fn bind_uuid(&mut self, index: usize, value: Uuid) -> Result<&mut Self>
Binds a “uuid” or “timeuuid” to a query or bound statement at the specified index.
sourcepub fn bind_uuid_by_name(&mut self, name: &str, value: Uuid) -> Result<&mut Self>
pub fn bind_uuid_by_name(&mut self, name: &str, value: Uuid) -> Result<&mut Self>
Binds a “uuid” or “timeuuid” to all the values with the specified name.
This can only be used with statements created by cass_prepared_bind().
sourcepub fn bind_inet(&mut self, index: usize, value: Inet) -> Result<&mut Self>
pub fn bind_inet(&mut self, index: usize, value: Inet) -> Result<&mut Self>
Binds an “inet” to a query or bound statement at the specified index.
sourcepub fn bind_inet_by_name(&mut self, name: &str, value: Inet) -> Result<&mut Self>
pub fn bind_inet_by_name(&mut self, name: &str, value: Inet) -> Result<&mut Self>
Binds an “inet” to all the values with the specified name.
sourcepub fn bind_map(&mut self, index: usize, map: Map) -> Result<&mut Self>
pub fn bind_map(&mut self, index: usize, map: Map) -> Result<&mut Self>
Bind a “map” to a query or bound statement at the specified index.
sourcepub fn bind_map_by_name(&mut self, name: &str, map: Map) -> Result<&mut Self>
pub fn bind_map_by_name(&mut self, name: &str, map: Map) -> Result<&mut Self>
Bind a “map” to all the values with the specified name.
This can only be used with statements created by cass_prepared_bind().
sourcepub fn bind_set(&mut self, index: usize, collection: Set) -> Result<&mut Self>
pub fn bind_set(&mut self, index: usize, collection: Set) -> Result<&mut Self>
Bind a “set” to a query or bound statement at the specified index.
sourcepub fn bind_set_by_name(
&mut self,
name: &str,
collection: Set
) -> Result<&mut Self>
pub fn bind_set_by_name(
&mut self,
name: &str,
collection: Set
) -> Result<&mut Self>
Bind a “set” to all the values with the specified name.
This can only be used with statements created by cass_prepared_bind().
sourcepub fn bind_list(&mut self, index: usize, collection: List) -> Result<&mut Self>
pub fn bind_list(&mut self, index: usize, collection: List) -> Result<&mut Self>
Bind a “list” to a query or bound statement at the specified index.
sourcepub fn bind_list_by_name(
&mut self,
name: &str,
collection: List
) -> Result<&mut Self>
pub fn bind_list_by_name(
&mut self,
name: &str,
collection: List
) -> Result<&mut Self>
Bind a “list” to all the values with the specified name.
This can only be used with statements created by cass_prepared_bind().
sourcepub fn bind_tuple(&mut self, index: usize, value: Tuple) -> Result<&mut Self>
pub fn bind_tuple(&mut self, index: usize, value: Tuple) -> Result<&mut Self>
Bind a “tuple” to a query or bound statement at the specified index.
sourcepub fn bind_tuple_by_name(
&mut self,
name: &str,
value: Tuple
) -> Result<&mut Self>
pub fn bind_tuple_by_name(
&mut self,
name: &str,
value: Tuple
) -> Result<&mut Self>
Bind a “tuple” to all the values with the specified name.
This can only be used with statements created by cass_prepared_bind().