macro_rules! prepare_and_bind {
    ($conn:expr, $sql:literal) => { ... };
}
Available on crate feature rusqlite-macros only.
Expand description

Captured identifiers in SQL

  • only SQLite $x / @x / :x syntax works (Rust &x syntax does not work).
  • $x.y expression does not work.

§Example


fn misc(db: &Connection) -> Result<Statement> {
    let name = "Lisa";
    let age = 8;
    let smart = true;
    Ok(prepare_and_bind!(db, "SELECT $name, @age, :smart;"))
}