update rusqlite - all tests pass - some warnings

This commit is contained in:
Mark Watts 2021-07-02 20:29:41 -04:00
parent 614ce63e2b
commit 15df38fc8f
17 changed files with 23 additions and 25 deletions

View file

@ -53,7 +53,7 @@ log = "~0.4"
uuid = { version = "~0.8", features = ["v4", "serde"] } uuid = { version = "~0.8", features = ["v4", "serde"] }
[dependencies.rusqlite] [dependencies.rusqlite]
version = "~0.24" version = "~0.25"
features = ["limits", "bundled"] features = ["limits", "bundled"]
[dependencies.edn] [dependencies.edn]

View file

@ -21,5 +21,5 @@ path = "../edn"
path = "../core-traits" path = "../core-traits"
[dependencies.rusqlite] [dependencies.rusqlite]
version = "~0.24" version = "~0.25"
features = ["limits", "bundled"] features = ["limits", "bundled"]

View file

@ -22,7 +22,7 @@ serde_json = { version = "~1.0", optional = true }
serde_derive = { version = "~1.0", optional = true } serde_derive = { version = "~1.0", optional = true }
[dependencies.rusqlite] [dependencies.rusqlite]
version = "~0.24" version = "~0.25"
features = ["limits", "bundled"] features = ["limits", "bundled"]
[dependencies.edn] [dependencies.edn]

View file

@ -61,6 +61,7 @@ use std::iter::Peekable;
use failure::ResultExt; use failure::ResultExt;
use rusqlite; use rusqlite;
use rusqlite::{params_from_iter};
use core_traits::{Binding, Entid, TypedValue}; use core_traits::{Binding, Entid, TypedValue};
@ -1071,7 +1072,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| Ok(aev_factory.row_to_aev(row)))?; let rows = statement.query_map(params_from_iter(&args), |row| Ok(aev_factory.row_to_aev(row)))?;
let aevs = AevRows { rows }; let aevs = AevRows { rows };
self.accumulate_into_cache( self.accumulate_into_cache(
None, None,

View file

@ -24,6 +24,7 @@ use rusqlite;
use rusqlite::limits::Limit; use rusqlite::limits::Limit;
use rusqlite::types::{ToSql, ToSqlOutput}; use rusqlite::types::{ToSql, ToSqlOutput};
use rusqlite::TransactionBehavior; use rusqlite::TransactionBehavior;
use rusqlite::{params_from_iter};
use crate::bootstrap; use crate::bootstrap;
use crate::{repeat_values, to_namespaced_keyword}; use crate::{repeat_values, to_namespaced_keyword};
@ -804,7 +805,7 @@ impl MentatStoring for rusqlite::Connection {
values); values);
let mut stmt: rusqlite::Statement = self.prepare(s.as_str())?; let mut stmt: rusqlite::Statement = self.prepare(s.as_str())?;
let m: Result<Vec<(i64, Entid)>> = stmt.query_and_then(&params, |row| -> Result<(i64, Entid)> { let m: Result<Vec<(i64, Entid)>> = stmt.query_and_then(params_from_iter(&params), |row| -> Result<(i64, Entid)> {
Ok((row.get(0)?, row.get(1)?)) Ok((row.get(0)?, row.get(1)?))
})?.collect(); })?.collect();
m m
@ -948,7 +949,7 @@ impl MentatStoring for rusqlite::Connection {
// TODO: consider ensuring we inserted the expected number of rows. // TODO: consider ensuring we inserted the expected number of rows.
let mut stmt = self.prepare_cached(s.as_str())?; let mut stmt = self.prepare_cached(s.as_str())?;
stmt.execute(&params) stmt.execute(params_from_iter(&params))
.context(DbErrorKind::NonFtsInsertionIntoTempSearchTableFailed) .context(DbErrorKind::NonFtsInsertionIntoTempSearchTableFailed)
.map_err(|e| e.into()) .map_err(|e| e.into())
.map(|_c| ()) .map(|_c| ())
@ -1042,7 +1043,7 @@ impl MentatStoring for rusqlite::Connection {
// TODO: consider ensuring we inserted the expected number of rows. // TODO: consider ensuring we inserted the expected number of rows.
let mut stmt = self.prepare_cached(fts_s.as_str())?; let mut stmt = self.prepare_cached(fts_s.as_str())?;
stmt.execute(&fts_params).context(DbErrorKind::FtsInsertionFailed)?; stmt.execute(params_from_iter(&fts_params)).context(DbErrorKind::FtsInsertionFailed)?;
// Second, insert searches. // Second, insert searches.
// `params` reference computed values in `block`. // `params` reference computed values in `block`.
@ -1070,7 +1071,7 @@ impl MentatStoring for rusqlite::Connection {
// TODO: consider ensuring we inserted the expected number of rows. // TODO: consider ensuring we inserted the expected number of rows.
let mut stmt = self.prepare_cached(s.as_str())?; let mut stmt = self.prepare_cached(s.as_str())?;
stmt.execute(&params).context(DbErrorKind::FtsInsertionIntoTempSearchTableFailed) stmt.execute(params_from_iter(&params)).context(DbErrorKind::FtsInsertionIntoTempSearchTableFailed)
.map_err(|e| e.into()) .map_err(|e| e.into())
.map(|_c| ()) .map(|_c| ())
}).collect::<Result<Vec<()>>>(); }).collect::<Result<Vec<()>>>();

