pub struct Query {
pub contents: String,
/* private fields */
}
Expand description
CQL query statement.
This represents a CQL query that can be executed on a server.
Fields§
§contents: String
Implementations§
source§impl Query
impl Query
sourcepub fn with_page_size(self, page_size: i32) -> Self
pub fn with_page_size(self, page_size: i32) -> Self
Returns self with page size set to the given value.
Panics if given number is nonpositive.
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.
Panics if given number is nonpositive.
sourcepub fn get_page_size(&self) -> i32
pub fn get_page_size(&self) -> i32
Returns the page size for this CQL query.
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 query 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.query() 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 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 From<Query> for BatchStatement
impl From<Query> for BatchStatement
Auto Trait Implementations§
impl Freeze for Query
impl !RefUnwindSafe for Query
impl Send for Query
impl Sync for Query
impl Unpin for Query
impl !UnwindSafe for Query
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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