Commit Graph
2111 Commits
Author SHA1 Message Date
Gwendal Roué 63590ede60 Association limit WIP 2025-03-01 13:20:23 +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
Gwendal Roué 900180dafd [BREAKING] Prefer any DatabaseReader and DatabaseWriter 2024-09-21 16:50:03 +02:00
Gwendal Roué 46e15616a7 [BREAKING] macOS 10.15+ 2024-09-21 14:28:24 +02:00
Gwendal Roué e4a4735494 [BREAKING] tvOS 13+ 2024-09-21 13:57:35 +02:00
Gwendal Roué 8c40592955 [BREAKING] iOS 13+ 2024-09-21 13:57:23 +02:00
Gwendal Roué 7707bbd1e9 Fix Swiftlint warning 2024-09-21 10:39:36 +02:00
Gwendal Roué 2845570929 Fix DocC warnings 2024-09-15 14:27:19 +02:00
Gwendal Roué 9501d1f936 Fix compiler warnings about SchedulingWatchdog concurrency 2024-09-14 17:24:00 +02:00
Gwendal Roué 2f240fd764 [SENDING REGRET] Async database access methods return Sendable results
We can not tell the compiler that we can safely return `sending` results, because fetched values are in the same region as the `db` argument, according to SE-0414 (https://github.com/swiftlang/swift-evolution/blob/main/proposals/0414-region-based-isolation.md#rules-for-merging-isolation-regions).

```
class NotSendable { init() { } }
func fetchNotSendable(_ db: Database) -> NotSendable { fatalError() }

func notOK<T>(_ make: (Database) -> sending T) { }
func ok<T>(_ make: () -> sending T) { }

func usage() {
    ok { NotSendable() }

    // Returning a task-isolated 'NotSendable' value as a 'sending' result
    // risks causing data races.
    notOK { db in fetchNotSendable(db) }
}
```

Various attempts at modifying all fetching methods so that they have a `sending` return value have failed.
2024-09-08 16:55:25 +02:00
Gwendal Roué 5f384a4b22 ValueObservation is Sendable 2024-09-08 16:17:51 +02:00
Gwendal Roué 28faa97a37 Database.afterNextTransaction callbacks are Sendable 2024-09-08 16:17:45 +02:00
Gwendal Roué 5585e47c33 Database publishers require Sendable closures 2024-09-08 16:17:17 +02:00
Gwendal Roué 62d96ec544 [SENDING REGRET] Async database accesses require Sendable closures
We should be able to use sending closures instead, but DispatchQueue.async does not accept sending closures yet.
2024-09-08 16:16:40 +02:00
Gwendal Roué e35fb79308 DatabaseRegionObservation callbacks are Sendable 2024-09-08 16:12:33 +02:00
Gwendal Roué c122872734 [SENDING REGRET] SerializedDatabase.async requires a Sendable closure
We should be able to use a sending closure instead, but DispatchQueue.async does not accept sending closures yet.
2024-09-08 16:09:31 +02:00
Gwendal Roué a7a9c75185 Place @escaping before @Sendable 2024-09-08 13:41:13 +02:00
Gwendal Roué 6a29d6c081 [BREAKING] Prefer Collection over Sequence for filter(keys:) and derived APIs
We were frequently turning those sequences into an Array in order to check their emptiness, and generally were not sure we'd iterate a sequence only once.

Also use `some Sequence` and `some Collection` whenever possible.
2024-09-08 12:52:27 +02:00
Gwendal Roué 0e6ffeb2d5 Merge branch 'master' into GRDB7 2024-09-08 11:37:48 +02:00
Gwendal Roué cdb181d9ca Don't invoke sqlite3_db_release_memory on closed database connections 2024-09-04 09:21:30 +02:00
Gwendal Roué 5b4b8a9065 Async database accesses check for cancellation before returning 2024-09-01 15:35:37 +02:00
Gwendal Roué cb1bd83777 Document that async methods can throw CancellationError 2024-09-01 15:35:37 +02:00
Gwendal Roué d6b91eec85 [BREAKING] DatabaseReader async methods support Task cancellation 2024-09-01 15:35:37 +02:00
Gwendal Roué fa54b74eba [BREAKING] DatabaseWriter async methods support Task cancellation 2024-09-01 15:35:37 +02:00
Gwendal Roué 40140afb8c SerializedDatabase support for async db access with support for Task cancellation 2024-09-01 15:24:39 +02:00
Gwendal Roué b85121d456 Database support for cancellation 2024-08-31 12:24:19 +02:00
Gwendal Roué aac8720bc7 DatabaseRegionObservation is Sendable 2024-08-27 08:05:26 +02:00
Gwendal Roué c56b52980a DatabaseCancellable is Sendable 2024-08-27 08:05:26 +02:00
Gwendal Roué 4222854f8b DatabaseRegionConvertible is Sendable 2024-08-27 08:05:26 +02:00
Gwendal Roué cc5798cf1e WALSnapshotTransaction is Sendable 2024-08-26 08:27:34 +02:00
Gwendal Roué aff662c101 SQL is Sendable 2024-08-25 18:06:29 +02:00
Gwendal Roué b0c5725075 OnDemandFuture fulfill is Sendable 2024-08-25 17:34:54 +02:00
Gwendal Roué b587afba0e Pool is Sendable 2024-08-25 17:28:02 +02:00