We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The named parameter API allows you to bind parameters partially, as exemplified in the following code:
use rusqlite::{named_params, Connection}; fn main() { let db = Connection::open_in_memory().unwrap(); db.execute("CREATE TABLE t(x, y)", ()).unwrap(); let mut stmt = db.prepare("INSERT INTO t (x, y) values (:x, :y)").unwrap(); stmt.execute(named_params! {":x": 0}).unwrap(); stmt.execute(named_params! {":y": 1}).unwrap(); let mut stmt = db.prepare("SELECT * from t").unwrap(); for _ in stmt .query_map((), |f| { Ok(println!( "{:?}, {:?}", f.get_ref("x").unwrap(), f.get_ref("y").unwrap() )) }) .unwrap() {} }
I would expect this to output
Integer(0), Null Null, Integer(1)
but instead this outputs
Integer(0), Null Integer(0), Integer(1)
I would personally expect the API to reset any binding state prior to running any queries.
The text was updated successfully, but these errors were encountered:
https://docs.rs/rusqlite/latest/rusqlite/trait.Params.html#named-parameters
Unbound named parameters will be left to the value they previously were bound with, falling back to NULL for parameters which have never been bound.
https://sqlite.org/c3ref/clear_bindings.html
Contrary to the intuition of many, sqlite3_reset() does not reset the bindings on a prepared statement. Use this routine to reset all host parameters to NULL.
And currently you cannot clear bindings.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
The named parameter API allows you to bind parameters partially, as exemplified in the following code:
I would expect this to output
but instead this outputs
I would personally expect the API to reset any binding state prior to running any queries.
The text was updated successfully, but these errors were encountered: