pub struct PreparedStatement {
pub prepare_tracing_ids: Vec<Uuid>,
/* private fields */
}
Expand description
Represents a statement prepared on the server.
Fields§
§prepare_tracing_ids: Vec<Uuid>
Implementations§
Source§impl PreparedStatement
impl PreparedStatement
pub fn get_id(&self) -> &Bytes
pub fn get_statement(&self) -> &str
Sourcepub fn set_page_size(&mut self, page_size: i32)
pub fn set_page_size(&mut self, page_size: i32)
Sets the page size for this CQL query.
Sourcepub fn disable_paging(&mut self)
pub fn disable_paging(&mut self)
Disables paging for this CQL query.
Sourcepub fn get_page_size(&self) -> Option<i32>
pub fn get_page_size(&self) -> Option<i32>
Returns the page size for this CQL query.
Sourcepub fn get_prepare_tracing_ids(&self) -> &[Uuid]
pub fn get_prepare_tracing_ids(&self) -> &[Uuid]
Gets tracing ids of queries used to prepare this statement
Sourcepub fn is_token_aware(&self) -> bool
pub fn is_token_aware(&self) -> bool
Returns true if the prepared statement has necessary information to be routed in a token-aware manner. If false, the query will always be sent to a random node/shard.
Sourcepub fn is_confirmed_lwt(&self) -> bool
pub fn is_confirmed_lwt(&self) -> bool
Returns true if it is known that the prepared statement contains a Lightweight Transaction. If so, the optimisation can be performed: the query should be routed to the replicas in a predefined order (i. e. always try first to contact replica A, then B if it fails, then C, etc.). If false, the query should be routed normally. Note: this a Scylla-specific optimisation. Therefore, the result will be always false for Cassandra.
Sourcepub fn compute_partition_key(
&self,
bound_values: &impl SerializeRow,
) -> Result<Bytes, PartitionKeyError>
pub fn compute_partition_key( &self, bound_values: &impl SerializeRow, ) -> Result<Bytes, PartitionKeyError>
Computes the partition key of the target table from given values — it assumes that all partition key columns are passed in values. Partition keys have specific serialization rules. Ref: https://github.com/scylladb/scylla/blob/40adf38915b6d8f5314c621a94d694d172360833/compound_compat.hh#L33-L47
Note: this is no longer required to compute a token. This is because partitioners are now stateful and stream-based, so they do not require materialised partition key. Therefore, for computing a token, there are more efficient methods, such as Self::calculate_token().
Sourcepub fn calculate_token(
&self,
values: &impl SerializeRow,
) -> Result<Option<Token>, QueryError>
pub fn calculate_token( &self, values: &impl SerializeRow, ) -> Result<Option<Token>, QueryError>
Calculates the token for given prepared statement and values.
Returns the token that would be computed for executing the provided prepared statement with the provided values.
Sourcepub fn get_keyspace_name(&self) -> Option<&str>
pub fn get_keyspace_name(&self) -> Option<&str>
Returns the name of the keyspace this statement is operating on.
Sourcepub fn get_table_name(&self) -> Option<&str>
pub fn get_table_name(&self) -> Option<&str>
Returns the name of the table this statement is operating on.
Sourcepub fn set_consistency(&mut self, c: Consistency)
pub fn set_consistency(&mut self, c: Consistency)
Sets the consistency to be used when executing this statement.
Sourcepub fn get_consistency(&self) -> Option<Consistency>
pub fn get_consistency(&self) -> Option<Consistency>
Gets the consistency to be used when executing this prepared statement if it is filled. If this is empty, the default_consistency of the session will be used.
Sourcepub fn set_serial_consistency(&mut self, sc: Option<SerialConsistency>)
pub fn set_serial_consistency(&mut self, sc: Option<SerialConsistency>)
Sets the serial consistency to be used when executing this statement. (Ignored unless the statement is an LWT)
Sourcepub fn get_serial_consistency(&self) -> Option<SerialConsistency>
pub fn get_serial_consistency(&self) -> Option<SerialConsistency>
Gets the serial consistency to be used when executing this statement. (Ignored unless the statement is an LWT)
Sourcepub fn set_is_idempotent(&mut self, is_idempotent: bool)
pub fn set_is_idempotent(&mut self, is_idempotent: bool)
Sets the idempotence of this statement
A query is idempotent if it can be applied multiple times without changing the result of the initial application
If set to true
we can be sure that it is idempotent
If set to false
it is unknown whether it is idempotent
This is used in RetryPolicy
to decide if retrying a query is safe
Sourcepub fn get_is_idempotent(&self) -> bool
pub fn get_is_idempotent(&self) -> bool
Gets the idempotence of this statement
Sourcepub fn set_tracing(&mut self, should_trace: bool)
pub fn set_tracing(&mut self, should_trace: bool)
Enable or disable CQL Tracing for this statement If enabled session.execute() will return a QueryResult containing tracing_id which can be used to query tracing information about the execution of this query
Sourcepub fn get_tracing(&self) -> bool
pub fn get_tracing(&self) -> bool
Gets whether tracing is enabled for this statement
Sourcepub fn set_timestamp(&mut self, timestamp: Option<i64>)
pub fn set_timestamp(&mut self, timestamp: Option<i64>)
Sets the default timestamp for this statement in microseconds.
If not None, it will replace the server side assigned timestamp as default timestamp
If a statement contains a USING TIMESTAMP
clause, calling this method won’t change
anything
Sourcepub fn get_timestamp(&self) -> Option<i64>
pub fn get_timestamp(&self) -> Option<i64>
Gets the default timestamp for this statement in microseconds.
Sourcepub fn set_request_timeout(&mut self, timeout: Option<Duration>)
pub fn set_request_timeout(&mut self, timeout: Option<Duration>)
Sets the client-side timeout for this statement.
If not None, the driver will stop waiting for the request
to finish after timeout
passed.
Otherwise, default session client timeout will be applied.
Sourcepub fn get_request_timeout(&self) -> Option<Duration>
pub fn get_request_timeout(&self) -> Option<Duration>
Gets client timeout associated with this query
Sourcepub fn get_prepared_metadata(&self) -> &PreparedMetadata
pub fn get_prepared_metadata(&self) -> &PreparedMetadata
Access metadata about this prepared statement as returned by the database
Sourcepub fn set_retry_policy(&mut self, retry_policy: Option<Arc<dyn RetryPolicy>>)
pub fn set_retry_policy(&mut self, retry_policy: Option<Arc<dyn RetryPolicy>>)
Set the retry policy for this statement, overriding the one from execution profile if not None.
Sourcepub fn get_retry_policy(&self) -> Option<&Arc<dyn RetryPolicy>>
pub fn get_retry_policy(&self) -> Option<&Arc<dyn RetryPolicy>>
Get the retry policy set for the statement.
Sourcepub fn set_history_listener(
&mut self,
history_listener: Arc<dyn HistoryListener>,
)
pub fn set_history_listener( &mut self, history_listener: Arc<dyn HistoryListener>, )
Sets the listener capable of listening what happens during query execution.
Sourcepub fn remove_history_listener(&mut self) -> Option<Arc<dyn HistoryListener>>
pub fn remove_history_listener(&mut self) -> Option<Arc<dyn HistoryListener>>
Removes the listener set by set_history_listener
.
Sourcepub fn set_execution_profile_handle(
&mut self,
profile_handle: Option<ExecutionProfileHandle>,
)
pub fn set_execution_profile_handle( &mut self, profile_handle: Option<ExecutionProfileHandle>, )
Associates the query with execution profile referred by the provided handle. Handle may be later remapped to another profile, and query will reflect those changes.
Sourcepub fn get_execution_profile_handle(&self) -> Option<&ExecutionProfileHandle>
pub fn get_execution_profile_handle(&self) -> Option<&ExecutionProfileHandle>
Borrows the execution profile handle associated with this query.
Trait Implementations§
Source§impl Clone for PreparedStatement
impl Clone for PreparedStatement
Source§impl Debug for PreparedStatement
impl Debug for PreparedStatement
Source§impl From<PreparedStatement> for BatchStatement
impl From<PreparedStatement> for BatchStatement
Source§fn from(p: PreparedStatement) -> Self
fn from(p: PreparedStatement) -> Self
Auto Trait Implementations§
impl !Freeze for PreparedStatement
impl !RefUnwindSafe for PreparedStatement
impl Send for PreparedStatement
impl Sync for PreparedStatement
impl Unpin for PreparedStatement
impl !UnwindSafe for PreparedStatement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more