From af12bbfa0e5ed52fb880cbf0b2a5517820cae610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sat, 4 Jul 2015 19:40:24 +0200 Subject: [PATCH] README.md --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 325820f1f..3d3d62dd9 100644 --- a/README.md +++ b/README.md @@ -133,18 +133,18 @@ Extract row values by index or column name: ```swift dbQueue.inDatabase { db in - for row in db.fetchRows("SELECT * FROM persons") { + for row in db.fetchRows("SELECT ...") { - // Leverage Swift type inference - let name: String? = row.value(atIndex: 1) + let name: String? = row.value(atIndex: 0) + let name: String? = row.value(named: "name") // Force unwrap when column is NOT NULL let id: Int64 = row.value(named: "id")! - // Both Int and Int64 are supported - let age: Int? = row.value(named: "age") - - print("id: \(id), name: \(name), age: \(age)") + // Use Swift type inference to fetch the data type you need: + let bookCount: Int = row.value(named: "bookCount")! + let bookCount64: Int64 = row.value(named: "bookCount")! + let hasBooks: Bool = row.value(named: "bookCount")! } }