Breathe life back into this project. #1
2 changed files with 10 additions and 18 deletions
|
@ -215,7 +215,7 @@ pub struct AevRows<'conn, F> {
|
||||||
/// for now it's convenient to avoid error handling.
|
/// for now it's convenient to avoid error handling.
|
||||||
impl<'conn, F> Iterator for AevRows<'conn, F>
|
impl<'conn, F> Iterator for AevRows<'conn, F>
|
||||||
where
|
where
|
||||||
F: FnMut(&rusqlite::Row) -> Aev,
|
F: FnMut(&rusqlite::Row) -> Result<Aev>,
|
||||||
{
|
{
|
||||||
type Item = Aev;
|
type Item = Aev;
|
||||||
fn next(&mut self) -> Option<Aev> {
|
fn next(&mut self) -> Option<Aev> {
|
||||||
|
@ -1075,7 +1075,7 @@ impl AttributeCaches {
|
||||||
replacing: bool,
|
replacing: bool,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let mut aev_factory = AevFactory::new();
|
let mut aev_factory = AevFactory::new();
|
||||||
let rows = statement.query_map(&args, |row| aev_factory.row_to_aev(row))?;
|
let rows = statement.query_map(&args, |row| Ok(aev_factory.row_to_aev(row)))?;
|
||||||
let aevs = AevRows { rows: rows };
|
let aevs = AevRows { rows: rows };
|
||||||
self.accumulate_into_cache(
|
self.accumulate_into_cache(
|
||||||
None,
|
None,
|
||||||
|
|
24
db/src/db.rs
24
db/src/db.rs
|
@ -456,23 +456,15 @@ impl TypedSQLValue for TypedValue {
|
||||||
/// Return the corresponding SQLite `value` and `value_type_tag` pair.
|
/// Return the corresponding SQLite `value` and `value_type_tag` pair.
|
||||||
fn to_sql_value_pair<'a>(&'a self) -> (ToSqlOutput<'a>, i32) {
|
fn to_sql_value_pair<'a>(&'a self) -> (ToSqlOutput<'a>, i32) {
|
||||||
match self {
|
match self {
|
||||||
&TypedValue::Ref(x) => (rusqlite::types::Value::Integer(x).into(), 0),
|
&TypedValue::Ref(x) => (x.into(), 0),
|
||||||
&TypedValue::Boolean(x) => (
|
&TypedValue::Boolean(x) => ((if x { 1 } else { 0 }).into(), 1),
|
||||||
rusqlite::types::Value::Integer(if x { 1 } else { 0 }).into(),
|
&TypedValue::Instant(x) => (x.to_micros().into(), 4),
|
||||||
1,
|
|
||||||
),
|
|
||||||
&TypedValue::Instant(x) => (rusqlite::types::Value::Integer(x.to_micros()).into(), 4),
|
|
||||||
// SQLite distinguishes integral from decimal types, allowing long and double to share a tag.
|
// SQLite distinguishes integral from decimal types, allowing long and double to share a tag.
|
||||||
&TypedValue::Long(x) => (rusqlite::types::Value::Integer(x).into(), 5),
|
&TypedValue::Long(x) => (x.into(), 5),
|
||||||
&TypedValue::Double(x) => (rusqlite::types::Value::Real(x.into_inner()).into(), 5),
|
&TypedValue::Double(x) => (x.into_inner().into(), 5),
|
||||||
&TypedValue::String(ref x) => (rusqlite::types::ValueRef::Text(x.as_str()).into(), 10),
|
&TypedValue::String(ref x) => (x.as_str().into(), 10),
|
||||||
&TypedValue::Uuid(ref u) => (
|
&TypedValue::Uuid(ref u) => (u.as_bytes().to_vec().into(), 11),
|
||||||
rusqlite::types::Value::Blob(u.as_bytes().to_vec()).into(),
|
&TypedValue::Keyword(ref x) => (x.to_string().into(), 13),
|
||||||
11,
|
|
||||||
),
|
|
||||||
&TypedValue::Keyword(ref x) => {
|
|
||||||
(rusqlite::types::ValueRef::Text(&x.to_string()).into(), 13)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue