Struct sqlite3::core::DatabaseConnection
[−]
[src]
pub struct DatabaseConnection { /* fields omitted */ }
A connection to a sqlite3 database.
Methods
impl DatabaseConnection
[src]
fn new<A: Access>(access: A) -> SqliteResult<DatabaseConnection>
Given explicit access to a database, attempt to connect to it.
Note SqliteError
code is accompanied by (copy) of sqlite3_errmsg()
.
fn ignore_detail(&mut self)
Opt out of copies of error message details.
fn in_memory() -> SqliteResult<DatabaseConnection>
Create connection to an in-memory database.
- TODO: integrate sqlite3_errmsg()
fn prepare<'db: 'st, 'st>(
&'db self,
sql: &str
) -> SqliteResult<PreparedStatement>
&'db self,
sql: &str
) -> SqliteResult<PreparedStatement>
Prepare/compile an SQL statement.
fn prepare_with_offset<'db: 'st, 'st>(
&'db self,
sql: &str
) -> SqliteResult<(PreparedStatement, usize)>
&'db self,
sql: &str
) -> SqliteResult<(PreparedStatement, usize)>
Prepare/compile an SQL statement and give offset to remaining text.
TODO: give caller a safe way to use the offset. Perhaps return a &'x str?
fn errmsg(&mut self) -> String
Return a copy of the latest error message.
Return ""
in case of ill-formed utf-8 or null.
TODO: represent error state in types: "If a prior API call failed but the most recent API call succeeded, the return value from sqlite3_errcode() is undefined."
cf ffi::sqlite3_errmsg
.
fn exec(&mut self, sql: &str) -> SqliteResult<()>
fn changes(&self) -> u64
Return the number of database rows that were changed or inserted or deleted by the most recently completed SQL statement.
cf sqlite3_changes
.
fn busy_timeout(&mut self, d: Duration) -> SqliteResult<()>
Set a busy timeout and clear any previously set handler. If duration is zero or negative, turns off busy handler.
fn last_insert_rowid(&self) -> i64
Return the rowid of the most recent successful INSERT into a rowid table or virtual table.
cf sqlite3_last_insert_rowid
unsafe fn expose(&mut self) -> *mut sqlite3
Expose the underlying sqlite3
struct pointer for use
with the ffi
module.