Commit Graph
13 Commits
Author SHA1 Message Date
Gwendal Roué f878d99733 Use SQLITE_HAS_CODEC instead of GRDBCIPHER when testing for SQLCipher availability
GRDBCIPHER is now just a marker for importing SQLCipher with CocoaPods.

Also, enable all APIs that used to be disabled with SQLCipher, and skip tests that require a specific SQLite version.
2025-10-12 14:49:59 +02:00
Gwendal Roué d1a2cb0948 All closures that accept DatabaseComponents can throw 2025-05-12 20:33:18 +02:00
Gwendal Roué 034b241e71 Rename ColumnsProvider to DatabaseComponents 2025-05-11 13:10:19 +02:00
Gwendal Roué 6b0faede2a Use closure syntax for insertAndFetch 2025-05-10 09:36:14 +02:00
Gwendal Roué b1424d16d5 [BREAKING] PersistenceContainer is Sendable 2024-08-31 10:08:44 +02:00
Gwendal Roué cd4e853b74 [BREAKING] insertAndFetch, saveAndFetch, and updateAndFetch no longer return optionals.
Those optionals were just an annoyance. Now, nil results are replaced with `RecordError.recordNotFound`. Such an error is only expected with the IGNORE conflict policy.
2024-08-24 17:02:49 +02:00
Gwendal Roué b896923fd4 TODO GRDB7: remove painful optionals due to IGNORE 2023-10-01 15:37:27 +02:00
Gwendal Roué d3c289a320 Availability checks cleanup 2023-01-22 12:37:40 +01:00
Gwendal Roué 1818534513 DocC 2022-11-06 16:02:36 +01:00
Gwendal Roué c2e4aaf51d Throw SQLITE_MISUSE in case of programmer error in the aroundXxx callbacks
While writing SingletonRecordTest.swift, I tried the solution below, in order to turn a failed update into an insert:

    func aroundUpdate(_ db: Database, columns: Set<String>, update: () throws -> PersistenceSuccess) throws {
        do {
            _ = try update()
        } catch {
            insert(db)
        }
    }

But this can't work. This `insert(db)` is unable to provide the information we need in `update()`: the result of the eventual RETURNING clause, and the PersistenceSuccess that contains the persisted PersistenceContainer.

So we now detect two misuses: 1) not calling the action method, and 2) not rethrowing the error of the action method.
2022-08-25 19:05:27 +02:00
Gwendal Roué 2a5626efea Replace if let x = x with if let x 2022-08-22 20:40:00 +02:00
Gwendal Roué 2789444acd Enable UPSERT and RETURNING with SQLCipher 2022-08-21 21:22:34 +02:00
Gwendal Roué a702fe6bc9 BREAKING: persistence callbacks, and support for RETURNING
- Replace performInsert, performUpdate, etc with callbacks: willInsert, aroundInsert, didInsert, etc.
- Always call didInsert, even with INSERT OR IGNORE
- Explicit conflict resolution in persistence methods
- Add ...AndFetch... methods
2022-08-21 21:22:34 +02:00