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:
Richard Newman 2018-01-17 16:36:15 -06:00 committed by GitHub
parent 1589104841
commit 95e95d735e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View file

@ -69,12 +69,12 @@ pub fn new_connection<T>(uri: T) -> rusqlite::Result<rusqlite::Connection> where
_ => rusqlite::Connection::open(uri)?,
};
/// 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.
/// 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)
/// necessary to store temp files on disk. Ideally, consumers should be able to
/// override this behaviour (see issue 505).
// 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.
// 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)
// necessary to store temp files on disk. Ideally, consumers should be able to
// override this behaviour (see issue 505).
conn.execute_batch("
PRAGMA page_size=32768;
PRAGMA journal_mode=wal;

View file

@ -374,7 +374,8 @@ impl TupleProjector {
// This is exactly the same as for rel.
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
.iter()
.map(|ti| ti.lookup(&row))
@ -422,7 +423,8 @@ impl RelProjector {
}
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
.iter()
.map(|ti| ti.lookup(&row))