pub struct OwnedPreparedStatement<V: SQLParam> {
pub text_segments: Box<[CompactString]>,
pub params: Box<[OwnedParam<V>]>,
pub sql: CompactString,
}Expand description
An owned version of PreparedStatement with no lifetime dependencies
Fields§
§text_segments: Box<[CompactString]>Pre-rendered text segments
params: Box<[OwnedParam<V>]>Parameter placeholders (in order) - only placeholders, no values
sql: CompactStringFully rendered SQL with placeholders for this dialect
Implementations§
Source§impl<V: SQLParam> OwnedPreparedStatement<V>
impl<V: SQLParam> OwnedPreparedStatement<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<'a, T: SQLParam + Into<V>>(
&self,
param_binds: impl IntoIterator<Item = ParamBind<'a, T>>,
) -> Result<(&str, impl Iterator<Item = V>)>
pub fn bind<'a, 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, ? for SQLite/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<V: Clone + SQLParam> Clone for OwnedPreparedStatement<V>
impl<V: Clone + SQLParam> Clone for OwnedPreparedStatement<V>
Source§fn clone(&self) -> OwnedPreparedStatement<V>
fn clone(&self) -> OwnedPreparedStatement<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 OwnedPreparedStatement<V>
impl<V: SQLParam> Display for OwnedPreparedStatement<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 OwnedPreparedStatement<V>
impl<'a, V: SQLParam> ToSQL<'a, V> for OwnedPreparedStatement<V>
Auto Trait Implementations§
impl<V> Freeze for OwnedPreparedStatement<V>
impl<V> RefUnwindSafe for OwnedPreparedStatement<V>where
V: RefUnwindSafe,
impl<V> Send for OwnedPreparedStatement<V>where
V: Send,
impl<V> Sync for OwnedPreparedStatement<V>where
V: Sync,
impl<V> Unpin for OwnedPreparedStatement<V>
impl<V> UnsafeUnpin for OwnedPreparedStatement<V>
impl<V> UnwindSafe for OwnedPreparedStatement<V>where
V: UnwindSafe,
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