Gwendal Roué
3ee256e7e8
Common API for statements that must ignore interruption errors
2025-12-09 21:39:20 +01:00
Gwendal Roué
361599aacd
Task cancellation should turn all SQLITE_INTERRUPT errors into CancellationError, including errors thrown by statement compilation
...
I did not know statement compilation could fail when database is interrupted until #1838 . A ROLLBACK statement would not even compile due to the FTS5 statement leak reported in https://sqlite.org/forum/forumpost/137c7662b389fa18
2025-12-09 21:38:15 +01:00
Gwendal Roué
64a024097d
Fix failing test for #1838 by reseting all prepared statements before retrying
2025-12-08 21:40:48 +01:00
Gwendal Roué
60ea10948b
Protect PRAGMA query_only = 0 against SQLITE_INTERRUPT
...
This should fix a race condition about cancellation that happens during a read-only access.
2025-12-08 21:22:43 +01:00
Gwendal Roué
5dba64d545
Retry a rollback in case of SQLITE_INTERRUPT error
...
This should fix a race condition about cancellation that happens during a rollback
2025-12-08 21:11:26 +01:00
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é
361a482b1e
Enable SQLITE_ENABLE_SNAPSHOT by default and introduce SQLITE_DISABLE_SNAPSHOT
2025-10-12 14:03:09 +02:00
Gwendal Roué
8cba324d6e
Refactor the SQLite import
...
We can not use `#if Trait` because Xcode does not enable those compiler flags. Always count on Apple for delivering the best quality software.
So now we import the default SPM SQLite last, after all other cases have been excluded.
The GRDB framework (GRDB.xcodeproj and GRDB via CocoaPods) is distinct from the default SPM trait, so we detect it with GRDBFRAMEWORK.
2025-10-04 17:56:06 +02:00
Gwendal Roué
b1b83abd8b
Simplify the compiler checks for the availability of SQLite snapshots
2025-10-04 14:15:13 +02:00
Gwendal Roué
3f27fb9289
Fix #1820
...
The regression was introduced by c7bbebc
2025-09-29 19:35:00 +02:00
Gwendal Roué
9ef5e2c8eb
Simplify error messages
2025-09-23 17:12:27 +02:00
Gwendal Roué
f5dc68fc6f
Fix typos
2025-09-23 17:12:27 +02:00
Gwendal Roué
b210ec7428
View Records guide
2025-09-23 17:12:27 +02:00
Gwendal Roué
99ecf76a77
Support primary key when testing the existence of an association to a view
2025-09-23 17:12:27 +02:00
Gwendal Roué
1b98a964d7
Documentation
2025-09-23 17:12:27 +02:00
Gwendal Roué
1095d21abd
Default implementation for schema source chaining.
...
When GRDB eventually adds methods to the DatabaseSchemaSource protocol, our chained schema source will implement chaining on those new methods.
When users write their own custom chaining schema source, the compiler will not tell them that they have to chain the new methods when they upgrade GRDB. The built-in (and correct) implementation of chaining helps avoiding this scenario.
2025-09-23 17:12:27 +02:00
Gwendal Roué
eb2378a741
DatabaseSchemaSource documentation
2025-09-23 17:12:27 +02:00
Gwendal Roué
37dde39557
Public Database.schemaSource and withSchemaSource(_:execute:)
2025-09-23 17:12:27 +02:00
Gwendal Roué
e1abafaae3
Ignore schema source during migrations
2025-09-23 17:12:27 +02:00
Gwendal Roué
26ebd7e147
Update outdated comments
2025-09-23 17:12:27 +02:00
Gwendal Roué
9518d74fa6
Improve error message
2025-09-23 17:12:27 +02:00
Gwendal Roué
38f5226e95
Database.table(_:hasUniqueKey:) now accept views
2025-09-23 17:12:27 +02:00
Gwendal Roué
d7d61add23
DatabaseSchemaSource customizes the primary key of database views
2025-09-23 17:12:27 +02:00
Gwendal Roué
d040588849
Database.fetchPrimitivePrimaryKey(forTable:)
...
This method is necessary for the customization of schema introspection: it must be possible to fallback on the primitive SQLite schema introspection when needed.
2025-09-23 17:12:27 +02:00
Gwendal Roué
30313623eb
Make DatabaseSchemaID and DatabaseObjectID public
...
This is also a big cleanup opportunity.
We need public schema identifiers in order to support the customization of schema introspection.
2025-09-23 17:12:27 +02:00
alephao
aab2664431
fix: DispatchQueueExecutor sendable conformance on Linux
2025-09-18 08:27:14 +02:00
Gwendal Roué
f3acfecc16
DatabaseCollation no longer uses a deprecated String initializer
2025-09-13 12:21:36 +02:00
Gwendal Roué
1a3842e4bc
Combine and concurrency: lol
2025-09-10 07:12:53 +02:00
Gwendal Roué
cf1702630f
DatabaseAggregate is SendableMetatype
...
DatabaseAggregate does not support isolated conformances: it must be able to aggregate values whenever a database access is performed. This can happen in a nonisolated fashion.
2025-09-10 07:12:52 +02:00
Gwendal Roué
4cfa692ddd
Fix race condition regarding Task cancellation
...
This complements #1797 by making sure read-only transactions complete correctly, even if the task is cancelled.
2025-09-10 07:12:11 +02:00
Gwendal Roué
8dfbbb50f6
TODO
2025-09-10 06:51:14 +02:00
Gwendal Roué
3f69614405
DatabaseFunction with raw xFunc
...
No use right now, but I was really bugged that we could not use raw sqlite3_result_xxx methods from custom functions.
2025-09-02 08:09:16 +02:00
Gwendal Roué
b4f3a83755
Remove SwiftLint warning
...
If we don't have warnings about explicit nil initialization, then we have a warning about the name of a disabled rule which is now deprecated. In all cases, we have a warning.
So let's just write 2025 Swift, ignore that rule, and call it a day.
2025-09-02 08:07:16 +02:00
Gwendal Roué
215128390d
Fix race condition: prevent cancellation from cancelling other database accesses after database accesses has completed
...
Before this change, cancelling a database access could cancel *another* database access 😱
2025-07-23 12:01:58 +02:00
Gwendal Roué
b572982e34
Document RowDecodingError
2025-07-20 13:11:42 +02:00
Gwendal Roué
5a8b025ee8
TODO: test throwing row accessors of record collections and sets
2025-07-20 13:00:12 +02:00
Gwendal Roué
f72d0cecb2
Document throwing row accessors
2025-07-20 13:00:12 +02:00
Gwendal Roué
24e0f5ddeb
Make throwing row accessors public
2025-07-20 13:00:12 +02:00
Gwendal Roué
2b1b56ea47
Make RowDecodingError public
2025-07-20 13:00:12 +02:00
Gwendal Roué
ad704c58e5
Hide implementation of RowDecodingError
...
Turn the enum into a struct so that it can be made public without exposing internal details
2025-07-20 13:00:12 +02:00
Gwendal Roué
d242421862
Async methods accept a non-escaping closure
2025-07-19 16:42:17 +02:00
Gwendal Roué
7a1e65b142
Remove late cancellation checks
...
I'm slowly changing my mind about this.
2025-07-19 15:27:08 +02:00
Gwendal Roué
fb4578a7d6
Delete unused code
2025-07-19 15:26:46 +02:00
Gwendal Roué
6069e6d683
DatabasePool.barrierWriteWithoutTransaction can access task locals
2025-07-19 15:26:44 +02:00
Gwendal Roué
684266b7b8
DispatchQueueActor supports barriers in concurrent DispatchQueue
2025-07-19 14:25:50 +02:00
Gwendal Roué
cbbd0cb945
Add asserts about expected ends of transaction
2025-07-19 14:25:50 +02:00
Gwendal Roué
dd4227303a
DatabasePool unsafeRead can access task locals
2025-07-19 14:25:50 +02:00
Gwendal Roué
69b786dc9e
Allow COMMIT from a cancelled read-only access.
2025-07-19 14:25:50 +02:00
Gwendal Roué
c5ac6cdaa6
DatabaseSnapshotPool reads can access task locals
2025-07-19 14:25:50 +02:00
Gwendal Roué
e154a652dc
Don't check for reentrancy from async Pool.read
...
One can't call an async function from a database access anywau
2025-07-19 14:25:50 +02:00