Commit Graph
10064 Commits
Author SHA1 Message Date
Gwendal Roué c40256600a Update playgrounds doc 2022-08-28 09:49:34 +02:00
Gwendal Roué b617f432c0 Merge branch 'dev/cross-platform-targets' into development 2022-08-27 14:43:33 +02:00
Gwendal Roué 72ef13f4fb CHANGELOG 2022-08-27 14:43:06 +02:00
Gwendal Roué 535f44c463 Update the GRDB6 migration guide 2022-08-27 14:42:57 +02:00
Gwendal Roué 4c10899a3c Single Cross-Platform Target 2022-08-27 13:43:44 +02:00
Gwendal Roué 524ee1d098 Merge pull request #1271 from groue/dev/SQLite-3.39.2
Bump custom SQLite builds v3.39.2
2022-08-27 12:27:56 +02:00
Gwendal Roué 973b679baa CHANGELOG 2022-08-27 12:27:14 +02:00
Gwendal Roué 0321c79c2d Update SQLiteCustom to v3.39.2 2022-08-27 12:16:59 +02:00
Gwendal Roué e82a03615f Merge branch 'development' v6.0.0-beta.3 2022-08-25 19:11:29 +02:00
Gwendal Roué 51c9071b3d v6.0.0-beta.3 2022-08-25 19:11:20 +02:00
Gwendal Roué 91e5f838d3 Merge branch 'dev/GRDB6-singleton-record' into development 2022-08-25 19:10:09 +02:00
Gwendal Roué d026232cbf CHANGELOG 2022-08-25 19:09:51 +02: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é 05b81df614 Update the migration guide with the actions to perform on customized records 2022-08-25 19:05:27 +02:00
Gwendal Roué 3e4b04d4d1 Test the "Single-Row Tables" guide 2022-08-25 19:05:27 +02:00
Gwendal Roué 56cdaabd9c Update the "Single-Row Tables" guide 2022-08-25 19:05:27 +02:00
Gwendal Roué c65a19c50f Merge pull request #1268 from groue/dev/issue-1267
Fix SQL generation of CHECK constraints.
2022-08-25 08:31:53 +02:00
Gwendal Roué 5247a1537c CHANGELOG 2022-08-25 08:31:20 +02:00
Gwendal Roué 58f970701f BREAKING: Fix failing test for #1267
The regression was probably due to a bad interaction between Implicitly Opened Existentials (SE-0352) and Opaque Parameter Declarations (SE-0341) which GRDB 6 now uses in a lot of places.

Considering the sample code below:

    try db.create(table: ...) { t in
      t.column(...).check { $0 != Column(...) }
    }

- The `check` method accepts a closure that returns `any SQLExpressible` (the same as GRDB 5)
- The `!=` SQL comparison operator is `(some SQLSpecificExpressible, some SQLSpecificExpressible) -> SQLExpression`, when it was `(SQLSpecificExpressible, SQLSpecificExpressible) -> SQLExpression` in GRDB 5

The compiler has started preferring interpreting the != operator as Column's Equatable implementation, instead of the `!=` SQL comparison operator

We force the compiler to use the SQL comparison operator by removing the Equatable conformance from Column. It was introduced in a70b42c, as a support for a feature that has been removed since then.

This is a breaking change, but this also is an improvement. Now `column1 != column2` has a single meaning, and the library is less prone to similar regressions in the future.
2022-08-25 08:26:37 +02:00
Gwendal Roué 980f5247f0 Failing test for #1267 2022-08-25 08:12:32 +02:00
Gwendal Roué d70032c483 Merge branch 'development' v6.0.0-beta.2 2022-08-23 22:17:06 +02:00
Gwendal Roué 14321e411c v6.0.0-beta.2 2022-08-23 22:16:37 +02:00
Gwendal Roué d3d2ad1b91 Merge branch 'dev/upsert-documentation' into development 2022-08-23 22:10:33 +02:00
Gwendal Roué 55f3c2f510 CHANGELOG 2022-08-23 22:05:23 +02:00
Gwendal Roué ffa183821c UPSERT documentation 2022-08-23 22:05:23 +02:00
Gwendal Roué 327911d057 Upsert: add support for conflict target and assignments 2022-08-23 20:02:17 +02:00
Gwendal Roué c6657b7063 ColumnAssignment that does nothing
A cool upsert feature is to overwrite an existing value in case of conflict, but another cool upsert feature is to NOT overwrite an existing value. This commit makes it possible to create a ColumnAssignement that does nothing.
2022-08-23 20:02:17 +02:00
Gwendal Roué 2a5626efea Replace if let x = x with if let x 2022-08-22 20:40:00 +02:00
Gwendal Roué 6bf346ccf5 Merge branch 'development' v6.0.0-beta 2022-08-21 21:57:30 +02:00
Gwendal Roué 1036dd4d6e v6.0.0-beta 2022-08-21 21:56:51 +02:00
Gwendal Roué 48f14c7a8c Merge pull request #1221 from groue/GRDB6/development
GRDB 6
2022-08-21 21:44:19 +02:00
Gwendal Roué 2789444acd Enable UPSERT and RETURNING with SQLCipher 2022-08-21 21:22:34 +02:00
Gwendal Roué 8f8b273424 CHANGELOG organization 2022-08-21 21:22:34 +02:00
Gwendal Roué 37f0a0bb9a BREAKING: throwing EncodableRecord.encode(to:) 2022-08-21 21:22:34 +02:00
Gwendal Roué d2dd18b3e5 Remove note and warning icons
Those are handled by Github now:
https://github.com/community/community/discussions/16925
2022-08-21 21:22:34 +02:00
Gwendal Roué 422e0ae85a BREAKING: Handles both commits and rollbacks
Replace afterNextTransactionCommit(_:) with afterNextTransaction(onCommit:onRollback:)
2022-08-21 21:22:34 +02:00
Gwendal Roué 8f562d3e11 NEW: Upsert 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
Gwendal Roué 0ed9367b26 BREAKING: DatabaseCursor no longer exposes its prepared statement 2022-08-21 21:22:34 +02:00
Gwendal Roué eda403bd31 StatementArguments is Hashable 2022-08-21 21:22:34 +02:00
Gwendal Roué c553d2d69e Documentation 2022-08-21 21:22:34 +02:00
Gwendal Roué 5243db7fbc Spelling 2022-08-21 21:22:34 +02:00
Gwendal Roué 4ced8c78e7 Less "iff" (some people think this is a typo)
iff = if and only if
2022-08-21 21:22:34 +02:00
Gwendal Roué c38d903f4d Make RequestProtocols.swift easier to read 2022-08-21 21:22:34 +02:00
Gwendal Roué 1239c14e6d Explicit initializers for HasOneThrough and HasManyThrough associations 2022-08-21 21:22:34 +02:00
Gwendal Roué 5004994344 TODO 2022-08-21 21:22:34 +02:00
Gwendal Roué c86581dedc Make SQLQueryGenerator.swift easier to read 2022-08-21 21:22:34 +02:00
Gwendal Roué 546bba17fb Make LockedBox.swift easier to read 2022-08-21 21:22:34 +02:00
Gwendal Roué 27b65c9a80 BREAKING: Starting DatabaseRegionObservation returns a cancellable 2022-08-21 21:22:34 +02:00
Gwendal Roué 1bfba945d3 Fix invalid Swift syntax in documentation 2022-08-21 21:22:34 +02:00