diff --git a/CHANGELOG.md b/CHANGELOG.md index 369a50109..f52dcee31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/GRDB/Core/Database.swift b/GRDB/Core/Database.swift index b9b24ee36..f5c4168e9 100644 --- a/GRDB/Core/Database.swift +++ b/GRDB/Core/Database.swift @@ -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 diff --git a/README.md b/README.md index 72b4aa27b..90da7de2c 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/TODO.md b/TODO.md index 818b1148b..ae412f882 100644 --- a/TODO.md +++ b/TODO.md @@ -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.