Commit Graph
1741 Commits
Author SHA1 Message Date
Gwendal Roué 8760033045 Update the list of extended result codes from SQLite 3.37.2
This updated list contains SQLITE_CONSTRAINT_DATATYPE, introduced with strict tables.
2022-01-09 17:01:37 +01:00
Gwendal Roué b2fabf5fc3 Strict tables need REAL and ANY column types 2022-01-09 17:01:37 +01:00
Gwendal Roué 790c054a28 Fix Swiftlint warnings 2022-01-09 14:43:27 +01:00
Gwendal Roué 94ff9f3e45 The casing of ColumnInfo.type depends on the SQLite version 2022-01-09 14:28:00 +01:00
Gwendal Roué fc0e1bede1 Methods that fully consume a cursor prefer forEach to next
This allows custom forEach implementations to wrap the full consumption of a cursor
2022-01-08 13:50:14 +01:00
Gwendal Roué 823af1944e Cursor.forEach is a customization point 2022-01-08 13:47:54 +01:00
Gwendal Roué 4aa37f6169 Expert users need raw access to expert values 2022-01-06 13:52:09 +01:00
Gwendal Roué 37571525e6 Merge branch 'development' into dev/issue-1074-incremental_backup_api 2022-01-06 13:45:26 +01:00
Michael Allman a71639159b Add DatabaseBackupProgress and update the documentation 2021-12-15 01:52:25 -05:00
Gwendal Roué 0cf4c4efba Merge branch 'development' into dev/async 2021-12-12 17:00:08 +01:00
Gwendal Roué 7001b60cf7 More support for association existence check
New: support for associated tables WITHOUT ROWID with a compound primary key
New: support for associated views

Checking for the existence of associated CTEs is still not implemented (it fails with "table does not exist" error).
2021-12-12 16:43:40 +01:00
Gwendal Roué dcc2d211b2 Database.primaryKey() fails for views 2021-12-12 16:14:25 +01:00
Gwendal Roué bc2a66e40f Don't throw any error when checking if a table is WITHOUT ROWID 2021-12-12 13:29:02 +01:00
Gwendal Roué effc991de1 Deprecate DatabaseRegion.init(table:)
This commit reverts #510
2021-12-12 12:36:27 +01:00
Gwendal Roué 1b62e06c4a Expose Sendable conformance to Swift 5.5
But async apis are still only exposed to Swift 5.5.2.

Sendable conformances are helpful for users of Xcode < 13.2.
2021-12-10 08:08:47 +01:00
Michael Allman bedf2dbcd4 Revise and correct some names and backup code documentation 2021-12-08 10:23:11 -08:00
Michael Allman 13e195db40 Revise incremental backup API to report progress via a throwing callback
function
2021-12-08 09:37:10 -08:00
Michael Allman 087ad10086 Add an API to track progress of and cancel backups in progress, for both
the DatabaseReader/DatabaseWriter API and Database API
2021-12-08 09:37:10 -08:00
Michael Allman f012c011b1 Import the Foundation framework in DatabaseReader.swift, which is required to get the Progress class 2021-12-08 09:37:10 -08:00
Michael Allman f829d46b7f Change default backup page step size from 5 to 100, which is the value used in the sqlite3 cli .backup command 2021-12-08 09:37:10 -08:00
Michael Allman ab6f18e46d Initial commit of code to implement progress-reporting database backups 2021-12-08 09:37:10 -08:00
Gwendal Roué 01f4c04c4d DatabaseReader is Sendable 2021-12-08 18:12:28 +01:00
Gwendal Roué 33d9ca0e97 UIApplication notification names are isolated to @MainActor
I believe this is incorrect: FB9801372 (UIApplication.didReceiveMemoryWarningNotification should not be declared @MainActor)

Meanwhile, just use the string version.

A workaround based on a MainActor-isolated task can't work due to conflict between compiler version and minimum iOS target:

    #if compiler(>=5.5) && canImport(_Concurrency)
    if #available(...) { // Check for availability of concurrency runtime
        Task { @MainActor [weak self] in
            NotificationCenter.default.addObserver(..., name: UIApplication.didReceiveMemoryWarningNotification, object: nil)
        }
    } else {
        // IMPOSSIBLE CASE: No access to Task, no access to notification names
    }
    #else
    NotificationCenter.default.addObserver(..., name: UIApplication.didReceiveMemoryWarningNotification, object: nil)
    #endif
