From 179f0da0e6c88c4e82addb264bb1d1aac661ebe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 27 Sep 2015 22:25:11 +0200 Subject: [PATCH] README.md --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 93ed032ec..1a4877682 100644 --- a/README.md +++ b/README.md @@ -944,13 +944,15 @@ public protocol DatabaseTransactionDelegate: class { Those four callbacks are all optional, and all invoked on the database queue. -The changes notified to `database(_:didChangeWithEvent:)` are not actually applied until `databaseDidCommit(_)` is called. On the other side, `databaseDidRollback(_)` confirms the invalidation of those changes: +Change notified to `database(_:didChangeWithEvent:)` are triggered by `INSERT`, `UPDATE` and `DELETE` statements, and also by `ON DELETE` and `ON UPDATE` actions associated to [foreign keys](https://www.sqlite.org/foreignkeys.html#fk_actions). + +Those changes are not actually applied until `databaseDidCommit(_)` is called. On the other side, `databaseDidRollback(_)` confirms their invalidation: ```swift try dbQueue.inTransaction do { db in try db.execute("INSERT ...") // Change callback try db.execute("UPDATE ...") // Change callback - return .Commit // Commit callback + return .Commit / .Rollback // Commit / Rollback callback } ``` @@ -963,6 +965,7 @@ try dbQueue.inDatabase do { db in } ``` + **Warning**: `database(_:didChangeWithEvent:)` and `databaseShouldCommit(_)` *must not* read or write to the database. This limitation does not apply to `databaseDidCommit(_)` and `databaseDidRollback(_)`.