pub struct PreparedStatement<'c, 'db> { /* private fields */ }Expand description
A prepared SQL statement bound to a Connection.
Implementations§
Source§impl<'c, 'db> PreparedStatement<'c, 'db>
impl<'c, 'db> PreparedStatement<'c, 'db>
Sourcepub fn param_count(&self) -> usize
pub fn param_count(&self) -> usize
Number of positional parameters ($1, $2, …) this statement expects.
Sourcepub fn parameter_count(&self) -> usize
pub fn parameter_count(&self) -> usize
Alias of Self::param_count matching rusqlite’s name.
Sourcepub fn column_count(&self) -> usize
pub fn column_count(&self) -> usize
Number of output columns. Zero for non-SELECT statements.
Sourcepub fn column_names(&self) -> &[String]
pub fn column_names(&self) -> &[String]
Output column names in declaration order.
Sourcepub fn column_name(&self, i: usize) -> Option<&str>
pub fn column_name(&self, i: usize) -> Option<&str>
Output column name at index i, if any.
Sourcepub fn column_index(&self, name: &str) -> Option<usize>
pub fn column_index(&self, name: &str) -> Option<usize>
Position of the column named name, if present.
Sourcepub fn is_explain(&self) -> bool
pub fn is_explain(&self) -> bool
True if the statement is an EXPLAIN.
Sourcepub fn execute(&self, params: &[Value]) -> Result<u64>
pub fn execute(&self, params: &[Value]) -> Result<u64>
Execute the statement; returns rows affected (0 for SELECT/DDL).
Sourcepub fn query(&self, params: &[Value]) -> Result<Rows<'_>>
pub fn query(&self, params: &[Value]) -> Result<Rows<'_>>
Execute and return a stepping Rows<'_> iterator.
Streams rows directly from the B+ tree for simple SELECT [cols] FROM t
shapes (no WHERE/ORDER BY/aggregate/join). Materializes internally for
everything else — same user-visible API either way.
DML statements execute the mutation and yield an immediately-exhausted Rows
(matching rusqlite semantics).
Sourcepub fn query_collect(&self, params: &[Value]) -> Result<QueryResult>
pub fn query_collect(&self, params: &[Value]) -> Result<QueryResult>
Execute and return the fully-materialized QueryResult.
Equivalent to self.query(params)?.collect() but slightly more direct.