From e4c1f541ae1f95d866bfd614283275dd23e7e716 Mon Sep 17 00:00:00 2001 From: gwenn Date: Sat, 26 Jan 2019 11:01:51 +0100 Subject: [PATCH 1/2] Expose sqlite3_changes() #460 --- src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index de904c2..e9b2a2f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -618,7 +618,10 @@ impl Connection { self.db.borrow_mut().decode_result(code) } - fn changes(&self) -> usize { + /// Return the number of rows modified, inserted or deleted by the most + /// recently completed INSERT, UPDATE or DELETE statement on the database + /// connection. + pub fn changes(&self) -> usize { self.db.borrow_mut().changes() } From 4be7900bab7f2a5fbbf6923600c56f3d66347133 Mon Sep 17 00:00:00 2001 From: gwenn Date: Sat, 26 Jan 2019 11:02:34 +0100 Subject: [PATCH 2/2] Rustfmt --- src/functions.rs | 11 +++++++---- src/lib.rs | 7 ++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/functions.rs b/src/functions.rs index 90ef6da..95bc989 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -713,10 +713,13 @@ mod test { }) .unwrap(); - let res: bool = db.query_row( - "SELECT example(0, i) FROM (SELECT 0 as i UNION SELECT 1)", - NO_PARAMS, - |r| r.get(0)).unwrap(); + let res: bool = db + .query_row( + "SELECT example(0, i) FROM (SELECT 0 as i UNION SELECT 1)", + NO_PARAMS, + |r| r.get(0), + ) + .unwrap(); // Doesn't actually matter, we'll assert in the function if there's a problem. assert!(res); } diff --git a/src/lib.rs b/src/lib.rs index e9b2a2f..be4fdaa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -196,7 +196,12 @@ pub enum DatabaseName<'a> { // Currently DatabaseName is only used by the backup and blob mods, so hide // this (private) impl to avoid dead code warnings. -#[cfg(any(feature = "backup", feature = "blob", feature = "session", feature = "bundled"))] +#[cfg(any( + feature = "backup", + feature = "blob", + feature = "session", + feature = "bundled" +))] impl<'a> DatabaseName<'a> { fn to_cstring(&self) -> Result { use self::DatabaseName::{Attached, Main, Temp};