pub struct PreparedStatement { /* private fields */ }Expand description
A prepared statement with cached AST and optional execution plan
Implementations§
Source§impl PreparedStatement
impl PreparedStatement
Sourcepub fn new(sql: String, statement: Statement) -> Self
pub fn new(sql: String, statement: Statement) -> Self
Create a new prepared statement from parsed AST
Sourcepub fn signature(&self) -> &QuerySignature
pub fn signature(&self) -> &QuerySignature
Get the query signature
Sourcepub fn param_count(&self) -> usize
pub fn param_count(&self) -> usize
Get the number of parameters expected
Sourcepub fn cached_plan(&self) -> &CachedPlan
pub fn cached_plan(&self) -> &CachedPlan
Get the cached execution plan
Sourcepub fn bind(
&self,
params: &[SqlValue],
) -> Result<Statement, PreparedStatementError>
pub fn bind( &self, params: &[SqlValue], ) -> Result<Statement, PreparedStatementError>
Bind parameters to create an executable statement
For statements without placeholders, returns a clone of the cached statement. For parameterized statements, replaces Placeholder expressions with Literal values directly in the AST, avoiding the overhead of re-parsing.
This is the key performance optimization: binding happens at the AST level, not by string substitution and re-parsing.
Trait Implementations§
Source§impl Clone for PreparedStatement
impl Clone for PreparedStatement
Source§fn clone(&self) -> PreparedStatement
fn clone(&self) -> PreparedStatement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PreparedStatement
impl RefUnwindSafe for PreparedStatement
impl Send for PreparedStatement
impl Sync for PreparedStatement
impl Unpin for PreparedStatement
impl UnwindSafe for PreparedStatement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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