Prepared

Trait Prepared 

Source
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

  • bind appends a value (driver chooses actual placeholder numbering).
  • bind_index sets the parameter at index (zero-based).

Methods return &mut Self for fluent chaining:

prepared.bind(42)?.bind("hello")?;

Required Methods§

Source

fn as_any(self: Box<Self>) -> Box<dyn Any>

Source

fn clear_bindings(&mut self) -> Result<&mut Self>
where Self: Sized,

Clear all bound values.

Source

fn bind(&mut self, value: impl AsValue) -> Result<&mut Self>
where Self: Sized,

Append a bound value.

Source

fn bind_index(&mut self, value: impl AsValue, index: u64) -> Result<&mut Self>
where Self: Sized,

Bind a value at a specific index.

Source

fn metadata(&self) -> &QueryMetadata

Get QueryMetadata

Source

fn metadata_mut(&mut self) -> &mut QueryMetadata

Get mutable QueryMetadata

Implementors§