Rename transaction mode to behavior to match SQLite docs

This commit is contained in:
John Gallagher 2014-10-23 17:57:02 -04:00
parent c8af7e4eb5
commit 68e9d81283
2 changed files with 6 additions and 6 deletions

View File

@ -15,7 +15,7 @@ use libc::{c_int, c_void, c_char};
use types::{ToSql, FromSql};
pub use transaction::{SqliteTransaction};
pub use transaction::{SqliteTransactionMode,
pub use transaction::{SqliteTransactionBehavior,
SqliteTransactionDeferred,
SqliteTransactionImmediate,
SqliteTransactionExclusive};
@ -68,9 +68,9 @@ impl SqliteConnection {
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>> {
SqliteTransaction::new(self, mode)
SqliteTransaction::new(self, behavior)
}
pub fn execute_batch(&self, sql: &str) -> SqliteResult<()> {

View File

@ -1,6 +1,6 @@
use {SqliteResult, SqliteConnection};
pub enum SqliteTransactionMode {
pub enum SqliteTransactionBehavior {
SqliteTransactionDeferred,
SqliteTransactionImmediate,
SqliteTransactionExclusive,
@ -15,8 +15,8 @@ pub struct SqliteTransaction<'conn> {
impl<'conn> SqliteTransaction<'conn> {
pub fn new(conn: &SqliteConnection,
mode: SqliteTransactionMode) -> SqliteResult<SqliteTransaction> {
let query = match mode {
behavior: SqliteTransactionBehavior) -> SqliteResult<SqliteTransaction> {
let query = match behavior {
SqliteTransactionDeferred => "BEGIN DEFERRED",
SqliteTransactionImmediate => "BEGIN IMMEDIATE",
SqliteTransactionExclusive => "BEGIN EXCLUSIVE",