From fa04627ece442551f477c87f24c9e4fd5cefe81f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Wed, 2 May 2018 19:57:36 +0200 Subject: [PATCH] WIP: GRDB2MigrationGuide.md --- Documentation/GRDB2MigrationGuide.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Documentation/GRDB2MigrationGuide.md b/Documentation/GRDB2MigrationGuide.md index 50dc84248..7ff4edbe6 100644 --- a/Documentation/GRDB2MigrationGuide.md +++ b/Documentation/GRDB2MigrationGuide.md @@ -124,10 +124,10 @@ That is because the library requires Swift 4.1, which ships with Xcode 9.3, unab ## If You Use Database Queues -With GRDB 2, you used to access the database through the `inDatabase` or `inTransaction` DatabaseQueue methods: +With GRDB 2, you used to access the database through the `inDatabase` or `inTransaction` [DatabaseQueue] methods: ```swift -// Typical GRDB 2 +// GRDB 2 let players = try dbQueue.inDatabase { db in try Player.fetchAll(db) } @@ -166,13 +166,13 @@ let balance = try dbQueue.write { db in } ``` -The purpose of the new `read` and `write` methods is to soothe the "transaction mental load" of GRDB 2, inherited from FMDB. All developers can *forget* to open transactions, with the unfortunate consequence that the database may end up containing inconsistent values. Experienced developers may *wonder* whether they should open transactions or not, even when this doesn't matter a lot. +The purpose of the new `read` and `write` methods is to soothe the "transaction mental load" of GRDB 2, a legacy of the [FMDB] heritage. All developers can *forget* to open transactions, with the unfortunate consequence that the database may end up containing inconsistent values. Experienced developers may *wonder* whether they should open transactions or not, even when this doesn't matter a lot. With GRDB 3, use `read` when you need to read values. It's impossible to write within a `read` block, which means that you can be sure that no unwanted side effect can happen. When you need to write, use `write`: your database changes are automatically wrapped in a transaction, with the guarantee that all changes are applied, or, should any error happen, none at all. -Of course, precise transaction handling is still possible. Check the updated [Transactions and Savepoints] chapter. +Of course, precise transaction handling sometimes matter. Check the updated [Transactions and Savepoints] chapter. ## If You Use Database Pools @@ -189,3 +189,5 @@ Of course, precise transaction handling is still possible. Check the updated [Tr [DatabaseMigrator]: ../README.md#migrations [database observation tools]: ../README.md#database-changes-observation [Transactions and Savepoints]: ../README.md#transactions-and-savepoints +[DatabaseQueue]: ../README.md#database-queues +[FMDB]: http://github.com/ccgus/fmdb \ No newline at end of file