[][src]Module rusqlite::vtab::array

feature = "array" 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(?);")?;
    let rows = stmt.query_map(params![values], |row| row.get::<_, i64>(0))?;
    for value in rows {
        println!("{}", value?);
    }
    Ok(())
}

Functions

load_module

feature = "array" Register the "rarray" module.

Type Definitions

Array

Array parameter / pointer