pub struct Statement { /* private fields */ }Expand description
SQL statement as a pure data container.
Statement holds SQL text, parameters, timeout, and statement type. Execution is performed by Connection, not by Statement itself.
§Example
Implementations§
Source§impl Statement
impl Statement
Sourcepub fn statement_type(&self) -> StatementType
pub fn statement_type(&self) -> StatementType
Get the statement type.
Sourcepub fn timeout_ms(&self) -> u64
pub fn timeout_ms(&self) -> u64
Get the timeout in milliseconds.
Sourcepub fn set_timeout(&mut self, timeout_ms: u64)
pub fn set_timeout(&mut self, timeout_ms: u64)
Set query timeout.
Sourcepub fn bind<T: Into<Parameter>>(
&mut self,
index: usize,
value: T,
) -> Result<(), QueryError>
pub fn bind<T: Into<Parameter>>( &mut self, index: usize, value: T, ) -> Result<(), QueryError>
Sourcepub fn bind_all<T: Into<Parameter> + Clone>(
&mut self,
params: &[T],
) -> Result<(), QueryError>
pub fn bind_all<T: Into<Parameter> + Clone>( &mut self, params: &[T], ) -> Result<(), QueryError>
Bind multiple parameters.
Sourcepub fn clear_parameters(&mut self)
pub fn clear_parameters(&mut self)
Clear all bound parameters.
Sourcepub fn parameters(&self) -> &[Option<Parameter>]
pub fn parameters(&self) -> &[Option<Parameter>]
Get bound parameters.
Sourcepub fn build_sql(&self) -> Result<String, QueryError>
pub fn build_sql(&self) -> Result<String, QueryError>
Build the final SQL with parameters substituted.
This is used internally by Connection when executing statements.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Statement
impl RefUnwindSafe for Statement
impl Send for Statement
impl Sync for Statement
impl Unpin for Statement
impl UnwindSafe for Statement
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