Skip to content

Commit 1881227

Browse files
committed
Upgrade SQLite.swift
1 parent 0ca85e7 commit 1881227

File tree

5 files changed

+5
-24
lines changed

5 files changed

+5
-24
lines changed

Cartfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ github "krzyzanowskim/CryptoSwift" == 1.5.1 # From 1.6.0, the build fails in Git
44
github "ra1028/DifferenceKit" ~> 1.3.0
55
github "readium/GCDWebServer" ~> 4.0.0
66
github "scinfu/SwiftSoup" == 2.5.3 # 2.6.0 requires Xcode 14
7-
github "stephencelis/SQLite.swift" == 0.13.3 # 0.14 introduces a breaking change
7+
github "stephencelis/SQLite.swift" ~> 0.15.3
88
github "weichsel/ZIPFoundation" == 0.9.11 # 0.9.12 requires iOS 12+

Package.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ let package = Package(
3131
.package(url: "https://github.com/readium/GCDWebServer.git", from: "4.0.0"),
3232
// From 2.6.0, Xcode 14 is required
3333
.package(url: "https://github.com/scinfu/SwiftSoup.git", "2.5.3" ..< "2.6.0"),
34-
// 0.14 introduced a breaking change
35-
.package(url: "https://github.com/stephencelis/SQLite.swift.git", "0.12.0" ..< "0.13.3"),
34+
.package(url: "https://github.com/stephencelis/SQLite.swift.git", from: "0.15.3"),
3635
// 0.9.12 requires iOS 12+
3736
.package(url: "https://github.com/weichsel/ZIPFoundation.git", "0.9.0" ..< "0.9.12"),
3837
],

Sources/Adapters/LCPSQLite/Connection.swift

-17
This file was deleted.

Sources/Adapters/LCPSQLite/SQLiteLCPLicenseRepository.swift

+2-3
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ public class LCPSQLiteLicenseRepository: LCPLicenseRepository {
5656

5757
public func isDeviceRegistered(for id: LicenseDocument.ID) async throws -> Bool {
5858
try checkExists(id)
59-
let query = licenses.filter(self.id == id && registered == true)
60-
let count = try db.count(query)
59+
let count = try db.scalar(licenses.filter(self.id == id && registered == true).count)
6160
return count != 0
6261
}
6362

@@ -95,7 +94,7 @@ public class LCPSQLiteLicenseRepository: LCPLicenseRepository {
9594
}
9695

9796
private func exists(_ licenseID: LicenseDocument.ID) -> Bool {
98-
((try? db.count(licenses.filter(id == licenseID))) ?? 0) != 0
97+
((try? db.scalar(licenses.filter(id == licenseID).count)) ?? 0) != 0
9998
}
10099

101100
private func get(_ column: Expression<Int?>, for licenseId: String) throws -> Int? {

Support/CocoaPods/ReadiumAdapterLCPSQLite.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ Pod::Spec.new do |s|
1414
s.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2' }
1515

1616
s.dependency 'ReadiumShared'
17-
s.dependency 'SQLite.swift', '<= 0.13.3' # 0.14 introduces breaking changes
17+
s.dependency 'SQLite.swift', '~> 0.15.3'
1818

1919
end

0 commit comments

Comments
 (0)