mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-24 04:07:47 +00:00
Swift2.2
This commit is contained in:
1 parent
056eb22c7a
commit
d74cf435ed
4 files changed
+8
-8
No files matched your search
@@ -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 {
|
||||
|
||||
+2
-2
@@ -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<Row, String> {
|
||||
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<Row, DatabaseValue> {
|
||||
return LazyMapCollection(self) { $0.1 }
|
||||
return lazy.map { $0.1 }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 = []
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user