Remove Row.databaseValue(atIndex:) and Row.databaseValue(named:)

This commit is contained in:
Gwendal Roué committed 2016-09-16 05:58:17 +02:00
1 parent f5cb34f506
commit 4a1706ede6
11 files changed
+57 -78

No files matched your search

-20
View File
@@ -434,26 +434,6 @@ extension Row {
public var databaseValues: LazyMapCollection<Row, DatabaseValue> {
return lazy.map { $0.1 }
}
/// Returns the `DatabaseValue` at given index.
///
/// Indexes span from 0 for the leftmost column to (row.count - 1) for the
/// righmost column.
@warn_unused_result
public func databaseValue(atIndex index: Int) -> DatabaseValue {
return value(atIndex: index)
}
/// Returns the `DatabaseValue` at given column.
///
/// Column name lookup is case-insensitive, and when several columns have
/// the same name, the leftmost column is considered.
///
/// The result is nil if the row does not contain the column.
@warn_unused_result
public func databaseValue(named columnName: String) -> DatabaseValue? {
return value(named: columnName)
}
}
extension Row {
+1 -1
View File
@@ -305,7 +305,7 @@ struct AdapterRowImpl : RowImpl {
}
func databaseValue(atIndex index: Int) -> DatabaseValue {
return baseRow.databaseValue(atIndex: concreteColumnMapping.baseColumIndex(adaptedIndex: index))
return baseRow.value(atIndex: concreteColumnMapping.baseColumIndex(adaptedIndex: index))
}
func dataNoCopy(atIndex index:Int) -> NSData? {
+2 -2
View File
@@ -792,7 +792,7 @@ private func databaseEventFilter(observedTables: [String: Set<String>]) -> (Data
func changedValues(from oldRow: Row, to newRow: Row) -> [String: DatabaseValue] {
var changedValues: [String: DatabaseValue] = [:]
for (column, newValue) in newRow {
let oldValue = oldRow.databaseValue(named: column)
let oldValue: DatabaseValue? = oldRow.value(named: column)
if newValue != oldValue {
changedValues[column] = oldValue
}
@@ -1007,7 +1007,7 @@ private func ==<T>(lhs: Item<T>, rhs: Item<T>) -> Bool {
func makePrimaryKeyFunction(db: Database, tableName: String) throws -> (Row) -> [String: DatabaseValue] {
let columns = try db.primaryKey(tableName)?.columns ?? []
return { row in
return Dictionary<String, DatabaseValue>(keys: columns) { row.databaseValue(named: $0)! }
return Dictionary<String, DatabaseValue>(keys: columns) { row.value(named: $0) }
}
}
+1 -1
View File
@@ -171,7 +171,7 @@ public class Record : RowConvertible, TableMapping, Persistable {
// Loop until we find a change, or exhaust columns:
while let (column, newValue) = newValueGenerator.next() {
let new = newValue?.databaseValue ?? .Null
guard let old = oldRow?.databaseValue(named: column) else {
guard let oldRow = oldRow, let old: DatabaseValue = oldRow.value(named: column) else {
return (column: column, old: nil)
}
if new != old {
+11 -12
View File
@@ -238,7 +238,7 @@ pod 'GRDB.swift', :git => 'git@github.com:groue/GRDB.swift', :branch => 'Swift2.
To use GRDB.swift with Carthage, specify in your Cartfile:
```
github "groue/GRDB.swift"
github "groue/GRDB.swift" "Swift2.3"
```
> :point_up: **Note**: [custom SQLite builds](#custom-sqlite-builds) are not available via Carthage.
@@ -256,7 +256,7 @@ See [GRDBDemoiOS](DemoApps/GRDBDemoiOS) for an example of such integration.
#### Custom SQLite builds
**By default, GRDB uses the SQLite library that ships with the operating system.** You can build GRDB with custom SQLite sources and options, through [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfalling/SQLiteLib). See [installation instructions](SQLiteCustom/README.md).
**By default, GRDB uses the SQLite library that ships with the operating system.** You can build GRDB with custom SQLite sources and options, through [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfalling/SQLiteLib). The current SQLite version is 3.14.1. See [installation instructions](SQLiteCustom/README.md).
Database Connections
@@ -729,8 +729,8 @@ Generally speaking, you can extract the type you need, *provided it can be conve
**DatabaseValue is an intermediate type between SQLite and your values, which gives information about the raw value stored in the database.**
```swift
let dbv = row.databaseValue(atIndex: 0) // 0 is the leftmost column
let dbv = row.databaseValue(named: "name") // leftmost matching column - lookup is case-insensitive
let dbv: DatabaseValue = row.value(atIndex: 0) // 0 is the leftmost column
let dbv: DatabaseValue = row.value(named: "name") // leftmost matching column - lookup is case-insensitive
// Check for NULL:
dbv.isNull // Bool
@@ -748,12 +748,12 @@ case .Blob(let data): print("NSData: \(data)")
You can extract [values](#values) (Bool, Int, String, NSDate, Swift enums, etc.) from DatabaseValue with the [DatabaseValueConvertible.fromDatabaseValue()](#custom-value-types) method:
```swift
let dbv = row.databaseValue(named: "bookCount")
let dbv: DatabaseValue = row.value(named: "bookCount")
let bookCount = Int.fromDatabaseValue(dbv) // Int?
let bookCount64 = Int64.fromDatabaseValue(dbv) // Int64?
let hasBooks = Bool.fromDatabaseValue(dbv) // Bool?, false when 0
let dbv = row.databaseValue(named: "date")
let dbv: DatabaseValue = row.value(named: "date")
let string = String.fromDatabaseValue(dbv) // "2015-09-11 18:14:15.123"
let date = NSDate.fromDatabaseValue(dbv) // NSDate?
```
@@ -762,7 +762,7 @@ let date = NSDate.fromDatabaseValue(dbv) // NSDate?
```swift
let row = Row.fetchOne(db, "SELECT 'foo'")!
let dbv = row.databaseValue(at: 0)
let dbv: DatabaseValue = row.value(at: 0)
let string = String.fromDatabaseValue(dbv) // "foo"
let int = Int.fromDatabaseValue(dbv) // nil
let date = NSDate.fromDatabaseValue(dbv) // nil
@@ -794,7 +794,6 @@ Yet rows are not real dictionaries: they are ordered, and may contain duplicate
let row = Row.fetchOne(db, "SELECT 1 AS foo, 2 AS foo")!
row.columnNames // ["foo", "foo"]
row.databaseValues // [1, 2]
row.databaseValue(named: "foo") // 1 (the value for the leftmost column "foo")
for (columnName, databaseValue) in row { ... } // ("foo", 1), ("foo", 2)
```
@@ -909,7 +908,7 @@ for row in Row.fetch(db, "SELECT data, ...") {
let data: NSData = row.value(named: "data")
// This data is copied:
if let databaseValue = row.databaseValue(named: "data") {
if let dbv: DatabaseValue = row.value(named: "data") {
let data: NSData = databaseValue.value()
}
@@ -1093,7 +1092,7 @@ row.value(atIndex: 0) as String // "Syrah"
row.value(atIndex: 0) as Grape? // fatal error: could not convert "Syrah" to Grape.
row.value(atIndex: 0) as Grape // fatal error: could not convert "Syrah" to Grape.
let dbv = row.databaseValue(atIndex: 0)
let dbv: DatabaseValue = row.value(atIndex: 0)
String.fromDatabaseValue(dbv) // "Syrah"
Grape.fromDatabaseValue(dbv) // nil
```
@@ -3509,7 +3508,7 @@ They uncover programmer errors, false assumptions, and prevent misuses. Here are
Solution: fix the contents of the database, or use [DatabaseValue](#databasevalue) to handle all possible cases:
```swift
let dbv = row.databaseValue(named: "date")
let dbv: DatabaseValue = row.value(named: "date")
if dbv.isNull {
// Handle NULL
if let date = NSDate.fromDatabaseValue(dbv) {
@@ -3574,7 +3573,7 @@ if let arguments = StatementArguments(arguments) {
for row in Row.fetchAll(statement) {
// Database value may not be convertible to NSDate
let dbv = row.databaseValue(atIndex: 0)
let dbv: DatabaseValue = row.value(atIndex: 0)
if let date = NSDate.fromDatabaseValue(dbv) {
// use date
}
@@ -64,7 +64,7 @@ class MinimalPrimaryKeyRowIDTests : GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM minimalRowIDs WHERE id = ?", arguments: [record.id])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -84,7 +84,7 @@ class MinimalPrimaryKeyRowIDTests : GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM minimalRowIDs WHERE id = ?", arguments: [record.id])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -121,7 +121,7 @@ class MinimalPrimaryKeyRowIDTests : GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM minimalRowIDs WHERE id = ?", arguments: [record.id])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -160,7 +160,7 @@ class MinimalPrimaryKeyRowIDTests : GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM minimalRowIDs WHERE id = ?", arguments: [record.id])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -201,7 +201,7 @@ class MinimalPrimaryKeyRowIDTests : GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM minimalRowIDs WHERE id = ?", arguments: [record.id])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -221,7 +221,7 @@ class MinimalPrimaryKeyRowIDTests : GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM minimalRowIDs WHERE id = ?", arguments: [record.id])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -241,7 +241,7 @@ class MinimalPrimaryKeyRowIDTests : GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM minimalRowIDs WHERE id = ?", arguments: [record.id])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -262,7 +262,7 @@ class MinimalPrimaryKeyRowIDTests : GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM minimalRowIDs WHERE id = ?", arguments: [record.id])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -75,7 +75,7 @@ class MinimalPrimaryKeySingleTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM minimalSingles WHERE UUID = ?", arguments: [record.UUID])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -114,7 +114,7 @@ class MinimalPrimaryKeySingleTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM minimalSingles WHERE UUID = ?", arguments: [record.UUID])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -154,7 +154,7 @@ class MinimalPrimaryKeySingleTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM minimalSingles WHERE UUID = ?", arguments: [record.UUID])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -211,7 +211,7 @@ class MinimalPrimaryKeySingleTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM minimalSingles WHERE UUID = ?", arguments: [record.UUID])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -232,7 +232,7 @@ class MinimalPrimaryKeySingleTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM minimalSingles WHERE UUID = ?", arguments: [record.UUID])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -254,7 +254,7 @@ class MinimalPrimaryKeySingleTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM minimalSingles WHERE UUID = ?", arguments: [record.UUID])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -88,7 +88,7 @@ class PrimaryKeyMultipleTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM citizenships WHERE personName = ? AND countryName = ?", arguments: [record.personName, record.countryName])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -125,7 +125,7 @@ class PrimaryKeyMultipleTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM citizenships WHERE personName = ? AND countryName = ?", arguments: [record.personName, record.countryName])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -179,7 +179,7 @@ class PrimaryKeyMultipleTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM citizenships WHERE personName = ? AND countryName = ?", arguments: [record.personName, record.countryName])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -234,7 +234,7 @@ class PrimaryKeyMultipleTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM citizenships WHERE personName = ? AND countryName = ?", arguments: [record.personName, record.countryName])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -256,7 +256,7 @@ class PrimaryKeyMultipleTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM citizenships WHERE personName = ? AND countryName = ?", arguments: [record.personName, record.countryName])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -277,7 +277,7 @@ class PrimaryKeyMultipleTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM citizenships WHERE personName = ? AND countryName = ?", arguments: [record.personName, record.countryName])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -91,7 +91,7 @@ class PrimaryKeyRowIDTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM persons WHERE id = ?", arguments: [record.id])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -112,7 +112,7 @@ class PrimaryKeyRowIDTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM persons WHERE id = ?", arguments: [record.id])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -134,7 +134,7 @@ class PrimaryKeyRowIDTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM persons WHERE id = ?", arguments: [record.id])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -184,7 +184,7 @@ class PrimaryKeyRowIDTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM persons WHERE id = ?", arguments: [record.id])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -238,7 +238,7 @@ class PrimaryKeyRowIDTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM persons WHERE id = ?", arguments: [record.id])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -279,7 +279,7 @@ class PrimaryKeyRowIDTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM persons WHERE id = ?", arguments: [record.id])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -298,7 +298,7 @@ class PrimaryKeyRowIDTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM persons WHERE id = ?", arguments: [record.id])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -321,7 +321,7 @@ class PrimaryKeyRowIDTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM persons WHERE id = ?", arguments: [record.id])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -342,7 +342,7 @@ class PrimaryKeyRowIDTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM persons WHERE id = ?", arguments: [record.id])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -79,7 +79,7 @@ class PrimaryKeySingleTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM pets WHERE UUID = ?", arguments: [record.UUID])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -116,7 +116,7 @@ class PrimaryKeySingleTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM pets WHERE UUID = ?", arguments: [record.UUID])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -170,7 +170,7 @@ class PrimaryKeySingleTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM pets WHERE UUID = ?", arguments: [record.UUID])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -225,7 +225,7 @@ class PrimaryKeySingleTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM pets WHERE UUID = ?", arguments: [record.UUID])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -247,7 +247,7 @@ class PrimaryKeySingleTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM pets WHERE UUID = ?", arguments: [record.UUID])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -268,7 +268,7 @@ class PrimaryKeySingleTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM pets WHERE UUID = ?", arguments: [record.UUID])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -80,7 +80,7 @@ class PrimaryKeySingleWithReplaceConflictResolutionTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM emails WHERE email = ?", arguments: [record.email])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -103,7 +103,7 @@ class PrimaryKeySingleWithReplaceConflictResolutionTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM emails WHERE email = ?", arguments: [record.email])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -125,7 +125,7 @@ class PrimaryKeySingleWithReplaceConflictResolutionTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM emails WHERE email = ?", arguments: [record.email])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -165,7 +165,7 @@ class PrimaryKeySingleWithReplaceConflictResolutionTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM emails WHERE email = ?", arguments: [record.email])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -222,7 +222,7 @@ class PrimaryKeySingleWithReplaceConflictResolutionTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM emails WHERE email = ?", arguments: [record.email])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -243,7 +243,7 @@ class PrimaryKeySingleWithReplaceConflictResolutionTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM emails WHERE email = ?", arguments: [record.email])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")
@@ -265,7 +265,7 @@ class PrimaryKeySingleWithReplaceConflictResolutionTests: GRDBTestCase {
let row = Row.fetchOne(db, "SELECT * FROM emails WHERE email = ?", arguments: [record.email])!
for (key, value) in record.persistentDictionary {
if let dbv = row.databaseValue(named: key) {
if let dbv: DatabaseValue = row.value(named: key) {
XCTAssertEqual(dbv, value?.databaseValue ?? .Null)
} else {
XCTFail("Missing column \(key) in fetched row")