pub struct Statement(/* private fields */);
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

source

pub fn session(&self) -> &Session

Returns the session of which this statement is bound to.

source

pub async fn execute(self) -> Result<CassResult>

Executes the statement.

source

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.

source

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.

source

pub fn set_consistency(&mut self, consistency: Consistency) -> Result<&mut Self>

Sets the statement’s consistency level.

Default: CASS_CONSISTENCY_LOCAL_ONE

source

pub fn set_serial_consistency( &mut self, serial_consistency: Consistency ) -> Result<&mut Self>

Sets the statement’s serial consistency level.

Default: Not set

source

pub fn set_paging_size(&mut self, page_size: i32) -> Result<&mut Self>

Sets the statement’s page size.

Default: -1 (Disabled)

source

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.

source

pub fn set_paging_state_token( &mut self, paging_state: &[u8] ) -> 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.

source

pub fn set_timestamp(&mut self, timestamp: i64) -> Result<&mut Self>

Sets the statement’s timestamp.

source

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).

source

pub fn set_retry_policy( &mut self, retry_policy: RetryPolicy ) -> Result<&mut Self>

Sets the statement’s retry policy.

source

pub fn set_custom_payload( &mut self, payload: CustomPayload ) -> Result<&mut Self>

Sets the statement’s custom payload.

source

pub fn set_tracing(&mut self, value: bool) -> Result<&mut Self>

Sets the statement’s tracing flag.

source

pub fn bind_null(&mut self, index: usize) -> Result<&mut Self>

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

source

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().

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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().

source

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.

source

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.

source

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.

source

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().

source

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.

source

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().

source

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.

source

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().

source

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.

source

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().

source

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.

source

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().

source

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.

source

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().

source

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.

source

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.

source

pub fn bind_decimal( &mut self, index: usize, value: &BigDecimal ) -> Result<&mut Self>

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

source

pub fn bind_decimal_by_name( &mut self, name: &str, value: &BigDecimal ) -> Result<&mut Self>

Binds an “BigDecimal” to all the values with the specified name.

source

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.

source

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().

source

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.

source

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().

source

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.

source

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().

source

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.

source

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().

source

pub fn bind_user_type( &mut self, index: usize, value: &UserType ) -> Result<&mut Self>

Bind a user defined type to a query or bound statement at the specified index.

source

pub fn bind_user_type_by_name( &mut self, name: &str, value: &UserType ) -> Result<&mut Self>

Bind a user defined type to a query or bound statement with the specified name.

Trait Implementations§

source§

impl BindRustType<&BigDecimal> for Statement

source§

fn bind(&mut self, index: usize, value: &BigDecimal) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: &BigDecimal) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl BindRustType<&UserType> for Statement

source§

fn bind(&mut self, index: usize, value: &UserType) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: &UserType) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl<'a> BindRustType<&'a str> for Statement

source§

fn bind(&mut self, index: usize, value: &str) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: &str) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl BindRustType<Inet> for Statement

source§

fn bind(&mut self, index: usize, value: Inet) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: Inet) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl BindRustType<List> for Statement

source§

fn bind(&mut self, index: usize, value: List) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: List) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl BindRustType<Map> for Statement

source§

fn bind(&mut self, index: usize, value: Map) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: Map) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl BindRustType<Set> for Statement

source§

fn bind(&mut self, index: usize, value: Set) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: Set) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl BindRustType<Tuple> for Statement

source§

fn bind(&mut self, index: usize, value: Tuple) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: Tuple) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl BindRustType<Uuid> for Statement

source§

fn bind(&mut self, index: usize, value: Uuid) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: Uuid) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl BindRustType<Uuid> for Statement

source§

fn bind(&mut self, index: usize, value: Uuid) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: Uuid) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl BindRustType<Vec<u8>> for Statement

source§

fn bind(&mut self, index: usize, value: Vec<u8>) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: Vec<u8>) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl BindRustType<bool> for Statement

source§

fn bind(&mut self, index: usize, value: bool) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: bool) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl BindRustType<f32> for Statement

source§

fn bind(&mut self, index: usize, value: f32) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: f32) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl BindRustType<f64> for Statement

source§

fn bind(&mut self, index: usize, value: f64) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: f64) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl BindRustType<i16> for Statement

source§

fn bind(&mut self, index: usize, value: i16) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: i16) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl BindRustType<i32> for Statement

source§

fn bind(&mut self, index: usize, value: i32) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: i32) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl BindRustType<i64> for Statement

source§

fn bind(&mut self, index: usize, value: i64) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: i64) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl BindRustType<i8> for Statement

source§

fn bind(&mut self, index: usize, value: i8) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: i8) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl BindRustType<u32> for Statement

source§

fn bind(&mut self, index: usize, value: u32) -> Result<&mut Self>

binds a rust type to C* by index
source§

fn bind_by_name(&mut self, col: &str, value: u32) -> Result<&mut Self>

binds a rust type to C* by name
source§

impl Debug for Statement

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> SendSyncUnwindSafe for T
where T: Send + Sync + UnwindSafe + ?Sized,