Commit Graph
2142 Commits
Author SHA1 Message Date
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
Gwendal Roué 41d4f23a83 DatabasePool reads can access task locals 2025-07-19 14:25:50 +02:00
Gwendal Roué e6847886db Extract DispatchQueueActor
We'll probably need it in order to access pool elements with support for task locals
2025-07-19 14:25:50 +02:00
Gwendal Roué c064515247 DatabaseQueue and DatabaseSnapshot reads can access task locals 2025-07-19 14:25:50 +02:00
Gwendal Roué 96236a3d44 Turn Database.cancel into a sendable closure 2025-07-19 14:25:50 +02:00
Jason Abbott c7d50486ad Merge branch 'groue:development' into development 2025-05-30 12:05:03 -06:00
Jason Abbott 93292d88f4 Make DatabasePreUpdateEvent.Kind Sendable, matching DatabaseEvent.Kind, and also duplicate comments from DatabaseEvent.Kind while here 2025-05-30 12:02:23 -06:00
Gwendal Roué f635aea2f2 Update more documentation with the closure syntax 2025-05-10 16:38:02 +02:00
Gwendal Roué 6cc3116ff4 TableAlias is generic 2025-05-10 14:52:48 +02:00
Gwendal Roué 430141344d Update more documentation with the closure syntax 2025-05-10 09:36:14 +02:00
Gwendal Roué a71c1d6e80 Removed unnecessary TODO warning 2025-03-28 08:15:54 +01:00
Gwendal Roué 67b34dc57c TransactionObserver can access the database, even if the transaction was completed in a cancelled task.
Fix https://github.com/groue/GRDB.swift/discussions/1746
2025-03-22 12:13:42 +01:00
Gwendal Roué ef36727d9a 🎵 Whatever Lola wants, Lola gets
Address https://github.com/RxSwiftCommunity/RxGRDB/issues/72

Based on https://github.com/swiftlang/swift-evolution/blob/main/proposals/0337-support-incremental-migration-to-concurrency-checking.md#preconcurrency-attribute-on-nominal-declarations

See also https://www.massicotte.org/preconcurrency#working-with-swift-5

"Whatever Lola wants, Lola gets" because the Swift language is a blind and cruel mistress.
2025-02-05 13:38:19 +01:00
Gwendal Roué 5a4d9b5cb9 Let PRAGMA QUERY_ONLY statements run from a cancelled database access
Fix #1715
2025-02-04 19:35:39 +01:00
Gwendal Roué 0401d449bb Database.sqliteLibVersionNumber 2025-02-01 12:01:41 +01:00
Gwendal Roué 831e79ee82 JSONB functions and tests 2025-01-26 14:21:35 +01:00
Gwendal Roué 898e7b6abe Merge pull request #1662 from compnerd/c
Core: import `ucrt` on Windows for `strcmp`
2024-11-13 16:11:39 +01:00
Saleem Abdulrasool 77a4d17940 Core: import ucrt on Windows for strcmp
This uses the deprecated `strcmp` interface on Windows, which requires
the C library to be imported. Add the missing import to allow building
on Windows.
2024-11-12 11:12:27 -08:00
Saleem Abdulrasool c865a847fd Foundation: elide extensions on Windows to match Linux
Similar to Linux, elide some extensions on Windows. This is required to
build this module on Windows.
2024-11-12 11:10:07 -08:00
Gwendal Roué c97f633022 More documentation of database schema methods 2024-10-13 11:28:14 +02:00
Gwendal Roué 2c49a69f43 Raise a fatal error when the users filters a database view by primary key
Fixes #1648
2024-10-12 15:41:36 +02:00
Gwendal Roué 97c0c72702 Merge pull request #1645 from philmitchell/coalesce
Add coalesce free function and Row method
2024-10-06 13:55:02 +02:00
Gwendal Roué 8cac458efc Use "real" column names in examples.
Also, remove "essential".
2024-10-06 12:42:10 +02:00
Gwendal Roué a13c1bec29 Add coalesce in DocC 2024-10-06 12:19:49 +02:00
Gwendal Roué c6781f46d2 Prefer Collection over Array
This allows the user to call those methods with an Array, or any other collection at hand (including lazy ones)

This change makes `return coalesce(columns.lazy.map { $0.name })` iterate lazily. Before this commit, `map` was returning a non-lazy Array.
2024-10-06 12:19:49 +02:00
Phil Mitchell d7754fa79c Add coalesce free function and Row method 2024-09-30 13:10:59 +10:00
Dianna 5f2185a118 use #if directives to conditionally @preconcurrency import the Dispatch module to enable building the package on linux 2024-09-29 21:44:34 +00:00
Gwendal Roué 073682c4f0 Remove the experimental flag on stabilized apis 2024-09-28 14:41:12 +02:00
Gwendal Roué 972aa33f68 Avoid optionals in JSON Data to String conversions 2024-09-22 10:10:01 +02:00
Gwendal Roué 938ad7a086 Prefer Data over NSData 2024-09-22 09:29:59 +02:00