mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 00:39:20 +08:00
BREAKING CHANGE: Remove common prefix on TransactionBehavior case names.
This commit is contained in:
parent
b1cde705be
commit
6bcc3edccd
@ -1,5 +1,9 @@
|
||||
# Version UPCOMING (TBD)
|
||||
|
||||
* BREAKING CHANGE: `SqliteTransactionDeferred`, `SqliteTransactionImmediate`, and
|
||||
`SqliteTransactionExclusive` are no longer exported. Instead, use
|
||||
`TransactionBehavior::Deferred`, `TransactionBehavior::Immediate`, and
|
||||
`TransactionBehavior::Exclusive`.
|
||||
* Removed `Sqlite` prefix on many types:
|
||||
* `SqliteConnection` is now `Connection`
|
||||
* `SqliteError` is now `Error`
|
||||
|
@ -74,9 +74,7 @@ use libc::{c_int, c_void, c_char};
|
||||
|
||||
use types::{ToSql, FromSql};
|
||||
|
||||
pub use transaction::{SqliteTransaction, Transaction};
|
||||
pub use transaction::{TransactionBehavior, TransactionDeferred,
|
||||
TransactionImmediate, TransactionExclusive};
|
||||
pub use transaction::{SqliteTransaction, Transaction, TransactionBehavior};
|
||||
|
||||
#[cfg(feature = "load_extension")]
|
||||
pub use load_extension_guard::{SqliteLoadExtensionGuard, LoadExtensionGuard};
|
||||
@ -286,7 +284,7 @@ impl Connection {
|
||||
///
|
||||
/// Will return `Err` if the underlying SQLite call fails.
|
||||
pub fn transaction<'a>(&'a self) -> Result<Transaction<'a>> {
|
||||
Transaction::new(self, TransactionDeferred)
|
||||
Transaction::new(self, TransactionBehavior::Deferred)
|
||||
}
|
||||
|
||||
/// Begin a new transaction with a specified behavior.
|
||||
|
@ -1,7 +1,5 @@
|
||||
use {Result, Connection};
|
||||
|
||||
pub use TransactionBehavior::{TransactionDeferred, TransactionImmediate, TransactionExclusive};
|
||||
|
||||
/// Old name for `TransactionBehavior`. `SqliteTransactionBehavior` is deprecated.
|
||||
pub type SqliteTransactionBehavior = TransactionBehavior;
|
||||
|
||||
@ -9,9 +7,9 @@ pub type SqliteTransactionBehavior = TransactionBehavior;
|
||||
/// TRANSACTION](http://www.sqlite.org/lang_transaction.html) for details.
|
||||
#[derive(Copy,Clone)]
|
||||
pub enum TransactionBehavior {
|
||||
TransactionDeferred,
|
||||
TransactionImmediate,
|
||||
TransactionExclusive,
|
||||
Deferred,
|
||||
Immediate,
|
||||
Exclusive,
|
||||
}
|
||||
|
||||
/// Old name for `Transaction`. `SqliteTransaction` is deprecated.
|
||||
@ -53,9 +51,9 @@ impl<'conn> Transaction<'conn> {
|
||||
behavior: TransactionBehavior)
|
||||
-> Result<Transaction> {
|
||||
let query = match behavior {
|
||||
TransactionDeferred => "BEGIN DEFERRED",
|
||||
TransactionImmediate => "BEGIN IMMEDIATE",
|
||||
TransactionExclusive => "BEGIN EXCLUSIVE",
|
||||
TransactionBehavior::Deferred => "BEGIN DEFERRED",
|
||||
TransactionBehavior::Immediate => "BEGIN IMMEDIATE",
|
||||
TransactionBehavior::Exclusive => "BEGIN EXCLUSIVE",
|
||||
};
|
||||
conn.execute_batch(query).map(|_| {
|
||||
Transaction {
|
||||
|
Loading…
Reference in New Issue
Block a user