From 390bc93e54afadd5978ce39bccafc18003a42bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sat, 12 Mar 2016 12:43:42 +0100 Subject: [PATCH] README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d008a4a1..a586430d3 100644 --- a/README.md +++ b/README.md @@ -1774,12 +1774,16 @@ For an efficient algorithm which synchronizes the content of a database table wi **The query interface lets you write pure Swift instead of SQL:** ```swift +let redWineCount = Wine.filter(color == .Red).fetchCount(db) let wines = Wine.filter(origin == "Burgundy").order(price).fetchAll(db) ``` -Please bear in mind that the query interface can not generate all possible SQL queries. You may also *prefer* writing SQL: +Please bear in mind that the query interface can not generate all possible SQL queries. You may also *prefer* writing SQL, and this is just OK: ```swift +let redWineCount = Int.fetchOne(db, + "SELECT COUNT(*) FROM wines WHERE color = ?", + arguments [Color.Red])! let wines = Wine.fetchAll(db, "SELECT * FROM wines WHERE origin = ? ORDER BY price", arguments: ["Burgundy"])