Correct an assert relating Datalog projection and SQL column counts. (#519) r=tcsc
* Correct an assert relating Datalog projection and SQL column counts. (#517) * Fix a comment that shouldn't be a doc comment.
This commit is contained in:
parent
1589104841
commit
95e95d735e
2 changed files with 10 additions and 8 deletions
12
db/src/db.rs
12
db/src/db.rs
|
@ -69,12 +69,12 @@ pub fn new_connection<T>(uri: T) -> rusqlite::Result<rusqlite::Connection> where
|
||||||
_ => rusqlite::Connection::open(uri)?,
|
_ => rusqlite::Connection::open(uri)?,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// See https://github.com/mozilla/mentat/issues/505 for details on temp_store
|
// See https://github.com/mozilla/mentat/issues/505 for details on temp_store
|
||||||
/// pragma and how it might interact together with consumers such as Firefox.
|
// pragma and how it might interact together with consumers such as Firefox.
|
||||||
/// temp_store=2 is currently present to force SQLite to store temp files in memory.
|
// temp_store=2 is currently present to force SQLite to store temp files in memory.
|
||||||
/// Some of the platforms we support do not have a tmp partition (e.g. Android)
|
// Some of the platforms we support do not have a tmp partition (e.g. Android)
|
||||||
/// necessary to store temp files on disk. Ideally, consumers should be able to
|
// necessary to store temp files on disk. Ideally, consumers should be able to
|
||||||
/// override this behaviour (see issue 505).
|
// override this behaviour (see issue 505).
|
||||||
conn.execute_batch("
|
conn.execute_batch("
|
||||||
PRAGMA page_size=32768;
|
PRAGMA page_size=32768;
|
||||||
PRAGMA journal_mode=wal;
|
PRAGMA journal_mode=wal;
|
||||||
|
|
|
@ -374,7 +374,8 @@ impl TupleProjector {
|
||||||
|
|
||||||
// This is exactly the same as for rel.
|
// This is exactly the same as for rel.
|
||||||
fn collect_bindings<'a, 'stmt>(&self, row: Row<'a, 'stmt>) -> Result<Vec<TypedValue>> {
|
fn collect_bindings<'a, 'stmt>(&self, row: Row<'a, 'stmt>) -> Result<Vec<TypedValue>> {
|
||||||
assert_eq!(row.column_count(), self.len as i32);
|
// There will be at least as many SQL columns as Datalog columns.
|
||||||
|
assert!(row.column_count() >= self.len as i32);
|
||||||
self.templates
|
self.templates
|
||||||
.iter()
|
.iter()
|
||||||
.map(|ti| ti.lookup(&row))
|
.map(|ti| ti.lookup(&row))
|
||||||
|
@ -422,7 +423,8 @@ impl RelProjector {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_bindings<'a, 'stmt>(&self, row: Row<'a, 'stmt>) -> Result<Vec<TypedValue>> {
|
fn collect_bindings<'a, 'stmt>(&self, row: Row<'a, 'stmt>) -> Result<Vec<TypedValue>> {
|
||||||
assert_eq!(row.column_count(), self.len as i32);
|
// There will be at least as many SQL columns as Datalog columns.
|
||||||
|
assert!(row.column_count() >= self.len as i32);
|
||||||
self.templates
|
self.templates
|
||||||
.iter()
|
.iter()
|
||||||
.map(|ti| ti.lookup(&row))
|
.map(|ti| ti.lookup(&row))
|
||||||
|
|
Loading…
Reference in a new issue