pub trait Prepared:
Any
+ Send
+ Sync
+ Display
+ Debug {
// Required methods
fn as_any(self: Box<Self>) -> Box<dyn Any>;
fn clear_bindings(&mut self) -> Result<&mut Self>
where Self: Sized;
fn bind(&mut self, value: impl AsValue) -> Result<&mut Self>
where Self: Sized;
fn bind_index(
&mut self,
value: impl AsValue,
index: u64,
) -> Result<&mut Self>
where Self: Sized;
fn metadata(&self) -> &QueryMetadata;
fn metadata_mut(&mut self) -> &mut QueryMetadata;
}Expand description
A parameterized, backend-prepared query handle.
Prepared enables drivers to pre-parse / optimize SQL statements and later
bind positional parameters. Values are converted via the AsValue trait.
§Binding Semantics
bindappends a value (driver chooses actual placeholder numbering).bind_indexsets the parameter atindex(zero-based).
Methods return &mut Self for fluent chaining:
ⓘ
prepared.bind(42)?.bind("hello")?;Required Methods§
fn as_any(self: Box<Self>) -> Box<dyn Any>
Sourcefn clear_bindings(&mut self) -> Result<&mut Self>where
Self: Sized,
fn clear_bindings(&mut self) -> Result<&mut Self>where
Self: Sized,
Clear all bound values.
Sourcefn bind(&mut self, value: impl AsValue) -> Result<&mut Self>where
Self: Sized,
fn bind(&mut self, value: impl AsValue) -> Result<&mut Self>where
Self: Sized,
Append a bound value.
Sourcefn bind_index(&mut self, value: impl AsValue, index: u64) -> Result<&mut Self>where
Self: Sized,
fn bind_index(&mut self, value: impl AsValue, index: u64) -> Result<&mut Self>where
Self: Sized,
Bind a value at a specific index.
Sourcefn metadata(&self) -> &QueryMetadata
fn metadata(&self) -> &QueryMetadata
Get QueryMetadata
Sourcefn metadata_mut(&mut self) -> &mut QueryMetadata
fn metadata_mut(&mut self) -> &mut QueryMetadata
Get mutable QueryMetadata