From 8cd824f66f4e24b61ba4f670314eed30d4b8b6bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Fri, 2 Dec 2016 19:43:30 +0100 Subject: [PATCH] Documentation --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2a4a24953..faf1c9261 100644 --- a/README.md +++ b/README.md @@ -4877,7 +4877,7 @@ try dbPool.write { db in try Person(...).insert(db) // Read the number of persons. The writer queue is still locked :-( - let count = Person.fetchCount(db) + let count = try Person.fetchCount(db) } ``` @@ -4891,7 +4891,7 @@ try dbPool.write { db in } try dbPool.read { db in // Read some random value :-( - let count = Person.fetchCount(db) + let count = try Person.fetchCount(db) } The correct solution is the `readFromCurrentState` method, which must be called from within a write block: @@ -4904,7 +4904,7 @@ try dbPool.write { db in try dbPool.readFromCurrentState { db // Read the number of persons. The writer queue has been unlocked :-) - let count = Person.fetchCount(db) + let count = try Person.fetchCount(db) } } ```