diff --git a/GRDB/Core/DatabasePool.swift b/GRDB/Core/DatabasePool.swift index d4634cee6..08f4c2610 100644 --- a/GRDB/Core/DatabasePool.swift +++ b/GRDB/Core/DatabasePool.swift @@ -684,7 +684,7 @@ extension DatabasePool: DatabaseReader { // MARK: - WAL Snapshot Transactions -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT /// Returns a long-lived WAL snapshot transaction on a reader connection. func walSnapshotTransaction() throws -> WALSnapshotTransaction { guard let readerPool else { @@ -950,7 +950,7 @@ extension DatabasePool { purpose: "snapshot.\(databaseSnapshotCountMutex.increment())") } -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT /// Creates a database snapshot that allows concurrent accesses to an /// unchanging database content, as it exists at the moment the snapshot /// is created. diff --git a/GRDB/Core/DatabaseSnapshotPool.swift b/GRDB/Core/DatabaseSnapshotPool.swift index 67a91c5cb..4604c9c2c 100644 --- a/GRDB/Core/DatabaseSnapshotPool.swift +++ b/GRDB/Core/DatabaseSnapshotPool.swift @@ -1,4 +1,4 @@ -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT // Import C SQLite functions #if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher diff --git a/GRDB/Core/WALSnapshot.swift b/GRDB/Core/WALSnapshot.swift index 261f79d4e..729a8ac80 100644 --- a/GRDB/Core/WALSnapshot.swift +++ b/GRDB/Core/WALSnapshot.swift @@ -1,4 +1,4 @@ -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT // Import C SQLite functions #if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher diff --git a/GRDB/Core/WALSnapshotTransaction.swift b/GRDB/Core/WALSnapshotTransaction.swift index 2caeb69a3..22f6c90a7 100644 --- a/GRDB/Core/WALSnapshotTransaction.swift +++ b/GRDB/Core/WALSnapshotTransaction.swift @@ -1,4 +1,4 @@ -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT /// A long-live read-only WAL transaction. /// /// `WALSnapshotTransaction` **takes ownership** of its reader diff --git a/GRDB/ValueObservation/Observers/ValueConcurrentObserver.swift b/GRDB/ValueObservation/Observers/ValueConcurrentObserver.swift index 22f124a71..d75b89c73 100644 --- a/GRDB/ValueObservation/Observers/ValueConcurrentObserver.swift +++ b/GRDB/ValueObservation/Observers/ValueConcurrentObserver.swift @@ -276,7 +276,7 @@ extension ValueConcurrentObserver { } } -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT extension ValueConcurrentObserver { /// Synchronously starts the observation, and returns the initial value. /// diff --git a/Package.swift b/Package.swift index fdd896959..9d0c79554 100644 --- a/Package.swift +++ b/Package.swift @@ -14,8 +14,13 @@ let darwinPlatforms: [Platform] = [ ] var swiftSettings: [SwiftSetting] = [ .define("SQLITE_ENABLE_FTS5"), - // SQLite snapshots are available on the system SQLite on Darwin platforms. - .define("SQLITE_ENABLE_SNAPSHOT", .when(platforms: darwinPlatforms, traits: ["GRDBSQLite"])), + // Until Xcode has proper support for package traits, we must enable + // SQLITE_ENABLE_SNAPSHOT by default so that Xcode projects that build + // a Darwin app can depend on GRDB and profit from WAL snapshots. + // Package traits who want to disable snapshots must set SQLITE_DISABLE_SNAPSHOT. + // TODO: when Xcode support traits, remove all mentions of SQLITE_DISABLE_SNAPSHOT and update as below: + // .define("SQLITE_ENABLE_SNAPSHOT", .when(platforms: darwinPlatforms, traits: ["GRDBSQLite"])), + .define("SQLITE_ENABLE_SNAPSHOT"), ] var cSettings: [CSetting] = [] var dependencies: [PackageDescription.Package.Dependency] = [] diff --git a/Tests/GRDBCombineTests/DatabaseReaderReadPublisherTests.swift b/Tests/GRDBCombineTests/DatabaseReaderReadPublisherTests.swift index fbc35dcaa..baefd0dcd 100644 --- a/Tests/GRDBCombineTests/DatabaseReaderReadPublisherTests.swift +++ b/Tests/GRDBCombineTests/DatabaseReaderReadPublisherTests.swift @@ -40,7 +40,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase { try Test(test).runAtTemporaryDatabasePath { try setUp(DatabaseQueue(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshot() } -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshotPool() } #endif } @@ -141,7 +141,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase { try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0).makeSnapshot() } -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0).makeSnapshotPool() } #endif } @@ -177,7 +177,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase { try Test(test).runAtTemporaryDatabasePath { try setUp(DatabaseQueue(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshot() } -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshotPool() } #endif } @@ -213,7 +213,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase { try Test(test).runAtTemporaryDatabasePath { try setUp(DatabaseQueue(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshot() } -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshotPool() } #endif } @@ -250,7 +250,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase { try Test(test).runAtTemporaryDatabasePath { try setUp(DatabaseQueue(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshot() } -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshotPool() } #endif } @@ -274,7 +274,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase { try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0).makeSnapshot() } -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0).makeSnapshotPool() } #endif } diff --git a/Tests/GRDBTests/DatabaseAbortedTransactionTests.swift b/Tests/GRDBTests/DatabaseAbortedTransactionTests.swift index 974386bdf..3d3654f2a 100644 --- a/Tests/GRDBTests/DatabaseAbortedTransactionTests.swift +++ b/Tests/GRDBTests/DatabaseAbortedTransactionTests.swift @@ -40,7 +40,7 @@ class DatabaseAbortedTransactionTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -85,7 +85,7 @@ class DatabaseAbortedTransactionTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } diff --git a/Tests/GRDBTests/DatabaseConfigurationTests.swift b/Tests/GRDBTests/DatabaseConfigurationTests.swift index f00acecbb..f0739ba1c 100644 --- a/Tests/GRDBTests/DatabaseConfigurationTests.swift +++ b/Tests/GRDBTests/DatabaseConfigurationTests.swift @@ -27,7 +27,7 @@ class DatabaseConfigurationTests: GRDBTestCase { try pool.makeSnapshot().read { _ in } XCTAssertEqual(connectionCountMutex.load(), 5) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try pool.makeSnapshotPool().read { _ in } XCTAssertEqual(connectionCountMutex.load(), 6) #endif @@ -74,7 +74,7 @@ class DatabaseConfigurationTests: GRDBTestCase { XCTFail("Expected TestError") } catch is TestError { } -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT do { errorMutex.store(TestError()) _ = try pool.makeSnapshotPool() diff --git a/Tests/GRDBTests/DatabasePoolTests.swift b/Tests/GRDBTests/DatabasePoolTests.swift index b3f291d68..f8192e58f 100644 --- a/Tests/GRDBTests/DatabasePoolTests.swift +++ b/Tests/GRDBTests/DatabasePoolTests.swift @@ -53,7 +53,7 @@ class DatabasePoolTests: GRDBTestCase { XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-wal")) XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-shm")) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT // A non-empty wal file makes sure ValueObservation can use wal snapshots. // See let walURL = URL(fileURLWithPath: dbPool.path + "-wal") @@ -77,7 +77,7 @@ class DatabasePoolTests: GRDBTestCase { XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-wal")) XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-shm")) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT // A non-empty wal file makes sure ValueObservation can use wal snapshots. // See let walURL = URL(fileURLWithPath: dbPool.path + "-wal") @@ -103,7 +103,7 @@ class DatabasePoolTests: GRDBTestCase { XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-wal")) XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-shm")) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT // A non-empty wal file makes sure ValueObservation can use wal snapshots. // See let walURL = URL(fileURLWithPath: dbPool.path + "-wal") @@ -126,7 +126,7 @@ class DatabasePoolTests: GRDBTestCase { XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-wal")) XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-shm")) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT // A non-empty wal file makes sure ValueObservation can use wal snapshots. // See let walURL = URL(fileURLWithPath: dbPool.path + "-wal") diff --git a/Tests/GRDBTests/DatabaseReaderTests.swift b/Tests/GRDBTests/DatabaseReaderTests.swift index 205f596e7..d469ecf80 100644 --- a/Tests/GRDBTests/DatabaseReaderTests.swift +++ b/Tests/GRDBTests/DatabaseReaderTests.swift @@ -46,7 +46,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(setup(makeDatabaseQueue())) try test(setup(makeDatabasePool())) try test(setup(makeDatabasePool()).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(setup(makeDatabasePool()).makeSnapshotPool()) #endif } @@ -68,7 +68,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(setup(makeDatabaseQueue())) try await test(setup(makeDatabasePool())) try await test(setup(makeDatabasePool()).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(setup(makeDatabasePool()).makeSnapshotPool()) #endif } @@ -87,7 +87,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -106,7 +106,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -130,7 +130,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(setup(makeDatabaseQueue())) try test(setup(makeDatabasePool())) try test(setup(makeDatabasePool()).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(setup(makeDatabasePool()).makeSnapshotPool()) #endif } @@ -152,7 +152,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(setup(makeDatabaseQueue())) try await test(setup(makeDatabasePool())) try await test(setup(makeDatabasePool()).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(setup(makeDatabasePool()).makeSnapshotPool()) #endif } @@ -176,7 +176,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(setup(makeDatabaseQueue())) try test(setup(makeDatabasePool())) try test(setup(makeDatabasePool()).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(setup(makeDatabasePool()).makeSnapshotPool()) #endif } @@ -196,7 +196,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -243,7 +243,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -272,7 +272,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -292,7 +292,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -312,7 +312,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -339,7 +339,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(setup(makeDatabaseQueue(configuration: Configuration()))) try test(setup(makeDatabasePool(configuration: Configuration()))) try test(setup(makeDatabasePool(configuration: Configuration())).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(setup(makeDatabasePool(configuration: Configuration())).makeSnapshotPool()) #endif } @@ -358,7 +358,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -375,7 +375,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -410,7 +410,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -443,7 +443,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -481,7 +481,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -523,7 +523,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -558,7 +558,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -591,7 +591,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -629,7 +629,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -671,7 +671,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -719,7 +719,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) diff --git a/Tests/GRDBTests/DatabaseSnapshotPoolTests.swift b/Tests/GRDBTests/DatabaseSnapshotPoolTests.swift index 4d1dc5f55..54305e5c3 100644 --- a/Tests/GRDBTests/DatabaseSnapshotPoolTests.swift +++ b/Tests/GRDBTests/DatabaseSnapshotPoolTests.swift @@ -1,4 +1,4 @@ -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT import XCTest import GRDB diff --git a/Tests/GRDBTests/ValueObservationPrintTests.swift b/Tests/GRDBTests/ValueObservationPrintTests.swift index dc77bc822..149fafb22 100644 --- a/Tests/GRDBTests/ValueObservationPrintTests.swift +++ b/Tests/GRDBTests/ValueObservationPrintTests.swift @@ -55,7 +55,7 @@ class ValueObservationPrintTests: GRDBTestCase { try test(makeDatabaseQueue(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshotPool()) #endif } @@ -92,7 +92,7 @@ class ValueObservationPrintTests: GRDBTestCase { try test(makeDatabaseQueue(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshotPool()) #endif } @@ -130,7 +130,7 @@ class ValueObservationPrintTests: GRDBTestCase { try test(makeDatabaseQueue(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshotPool()) #endif } @@ -168,7 +168,7 @@ class ValueObservationPrintTests: GRDBTestCase { try test(makeDatabaseQueue(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshotPool()) #endif } diff --git a/Tests/GRDBTests/ValueObservationTests.swift b/Tests/GRDBTests/ValueObservationTests.swift index e1b4c62a5..03202b448 100644 --- a/Tests/GRDBTests/ValueObservationTests.swift +++ b/Tests/GRDBTests/ValueObservationTests.swift @@ -462,7 +462,7 @@ class ValueObservationTests: GRDBTestCase { } let expectedCounts: [Int] -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT // Optimization available expectedCounts = [0, 1] #else @@ -516,7 +516,7 @@ class ValueObservationTests: GRDBTestCase { } let expectedCounts: [Int] -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT // Optimization available expectedCounts = [0, 1] #else @@ -543,7 +543,7 @@ class ValueObservationTests: GRDBTestCase { // MARK: - Snapshot Observation -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT func testDatabaseSnapshotPoolObservation() throws { let dbPool = try makeDatabasePool() try dbPool.write { try $0.execute(sql: "CREATE TABLE t(id INTEGER PRIMARY KEY AUTOINCREMENT)") } @@ -1065,7 +1065,7 @@ class ValueObservationTests: GRDBTestCase { } let initialValueExpectation = self.expectation(description: "initialValue") -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT initialValueExpectation.assertForOverFulfill = true #else // ValueObservation on DatabasePool will notify the first value twice @@ -1123,7 +1123,7 @@ class ValueObservationTests: GRDBTestCase { } let initialValueExpectation = self.expectation(description: "") -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT initialValueExpectation.assertForOverFulfill = true #else // ValueObservation on DatabasePool will notify the first value twice