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: TimeoutSettingTri-state timeout override.
limit: LimitSettingTri-state bounded fetch-limit override.
telemetry: QuerySettingWhether telemetry is inherited, disabled, or enabled for this operation.
sql_capture: QuerySettingWhether 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: RetrySettingRetry policy override for a standalone PolicyPool execute_async/fetch_async operation.
replay_safety: ReplaySafetyExplicit 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
impl QueryOptions
Sourcepub fn provider_execute_options(&self) -> ExecuteOptions
pub fn provider_execute_options(&self) -> ExecuteOptions
Provider-facing execution settings after resolution.
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates options that inherit every global default, carry no parameters, and remain non-replay-safe.
Sourcepub fn bind(self, parameter: Parameter) -> Self
pub fn bind(self, parameter: Parameter) -> Self
Appends one already validated parameter in positional order.
Sourcepub fn bind_f64(self, value: f64) -> Result<Self, DbError>
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.
Sourcepub fn no_timeout(self) -> Self
pub fn no_timeout(self) -> Self
Explicitly requests no timeout for this operation.
Sourcepub fn telemetry(self, setting: QuerySetting) -> Self
pub fn telemetry(self, setting: QuerySetting) -> Self
Sets telemetry inheritance/off/on.
Sourcepub fn sql_capture(self, setting: QuerySetting) -> Self
pub fn sql_capture(self, setting: QuerySetting) -> Self
Sets SQL-capture inheritance/off/on.
Sourcepub fn retry(self, setting: RetrySetting) -> Self
pub fn retry(self, setting: RetrySetting) -> Self
Sets retry inheritance/off/explicit policy.
Sourcepub fn sql_hook(self, hook: SqlCaptureHook) -> Self
pub fn sql_hook(self, hook: SqlCaptureHook) -> Self
Replaces the per-operation SQL capture hook.
Sourcepub fn retry_runtime(self, runtime: RetryRuntime) -> Self
pub fn retry_runtime(self, runtime: RetryRuntime) -> Self
Replaces the retry runtime for this operation.
Sourcepub fn replay_safe(self) -> Self
pub fn replay_safe(self) -> Self
Marks the operation explicitly replay-safe. Defaults remain Never.
Sourcepub fn resolved_timeout(&self, defaults: PoolDefaults) -> Option<Duration>
pub fn resolved_timeout(&self, defaults: PoolDefaults) -> Option<Duration>
Resolves the timeout against pool defaults.
Sourcepub fn resolved_limit(&self, defaults: PoolDefaults) -> RowLimit
pub fn resolved_limit(&self, defaults: PoolDefaults) -> RowLimit
Resolves the fetch limit against pool defaults.
Sourcepub fn prepare_provider(
&mut self,
defaults: PoolDefaults,
) -> Result<RowLimit, DbError>
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.
Sourcepub fn validate_execute(&self) -> Result<(), DbError>
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.
Sourcepub fn prepare_execute_provider(
&mut self,
defaults: PoolDefaults,
) -> Result<(), DbError>
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.
Sourcepub fn validate_script(&self) -> Result<(), DbError>
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.
Sourcepub fn prepare_script_provider(
&mut self,
defaults: PoolDefaults,
) -> Result<(), DbError>
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.