From 2789444acd0f5729040d48827ee06b880bb58e2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 21 Aug 2022 20:41:42 +0200 Subject: [PATCH] Enable UPSERT and RETURNING with SQLCipher --- .../Request/QueryInterfaceRequest.swift | 4 +- .../SQLGeneration/SQLQueryGenerator.swift | 1 - .../Record/MutablePersistableRecord+DAO.swift | 1 - .../MutablePersistableRecord+Insert.swift | 2 +- .../MutablePersistableRecord+Save.swift | 2 +- .../MutablePersistableRecord+Update.swift | 4 +- .../MutablePersistableRecord+Upsert.swift | 2 +- GRDB/Record/PersistableRecord+Insert.swift | 2 +- GRDB/Record/PersistableRecord+Save.swift | 2 +- GRDB/Record/PersistableRecord+Upsert.swift | 2 +- .../MutablePersistableRecordTests.swift | 90 +++++++++++++++---- Tests/GRDBTests/PersistableRecordTests.swift | 36 ++++++-- Tests/GRDBTests/TableRecordDeleteTests.swift | 36 ++++++-- Tests/GRDBTests/TableRecordUpdateTests.swift | 24 ++++- 14 files changed, 165 insertions(+), 43 deletions(-) diff --git a/GRDB/QueryInterface/Request/QueryInterfaceRequest.swift b/GRDB/QueryInterface/Request/QueryInterfaceRequest.swift index 65bf9c0b2..d7d7663ec 100644 --- a/GRDB/QueryInterface/Request/QueryInterfaceRequest.swift +++ b/GRDB/QueryInterface/Request/QueryInterfaceRequest.swift @@ -426,7 +426,7 @@ extension QueryInterfaceRequest { // MARK: - Batch Delete and Fetch extension QueryInterfaceRequest { -#if GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER /// Returns a `DELETE ... RETURNING ...` prepared statement. /// /// For example: @@ -714,7 +714,7 @@ extension QueryInterfaceRequest { // MARK: - Batch Update and Fetch extension QueryInterfaceRequest { -#if GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER /// Returns an `UPDATE ... RETURNING ...` prepared statement. /// /// For example: diff --git a/GRDB/QueryInterface/SQLGeneration/SQLQueryGenerator.swift b/GRDB/QueryInterface/SQLGeneration/SQLQueryGenerator.swift index 7b62a139d..1455793e8 100644 --- a/GRDB/QueryInterface/SQLGeneration/SQLQueryGenerator.swift +++ b/GRDB/QueryInterface/SQLGeneration/SQLQueryGenerator.swift @@ -402,7 +402,6 @@ struct SQLQueryGenerator: Refinable { statement.arguments = arguments return statement } else { - assert(sqlite3_libversion_number() >= 3035000) let context = SQLGenerationContext(db) var sql = sql var arguments = arguments diff --git a/GRDB/Record/MutablePersistableRecord+DAO.swift b/GRDB/Record/MutablePersistableRecord+DAO.swift index e4e4cc19f..e86a0fdd1 100644 --- a/GRDB/Record/MutablePersistableRecord+DAO.swift +++ b/GRDB/Record/MutablePersistableRecord+DAO.swift @@ -190,7 +190,6 @@ final class DAO { statement.setUncheckedArguments(arguments) return statement } else { - assert(sqlite3_libversion_number() >= 3035000) let context = SQLGenerationContext(db) var sql = sql var arguments = arguments diff --git a/GRDB/Record/MutablePersistableRecord+Insert.swift b/GRDB/Record/MutablePersistableRecord+Insert.swift index 13d3a67fe..16f15d334 100644 --- a/GRDB/Record/MutablePersistableRecord+Insert.swift +++ b/GRDB/Record/MutablePersistableRecord+Insert.swift @@ -72,7 +72,7 @@ extension MutablePersistableRecord { // MARK: - Insert and Fetch extension MutablePersistableRecord { -#if GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER /// Executes an `INSERT ... RETURNING ...` statement, and returns the /// inserted record. /// diff --git a/GRDB/Record/MutablePersistableRecord+Save.swift b/GRDB/Record/MutablePersistableRecord+Save.swift index fc4435da7..23e0a4b34 100644 --- a/GRDB/Record/MutablePersistableRecord+Save.swift +++ b/GRDB/Record/MutablePersistableRecord+Save.swift @@ -77,7 +77,7 @@ extension MutablePersistableRecord { // MARK: - Save and Fetch extension MutablePersistableRecord { -#if GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER /// Executes an `INSERT ... RETURNING ...` or `UPDATE ... RETURNING ...` /// statement, and returns the saved row. /// diff --git a/GRDB/Record/MutablePersistableRecord+Update.swift b/GRDB/Record/MutablePersistableRecord+Update.swift index bc272c3ce..a8c14d009 100644 --- a/GRDB/Record/MutablePersistableRecord+Update.swift +++ b/GRDB/Record/MutablePersistableRecord+Update.swift @@ -150,7 +150,7 @@ extension MutablePersistableRecord { // MARK: - Update and Fetch extension MutablePersistableRecord { -#if GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER /// Executes an `UPDATE ... RETURNING ...` statement, and returns the /// updated record. /// @@ -700,7 +700,7 @@ extension MutablePersistableRecord { // MARK: - Internals extension MutablePersistableRecord { -#if GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER @inlinable // allow specialization so that empty callbacks are removed func updateChangesAndFetch( _ db: Database, diff --git a/GRDB/Record/MutablePersistableRecord+Upsert.swift b/GRDB/Record/MutablePersistableRecord+Upsert.swift index f53bf6304..ea3022ecd 100644 --- a/GRDB/Record/MutablePersistableRecord+Upsert.swift +++ b/GRDB/Record/MutablePersistableRecord+Upsert.swift @@ -1,7 +1,7 @@ // MARK: - Upsert extension MutablePersistableRecord { -#if GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER /// Executes an `INSERT ... ON CONFLICT DO UPDATE` statement. /// /// - parameter db: A database connection. diff --git a/GRDB/Record/PersistableRecord+Insert.swift b/GRDB/Record/PersistableRecord+Insert.swift index 924a5aaa5..504cb3c0f 100644 --- a/GRDB/Record/PersistableRecord+Insert.swift +++ b/GRDB/Record/PersistableRecord+Insert.swift @@ -36,7 +36,7 @@ extension PersistableRecord { // MARK: - Insert and Fetch extension PersistableRecord { -#if GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER /// Executes an `INSERT ... RETURNING ...` statement, and returns a new /// record built from the inserted row. /// diff --git a/GRDB/Record/PersistableRecord+Save.swift b/GRDB/Record/PersistableRecord+Save.swift index b33599474..125985627 100644 --- a/GRDB/Record/PersistableRecord+Save.swift +++ b/GRDB/Record/PersistableRecord+Save.swift @@ -32,7 +32,7 @@ extension PersistableRecord { // MARK: - Save and Fetch extension PersistableRecord { -#if GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER /// Executes an `INSERT ... RETURNING ...` or `UPDATE ... RETURNING ...` /// statement, and returns a new record built from the saved row. /// diff --git a/GRDB/Record/PersistableRecord+Upsert.swift b/GRDB/Record/PersistableRecord+Upsert.swift index e3ab46fa6..cfb02b060 100644 --- a/GRDB/Record/PersistableRecord+Upsert.swift +++ b/GRDB/Record/PersistableRecord+Upsert.swift @@ -1,7 +1,7 @@ // MARK: - Upsert extension PersistableRecord { -#if GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER /// Executes an `INSERT ... ON CONFLICT DO UPDATE` statement. /// /// - parameter db: A database connection. diff --git a/Tests/GRDBTests/MutablePersistableRecordTests.swift b/Tests/GRDBTests/MutablePersistableRecordTests.swift index ebdcb77ba..93e415ba1 100644 --- a/Tests/GRDBTests/MutablePersistableRecordTests.swift +++ b/Tests/GRDBTests/MutablePersistableRecordTests.swift @@ -1163,7 +1163,11 @@ class MutablePersistableRecordTests: GRDBTestCase { extension MutablePersistableRecordTests { func test_insertAndFetch() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -1180,7 +1184,11 @@ extension MutablePersistableRecordTests { } func test_insertAndFetch_as() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -1226,7 +1234,11 @@ extension MutablePersistableRecordTests { } func test_insertAndFetch_selection_fetch() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -1276,7 +1288,11 @@ extension MutablePersistableRecordTests { extension MutablePersistableRecordTests { func test_saveAndFetch() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -1293,7 +1309,11 @@ extension MutablePersistableRecordTests { } func test_saveAndFetch_as() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -1415,7 +1435,11 @@ extension MutablePersistableRecordTests { } func test_saveAndFetch_selection_fetch() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -1541,7 +1565,11 @@ extension MutablePersistableRecordTests { extension MutablePersistableRecordTests { func test_updateAndFetch() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -1588,7 +1616,11 @@ extension MutablePersistableRecordTests { } func test_updateAndFetch_as() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -1634,7 +1666,11 @@ extension MutablePersistableRecordTests { } func test_updateAndFetch_selection_fetch() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -1684,7 +1720,11 @@ extension MutablePersistableRecordTests { } func test_updateAndFetch_columns_selection_fetch() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -1734,7 +1774,11 @@ extension MutablePersistableRecordTests { } func test_updateChangesAndFetch_modify() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -1791,7 +1835,11 @@ extension MutablePersistableRecordTests { } func test_updateChangesAndFetch_as_modify() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -1847,7 +1895,11 @@ extension MutablePersistableRecordTests { } func test_updateChangesAndFetch_selection_fetch_modify() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -1909,7 +1961,11 @@ extension MutablePersistableRecordTests { extension MutablePersistableRecordTests { func test_upsert() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("UPSERT is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("UPSERT is not available") } @@ -2054,7 +2110,11 @@ extension MutablePersistableRecordTests { } func test_upsertAndFetch_as() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("UPSERT is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("UPSERT is not available") } diff --git a/Tests/GRDBTests/PersistableRecordTests.swift b/Tests/GRDBTests/PersistableRecordTests.swift index 91b82d5b7..65536d49e 100644 --- a/Tests/GRDBTests/PersistableRecordTests.swift +++ b/Tests/GRDBTests/PersistableRecordTests.swift @@ -1327,7 +1327,11 @@ extension PersistableRecordTests { extension PersistableRecordTests { func test_insertAndFetch_as() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -1372,7 +1376,11 @@ extension PersistableRecordTests { } func test_insertAndFetch_selection_fetch() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -1421,7 +1429,11 @@ extension PersistableRecordTests { extension PersistableRecordTests { func test_saveAndFetch_as() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -1540,7 +1552,11 @@ extension PersistableRecordTests { } func test_saveAndFetch_selection_fetch() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -1663,7 +1679,11 @@ extension PersistableRecordTests { extension PersistableRecordTests { func test_upsert() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("UPSERT is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("UPSERT is not available") } @@ -1796,7 +1816,11 @@ extension PersistableRecordTests { } func test_upsertAndFetch_as() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("UPSERT is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("UPSERT is not available") } diff --git a/Tests/GRDBTests/TableRecordDeleteTests.swift b/Tests/GRDBTests/TableRecordDeleteTests.swift index 948a84366..ee8f21011 100644 --- a/Tests/GRDBTests/TableRecordDeleteTests.swift +++ b/Tests/GRDBTests/TableRecordDeleteTests.swift @@ -230,7 +230,11 @@ class TableRecordDeleteTests: GRDBTestCase { } func testRequestDeleteAndFetchStatement() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -246,7 +250,11 @@ class TableRecordDeleteTests: GRDBTestCase { } func testRequestDeleteAndFetchCursor() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -295,7 +303,11 @@ class TableRecordDeleteTests: GRDBTestCase { } func testRequestDeleteAndFetchArray() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -319,7 +331,11 @@ class TableRecordDeleteTests: GRDBTestCase { } func testRequestDeleteAndFetchSet() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -401,7 +417,11 @@ class TableRecordDeleteTests: GRDBTestCase { } func testJoinedRequestDeleteAndFetch() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -564,7 +584,11 @@ class TableRecordDeleteTests: GRDBTestCase { } func testGroupedRequestDeleteAndFetchCursor() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } diff --git a/Tests/GRDBTests/TableRecordUpdateTests.swift b/Tests/GRDBTests/TableRecordUpdateTests.swift index 69ee86938..eeabd3bfc 100644 --- a/Tests/GRDBTests/TableRecordUpdateTests.swift +++ b/Tests/GRDBTests/TableRecordUpdateTests.swift @@ -118,7 +118,11 @@ class TableRecordUpdateTests: GRDBTestCase { } func testRequestUpdateAndFetchStatement() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -137,7 +141,11 @@ class TableRecordUpdateTests: GRDBTestCase { } func testRequestUpdateAndFetchCursor() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -160,7 +168,11 @@ class TableRecordUpdateTests: GRDBTestCase { } func testRequestUpdateAndFetchAll() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") } @@ -184,7 +196,11 @@ class TableRecordUpdateTests: GRDBTestCase { } func testRequestUpdateAndFetchSet() throws { -#if !GRDBCUSTOMSQLITE +#if GRDBCUSTOMSQLITE || GRDBCIPHER + guard sqlite3_libversion_number() >= 3035000 else { + throw XCTSkip("RETURNING clause is not available") + } +#else guard #available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) else { throw XCTSkip("RETURNING clause is not available") }