From ff48f6369a649f17b7119fd1b23ad8635f538d46 Mon Sep 17 00:00:00 2001 From: Conrad Dean Date: Mon, 22 Jul 2019 08:33:34 -0400 Subject: [PATCH] fix breaking change on rusqlite changing RowIndex's signature RowIndex must have just been an alias over i32, but now it's a trait implemented on str and usize, so we need to change mentat's internal type alias for it to a usize. --- query-projector/src/lib.rs | 2 +- query-projector/src/project.rs | 2 +- query-projector/src/projectors/pull_two_stage.rs | 4 ++-- query-projector/src/projectors/simple.rs | 4 ++-- query-projector/src/pull.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/query-projector/src/lib.rs b/query-projector/src/lib.rs index 1cf08f08..58d97113 100644 --- a/query-projector/src/lib.rs +++ b/query-projector/src/lib.rs @@ -343,7 +343,7 @@ impl QueryResults { } } -type Index = i32; // See rusqlite::RowIndex. +type Index = usize; // See rusqlite::RowIndex. enum TypedIndex { Known(Index, ValueTypeTag), Unknown(Index, Index), diff --git a/query-projector/src/project.rs b/query-projector/src/project.rs index d7f0ca20..0074b863 100644 --- a/query-projector/src/project.rs +++ b/query-projector/src/project.rs @@ -192,7 +192,7 @@ pub(crate) fn project_elements<'a, I: IntoIterator>( // We'll expand them later. let mut outer_projection: Vec> = Vec::with_capacity(count + 2); - let mut i: i32 = 0; + let mut i: usize = 0; let mut min_max_count: usize = 0; let mut templates = vec![]; let mut pulls: Vec = vec![]; diff --git a/query-projector/src/projectors/pull_two_stage.rs b/query-projector/src/projectors/pull_two_stage.rs index ca8f5bdf..0d841aff 100644 --- a/query-projector/src/projectors/pull_two_stage.rs +++ b/query-projector/src/projectors/pull_two_stage.rs @@ -124,7 +124,7 @@ impl TupleTwoStagePullProjector { // There will be at least as many SQL columns as Datalog columns. // gte 'cos we might be querying extra columns for ordering. // The templates will take care of ignoring columns. - assert!(row.column_count() >= self.len as i32); + assert!(row.column_count() >= self.len); self.templates .iter() .map(|ti| ti.lookup(&row)) @@ -208,7 +208,7 @@ impl RelTwoStagePullProjector { // There will be at least as many SQL columns as Datalog columns. // gte 'cos we might be querying extra columns for ordering. // The templates will take care of ignoring columns. - assert!(row.column_count() >= self.len as i32); + assert!(row.column_count() >= self.len); let mut count = 0; for binding in self.templates .iter() diff --git a/query-projector/src/projectors/simple.rs b/query-projector/src/projectors/simple.rs index d14f73b9..91068993 100644 --- a/query-projector/src/projectors/simple.rs +++ b/query-projector/src/projectors/simple.rs @@ -97,7 +97,7 @@ impl TupleProjector { // There will be at least as many SQL columns as Datalog columns. // gte 'cos we might be querying extra columns for ordering. // The templates will take care of ignoring columns. - assert!(row.column_count() >= self.len as i32); + assert!(row.column_count() >= self.len); self.templates .iter() .map(|ti| ti.lookup(&row)) @@ -155,7 +155,7 @@ impl RelProjector { // There will be at least as many SQL columns as Datalog columns. // gte 'cos we might be querying extra columns for ordering. // The templates will take care of ignoring columns. - assert!(row.column_count() >= self.len as i32); + assert!(row.column_count() >= self.len); let mut count = 0; for binding in self.templates .iter() diff --git a/query-projector/src/pull.rs b/query-projector/src/pull.rs index 21a47751..e325ac62 100644 --- a/query-projector/src/pull.rs +++ b/query-projector/src/pull.rs @@ -94,7 +94,7 @@ impl<'schema> PullConsumer<'schema> { } pub(crate) fn collect_entity<'a>(&mut self, row: &rusqlite::Row<'a>) -> Entid { - let entity = row.get(self.indices.sql_index); + let entity = row.get(self.indices.sql_index).unwrap(); self.entities.insert(entity); entity }