Breathe life back into this project. #1

Merged
gburd merged 22 commits from gburd/2018edition-fmt-fix-deps into master 2020-01-16 16:27:21 +00:00
2 changed files with 10 additions and 18 deletions
Showing only changes of commit a25f476734 - Show all commits

View file

@ -215,7 +215,7 @@ pub struct AevRows<'conn, F> {
/// for now it's convenient to avoid error handling.
impl<'conn, F> Iterator for AevRows<'conn, F>
where
F: FnMut(&rusqlite::Row) -> Aev,
F: FnMut(&rusqlite::Row) -> Result<Aev>,
{
type Item = Aev;
fn next(&mut self) -> Option<Aev> {
@ -1075,7 +1075,7 @@ impl AttributeCaches {
replacing: bool,
) -> Result<()> {
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 };
self.accumulate_into_cache(
None,

View file

@ -456,23 +456,15 @@ impl TypedSQLValue for TypedValue {
/// Return the corresponding SQLite `value` and `value_type_tag` pair.
fn to_sql_value_pair<'a>(&'a self) -> (ToSqlOutput<'a>, i32) {
match self {
&TypedValue::Ref(x) => (rusqlite::types::Value::Integer(x).into(), 0),
&TypedValue::Boolean(x) => (
rusqlite::types::Value::Integer(if x { 1 } else { 0 }).into(),
1,
),
&TypedValue::Instant(x) => (rusqlite::types::Value::Integer(x.to_micros()).into(), 4),
&TypedValue::Ref(x) => (x.into(), 0),
&TypedValue::Boolean(x) => ((if x { 1 } else { 0 }).into(), 1),
&TypedValue::Instant(x) => (x.to_micros().into(), 4),
// 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::Double(x) => (rusqlite::types::Value::Real(x.into_inner()).into(), 5),
&TypedValue::String(ref x) => (rusqlite::types::ValueRef::Text(x.as_str()).into(), 10),
&TypedValue::Uuid(ref u) => (
rusqlite::types::Value::Blob(u.as_bytes().to_vec()).into(),
11,
),
&TypedValue::Keyword(ref x) => {
(rusqlite::types::ValueRef::Text(&x.to_string()).into(), 13)
}
&TypedValue::Long(x) => (x.into(), 5),
&TypedValue::Double(x) => (x.into_inner().into(), 5),
&TypedValue::String(ref x) => (x.as_str().into(), 10),
&TypedValue::Uuid(ref u) => (u.as_bytes().to_vec().into(), 11),
&TypedValue::Keyword(ref x) => (x.to_string().into(), 13),
}
}