I'm following the example from the rusqlite git hub https://github.com/rusqlite/rusqlite/blob/master/src/vtab/array.rs#L206. I have the exact same code but I get the compile error
the trait bound `std::vec::Vec<rusqlite::types::Value>: rusqlite::ToSql` is not satisfied
A snippet of the code is below. ids is a Vec of String
let intValues:Vec<i64> = ids.into_iter().map(|s| s.parse::<i64>().expect("Id Parse error.")).collect();
let values:Vec<rusqlite::types::Value> = intValues.into_iter().map(rusqlite::types::Value::from).collect();
let ptr = std::rc::Rc::new(values);
let mut statement = db_connection
.prepare("select * from item where id in rarray(?);")
.expect("Failed to prepare second query.");
let results = statement
// This is the error line
.query_map(&[&ptr], |row| {
Ok(database::ItemData {
id: row.get(0)?,
name: row.get(1)?,
time_to_prepare: row.get(2)?
})
});
I had to add "array" to the feature in the toml file.