From 05b03ae2cec9f9f630095d5c0e89682da334f4a4 Mon Sep 17 00:00:00 2001 From: John Gallagher Date: Tue, 23 Dec 2014 12:26:57 -0500 Subject: [PATCH] Set default busy timeout to 5 seconds --- src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 150f642..c263f2a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -320,12 +320,19 @@ impl InnerSqliteConnection { SqliteError{ code: r, message: ffi::code_to_str(r).to_string() } } else { + let e = SqliteError::from_handle(db, r); ffi::sqlite3_close(db); - SqliteError::from_handle(db, r) + e }; return Err(e); } + let r = ffi::sqlite3_busy_timeout(db, 5000); + if r != ffi::SQLITE_OK { + let e = SqliteError::from_handle(db, r); + ffi::sqlite3_close(db); + return Err(e); + } Ok(InnerSqliteConnection{ db: db }) }) }