View file

@ -306,10 +306,9 @@ pub fn transactions_after<S: Borrow<Schema>>(
pub fn fulltext_values(conn: &rusqlite::Connection) -> Result<FulltextValues> { pub fn fulltext_values(conn: &rusqlite::Connection) -> Result<FulltextValues> {
let mut stmt: rusqlite::Statement = let mut stmt: rusqlite::Statement =
conn.prepare("SELECT rowid, text FROM fulltext_values ORDER BY rowid")?; conn.prepare("SELECT rowid, text FROM fulltext_values ORDER BY rowid")?;
let params: &[i32; 0] = &[];
let r: Result<Vec<_>> = stmt let r: Result<Vec<_>> = stmt
.query_and_then(params, |row| { .query_and_then([], |row| {
let rowid: i64 = row.get(0)?; let rowid: i64 = row.get(0)?;
let text: String = row.get(1)?; let text: String = row.get(1)?;
Ok((rowid, text)) Ok((rowid, text))

View file

@ -10,7 +10,7 @@
use std::ops::RangeFrom; use std::ops::RangeFrom;
use rusqlite; use rusqlite::{self, params_from_iter};
use db_traits::errors::{DbErrorKind, Result}; use db_traits::errors::{DbErrorKind, Result};
@ -81,10 +81,7 @@ fn move_transactions_to(
new_timeline, new_timeline,
crate::repeat_values(tx_ids.len(), 1) crate::repeat_values(tx_ids.len(), 1)
), ),
&(tx_ids params_from_iter(tx_ids.iter())
.iter()
.map(|x| x as &dyn rusqlite::types::ToSql)
.collect::<Vec<_>>()),
)?; )?;
Ok(()) Ok(())
} }

View file

@ -20,7 +20,7 @@ tokio = { version = "1.8.0", features = ["full"] }
uuid = "~0.8" uuid = "~0.8"
[dependencies.rusqlite] [dependencies.rusqlite]
version = "~0.24" version = "~0.25"
features = ["limits", "bundled"] features = ["limits", "bundled"]
[dependencies.hyper] [dependencies.hyper]

View file

@ -15,7 +15,7 @@ failure = "~0.1"
failure_derive = "~0.1" failure_derive = "~0.1"
[dependencies.rusqlite] [dependencies.rusqlite]
version = "~0.24" version = "~0.25"
features = ["limits", "bundled"] features = ["limits", "bundled"]
[dependencies.edn] [dependencies.edn]

View file

@ -11,7 +11,7 @@ failure = "~0.1"
indexmap = "~1.7" indexmap = "~1.7"
[dependencies.rusqlite] [dependencies.rusqlite]
version = "~0.24" version = "~0.25"
features = ["limits", "bundled"] features = ["limits", "bundled"]
[dependencies.core_traits] [dependencies.core_traits]

View file

@ -13,7 +13,7 @@ failure = "~0.1"
path = "../query-pull-traits" path = "../query-pull-traits"
[dependencies.rusqlite] [dependencies.rusqlite]
version = "~0.24" version = "~0.25"
features = ["limits", "bundled"] features = ["limits", "bundled"]
[dependencies.edn] [dependencies.edn]

View file

@ -4,7 +4,7 @@ version = "0.0.2"
workspace = ".." workspace = ".."
[dependencies.rusqlite] [dependencies.rusqlite]
version = "~0.24" version = "~0.25"
features = ["limits", "bundled"] features = ["limits", "bundled"]
[dependencies.edn] [dependencies.edn]

View file

@ -11,7 +11,7 @@ failure = "~0.1"
ordered-float = "~2.5" ordered-float = "~2.5"
[dependencies.rusqlite] [dependencies.rusqlite]
version = "~0.24" version = "~0.25"
features = ["limits", "bundled"] features = ["limits", "bundled"]
[dependencies.core_traits] [dependencies.core_traits]

View file

@ -19,7 +19,7 @@ serde_json = "~1.0"
uuid = { version = "~0.8" } uuid = { version = "~0.8" }
[dependencies.rusqlite] [dependencies.rusqlite]
version = "~0.24" version = "~0.25"
features = ["limits", "bundled"] features = ["limits", "bundled"]
[dependencies.db_traits] [dependencies.db_traits]

View file

@ -25,7 +25,7 @@ lazy_static = "~1.4"
uuid = { version = "~0.8", features = ["v4", "serde"] } uuid = { version = "~0.8", features = ["v4", "serde"] }
[dependencies.rusqlite] [dependencies.rusqlite]
version = "~0.24" version = "~0.25"
features = ["limits", "bundled"] features = ["limits", "bundled"]
[dependencies.edn] [dependencies.edn]

View file

@ -34,7 +34,7 @@ termion = "~1.5"
time = "~0.2" time = "~0.2"
[dependencies.rusqlite] [dependencies.rusqlite]
version = "~0.24" version = "~0.25"
features = ["limits", "bundled"] features = ["limits", "bundled"]
[dependencies.mentat] [dependencies.mentat]

View file

@ -10,7 +10,7 @@ sqlcipher = ["rusqlite/sqlcipher"]
failure = "~0.1" failure = "~0.1"
[dependencies.rusqlite] [dependencies.rusqlite]
version = "~0.24" version = "~0.25"
features = ["limits", "bundled"] features = ["limits", "bundled"]
[dependencies.edn] [dependencies.edn]