pub struct Statement(/* private fields */);Expand description
Prepared statement for querying a core database connection public API for extensions Statements can be manually closed.
Implementations§
Source§impl Statement
impl Statement
Sourcepub fn bind_at(&self, idx: NonZeroUsize, arg: Value)
pub fn bind_at(&self, idx: NonZeroUsize, arg: Value)
Bind a value to a parameter in the prepared statement.
let stmt = conn.prepare_stmt("select * from users where name = ?");
stmt.bind_at(1, Value::from_text("test".into()));Sourcepub fn step(&self) -> StepResult
pub fn step(&self) -> StepResult
Execute the statement and return the next row
while stmt.step() == StepResult::Row {
let row = stmt.get_row();
println!("row: {:?}", row);
}Sourcepub fn get_row(&mut self) -> &[Value]
pub fn get_row(&mut self) -> &[Value]
while stmt.step() == StepResult::Row {
let row = stmt.get_row();
println!("row: {:?}", row);Sourcepub fn get_column_names(&self) -> Vec<String>
pub fn get_column_names(&self) -> Vec<String>
Get the result column names for the prepared statement
Trait Implementations§
Auto Trait Implementations§
impl !Send for Statement
impl !Sync for Statement
impl Freeze for Statement
impl RefUnwindSafe for Statement
impl Unpin for Statement
impl UnsafeUnpin 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