TransactionObserverType methods are no longer optional.

This commit is contained in:
Gwendal Roué committed 2015-11-05 14:37:39 +01:00
1 parent 0f698e1306
commit b7147ba64c
4 files changed
+13 -18

No files matched your search

+7
View File
@@ -1,6 +1,13 @@
Release Notes
=============
## Next Release
**Breaking Change**
- The methods of protocol `TransactionObserverType` are no longer optional.
## 0.27.0
Released November 4, 2015
-15
View File
@@ -636,21 +636,6 @@ public protocol TransactionObserverType : class {
func databaseDidRollback(db: Database)
}
/// Default implementations for TransactionObserverType methods.
public extension TransactionObserverType {
/// Default implementation does nothing.
func databaseDidChangeWithEvent(event: DatabaseEvent) { }
/// Default implementation does nothing.
func databaseWillCommit() throws { }
/// Default implementation does nothing.
func databaseDidCommit(db: Database) { }
/// Default implementation does nothing.
func databaseDidRollback(db: Database) { }
}
// =============================================================================
// MARK: - DatabaseEvent
+6 -2
View File
@@ -917,7 +917,7 @@ See [Column Values](#column-values) and [Value Queries](#value-queries) for more
**Prepared Statements** let you prepare an SQL query and execute it later, several times if you need, with different arguments.
There are two kinds to prepared statements: **select statements**, and **update statements**:
There are two kinds of prepared statements: **select statements**, and **update statements**:
```swift
try dbQueue.inTransaction { db in
@@ -1229,7 +1229,7 @@ config.transactionObserver = MyObserver()
let dbQueue = try DatabaseQueue(path: databasePath, configuration: config)
```
All protocol callbacks are optional, and invoked on the database queue.
Protocol callbacks are all invoked on the database queue.
**All database changes are notified** to databaseDidChangeWithEvent, inserts, updates and deletes, including indirect ones triggered by ON DELETE and ON UPDATE actions associated to [foreign keys](https://www.sqlite.org/foreignkeys.html#fk_actions).
@@ -1291,6 +1291,10 @@ class TableChangeObserver : NSObject, TransactionObserverType {
changedTableNames.insert(event.tableName)
}
func databaseWillCommit() throws {
// Let go
}
func databaseDidCommit(db: Database) {
// Extract the names of changed tables, and reset until next
// database event:
-1
View File
@@ -3,7 +3,6 @@
- [ ] Study custom SQL functions
- [ ] Study custom collations
- [ ] `IN (?)` sql snippet, with an array argument.
- [ ] TransactionObserverType methods should not be optional. Non-optional methods force the user to adapt his code if the protocol eventually evolves. Requires TableChangeObserver sample code update.
- [ ] Write sample code around NSFetchedResultsController: fetch and output a list of TableView sections & row differences.