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