diff --git a/Cargo.toml b/Cargo.toml index 9b0a6bb..b09f2b0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rusqlite" -version = "0.0.16" +version = "0.0.17" authors = ["John Gallagher "] description = "Ergonomic wrapper for SQLite" repository = "https://github.com/jgallagher/rusqlite" diff --git a/Changelog.md b/Changelog.md index 57f119c..2b53b9e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,9 @@ +# Version 0.0.17 (2015-04-03) + +* Publish version that builds on stable rust (beta). This version lives on the + `stable` branch. Development continues on `master` and still requires a nightly + version of Rust. + # Version 0.0.16 * Updates to track rustc nightly. diff --git a/src/lib.rs b/src/lib.rs index 5877d19..aa01314 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -47,15 +47,12 @@ //! } //! } //! ``` -#![feature(unique)] -#![cfg_attr(test, feature(test))] - extern crate libc; extern crate libsqlite3_sys as ffi; #[macro_use] extern crate bitflags; use std::mem; -use std::ptr::{self, Unique}; +use std::ptr; use std::fmt; use std::path::{Path}; use std::error; @@ -152,6 +149,8 @@ pub struct SqliteConnection { db: RefCell, } +unsafe impl Send for SqliteConnection {} + impl SqliteConnection { /// Open a new connection to a SQLite database. /// @@ -418,7 +417,7 @@ impl fmt::Debug for SqliteConnection { } struct InnerSqliteConnection { - db: Unique, + db: *mut ffi::Struct_sqlite3, } bitflags! { @@ -462,12 +461,12 @@ impl InnerSqliteConnection { ffi::sqlite3_close(db); return Err(e); } - Ok(InnerSqliteConnection{ db: Unique::new(db) }) + Ok(InnerSqliteConnection{ db: db }) } } fn db(&self) -> *mut ffi::Struct_sqlite3 { - unsafe {self.db.get() as *const _ as *mut _} + self.db } fn decode_result(&mut self, code: c_int) -> SqliteResult<()> { @@ -491,7 +490,7 @@ impl InnerSqliteConnection { fn close(&mut self) -> SqliteResult<()> { unsafe { let r = ffi::sqlite3_close(self.db()); - self.db = Unique::new(ptr::null_mut()); + self.db = ptr::null_mut(); self.decode_result(r) } } diff --git a/src/transaction.rs b/src/transaction.rs index a994532..1882539 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -158,7 +158,6 @@ impl<'conn> Drop for SqliteTransaction<'conn> { #[cfg(test)] mod test { - extern crate test; use SqliteConnection; fn checked_memory_handle() -> SqliteConnection { @@ -231,32 +230,4 @@ mod test { } assert_eq!(3i32, db.query_row("SELECT SUM(x) FROM foo", &[], |r| r.get(0))); } - - #[bench] - fn test_no_transaction_insert(bencher: &mut test::Bencher) { - let db = checked_memory_handle(); - - let mut stmt = db.prepare("INSERT INTO foo VALUES(1)").unwrap(); - - bencher.iter(|| { - for _ in 0i32 .. 1000 { - stmt.execute(&[]).unwrap(); - } - }) - } - - #[bench] - fn test_transaction_insert(bencher: &mut test::Bencher) { - let db = checked_memory_handle(); - - let mut stmt = db.prepare("INSERT INTO foo VALUES(1)").unwrap(); - - bencher.iter(|| { - let mut tx = db.transaction().unwrap(); - tx.set_commit(); - for _ in 0i32 .. 1000 { - stmt.execute(&[]).unwrap(); - } - }) - } }