mirror of
https://github.com/isar/rusqlite.git
synced 2026-03-24 06:59:13 +08:00
Make the creation of transactions and savepoints take &mut self.
Transactions in SQLite are nested, but the previous API allowed rusqlite transaction wrappers to be created as "siblings". This resulted in unexpected (and usually wrong) behavior.
This commit is contained in:
@@ -237,7 +237,7 @@ impl Connection {
|
||||
/// # Failure
|
||||
///
|
||||
/// Will return `Err` if the underlying SQLite call fails.
|
||||
pub fn transaction(&self) -> Result<Transaction> {
|
||||
pub fn transaction(&mut self) -> Result<Transaction> {
|
||||
Transaction::new(self, TransactionBehavior::Deferred)
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ impl Connection {
|
||||
/// # Failure
|
||||
///
|
||||
/// Will return `Err` if the underlying SQLite call fails.
|
||||
pub fn transaction_with_behavior(&self, behavior: TransactionBehavior) -> Result<Transaction> {
|
||||
pub fn transaction_with_behavior(&mut self, behavior: TransactionBehavior) -> Result<Transaction> {
|
||||
Transaction::new(self, behavior)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user