This commit is contained in:
Gwendal Roué committed 2016-02-10 19:09:28 +01:00
1 parent 056eb22c7a
commit d74cf435ed
4 files changed
+8 -8

No files matched your search

+1 -1
View File
@@ -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
View File
@@ -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 }
}
}
+1 -1
View File
@@ -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 = []
}