From 87f8e55aff019b67e1560eee485031782217d3ff Mon Sep 17 00:00:00 2001 From: Drew McCormack Date: Wed, 8 Dec 2021 12:12:31 +0100 Subject: [PATCH 1/2] Bumped Swift-Kuery dependence to 4.0.0. Without this, Swift-Kuery fails to build with recent Swift compilers due to an ambiguity bug. --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index c828f8c..9e8cf07 100644 --- a/Package.swift +++ b/Package.swift @@ -28,7 +28,7 @@ let package = Package( ) ], dependencies: [ - .package(url: "https://github.com/Kitura/Swift-Kuery.git", from: "3.0.200"), + .package(url: "https://github.com/Kitura/Swift-Kuery.git", from: "4.0.0"), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. From d8c72003c8628c6ad7fcf1a607c9b9143a587292 Mon Sep 17 00:00:00 2001 From: Drew McCormack Date: Wed, 8 Dec 2021 12:13:57 +0100 Subject: [PATCH 2/2] Fixed a bug where recent Swift compilers would complain about unwrapped optionals. The cleanup code in withUnsafeBufferPointers would not build, because the values array is an array of optionals, and the free function was expecting a non-optional. --- Sources/SwiftKueryPostgreSQL/PostgreSQLParameterSet.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/SwiftKueryPostgreSQL/PostgreSQLParameterSet.swift b/Sources/SwiftKueryPostgreSQL/PostgreSQLParameterSet.swift index 703ec6a..f6a826c 100644 --- a/Sources/SwiftKueryPostgreSQL/PostgreSQLParameterSet.swift +++ b/Sources/SwiftKueryPostgreSQL/PostgreSQLParameterSet.swift @@ -23,7 +23,7 @@ internal struct PostgreSQLParameterSet { /// - Throws: QueryError.unsupported if parameter cannot be converted to data internal func withUnsafeBufferPointers(_ body: @escaping (UnsafePointers) -> Void) throws { let (values, lengths, formats) = try parameterData() - defer { values.forEach({ free($0) }) } + defer { values.compactMap({ $0 }).forEach({ free($0) }) } values.map({ UnsafePointer($0) }).withUnsafeBufferPointer { valuesBuffer in lengths.withUnsafeBufferPointer { lengthsBuffer in