From d74cf435ede9d955a3de76e6f754bb595efdd00b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Wed, 10 Feb 2016 19:09:28 +0100 Subject: [PATCH] Swift2.2 --- GRDB/Core/Database.swift | 2 +- GRDB/Core/Row.swift | 4 ++-- GRDB/Record/Record.swift | 2 +- .../TransactionObserver/TransactionObserverTests.swift | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/GRDB/Core/Database.swift b/GRDB/Core/Database.swift index 135e6a2f2..c156e6662 100644 --- a/GRDB/Core/Database.swift +++ b/GRDB/Core/Database.swift @@ -49,7 +49,7 @@ public final class Database { self.configuration = configuration // See https://www.sqlite.org/c3ref/open.html - var sqliteConnection = SQLiteConnection() + var sqliteConnection: SQLiteConnection = nil let code = sqlite3_open_v2(path, &sqliteConnection, configuration.sqliteOpenFlags, nil) self.sqliteConnection = sqliteConnection guard code == SQLITE_OK else { diff --git a/GRDB/Core/Row.swift b/GRDB/Core/Row.swift index fc7399b5c..e071f3788 100644 --- a/GRDB/Core/Row.swift +++ b/GRDB/Core/Row.swift @@ -63,7 +63,7 @@ extension Row { /// Columns appear in the same order as they occur as the `.0` member /// of column-value pairs in `self`. public var columnNames: LazyMapCollection { - return LazyMapCollection(self) { $0.0 } + return lazy.map { $0.0 } } /// Returns true if and only if the row has that column. @@ -392,7 +392,7 @@ extension Row { /// Values appear in the same order as they occur as the `.1` member /// of column-value pairs in `self`. public var databaseValues: LazyMapCollection { - return LazyMapCollection(self) { $0.1 } + return lazy.map { $0.1 } } } diff --git a/GRDB/Record/Record.swift b/GRDB/Record/Record.swift index fd58ba397..8bb4c1b38 100644 --- a/GRDB/Record/Record.swift +++ b/GRDB/Record/Record.swift @@ -147,7 +147,7 @@ public class Record : RowConvertible, TableMapping, Persistable { private func generatePersistentChangedValues() -> AnyGenerator<(column: String, old: DatabaseValue?)> { let oldRow = referenceRow var newValueGenerator = persistentDictionary.generate() - return anyGenerator { + return AnyGenerator { // Loop until we find a change, or exhaust columns: while let (column, newValue) = newValueGenerator.next() { let new = newValue?.databaseValue ?? .Null diff --git a/Tests/Public/Core/TransactionObserver/TransactionObserverTests.swift b/Tests/Public/Core/TransactionObserver/TransactionObserverTests.swift index da2d83a70..02b3b184a 100644 --- a/Tests/Public/Core/TransactionObserver/TransactionObserverTests.swift +++ b/Tests/Public/Core/TransactionObserver/TransactionObserverTests.swift @@ -30,25 +30,25 @@ class TransactionObserver : TransactionObserverType { } func databaseDidChangeWithEvent(event: DatabaseEvent) { - didChangeCount++ + didChangeCount += 1 events.append(event) } func databaseWillCommit() throws { - willCommitCount++ + willCommitCount += 1 if let commitError = commitError { throw commitError } } func databaseDidCommit(db: Database) { - didCommitCount++ + didCommitCount += 1 lastCommittedEvents = events events = [] } func databaseDidRollback(db: Database) { - didRollbackCount++ + didRollbackCount += 1 lastCommittedEvents = [] events = [] }