Skip to main content

QueryOptions

Struct QueryOptions 

Source
pub struct QueryOptions {
    pub parameters: Vec<Parameter>,
    pub timeout: TimeoutSetting,
    pub limit: LimitSetting,
    pub telemetry: QuerySetting,
    pub sql_capture: QuerySetting,
    pub sql_hook: Option<SqlCaptureHook>,
    pub retry: RetrySetting,
    pub replay_safety: ReplaySafety,
    pub retry_runtime: Option<RetryRuntime>,
    /* private fields */
}
Expand description

Owned parameters and policy overrides for one pool, session, transaction, or script operation.

Fields§

§parameters: Vec<Parameter>

Ordered operation-local parameters. Never inherited from pool defaults.

§timeout: TimeoutSetting

Tri-state timeout override.

§limit: LimitSetting

Tri-state bounded fetch-limit override.

§telemetry: QuerySetting

Whether telemetry is inherited, disabled, or enabled for this operation.

§sql_capture: QuerySetting

Whether SQL capture is inherited, disabled, or enabled for this operation.

§sql_hook: Option<SqlCaptureHook>

Per-query SQL hook, replacing the pool hook when present.

§retry: RetrySetting

Retry policy override for a standalone PolicyPool execute_async/fetch_async operation.

§replay_safety: ReplaySafety

Explicit caller assertion required before any retry can occur.

§retry_runtime: Option<RetryRuntime>

Per-operation retry runtime, replacing the pool default when present.

Implementations§

Source§

impl QueryOptions

Source

pub fn provider_execute_options(&self) -> ExecuteOptions

Provider-facing execution settings after resolution.

Source

pub fn new() -> Self

Creates options that inherit every global default, carry no parameters, and remain non-replay-safe.

Source

pub fn bind(self, parameter: Parameter) -> Self

Appends one already validated parameter in positional order.

Source

pub fn bind_all(self, parameters: &[Parameter]) -> Self

Appends parameters in slice order.

Source

pub fn bind_f64(self, value: f64) -> Result<Self, DbError>

Appends finite float, text, or byte parameters with exact declared types.

§Errors

Returns InvalidArgument for a non-finite float.

Source

pub fn bind_null(self, db_type: DbType) -> Self

Appends a typed SQL null.

Source

pub fn timeout(self, timeout: Duration) -> Self

Replaces the pool timeout for this operation.

Source

pub fn no_timeout(self) -> Self

Explicitly requests no timeout for this operation.

Source

pub fn limit(self, limit: RowLimit) -> Self

Replaces the pool fetch limit for this operation.

Source

pub fn telemetry(self, setting: QuerySetting) -> Self

Sets telemetry inheritance/off/on.

Source

pub fn sql_capture(self, setting: QuerySetting) -> Self

Sets SQL-capture inheritance/off/on.

Source

pub fn retry(self, setting: RetrySetting) -> Self

Sets retry inheritance/off/explicit policy.

Source

pub fn sql_hook(self, hook: SqlCaptureHook) -> Self

Replaces the per-operation SQL capture hook.

Source

pub fn retry_runtime(self, runtime: RetryRuntime) -> Self

Replaces the retry runtime for this operation.

Source

pub fn replay_safe(self) -> Self

Marks the operation explicitly replay-safe. Defaults remain Never.

Source

pub fn resolved_timeout(&self, defaults: PoolDefaults) -> Option<Duration>

Resolves the timeout against pool defaults.

Source

pub fn resolved_limit(&self, defaults: PoolDefaults) -> RowLimit

Resolves the fetch limit against pool defaults.

Source

pub fn prepare_provider( &mut self, defaults: PoolDefaults, ) -> Result<RowLimit, DbError>

Resolve provider-facing timeout and reject policy options no wrapper handles.

§Errors

Returns Unsupported for policy facilities unavailable on a bare provider, or InvalidArgument if the timeout cannot be represented in milliseconds.

Source

pub fn validate_execute(&self) -> Result<(), DbError>

Reject a fetch-only limit before dispatching a non-fetch statement.

Inherited pool limits do not apply to execute operations.

§Errors

Returns InvalidArgument when a per-operation fetch limit was supplied.

Source

pub fn prepare_execute_provider( &mut self, defaults: PoolDefaults, ) -> Result<(), DbError>

Validate and resolve options for a provider’s execute operation.

§Errors

Returns an error for an explicit fetch limit or unsupported provider settings.

Source

pub fn validate_script(&self) -> Result<(), DbError>

Reject settings that cannot apply to an unparameterized trusted script.

§Errors

Returns InvalidArgument if parameters or a fetch limit were supplied.

Source

pub fn prepare_script_provider( &mut self, defaults: PoolDefaults, ) -> Result<(), DbError>

Resolve a trusted script’s provider settings after rejecting inapplicable options.

§Errors

Returns an error for inapplicable or unsupported settings.

Trait Implementations§

Source§

impl Clone for QueryOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for QueryOptions

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for QueryOptions

Source§

fn default() -> Self

Returns the “default value” for a type. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.