pub struct PreparedStatement<'a, V: SQLParam> {
pub text_segments: Box<[CompactString]>,
pub params: Box<[Param<'a, V>]>,
pub sql: CompactString,
}Expand description
A pre-rendered SQL statement with parameter placeholders Structure: [text, param, text, param, text] where text segments are pre-rendered and params are placeholders to be bound later
Fields§
§text_segments: Box<[CompactString]>Pre-rendered text segments
params: Box<[Param<'a, V>]>Parameter placeholders (in order)
sql: CompactStringFully rendered SQL with placeholders for this dialect
Implementations§
Source§impl<'a, V: SQLParam> PreparedStatement<'a, V>
impl<'a, V: SQLParam> PreparedStatement<'a, V>
Sourcepub fn external_param_count(&self) -> usize
pub fn external_param_count(&self) -> usize
Returns the number of external parameter bindings expected. This counts params that need external binding (no pre-set value), deduplicating named params since one binding satisfies all uses.
Sourcepub fn bind<T: SQLParam + Into<V>>(
&self,
param_binds: impl IntoIterator<Item = ParamBind<'a, T>>,
) -> Result<(&str, impl Iterator<Item = V>)>
pub fn bind<T: SQLParam + Into<V>>( &self, param_binds: impl IntoIterator<Item = ParamBind<'a, T>>, ) -> Result<(&str, impl Iterator<Item = V>)>
Bind parameters and return SQL with dialect-appropriate placeholders.
Uses $1, $2, ... for PostgreSQL, :name or ? for SQLite, ? for MySQL.
§Errors
Returns an error if required parameters are missing or if a named placeholder cannot be resolved from the supplied bindings.
Trait Implementations§
Source§impl<'a, V: Clone + SQLParam> Clone for PreparedStatement<'a, V>
impl<'a, V: Clone + SQLParam> Clone for PreparedStatement<'a, V>
Source§fn clone(&self) -> PreparedStatement<'a, V>
fn clone(&self) -> PreparedStatement<'a, V>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<V: SQLParam> Display for PreparedStatement<'_, V>
impl<V: SQLParam> Display for PreparedStatement<'_, V>
Source§impl<V: SQLParam> From<OwnedPreparedStatement<V>> for PreparedStatement<'_, V>
impl<V: SQLParam> From<OwnedPreparedStatement<V>> for PreparedStatement<'_, V>
Source§fn from(value: OwnedPreparedStatement<V>) -> Self
fn from(value: OwnedPreparedStatement<V>) -> Self
Converts to this type from the input type.
Source§impl<'a, V: SQLParam> From<PreparedStatement<'a, V>> for OwnedPreparedStatement<V>
impl<'a, V: SQLParam> From<PreparedStatement<'a, V>> for OwnedPreparedStatement<V>
Source§fn from(prepared: PreparedStatement<'a, V>) -> Self
fn from(prepared: PreparedStatement<'a, V>) -> Self
Converts to this type from the input type.
Source§impl<'a, V: SQLParam> ToSQL<'a, V> for PreparedStatement<'a, V>
impl<'a, V: SQLParam> ToSQL<'a, V> for PreparedStatement<'a, V>
Auto Trait Implementations§
impl<'a, V> Freeze for PreparedStatement<'a, V>
impl<'a, V> RefUnwindSafe for PreparedStatement<'a, V>where
V: RefUnwindSafe,
impl<'a, V> Send for PreparedStatement<'a, V>
impl<'a, V> Sync for PreparedStatement<'a, V>where
V: Sync,
impl<'a, V> Unpin for PreparedStatement<'a, V>
impl<'a, V> UnsafeUnpin for PreparedStatement<'a, V>
impl<'a, V> UnwindSafe for PreparedStatement<'a, V>where
V: UnwindSafe + RefUnwindSafe,
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,
impl<Mk> MarkerAggValidFor<()> for Mk
impl<Scope> ScopeSatisfies<Nil, ()> for Scope
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more