From 350fd11fed963b73f8e4b0ec206c57e0f4c636fe Mon Sep 17 00:00:00 2001 From: John Gallagher Date: Mon, 1 Feb 2016 15:21:03 -0500 Subject: [PATCH 1/2] Add a `handle()` method to unsafely get the underlying SQLite connection. Doc comments suggest opening issues on rusqlite for any uses of `handle()`, as uses indicate areas where rusqlite insufficiently wraps SQLite. --- src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 7a11f64..6b52a95 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -494,6 +494,18 @@ impl Connection { self.db.borrow_mut().load_extension(dylib_path.as_ref(), entry_point) } + /// Get access to the underlying SQLite database connection handle. + /// + /// # Warning + /// + /// You should not need to use this function. If you do need to, please [open an issue + /// on the rusqlite repository](https://github.com/jgallagher/rusqlite/issues) and describe + /// your use case. This function is unsafe because it gives you raw access to the SQLite + /// connection, and what you do with it could impact the safety of this `Connection`. + pub unsafe fn handle(&self) -> *mut ffi::Struct_sqlite3 { + self.db.borrow().db() + } + fn decode_result(&self, code: c_int) -> Result<()> { self.db.borrow_mut().decode_result(code) } From d6d9fa9f6324500e765cff9ca28047577406f732 Mon Sep 17 00:00:00 2001 From: John Gallagher Date: Mon, 1 Feb 2016 15:23:05 -0500 Subject: [PATCH 2/2] Add handle() to Changelog --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index 40c1642..63828da 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,6 +7,7 @@ * Introduces `ZeroBlob` type under the `blob` module/feature exposing SQLite's zeroblob API. * Adds CI testing for Windows via AppVeyor. * Fixes a warning building libsqlite3-sys under Rust 1.6. +* Adds an unsafe `handle()` method to `Connection`. Please file an issue if you actually use it. # Version 0.6.0 (2015-12-17)