diff --git a/GRDB/Core/Row.swift b/GRDB/Core/Row.swift index 6d5adc49e..8834890a6 100644 --- a/GRDB/Core/Row.swift +++ b/GRDB/Core/Row.swift @@ -2188,11 +2188,13 @@ extension RowImpl { // TODO: merge with StatementCopyRowImpl eventually? /// See Row.init(dictionary:) -private struct ArrayRowImpl: RowImpl { +struct ArrayRowImpl: RowImpl { let columns: [(String, DatabaseValue)] - init(columns: [(String, DatabaseValue)]) { - self.columns = columns + init(columns: C) + where C: Collection, C.Element == (String, DatabaseValue) + { + self.columns = Array(columns) } var count: Int { columns.count } @@ -2217,6 +2219,10 @@ private struct ArrayRowImpl: RowImpl { } } +#if compiler(>=5.5.1) +extension ArrayRowImpl: Sendable { } +#endif + // TODO: merge with ArrayRowImpl eventually? /// See Row.init(copiedFromStatementRef:sqliteStatement:) diff --git a/GRDB/Core/RowDecodingError.swift b/GRDB/Core/RowDecodingError.swift index ff3c5b5c8..9db8a38dc 100644 --- a/GRDB/Core/RowDecodingError.swift +++ b/GRDB/Core/RowDecodingError.swift @@ -23,9 +23,10 @@ enum RowDecodingError: Error { @usableFromInline let debugDescription: String - // TODO: replace with a Sendable copy of row + let rowImpl: ArrayRowImpl // Sendable + /// The row that could not be decoded - let row: Row + var row: Row { Row(impl: rowImpl) } /// Nil for RowDecodingError.keyNotFound, in order to avoid redundancy let key: RowKey? @@ -38,7 +39,7 @@ enum RowDecodingError: Error { init(decodingContext: RowDecodingContext, debugDescription: String) { self.debugDescription = debugDescription - self.row = decodingContext.row + self.rowImpl = ArrayRowImpl(columns: decodingContext.row) self.key = decodingContext.key self.sql = decodingContext.sql self.statementArguments = decodingContext.statementArguments