diff --git a/src/sql.rs b/src/sql.rs index 9a3ab31a8..be0641228 100644 --- a/src/sql.rs +++ b/src/sql.rs @@ -115,11 +115,11 @@ impl Sql { fn with_conn(&self, g: G) -> Result where - G: FnOnce(&Connection) -> Result, + G: FnOnce(&mut Connection) -> Result, { let res = match &*self.pool.read().unwrap() { Some(pool) => { - let conn = pool.get()?; + let mut conn = pool.get()?; // Only one process can make changes to the database at one time. // busy_timeout defines, that if a second process wants write access, @@ -130,7 +130,7 @@ impl Sql { // (without a busy_timeout, sqlite3_step() would return SQLITE_BUSY _at once_) conn.busy_timeout(Duration::from_secs(10))?; - g(&conn) + g(&mut conn) } None => Err(Error::SqlNoConnection), };