Available on crate features
vtab
and array
only.Expand description
Array Virtual Table.
Note: rarray
, not carray
is the name of the table valued function we
define.
Port of carray
C extension: https://www.sqlite.org/carray.html
Example
fn example(db: &Connection) -> Result<()> {
// Note: This should be done once (usually when opening the DB).
rusqlite::vtab::array::load_module(&db)?;
let v = [1i64, 2, 3, 4];
// Note: A `Rc<Vec<Value>>` must be used as the parameter.
let values = Rc::new(v.iter().copied().map(Value::from).collect::<Vec<Value>>());
let mut stmt = db.prepare("SELECT value from rarray(?1);")?;
let rows = stmt.query_map([values], |row| row.get::<_, i64>(0))?;
for value in rows {
println!("{}", value?);
}
Ok(())
}
Functions
- Register the “rarray” module.
Type Definitions
- Array parameter / pointer