mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-25 04:07:47 +00:00
More transaction/savepoints documentation
This commit is contained in:
1 parent
75728418af
commit
a239e435a6
1 file changed
+3
-1
@@ -1053,7 +1053,7 @@ try dbQueue.inTransaction { db in
|
||||
}
|
||||
```
|
||||
|
||||
A ROLLBACK statement is issued if an error is thrown within the transaction block.
|
||||
The transaction is rollbacked if an error is thrown within the transaction body, and that error is rethrown by the inTransaction method.
|
||||
|
||||
If you want to insert a transaction between other database statements, you can use the Database.inTransaction() function:
|
||||
|
||||
@@ -1106,6 +1106,8 @@ try dbQueue.inTransaction { db in
|
||||
}
|
||||
```
|
||||
|
||||
The savepoint is rollbacked if an error is thrown within the savepoint body, and that error is rethrown by the inSavepoint method.
|
||||
|
||||
**Unlike transactions, savepoints can be nested.** They implicitly open a transaction if no one was opened when the savepoint begins. As such, they behave just like nested transactions. Yet the database changes are only committed to disk when the outermost savepoint is committed:
|
||||
|
||||
```swift
|
||||
|
||||
Reference in new issue
Block a user