From ebff14adacabb69a0370e2b0c292fa2dcac03a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Fri, 6 Jan 2017 08:24:50 +0100 Subject: [PATCH] Cleanup --- GRDB/Record/TableMapping.swift | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/GRDB/Record/TableMapping.swift b/GRDB/Record/TableMapping.swift index acc91fcdf..3f847d3cc 100644 --- a/GRDB/Record/TableMapping.swift +++ b/GRDB/Record/TableMapping.swift @@ -239,16 +239,13 @@ extension TableMapping { /// /// - throws: A DatabaseError if table does not exist. static func primaryKeyFunction(_ db: Database) throws -> (Row) -> [String: DatabaseValue] { - let columns: [String] if let primaryKey = try db.primaryKey(databaseTableName) { - columns = primaryKey.columns + let columns = primaryKey.columns + return { row in Dictionary(keys: columns) { row.value(named: $0) } } } else if selectsRowID { - columns = ["rowid"] + return { row in ["rowid": row.value(named: "rowid")] } } else { - columns = [] - } - return { row in - return Dictionary(keys: columns) { row.value(named: $0) } + return { _ in [:] } } }