You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: GRDB/Documentation.docc/Extension/TransactionObserver.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,7 +97,7 @@ do {
97
97
98
98
**Transaction observers can choose the database changes they are interested in.**
99
99
100
-
The``observes(eventsOfKind:)`` method filters events that are notified to ``databaseDidChange(with:)``. It is the most efficient and recommended change filtering technique, because it is only called once before a database query is executed, and can completely disable change tracking:
100
+
By default, the``observes(eventsOfKind:)`` method filters events that are notified to ``databaseDidChange(with:)``. It is the most efficient and recommended change filtering technique, because it is only called once before a database query is executed, and can completely disable change tracking:
101
101
102
102
```swift
103
103
// Calls `observes(eventsOfKind:)` once.
@@ -125,6 +125,8 @@ class PlayerObserver: TransactionObserver {
125
125
126
126
When the `observes(eventsOfKind:)` method returns false for all event kinds, the observer is still notified of transactions.
127
127
128
+
The filtering performed by ``observes(eventsOfKind:)`` makes a transaction observer unaware of changes performed by SQLite statements that are not a `DELETE`, `INSERT` or `UPDATE` statement compiled and executed by GRDB. You can lift this limitation with the ``TransactionObserver/databaseEventObservationStrategy``.
129
+
128
130
## Observation Extent
129
131
130
132
**You can specify how long an observer is notified of database changes and transactions.**
@@ -232,7 +234,7 @@ The changes and transactions that are not automatically notified to transaction
232
234
233
235
-Read-only transactions.
234
236
-Changesand transactions performed by external database connections.
235
-
-Changes performed by SQLite statements that are notboth compiled and executed throughGRDBAPIs.
237
+
-Changes performed by SQLite statements that are nota `DELETE`, `INSERT`or`UPDATE` statement compiled and executed byGRDB(this limitation can be lifted, in your custom `TransactionObserver` type, with ``TransactionObserver/databaseEventObservationStrategy``).
236
238
-Changes to the database schema, changes to internal system tables such as `sqlite_master`.
237
239
-Changes to [`WITHOUT ROWID`](https://www.sqlite.org/withoutrowid.html) tables.
238
240
-The deletion of duplicate rows triggered by [`ON CONFLICT REPLACE`](https://www.sqlite.org/lang_conflict.html) clauses (this last exception might change in a future release of SQLite).
0 commit comments