look at the examples and ull knwo wht i mean. too much of match Value
rn, sql_escape_hatch has better querying support even tho that was not the intention lol
rusqlite
let mut stmt = conn.prepare(&sql)?;
let rows = stmt.query_map(rusqlite::params![name], |row| {
Ok(Product {
id: row.get(0)?, // index 0 is i64
name: row.get(1)?, // index 1 is String
price: row.get(2)?, // index 2 is f64
})
})?;
sqlitex
for row_result in results {
let row = row_result?;
let name = match row[1] {
Value::Text(s) => s, // more explicit, can be improved
_ => panic!()
};
}
sqlx
let rows = sqlx::query(&dynamic_sql)
.bind(value)
.fetch_all(&pool)
.await?;
for row in rows {
let name: String = row.try_get("name")?; // you assert the type
let price: f64 = row.try_get("price")?; // runtime error if wrong
}
use Option rather than Value::null
look at the examples and ull knwo wht i mean. too much of match Value
rn,
sql_escape_hatchhas better querying support even tho that was not the intention lolrusqlite
sqlitex
sqlx
use Option rather than Value::null