mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-29 04:24:21 +00:00
Fix failing tests for decodeNil()
Fix https://github.com/groue/GRDB.swift/issues/1531
This commit is contained in:
1 parent
de382d30b8
commit
7110a1fab3
1 file changed
+17
-7
@@ -175,15 +175,25 @@ private struct _RowDecoder<R: FetchableRecord>: Decoder {
|
||||
|
||||
func decodeNil(forKey key: Key) throws -> Bool {
|
||||
let row = decoder.row
|
||||
if let column = try? decodeColumn(forKey: key), row[column] != nil {
|
||||
return false
|
||||
}
|
||||
if row.scopesTree[key.stringValue] != nil {
|
||||
return false
|
||||
}
|
||||
if row.prefetchedRows[key.stringValue] != nil {
|
||||
|
||||
// Column?
|
||||
if let column = try? decodeColumn(forKey: key),
|
||||
let index = row.index(forColumn: column)
|
||||
{
|
||||
return row.hasNull(atIndex: index)
|
||||
}
|
||||
|
||||
// Scope?
|
||||
if let scopedRow = row.scopesTree[key.stringValue] {
|
||||
return scopedRow.containsNonNullValue == false
|
||||
}
|
||||
|
||||
// Prefetched Rows?
|
||||
if let prefetchedRows = row.prefetchedRows[key.stringValue] {
|
||||
return false
|
||||
}
|
||||
|
||||
// Unknown key
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user