diff --git a/src/connection.rs b/src/connection.rs index b577da6..3c12d09 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -14,18 +14,18 @@ pub struct Connection { /// A set of connection flags. #[derive(Clone, Copy, Debug)] -pub struct ConnectionFlags(c_int); +pub struct OpenFlags(c_int); unsafe impl Send for Connection {} impl Connection { /// Open a read-write connection to a new or existing database. pub fn open>(path: T) -> Result { - Connection::open_with_flags(path, ConnectionFlags::new().set_create().set_read_write()) + Connection::open_with_flags(path, OpenFlags::new().set_create().set_read_write()) } - /// Open a database connection with a specific set of connection flags. - pub fn open_with_flags>(path: T, flags: ConnectionFlags) -> Result { + /// Open a database connection with a specific set of flags. + pub fn open_with_flags>(path: T, flags: OpenFlags) -> Result { let mut raw = 0 as *mut _; unsafe { ok!(ffi::sqlite3_open_v2( @@ -157,11 +157,11 @@ impl Drop for Connection { } } -impl ConnectionFlags { +impl OpenFlags { /// Create a set of connection flags. #[inline] pub fn new() -> Self { - ConnectionFlags(0) + OpenFlags(0) } /// Create the database if it does not already exist. diff --git a/src/lib.rs b/src/lib.rs index 70b9dd6..fd3ebbf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -294,7 +294,7 @@ mod cursor; mod statement; pub use connection::Connection; -pub use connection::ConnectionFlags; +pub use connection::OpenFlags; pub use cursor::Cursor; pub use statement::{Bindable, Readable, State, Statement}; @@ -304,12 +304,9 @@ pub fn open>(path: T) -> Result { Connection::open(path) } -/// Open a connection to a database with a specific set of connection flags. +/// Open a connection to a database with a specific set of flags. #[inline] -pub fn open_with_flags>( - path: T, - flags: ConnectionFlags, -) -> Result { +pub fn open_with_flags>(path: T, flags: OpenFlags) -> Result { Connection::open_with_flags(path, flags) } diff --git a/tests/lib.rs b/tests/lib.rs index 9e46bee..212edfa 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -1,7 +1,7 @@ extern crate sqlite; extern crate temporary; -use sqlite::{Connection, ConnectionFlags, State, Type, Value}; +use sqlite::{Connection, OpenFlags, State, Type, Value}; use std::path::Path; macro_rules! ok(($result:expr) => ($result.unwrap())); @@ -48,10 +48,10 @@ fn connection_open_with_flags() { let path = directory.path().join("database.sqlite3"); setup_users(&path); - let flags = ConnectionFlags::new().set_read_only(); + let flags = OpenFlags::new().set_read_only(); let connection = ok!(sqlite::open_with_flags(path, flags)); match connection.execute("INSERT INTO users VALUES (2, 'Bob', NULL, NULL)") { - Err(_) => {}, + Err(_) => {} _ => unreachable!(), } }