Struct scylla::statement::query::Query

source ·
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

source

pub fn new(query_text: impl Into<String>) -> Self

Creates a new Query from a CQL query string.

source

pub fn with_page_size(self, page_size: i32) -> Self

Returns self with page size set to the given value

source

pub fn set_page_size(&mut self, page_size: i32)

Sets the page size for this CQL query.

source

pub fn disable_paging(&mut self)

Disables paging for this CQL query.

source

pub fn get_page_size(&self) -> Option<i32>

Returns the page size for this CQL query.

source

pub fn set_consistency(&mut self, c: Consistency)

Sets the consistency to be used when executing this statement.

source

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.

source

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)

source

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)

source

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

source

pub fn get_is_idempotent(&self) -> bool

Gets the idempotence of this statement

source

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

source

pub fn get_tracing(&self) -> bool

Gets whether tracing is enabled for this statement

source

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

source

pub fn get_timestamp(&self) -> Option<i64>

Gets the default timestamp for this statement in microseconds.

source

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.

source

pub fn get_request_timeout(&self) -> Option<Duration>

Gets client timeout associated with this query

source

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.

source

pub fn get_retry_policy(&self) -> Option<&Arc<dyn RetryPolicy>>

Get the retry policy set for the statement.

source

pub fn set_history_listener( &mut self, history_listener: Arc<dyn HistoryListener> )

Sets the listener capable of listening what happens during query execution.

source

pub fn remove_history_listener(&mut self) -> Option<Arc<dyn HistoryListener>>

Removes the listener set by set_history_listener.

source

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.

source

pub fn get_execution_profile_handle(&self) -> Option<&ExecutionProfileHandle>

Borrows the execution profile handle associated with this query.

Trait Implementations§

source§

impl Clone for Query

source§

fn clone(&self) -> Query

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> From<&'a str> for Query

source§

fn from(s: &'a str) -> Query

Converts to this type from the input type.
source§

impl From<Query> for BatchStatement

source§

fn from(q: Query) -> Self

Converts to this type from the input type.
source§

impl From<String> for Query

source§

fn from(s: String) -> Query

Converts to this type from the input type.

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> 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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more