Gwendal Roué
7bd1992e61
Fix ergonomics issue with the definition of compound primary key
...
If the user would forget the PrimaryKeyDefinition, the primary was not defined:
try db.create(table: "membership") { t in
// WRONG: pk is unused
t.primaryKey { pk in
t.column("playerId", .integer)
t.column("teamId", .text)
}
}
The fix is to remove the PrimaryKeyDefinition:
try db.create(table: "membership") { t in
t.primaryKey {
t.column("playerId", .integer)
t.column("teamId", .text)
}
}
2022-11-27 14:09:25 +01:00
Gwendal Roué
f774aa7c07
Fix tests for named in-memory database
2022-11-27 12:46:59 +01:00
Gwendal Roué
f5ebf0de4d
Use primary key definitions with NOT NULL constraint by default
2022-11-27 12:35:47 +01:00
Gwendal Roué
cd16e921fe
Tests for primary key definition with NOT NULL constraint by default
2022-11-27 11:47:56 +01:00
Gwendal Roué
a0bfbafd9c
Add tests for MutablePersistableRecord on tables without explicit primary key
2022-11-26 16:27:27 +01:00
Gwendal Roué
392e9e447d
Shared in-memory databases
2022-11-23 18:32:57 +01:00
Gwendal Roué
0ba3dff901
Rewrite availability check for WAL snapshots
...
Also, enable WAL snapshots with SQLCipher, if SQLITE_ENABLE_SNAPSHOT is set.
2022-11-18 13:33:28 +01:00
Gwendal Roué
9b4d76ca37
Robustness: DatabaseSnapshotPool discards connections that have lost the snapshot
2022-11-18 08:53:39 +01:00
Gwendal Roué
9b663e3bcc
Pool can discard elements after use
2022-11-18 08:52:52 +01:00
Gwendal Roué
847386860f
Fix test compilation on Xcode 14
...
Grrr
2022-11-17 22:48:13 +01:00
Gwendal Roué
e4c5cc3451
Test that DatabaseSnapshotPool can be used from ValueObservation
2022-11-17 22:04:06 +01:00
Gwendal Roué
79d4db7827
More DatabaseSnapshotPool tests
2022-11-17 21:56:01 +01:00
Gwendal Roué
12d656d3a1
Let SQLite check if DatabaseSnapshotPool can be created
2022-11-17 20:01:17 +01:00
Gwendal Roué
0bc49460d7
DatabaseSnapshotPool uses its own pool of connections
...
In the previous implementation, the snapshot pool would use the same reader connections as the database pool. This would create problem with reentrant reads. Let's make things simple, and not share any database connection.
2022-11-17 18:36:17 +01:00
Gwendal Roué
e129df15db
Fix tests for Xcode 14.0
2022-11-14 19:29:17 +01:00
Gwendal Roué
c4c0b1ce90
Test and fix unsafe and async DatabaseSnapshotPool
2022-11-14 19:10:52 +01:00
Gwendal Roué
c23b93d71b
Document that reentrant database accesses use the current database connection when possible
2022-11-14 18:38:33 +01:00
Gwendal Roué
b8bc8273a9
Turn snapshot tokens into a proper reader: DatabaseSnapshotPool
2022-11-14 18:22:13 +01:00
Gwendal Roué
a71eb3d662
Introduce WALSnapshotToken
2022-11-13 18:28:54 +01:00
Gwendal Roué
4871304c60
Enable WALSnapshot on macOS (Xcode 14.1+)
2022-11-13 15:29:44 +01:00
Gwendal Roué
c5a0598cea
DocC: Concurrency Guides
2022-11-09 13:22:53 +01:00
Gwendal Roué
13c804d1cc
DocC
2022-11-06 16:02:36 +01:00
Gwendal Roué
811d287bd9
Row.withUnsafeData
2022-11-06 16:02:36 +01:00
Gwendal Roué
8d316dc969
Test insertAndFetch with IGNORE policy
2022-11-06 16:02:36 +01:00
Gwendal Roué
38e7e649c7
Upgrade GRDBPerformance dependencies
2022-10-29 17:10:16 +02:00
Gwendal Roué
c197e2f520
Don't run unicode61 tokenizer categories tests before SQLite 3.25.0
2022-10-29 15:04:09 +02:00
Gwendal Roué
4f4553f4f0
Regression tests for tokenizer arguments quoting
2022-10-29 14:21:33 +02:00
Gwendal Roué
9b505bb34b
Fix quoting of FTS5 tokenizer arguments
...
Tokenizer arguments only need to be quoted ("foo" -> "'foo'") when we generate SQL for a tokenizer. They must not be quoted when we instantiate a tokenizer with the fts5_tokenizer.xCreate function.
This commit fixes tokenizer instantiation by not quoting arguments when we call the fts5_tokenizer.xCreate function.
Before this fix, the FTS5Tokenizer.tokenize(query:) method would return incorrect tokens.
2022-10-29 14:21:33 +02:00
Jon
76b05369ff
Add support for passing in categories to the unicode61 tokenizer
2022-10-21 16:21:07 -04:00
Gwendal Roué
901d010ab3
Restore the test that strict tables won't accept ill-typed values.
2022-10-20 08:46:49 +02:00
Gwendal Roué
3c4ff5b26e
Single test for strict tables
...
Also, skip the test for old SQLCipher version.
2022-10-20 08:46:49 +02:00
Josip Cavar
c57e76be52
Add support for .strict table option in 3.37+
2022-10-19 15:55:46 +02:00
Gwendal Roué
c6aa323cd8
Skip flaky test
2022-09-09 09:50:25 +02:00
Gwendal Roué
1c7b618a89
Parallelizable tests
2022-09-09 09:33:57 +02:00
Gwendal Roué
d3ad7acd59
No WALSnapshot on macOS and macOS Catalyst
...
Fix #1276
2022-09-09 08:16:55 +02:00
Gwendal Roué
82b4d90a82
Xcode 14 RC doesn't ship with the Swift 5.6 stdlib
...
https://forums.swift.org/t/xcode-14-rc-cannot-specialize-protocol-type/60171
2022-09-09 08:16:55 +02:00
Gwendal Roué
b0f7493765
BREAKING: rename request methods that build a DatabasePromise
...
This creates an opportunity for future `request.filter { ... }` apis that look like standard ones. Why not `Player.filter { $0.score > 1000 }` eventually, perhaps with code generation?
2022-09-06 22:56:40 +02:00
Gwendal Roué
fdbcb07452
Fix #1275
2022-09-06 08:25:21 +02:00
Gwendal Roué
f3b8b7221c
Failing test for #1274
...
https://github.com/groue/GRDB.swift/discussions/1274
2022-09-05 08:42:29 +02:00
Gwendal Roué
6add38e3e5
BREAKING: Allow ValueObservation to perform different kinds of fetch
...
We're interested in allowing observations to build values based on snapshots
2022-09-04 12:06:17 +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é
3e4b04d4d1
Test the "Single-Row Tables" guide
2022-08-25 19:05:27 +02:00
Gwendal Roué
980f5247f0
Failing test for #1267
2022-08-25 08:12:32 +02:00
Gwendal Roué
327911d057
Upsert: add support for conflict target and assignments
2022-08-23 20:02:17 +02:00
Gwendal Roué
2789444acd
Enable UPSERT and RETURNING with SQLCipher
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é
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