mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-26 04:07:50 +00:00
Cleanup
This commit is contained in:
1 parent
070f4276de
commit
755fb1f4b6
1 file changed
+6
-4
@@ -92,11 +92,13 @@ public extension DatabaseValueConvertible where Self: StatementColumnConvertible
|
||||
@warn_unused_result
|
||||
public static func fetchOne(statement: SelectStatement, arguments: StatementArguments? = nil) -> Self? {
|
||||
let sqliteStatement = statement.sqliteStatement
|
||||
let isNullSequence = statement.fetchSequence(arguments: arguments) {
|
||||
sqlite3_column_type(sqliteStatement, 0) == SQLITE_NULL
|
||||
let sequence = statement.fetchSequence(arguments: arguments) {
|
||||
(sqlite3_column_type(sqliteStatement, 0) == SQLITE_NULL) ?
|
||||
(nil as Self?) :
|
||||
Self.init(sqliteStatement: sqliteStatement, index: 0)
|
||||
}
|
||||
if isNullSequence.generate().next() == false {
|
||||
return Self.init(sqliteStatement: sqliteStatement, index: 0)
|
||||
if let value = sequence.generate().next() {
|
||||
return value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user