From 2fa5ca767f00c2c5e33729d82014e5a2bd575835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Rou=C3=A9?= Date: Mon, 20 Mar 2023 13:27:57 +0100 Subject: [PATCH] WALSnapshot is only available when the SQLite feature is Since #1350 we no longer need to expose it and check for failures at runtime. --- GRDB/Core/WALSnapshot.swift | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/GRDB/Core/WALSnapshot.swift b/GRDB/Core/WALSnapshot.swift index 36f21eb69..1256833bb 100644 --- a/GRDB/Core/WALSnapshot.swift +++ b/GRDB/Core/WALSnapshot.swift @@ -1,3 +1,4 @@ +#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER && (compiler(>=5.7.1) || !(os(macOS) || targetEnvironment(macCatalyst)))) /// An instance of WALSnapshot records the state of a WAL mode database for some /// specific point in history. /// @@ -20,13 +21,6 @@ /// /// See . final class WALSnapshot: Sendable { - // Xcode 14 (Swift 5.7) ships with a macOS SDK that misses snapshot support. - // Xcode 14.1 (Swift 5.7.1) ships with a macOS SDK that has snapshot support. - // This is the meaning of (compiler(>=5.7.1) || !(os(macOS) || targetEnvironment(macCatalyst))) - // swiftlint:disable:next line_length -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER && (compiler(>=5.7.1) || !(os(macOS) || targetEnvironment(macCatalyst)))) - static let available = true - let sqliteSnapshot: UnsafeMutablePointer init(_ db: Database) throws { @@ -67,15 +61,5 @@ final class WALSnapshot: Sendable { func compare(_ other: WALSnapshot) -> CInt { sqlite3_snapshot_cmp(sqliteSnapshot, other.sqliteSnapshot) } -#else - static let available = false - - init(_ db: Database) throws { - throw DatabaseError(resultCode: .SQLITE_MISUSE, message: "snapshots are not available") - } - - func compare(_ other: WALSnapshot) -> CInt { - preconditionFailure("snapshots are not available") - } -#endif } +#endif