pub struct PreparedStatement { /* private fields */ }
Expand description
A prepared statement.
Implementations§
Source§impl PreparedStatement
impl PreparedStatement
Sourcepub fn execute(&mut self) -> ResultSet<'_>
pub fn execute(&mut self) -> ResultSet<'_>
Begin executing a statement.
An sqlite “row” only lasts until the next call to
ffi::sqlite3_step()
, so ResultSet
has a corresponding
lifetime constraint, which prevents it ResultSet
from
implementing the Iterator
trait. See the Query
trait
for and Iterator
over query results.
Source§impl PreparedStatement
A compiled prepared statement that may take parameters.
Note: “The leftmost SQL parameter has an index of 1.”1
impl PreparedStatement
A compiled prepared statement that may take parameters. Note: “The leftmost SQL parameter has an index of 1.”1
Sourcepub fn ignore_detail(&mut self)
pub fn ignore_detail(&mut self)
Opt out of copies of error message details.
Sourcepub fn bind_null(&mut self, i: ParamIx) -> SqliteResult<()>
pub fn bind_null(&mut self, i: ParamIx) -> SqliteResult<()>
Bind null to a statement parameter.
Sourcepub fn bind_int(&mut self, i: ParamIx, value: i32) -> SqliteResult<()>
pub fn bind_int(&mut self, i: ParamIx, value: i32) -> SqliteResult<()>
Bind an int to a statement parameter.
Sourcepub fn bind_int64(&mut self, i: ParamIx, value: i64) -> SqliteResult<()>
pub fn bind_int64(&mut self, i: ParamIx, value: i64) -> SqliteResult<()>
Bind an int64 to a statement parameter.
Sourcepub fn bind_double(&mut self, i: ParamIx, value: f64) -> SqliteResult<()>
pub fn bind_double(&mut self, i: ParamIx, value: f64) -> SqliteResult<()>
Bind a double to a statement parameter.
Sourcepub fn bind_text(&mut self, i: ParamIx, value: &str) -> SqliteResult<()>
pub fn bind_text(&mut self, i: ParamIx, value: &str) -> SqliteResult<()>
Bind a (copy of a) str to a statement parameter.
TODO: support binding without copying strings, blobs
Sourcepub fn bind_blob(&mut self, i: ParamIx, value: &[u8]) -> SqliteResult<()>
pub fn bind_blob(&mut self, i: ParamIx, value: &[u8]) -> SqliteResult<()>
Bind a (copy of a) byte sequence to a statement parameter.
TODO: support binding without copying strings, blobs
Sourcepub fn clear_bindings(&mut self)
pub fn clear_bindings(&mut self)
Clear all parameter bindings.
Sourcepub fn bind_parameter_count(&mut self) -> ParamIx
pub fn bind_parameter_count(&mut self) -> ParamIx
Return the number of SQL parameters. If parameters of the ?NNN form are used, there may be gaps in the list.
Sourcepub unsafe fn expose(&mut self) -> *mut sqlite3_stmt
pub unsafe fn expose(&mut self) -> *mut sqlite3_stmt
Expose the underlying sqlite3_stmt
struct pointer for use
with the ffi
module.
Trait Implementations§
Source§impl Drop for PreparedStatement
impl Drop for PreparedStatement
Source§impl<F, T> Query<F, T> for PreparedStatement
impl<F, T> Query<F, T> for PreparedStatement
Source§fn query<'stmt>(
&'stmt mut self,
values: &[&dyn ToSql],
txform: F,
) -> SqliteResult<QueryResults<'stmt, T, F>>
fn query<'stmt>( &'stmt mut self, values: &[&dyn ToSql], txform: F, ) -> SqliteResult<QueryResults<'stmt, T, F>>
Source§impl<F> QueryEach<F> for PreparedStatement
impl<F> QueryEach<F> for PreparedStatement
Source§fn query_each(
&mut self,
values: &[&dyn ToSql],
each_row: &mut F,
) -> SqliteResult<()>
fn query_each( &mut self, values: &[&dyn ToSql], each_row: &mut F, ) -> SqliteResult<()>
Process rows from a query after binding parameters.
For call each_row(row)
for each resulting step,
exiting on Err
.
Source§impl<F, A> QueryFold<F, A> for PreparedStatement
impl<F, A> QueryFold<F, A> for PreparedStatement
Source§fn query_fold(
&mut self,
values: &[&dyn ToSql],
init: A,
f: F,
) -> SqliteResult<A>
fn query_fold( &mut self, values: &[&dyn ToSql], init: A, f: F, ) -> SqliteResult<A>
Fold rows from a query after binding parameters.
Source§impl StatementUpdate for PreparedStatement
impl StatementUpdate for PreparedStatement
Source§fn update(&mut self, values: &[&dyn ToSql]) -> SqliteResult<u64>
fn update(&mut self, values: &[&dyn ToSql]) -> SqliteResult<u64>
Execute a statement after binding any parameters.
When the statement is done, The number of rows modified is reported.
Fail with Err(SQLITE_MISUSE)
in case the statement results
in any any rows (e.g. a SELECT
rather than INSERT
or
UPDATE
).