mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-22 16:29:20 +08:00
Merge pull request #6 from jgallagher/update-for-latest-rust
Update for latest rust; add default busy timeout
This commit is contained in:
commit
52aeb19246
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "rusqlite"
|
||||
version = "0.0.2"
|
||||
version = "0.0.3"
|
||||
authors = ["John Gallagher <jgallagher@bignerdranch.com>"]
|
||||
description = "Ergonomic wrapper for SQLite"
|
||||
homepage = "https://github.com/jgallagher/rusqlite"
|
||||
|
@ -1,3 +1,8 @@
|
||||
# Version 0.0.3 (2014-12-23)
|
||||
|
||||
* Updates to track latest rustc changes.
|
||||
* Add call to `sqlite3_busy_timeout`.
|
||||
|
||||
# Version 0.0.2 (2014-12-04)
|
||||
|
||||
* Remove use of now-deprecated `std::vec::raw::from_buf`.
|
||||
|
1333
src/ffi/bindgen.rs
1333
src/ffi/bindgen.rs
File diff suppressed because it is too large
Load Diff
@ -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 })
|
||||
})
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ pub use SqliteTransactionBehavior::{
|
||||
|
||||
/// Options for transaction behavior. See [BEGIN
|
||||
/// TRANSACTION](http://www.sqlite.org/lang_transaction.html) for details.
|
||||
#[deriving(Copy)]
|
||||
pub enum SqliteTransactionBehavior {
|
||||
SqliteTransactionDeferred,
|
||||
SqliteTransactionImmediate,
|
||||
|
17
src/types.rs
17
src/types.rs
@ -80,11 +80,11 @@ macro_rules! raw_to_impl(
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
raw_to_impl!(c_int, sqlite3_bind_int)
|
||||
raw_to_impl!(i64, sqlite3_bind_int64)
|
||||
raw_to_impl!(c_double, sqlite3_bind_double)
|
||||
raw_to_impl!(c_int, sqlite3_bind_int);
|
||||
raw_to_impl!(i64, sqlite3_bind_int64);
|
||||
raw_to_impl!(c_double, sqlite3_bind_double);
|
||||
|
||||
impl<'a> ToSql for &'a str {
|
||||
unsafe fn bind_parameter(&self, stmt: *mut ffi::sqlite3_stmt, col: c_int) -> c_int {
|
||||
@ -141,6 +141,7 @@ impl<T: ToSql> ToSql for Option<T> {
|
||||
/// conn.execute("INSERT INTO people (name) VALUES (?)", &[&Null])
|
||||
/// }
|
||||
/// ```
|
||||
#[deriving(Copy)]
|
||||
pub struct Null;
|
||||
|
||||
impl ToSql for Null {
|
||||
@ -157,11 +158,11 @@ macro_rules! raw_from_impl(
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
raw_from_impl!(c_int, sqlite3_column_int)
|
||||
raw_from_impl!(i64, sqlite3_column_int64)
|
||||
raw_from_impl!(c_double, sqlite3_column_double)
|
||||
raw_from_impl!(c_int, sqlite3_column_int);
|
||||
raw_from_impl!(i64, sqlite3_column_int64);
|
||||
raw_from_impl!(c_double, sqlite3_column_double);
|
||||
|
||||
impl FromSql for String {
|
||||
unsafe fn column_result(stmt: *mut ffi::sqlite3_stmt, col: c_int) -> SqliteResult<String> {
|
||||
|
Loading…
Reference in New Issue
Block a user