mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-26 11:31:37 +08:00
Rename transaction mode
to behavior
to match SQLite docs
This commit is contained in:
parent
c8af7e4eb5
commit
68e9d81283
@ -15,7 +15,7 @@ use libc::{c_int, c_void, c_char};
|
|||||||
use types::{ToSql, FromSql};
|
use types::{ToSql, FromSql};
|
||||||
|
|
||||||
pub use transaction::{SqliteTransaction};
|
pub use transaction::{SqliteTransaction};
|
||||||
pub use transaction::{SqliteTransactionMode,
|
pub use transaction::{SqliteTransactionBehavior,
|
||||||
SqliteTransactionDeferred,
|
SqliteTransactionDeferred,
|
||||||
SqliteTransactionImmediate,
|
SqliteTransactionImmediate,
|
||||||
SqliteTransactionExclusive};
|
SqliteTransactionExclusive};
|
||||||
@ -68,9 +68,9 @@ impl SqliteConnection {
|
|||||||
SqliteTransaction::new(self, SqliteTransactionDeferred)
|
SqliteTransaction::new(self, SqliteTransactionDeferred)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn transaction_with_mode<'a>(&'a self, mode: SqliteTransactionMode)
|
pub fn transaction_with_behavior<'a>(&'a self, behavior: SqliteTransactionBehavior)
|
||||||
-> SqliteResult<SqliteTransaction<'a>> {
|
-> SqliteResult<SqliteTransaction<'a>> {
|
||||||
SqliteTransaction::new(self, mode)
|
SqliteTransaction::new(self, behavior)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn execute_batch(&self, sql: &str) -> SqliteResult<()> {
|
pub fn execute_batch(&self, sql: &str) -> SqliteResult<()> {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use {SqliteResult, SqliteConnection};
|
use {SqliteResult, SqliteConnection};
|
||||||
|
|
||||||
pub enum SqliteTransactionMode {
|
pub enum SqliteTransactionBehavior {
|
||||||
SqliteTransactionDeferred,
|
SqliteTransactionDeferred,
|
||||||
SqliteTransactionImmediate,
|
SqliteTransactionImmediate,
|
||||||
SqliteTransactionExclusive,
|
SqliteTransactionExclusive,
|
||||||
@ -15,8 +15,8 @@ pub struct SqliteTransaction<'conn> {
|
|||||||
|
|
||||||
impl<'conn> SqliteTransaction<'conn> {
|
impl<'conn> SqliteTransaction<'conn> {
|
||||||
pub fn new(conn: &SqliteConnection,
|
pub fn new(conn: &SqliteConnection,
|
||||||
mode: SqliteTransactionMode) -> SqliteResult<SqliteTransaction> {
|
behavior: SqliteTransactionBehavior) -> SqliteResult<SqliteTransaction> {
|
||||||
let query = match mode {
|
let query = match behavior {
|
||||||
SqliteTransactionDeferred => "BEGIN DEFERRED",
|
SqliteTransactionDeferred => "BEGIN DEFERRED",
|
||||||
SqliteTransactionImmediate => "BEGIN IMMEDIATE",
|
SqliteTransactionImmediate => "BEGIN IMMEDIATE",
|
||||||
SqliteTransactionExclusive => "BEGIN EXCLUSIVE",
|
SqliteTransactionExclusive => "BEGIN EXCLUSIVE",
|
||||||
|
Loading…
Reference in New Issue
Block a user