2021-12-08 12:48:19 +01:00
Gwendal Roué 61b0df8017 Enable async APIs on Xcode 13.2+ only
Xcode 13.1 won't have access to async apis. This simplifies our availability checks.

The techniques were inspired from:

- https://github.com/swift-server/guides/blob/main/docs/concurrency-adoption-guidelines.md#api-design
- https://github.com/swift-server/guides/blob/main/docs/concurrency-adoption-guidelines.md#backwards-compatibility-of-declarations-and-checked-swift-concurrency
2021-12-08 11:17:40 +01:00
Gwendal Roué 3f02724e60 RowDecodingError is Sendable
Xcode 13.2 RC won't compile unless we make a Sendable copy of the row that could not be decoded.
2021-12-08 07:59:43 +01:00
Gwendal Roué 8ed16f4440 Fix some compiler warnings with -Xfrontend -warn-concurrency
https://twitter.com/olebegemann/status/1467893554915782668
2021-12-07 09:23:37 +01:00
Gwendal Roué 6ec3ebc398 Merge branch 'development' into dev/async 2021-12-06 18:04:35 +01:00
Gwendal Roué 36fba9a79a TODO: deprecate DatabaseRegion(table:)
We have `Table` now, wich is DatabaseRegionConvertible.

This deprecation will revert https://github.com/groue/GRDB.swift/pull/510
2021-12-02 17:21:58 +01:00
Gwendal Roué 6240585a03 Make sure ValueObservation fetches in an isolated transaction
Previously, ValueObservation could fetch in a non-isolated way. When an external connection would commit changes, we could fetch inconsistent values. Here we make sure ValueObservation always fetch in an isolated way.
2021-12-02 09:46:02 +01:00
Gwendal Roué bb2ce74125 Add helper method Database.isolated(readOnly:) 2021-12-02 09:45:28 +01:00
Gwendal Roué 97d4a60148 Merge branch 'development' into dev/async
# Conflicts:
#	Documentation/DemoApps/GRDBDemoiOS/README.md
#	Documentation/DemoApps/README.md
2021-11-27 12:05:24 +01:00
Gwendal Roué d8b83fba12 improve compilation time 2021-11-18 08:34:59 +01:00
Gwendal Roué 93c4249619 ForeignKeyViolation.databaseError(_:) 2021-11-16 08:51:33 +01:00
Gwendal Roué ebc8524706 Add missing public qualifiers 2021-11-16 08:45:34 +01:00
Gwendal Roué ea41f34f3d Quote table name in raw SQL query 2021-11-16 08:40:16 +01:00
Gwendal Roué f74ce91a17 Merge branch 'development' into dev/async
# Conflicts:
#	CHANGELOG.md
#	Documentation/Concurrency.md
#	README.md
2021-11-07 11:47:01 +01:00
Gwendal Roué af2d65ef49 Fix Swiftlint warnings 2021-11-07 10:32:00 +01:00
Gwendal Roué 7af3858ff6 More robust DatabasePool.close() test 2021-11-07 08:17:48 +01:00
Gwendal Roué eb9d0bce58 Documentation 2021-11-07 08:16:58 +01:00
Gwendal Roué 1738ad34cd Extract the Concurrency Guide 2021-11-06 12:23:54 +01:00
Gwendal Roué c81a4dbf32 Distinguish "FOREIGN KEY constraint failed" from "FOREIGN KEY constraint violation" errors 2021-11-04 18:44:44 +01:00
Gwendal Roué 127c4e0440 Rename methods that check foreign keys 2021-11-04 18:26:24 +01:00
Gwendal Roué 6193c6aa00 foreignKeyViolations() and checkForeignKeyViolations() 2021-11-04 14:19:11 +01:00
Gwendal Roué 7897c6a799 asyncUnsafeRead handle closed connection 2021-11-01 07:25:26 +01:00
Gwendal Roué 15b38353bc Add experimental warning to the documentation of async methods 2021-10-31 19:35:05 +01:00
Gwendal Roué 1a87faacfa Merge branch 'development' into dev/async 2021-10-31 18:32:03 +01:00
Gwendal Roué 20cb50f52d Public close() method 2021-10-31 18:12:13 +01:00
Gwendal Roué c755dc70ef Restrict async/await to Xcode 13.1+ 2021-10-30 20:09:39 +02:00
Gwendal Roué 0ead20cdd6 All async apis are experimental 2021-10-17 13:26:41 +02:00
Gwendal Roué 2ad6131d08 Require canImport(_Concurrency)
This fixes the build for macOS 11.5
2021-10-17 13:26:41 +02:00