mirror of
https://github.com/groue/GRDB.swift
synced 2026-12-04 05:08:44 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45e58e64b7 | ||
|
|
8123704c56 | ||
|
|
b0e1be2e70 |
No files matched your search
@@ -18,11 +18,12 @@ Please fill out this template when filing an issue.
|
||||
|
||||
### Environment
|
||||
|
||||
**GRDB flavor(s):** (GRDB, SQLCipher, Custom SQLite build?)
|
||||
**GRDB version:**
|
||||
**Enabled SwiftPM traits:**
|
||||
**Installation method:** (CocoaPods, SPM, manual?)
|
||||
**Xcode version:**
|
||||
**Swift version:**
|
||||
**Platform(s) running GRDB:**
|
||||
**Platform(s) running GRDB:** (iOS, macOS, watchOS?)
|
||||
**macOS version running Xcode:**
|
||||
|
||||
### Demo Project
|
||||
|
||||
+41
-24
@@ -1,4 +1,4 @@
|
||||
# https://github.com/actions/runner-images/blob/main/images/macos/xcode-27-arm64-Readme.md
|
||||
# https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md
|
||||
|
||||
name: "GRDB CI"
|
||||
|
||||
@@ -8,7 +8,7 @@ on:
|
||||
- master
|
||||
- development
|
||||
paths:
|
||||
- 'Sources/**'
|
||||
- 'GRDB/**'
|
||||
- 'Tests/**'
|
||||
- '.github/workflows/**'
|
||||
- 'Makefile'
|
||||
@@ -16,7 +16,7 @@ on:
|
||||
- 'SQLiteCustom/src'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'Sources/**'
|
||||
- 'GRDB/**'
|
||||
- 'Tests/**'
|
||||
- '.github/workflows/**'
|
||||
- 'Makefile'
|
||||
@@ -40,17 +40,17 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- xcode: "Xcode_27.2.app"
|
||||
runsOn: xcode-27
|
||||
- xcode: "Xcode_16.4.app"
|
||||
runsOn: macOS-15
|
||||
destination: "platform=macOS"
|
||||
name: "macOS"
|
||||
- xcode: "Xcode_27.2.app"
|
||||
runsOn: xcode-27
|
||||
destination: "OS=27.2,name=iPhone 17"
|
||||
- xcode: "Xcode_16.4.app"
|
||||
runsOn: macOS-15
|
||||
destination: "OS=18.5,name=iPhone 16 Pro"
|
||||
name: "iOS"
|
||||
- xcode: "Xcode_27.2.app"
|
||||
runsOn: xcode-27
|
||||
destination: "OS=27.2,name=Apple TV 4K (4th generation)"
|
||||
- xcode: "Xcode_16.4.app"
|
||||
runsOn: macOS-15
|
||||
destination: "OS=18.5,name=Apple TV"
|
||||
name: "tvOS"
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
@@ -66,13 +66,30 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- xcode: "Xcode_27.2.app"
|
||||
runsOn: xcode-27
|
||||
name: "Xcode 27.2"
|
||||
- xcode: "Xcode_16.4.app"
|
||||
runsOn: macOS-15
|
||||
name: "Xcode 16.4"
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: ${{ matrix.name }}
|
||||
run: make test_SPM test_install_SPM
|
||||
SQLCipher3:
|
||||
name: SQLCipher3
|
||||
runs-on: ${{ matrix.runsOn }}
|
||||
env:
|
||||
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}/Contents/Developer"
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- xcode: "Xcode_16.4.app"
|
||||
runsOn: macOS-15
|
||||
name: "Xcode 16.4"
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: ${{ matrix.name }}
|
||||
run: make test_framework_SQLCipher3Encrypted
|
||||
SQLCipher4:
|
||||
name: SQLCipher4
|
||||
runs-on: ${{ matrix.runsOn }}
|
||||
@@ -83,13 +100,13 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- xcode: "Xcode_27.2.app"
|
||||
runsOn: xcode-27
|
||||
name: "Xcode 27.2"
|
||||
- xcode: "Xcode_16.4.app"
|
||||
runsOn: macOS-15
|
||||
name: "Xcode 16.4"
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: ${{ matrix.name }}
|
||||
run: make test_SPM_SQLCipherEncrypted
|
||||
run: make test_framework_SQLCipher4Encrypted
|
||||
# CustomSQLite:
|
||||
# name: CustomSQLite
|
||||
# runs-on: ${{ matrix.runsOn }}
|
||||
@@ -100,9 +117,9 @@ jobs:
|
||||
# fail-fast: false
|
||||
# matrix:
|
||||
# include:
|
||||
# - xcode: "Xcode_27.2.app"
|
||||
# runsOn: xcode-27
|
||||
# name: "Xcode 27.2"
|
||||
# - xcode: "Xcode_16.4.app"
|
||||
# runsOn: macOS-15
|
||||
# name: "Xcode 16.4"
|
||||
# steps:
|
||||
# - uses: actions/checkout@v5
|
||||
# - name: ${{ matrix.name }}
|
||||
@@ -117,9 +134,9 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- xcode: "Xcode_27.2.app"
|
||||
runsOn: xcode-27
|
||||
name: "Xcode 27.2"
|
||||
- xcode: "Xcode_16.4.app"
|
||||
runsOn: macOS-15
|
||||
name: "Xcode 16.4"
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: ${{ matrix.name }}
|
||||
|
||||
+6
-1
@@ -71,7 +71,6 @@ Session.vim
|
||||
# Build generated
|
||||
build/
|
||||
DerivedData
|
||||
/Package.resolved
|
||||
|
||||
# Various settings
|
||||
*.pbxuser
|
||||
@@ -101,6 +100,10 @@ xcuserdata
|
||||
SQLiteCustom/GRDBCustomSQLite-USER.h
|
||||
SQLiteCustom/GRDBCustomSQLite-USER.xcconfig
|
||||
|
||||
# CocoaPods test
|
||||
Pods
|
||||
Podfile.lock
|
||||
|
||||
# SPM
|
||||
.build
|
||||
GRDB.xcworkspace/xcshareddata/swiftpm
|
||||
@@ -110,3 +113,5 @@ Tests/SPM/Packages
|
||||
# Ruby
|
||||
.ruby-version
|
||||
|
||||
# Test products
|
||||
Tests/products
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
[submodule "SQLiteCustom/src"]
|
||||
path = SQLiteCustom/src
|
||||
url = https://github.com/groue/SQLiteLib
|
||||
url = https://github.com/swiftlyfalling/SQLiteLib.git
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
# The OS X Build Environment
|
||||
# https://docs.travis-ci.com/user/reference/osx/#xcode-version
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- development
|
||||
|
||||
language: objective-c
|
||||
xcode_project: GRDB.xcodeproj
|
||||
|
||||
# Caches
|
||||
cache:
|
||||
- bundler
|
||||
- cocoapods
|
||||
|
||||
# Custom CocoaPods installation so that Podfile.lock is honored
|
||||
install:
|
||||
- bundle install
|
||||
- bundle exec pod repo update
|
||||
|
||||
# Disable the default Travis-CI submodule logic
|
||||
# The various make commands ensure that the appropriate submodules are retrieved
|
||||
git:
|
||||
submodules: false
|
||||
|
||||
jobs:
|
||||
include:
|
||||
|
||||
###########################################
|
||||
## Test GRDB Xcode 11.4
|
||||
|
||||
- name: "Test GRDB Xcode 11.4 - GRDBiOS iOS maxTarget"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode11.4
|
||||
script: make test_framework_GRDBiOS_maxTarget_maxSwift
|
||||
|
||||
- name: "Test GRDB Xcode 11.4 - GRDBiOS iOS minTarget"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode11.4
|
||||
script: make test_framework_GRDBiOS_minTarget
|
||||
|
||||
###########################################
|
||||
## Test GRDB Xcode 12.5
|
||||
|
||||
- name: "Test GRDB Xcode 12.5 - GRDBOSX - Swift 5.3"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_framework_GRDBOSX_maxSwift
|
||||
|
||||
- name: "Test GRDB Xcode 12.5 - GRDBOSX - Swift 5.2"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_framework_GRDBOSX_minSwift
|
||||
|
||||
- name: "Test GRDB Xcode 12.5 - GRDBWatchOS"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_framework_GRDBWatchOS
|
||||
|
||||
- name: "Test GRDB Xcode 12.5 - GRDBiOS iOS maxTarget"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_framework_GRDBiOS_maxTarget_maxSwift
|
||||
|
||||
- name: "Test GRDB Xcode 12.5 - GRDBiOS iOS minTarget"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_framework_GRDBiOS_minTarget
|
||||
|
||||
- name: "Test GRDB Xcode 12.5 - GRDBtvOS maxTarget"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_framework_GRDBtvOS_maxTarget_maxSwift
|
||||
|
||||
- name: "Test GRDB Xcode 12.5 - GRDBtvOS minTarget"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_framework_GRDBtvOS_minTarget
|
||||
|
||||
- name: "Test GRDB Xcode 12.5 - SPM"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_SPM
|
||||
|
||||
###########################################
|
||||
## Test GRDBCustom Xcode 12.5
|
||||
|
||||
- name: "Test GRDBCustom Xcode 12.5 - GRDBOSX"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_framework_GRDBCustomSQLiteOSX
|
||||
|
||||
- name: "Test GRDBCustom Xcode 12.5 - GRDBiOS maxTarget"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_framework_GRDBCustomSQLiteiOS_maxTarget_maxSwift
|
||||
|
||||
- name: "Test GRDBCustom Xcode 12.5 - GRDBiOS minTarget"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_framework_GRDBCustomSQLiteiOS_minTarget
|
||||
|
||||
###########################################
|
||||
## Test SQLCipher Xcode 12.5
|
||||
|
||||
- name: "Test SQLCipher Xcode 12.5 - SQLCipher 3"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_framework_SQLCipher3
|
||||
|
||||
- name: "Test SQLCipher Xcode 12.5 - SQLCipher 4"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_framework_SQLCipher4
|
||||
|
||||
###########################################
|
||||
## Test Installation Xcode 12.5
|
||||
|
||||
# Manual Install
|
||||
- name: "Test Installation Xcode 12.5 - Manual Install"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_install_manual
|
||||
|
||||
# Travis is much too slow, and always fail this job
|
||||
# # CocoaPods Lint
|
||||
# - name: "Test Installation Xcode 12.5 - CocoaPods Lint"
|
||||
# gemfile: .ci/gemfiles/Gemfile.travis
|
||||
# osx_image: xcode12.5
|
||||
# script: make test_CocoaPodsLint_GRDB
|
||||
|
||||
# CocoaPods Install GRDB
|
||||
- name: "Test Installation Xcode 12.5 - CocoaPods Framework"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_install_GRDB_CocoaPods_framework
|
||||
|
||||
# CocoaPods Install GRDB
|
||||
- name: "Test Installation Xcode 12.5 - CocoaPods Static"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_install_GRDB_CocoaPods_static
|
||||
|
||||
# SPM Install
|
||||
- name: "Test Installation Xcode 12.5 - SPM Package"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_install_SPM_Package
|
||||
|
||||
# SPM Install
|
||||
- name: "Test Installation Xcode 12.5 - SPM Package in Xcode Project"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_install_SPM_Project
|
||||
|
||||
# Custom SQLite Install
|
||||
- name: "Test Installation Xcode 12.5 - Custom SQLite"
|
||||
gemfile: .ci/gemfiles/Gemfile.travis
|
||||
osx_image: xcode12.5
|
||||
script: make test_install_customSQLite
|
||||
@@ -144,22 +144,6 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception:
|
||||
|
||||
---
|
||||
|
||||
## Unreleased
|
||||
|
||||
[Migrating From GRDB 7 to GRDB 8](Documentation/GRDB8MigrationGuide.md) describes how to bump the GRDB version in your application.
|
||||
|
||||
- **New**: Xcode 27 compatibility
|
||||
- **New**: Bump custom SQLite build to version 3.54.1
|
||||
- **New**: SQLCipher package trait by [@GeorgeElsham](https://github.com/GeorgeElsham) and [@groue](https://github.com/groue) in [#1902](https://github.com/groue/GRDB.swift/pull/1902)
|
||||
- **New**: `sum(_:orderBy:filter:)` and `total(_:orderBy:filter:)` are available with the system SQLite, from iOS 26, macOS 26, tvOS 26, watchOS 26, and visionOS 26.
|
||||
- **Breaking Change**: Raise deployment targets for Xcode 27 compatibility: iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 9.0
|
||||
- **Breaking Change**: Raise minimal Swift version to 6.4 (Xcode 27.0)
|
||||
- **Breaking Change**: Raise minimal SQLite version to 3.36.0
|
||||
- **Breaking Change**: Raise minimal SQLCipher version to 4.5.0
|
||||
- **Breaking Change**: Drop CocoaPods support
|
||||
- **Breaking Change**: `FetchableRecord.databaseDecodingUserInfo` and `EncodableRecord.databaseEncodingUserInfo` are now declared as `[CodingUserInfoKey: any Sendable]`, as `JSONDecoder.userInfo` and `JSONEncoder.userInfo` are.
|
||||
- **Breaking Change**: Remove deprecated APIs
|
||||
|
||||
## 7.12.1
|
||||
|
||||
Released November 30, 2026
|
||||
|
||||
+3
-1
@@ -11,6 +11,7 @@ How you can Contribute
|
||||
|
||||
- For running tests:
|
||||
- Ruby
|
||||
- [CocoaPods](https://cocoapods.org) (gem)
|
||||
- [xcpretty](https://github.com/xcpretty/xcpretty) (gem)
|
||||
- For contributing code:
|
||||
- [Swiftlint](https://github.com/realm/SwiftLint) (present in the `$PATH` or in `/opt/homebrew/bin/`)
|
||||
@@ -27,7 +28,8 @@ How you can Contribute
|
||||
- `GRDB`: GRDB sources
|
||||
- `Tests`: GRDB tests
|
||||
- `GRDBCustom.xcodeproj`: the project which builds GRDB with a custom SQLite build.
|
||||
- `GRDBDemo.xcodeproj`: the demo app.
|
||||
- `GRDBProfiling.xcodeproj`: a project which helps profile GRDB with Instruments. No code here is really precious.
|
||||
- `GRDBDemoiOS.xcodeproj`, `GRDBCombineDemo.xcodeproj`, `GRDBAsyncDemo.xcodeproj`: the demo apps.
|
||||
|
||||
To work with `GRDBCustom.xcodeproj`:
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ Custom SQLite Builds
|
||||
|
||||
By default, GRDB uses the version of SQLite that ships with the target operating system.
|
||||
|
||||
**You can build GRDB with a custom build of [SQLite 3.54.1](https://www.sqlite.org/changes.html).**
|
||||
**You can build GRDB with a custom build of [SQLite 3.47.2](https://www.sqlite.org/changes.html).**
|
||||
|
||||
A custom SQLite build can activate extra SQLite features, and extra GRDB features as well, such as support for the [FTS5 full-text search engine](FullTextSearch.md), and [SQLite Pre-Update Hooks](https://swiftpackageindex.com/groue/GRDB.swift/documentation/grdb/transactionobserver).
|
||||
|
||||
GRDB builds SQLite with [groue/SQLiteLib](https://github.com/groue/SQLiteLib), which uses the same SQLite configuration as the one used by Apple in its operating systems, and lets you add extra compilation options that leverage the features you need.
|
||||
GRDB builds SQLite with [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfalling/SQLiteLib), which uses the same SQLite configuration as the one used by Apple in its operating systems, and lets you add extra compilation options that leverage the features you need.
|
||||
|
||||
> Warning: The technique described here is not compatible with the Swift Package Manager (SPM). It will create [build issues](https://github.com/groue/GRDB.swift/issues/1709) with SPM companion libraries such as [GRDBQuery](https://github.com/groue/GRDBQuery) or [GRDBSnapshotTesting](https://github.com/groue/GRDBSnapshotTesting).
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 26.6;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 17.6;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
@@ -346,7 +346,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 26.6;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 17.6;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
@@ -381,7 +381,6 @@
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemo;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 6.1;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
@@ -411,7 +410,6 @@
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemo;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 6.1;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
@@ -428,7 +426,6 @@
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_VERSION = 6.1;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
@@ -446,7 +443,6 @@
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_VERSION = 6.1;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "2720"
|
||||
LastUpgradeVersion = "2600"
|
||||
version = "1.7">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -141,8 +141,8 @@ extension AppDatabase {
|
||||
}
|
||||
|
||||
// Delete a random player
|
||||
if Bool.random(), let player = try Player.order(sql: "RANDOM()").fetchOne(db) {
|
||||
try player.delete(db)
|
||||
if Bool.random() {
|
||||
try Player.order(sql: "RANDOM()").limit(1).deleteAll(db)
|
||||
}
|
||||
|
||||
// Update some players
|
||||
|
||||
@@ -65,12 +65,18 @@
|
||||
},
|
||||
"Anonymous" : {
|
||||
|
||||
},
|
||||
"Cancel" : {
|
||||
|
||||
},
|
||||
"Name" : {
|
||||
|
||||
},
|
||||
"New Player" : {
|
||||
|
||||
},
|
||||
"Save" : {
|
||||
|
||||
},
|
||||
"Score" : {
|
||||
|
||||
|
||||
@@ -14,12 +14,10 @@ struct PlayerCreationSheet: View {
|
||||
.navigationTitle("New Player")
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .cancellationAction) {
|
||||
Button(role: .cancel) {
|
||||
dismiss()
|
||||
}
|
||||
Button("Cancel") { dismiss() }
|
||||
}
|
||||
ToolbarItem(placement: .confirmationAction) {
|
||||
Button(role: .confirm) {
|
||||
Button("Save") {
|
||||
save()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import SwiftUI
|
||||
|
||||
struct PlayerEditView: View {
|
||||
@Environment(\.isPresented) var isPresented
|
||||
@Environment(\.appDatabase) var appDatabase
|
||||
@State var form: PlayerForm
|
||||
var player: Player
|
||||
@@ -15,9 +16,11 @@ struct PlayerEditView: View {
|
||||
PlayerFormView(form: $form)
|
||||
}
|
||||
.navigationTitle(player.name)
|
||||
.onDisappear {
|
||||
// Back button was pressed
|
||||
save()
|
||||
.onChange(of: isPresented) {
|
||||
if !isPresented {
|
||||
// Back button was pressed
|
||||
save()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
Migrating From GRDB 7 to GRDB 8
|
||||
===============================
|
||||
|
||||
**This guide helps you upgrade your applications from GRDB 7 to GRDB 8.**
|
||||
|
||||
- [Preparing the Migration to GRDB 8](#preparing-the-migration-to-grdb-8)
|
||||
- [New requirements](#new-requirements)
|
||||
- [CocoaPods is no Longer Supported](#cocoapods-is-no-longer-supported)
|
||||
- [SQLCipher](#sqlcipher)
|
||||
- [Cached Statements](#cached-statements)
|
||||
- [JSON User Info](#json-user-info)
|
||||
|
||||
## Preparing the Migration to GRDB 8
|
||||
|
||||
Before upgrading, ensure you are using the [latest GRDB 7 release](https://github.com/groue/GRDB.swift/tags) and address any deprecation warnings. Once this is done, proceed with upgrading to GRDB 8. Due to breaking changes, your application may no longer compile. Follow the fix-it suggestions, and review the specific modifications described below.
|
||||
|
||||
## New requirements
|
||||
|
||||
GRDB requirements have been bumped:
|
||||
|
||||
- **Swift Compiler 6.4+** (was Swift 6.1+)
|
||||
- **Xcode 27.0+** (was Xcode 16.3+)
|
||||
- **iOS 15.0+** (was iOS 13.0+)
|
||||
- **macOS 12.0+** (was macOS 10.15+)
|
||||
- **tvOS 15.0+** (was tvOS 13.0+)
|
||||
- **watchOS 9.0+** (was watchOS 7.0+)
|
||||
- **SQLite 3.36.0+** (was SQLite 3.20.0+)
|
||||
- **SQLCipher 4.5+** (was SQLCipher 3.4+)
|
||||
|
||||
## CocoaPods is no Longer Supported
|
||||
|
||||
GRDB 8 is no longer distributed with CocoaPods. Install it with the Swift Package Manager, or manually. See [Installation](../README.md#installation).
|
||||
|
||||
## SQLCipher
|
||||
|
||||
To use GRDB with SQLCipher, enable the `SQLCipher` trait of the GRDB package. There is no longer any need to fork GRDB. See [Encryption](../README.md#encryption).
|
||||
|
||||
When GRDB uses SQLCipher, access SQLite C functions with `import SQLCipher` only. Importing `SQLite3` or `GRDBSQLite` can link the system SQLite next to SQLCipher, which creates undefined behavior.
|
||||
|
||||
## Cached Statements
|
||||
|
||||
The statements returned by `Database.cachedStatement(sql:)` and `Database.cachedStatement(literal:)` no longer preserve their arguments between two calls. You must set the arguments of a cached statement each time you load it from the cache:
|
||||
|
||||
```swift
|
||||
// GRDB 7: relies on the arguments set by the first call.
|
||||
try db.cachedStatement(sql: "INSERT INTO player (name) VALUES (?)")
|
||||
.setArguments(["Arthur"])
|
||||
try db.cachedStatement(sql: "INSERT INTO player (name) VALUES (?)")
|
||||
.execute()
|
||||
|
||||
// GRDB 8: set arguments each time.
|
||||
try db.cachedStatement(sql: "INSERT INTO player (name) VALUES (?)")
|
||||
.execute(arguments: ["Arthur"])
|
||||
```
|
||||
|
||||
Two calls with the same SQL no longer return the same statement when the first one is still in use (held by the application or by a cursor). This allows nested iterations of the same cached SQL.
|
||||
|
||||
## JSON User Info
|
||||
|
||||
The `databaseDecodingUserInfo` and `databaseEncodingUserInfo` properties of record types are now declared as `[CodingUserInfoKey: any Sendable]`, like `JSONDecoder.userInfo` and `JSONEncoder.userInfo`.
|
||||
|
||||
Update the declarations of these properties in your record types, as below. In the Swift 6 language mode, a property declared as `[CodingUserInfoKey: Any]` no longer matches the protocol requirement, and is ignored by GRDB. The compiler does not emit any diagnostic.
|
||||
|
||||
```swift
|
||||
// GRDB 7
|
||||
struct Player: FetchableRecord, Decodable {
|
||||
static var databaseDecodingUserInfo: [CodingUserInfoKey: Any] { ... }
|
||||
}
|
||||
|
||||
// GRDB 8
|
||||
struct Player: FetchableRecord, Decodable {
|
||||
static var databaseDecodingUserInfo: [CodingUserInfoKey: any Sendable] { ... }
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,144 @@
|
||||
//: To run this playground:
|
||||
//:
|
||||
//: - Open GRDB.xcworkspace
|
||||
//: - Select the GRDB scheme: menu Product > Scheme > GRDB
|
||||
//: - Build: menu Product > Build
|
||||
//: - Select the playground in the Playgrounds Group
|
||||
//: - Run the playground
|
||||
|
||||
import GRDB
|
||||
|
||||
//: Open a database connection
|
||||
|
||||
var configuration = Configuration()
|
||||
configuration.prepareDatabase { db in
|
||||
db.trace { print("SQL> \($0)") }
|
||||
}
|
||||
let dbQueue = try DatabaseQueue(configuration: configuration)
|
||||
|
||||
//: Use a migrator to define the database schema
|
||||
|
||||
var migrator = DatabaseMigrator()
|
||||
|
||||
migrator.registerMigration("createLibrary") { db in
|
||||
try db.create(table: "author") { t in
|
||||
t.autoIncrementedPrimaryKey("id")
|
||||
t.column("name", .text).notNull()
|
||||
}
|
||||
|
||||
try db.create(table: "book") { t in
|
||||
t.autoIncrementedPrimaryKey("id")
|
||||
t.column("title", .text).notNull()
|
||||
t.belongsTo("author", onDelete: .cascade).notNull()
|
||||
}
|
||||
}
|
||||
|
||||
try migrator.migrate(dbQueue)
|
||||
|
||||
//: Define Record types
|
||||
|
||||
struct Author: Codable, FetchableRecord, MutablePersistableRecord {
|
||||
var id: Int64?
|
||||
var name: String
|
||||
|
||||
mutating func didInsert(_ inserted: InsertionSuccess) {
|
||||
id = inserted.rowID
|
||||
}
|
||||
}
|
||||
|
||||
struct Book: Codable, FetchableRecord, MutablePersistableRecord {
|
||||
var id: Int64?
|
||||
var authorId: Int64
|
||||
var title: String
|
||||
|
||||
mutating func didInsert(_ inserted: InsertionSuccess) {
|
||||
id = inserted.rowID
|
||||
}
|
||||
}
|
||||
|
||||
//: Define Associations
|
||||
|
||||
extension Author {
|
||||
static let books = hasMany(Book.self)
|
||||
var books: QueryInterfaceRequest<Book> { request(for: Author.books) }
|
||||
}
|
||||
|
||||
extension Book {
|
||||
static let author = belongsTo(Author.self)
|
||||
var author: QueryInterfaceRequest<Author> { request(for: Book.author) }
|
||||
}
|
||||
|
||||
//: Populate the database
|
||||
|
||||
print("----------")
|
||||
print("Populate the database")
|
||||
try dbQueue.write { db in
|
||||
var melville = Author(id: nil, name: "Hermann Melville")
|
||||
try melville.insert(db)
|
||||
var mobyDick = Book(id: nil, authorId: melville.id!, title: "Moby-Dick")
|
||||
try mobyDick.insert(db)
|
||||
|
||||
var genet = Author(id: nil, name: "Jean Genet")
|
||||
try genet.insert(db)
|
||||
var querelle = Book(id: nil, authorId: genet.id!, title: "Querelle de Brest")
|
||||
try querelle.insert(db)
|
||||
var lesBonnes = Book(id: nil, authorId: genet.id!, title: "Les Bonnes")
|
||||
try lesBonnes.insert(db)
|
||||
}
|
||||
|
||||
//: Fetch author information
|
||||
|
||||
print("----------")
|
||||
print("Fetch author information")
|
||||
struct AuthorInfo {
|
||||
var author: Author
|
||||
var books: [Book]
|
||||
}
|
||||
let authorId = 2
|
||||
let authorInfo: AuthorInfo? = try dbQueue.read { db in
|
||||
guard let author = try Author.fetchOne(db, key: authorId) else { return nil }
|
||||
let books = try author.books.fetchAll(db)
|
||||
return AuthorInfo(author: author, books: books)
|
||||
}
|
||||
if let authorInfo {
|
||||
print("\(authorInfo.author.name) has written:")
|
||||
for book in authorInfo.books {
|
||||
print("- \(book.title)")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//: Fetch book information
|
||||
|
||||
print("----------")
|
||||
print("Fetch book information")
|
||||
struct BookInfo: FetchableRecord, Codable {
|
||||
var book: Book
|
||||
var author: Author
|
||||
}
|
||||
let bookId = 1
|
||||
let bookInfo: BookInfo? = try dbQueue.read { db in
|
||||
let request = Book
|
||||
.filter(key: bookId)
|
||||
.including(required: Book.author)
|
||||
return try BookInfo.fetchOne(db, request)
|
||||
}
|
||||
if let bookInfo {
|
||||
print("\(bookInfo.book.title) was written by \(bookInfo.author.name)")
|
||||
}
|
||||
|
||||
//: Fetch all authorships
|
||||
|
||||
print("----------")
|
||||
print("Fetch all authorships")
|
||||
struct Authorship: Decodable, FetchableRecord {
|
||||
var book: Book
|
||||
var author: Author
|
||||
}
|
||||
let authorships: [Authorship] = try dbQueue.read { db in
|
||||
let request = Book.including(required: Book.author)
|
||||
return try Authorship.fetchAll(db, request)
|
||||
}
|
||||
for authorship in authorships {
|
||||
print("\(authorship.book.title) was written by \(authorship.author.name)")
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<playground version='5.0' target-platform='macos' buildActiveScheme='true'>
|
||||
<timeline fileName='timeline.xctimeline'/>
|
||||
</playground>
|
||||
@@ -0,0 +1,46 @@
|
||||
// To run this playground, select and build the GRDB scheme.
|
||||
|
||||
import GRDB
|
||||
|
||||
var configuration = Configuration()
|
||||
configuration.prepareDatabase { db in
|
||||
db.trace { print("SQL> \($0)") }
|
||||
}
|
||||
let dbQueue = try DatabaseQueue(configuration: configuration)
|
||||
|
||||
struct Player: Codable, FetchableRecord, MutablePersistableRecord {
|
||||
var id: Int64?
|
||||
var name: String
|
||||
var score: Int
|
||||
|
||||
mutating func didInsert(_ inserted: InsertionSuccess) {
|
||||
id = inserted.rowID
|
||||
}
|
||||
}
|
||||
|
||||
try dbQueue.write { db in
|
||||
try db.create(table: "player") { t in
|
||||
t.autoIncrementedPrimaryKey("id")
|
||||
t.column("name", .text).notNull()
|
||||
t.column("score", .integer).notNull()
|
||||
}
|
||||
|
||||
do {
|
||||
var player = Player(id: nil, name: "Arthur", score: 100)
|
||||
try player.insert(db)
|
||||
player = Player(id: nil, name: "Barbara", score: 100)
|
||||
try player.insert(db)
|
||||
}
|
||||
|
||||
do {
|
||||
let players = try Player.fetchAll(db)
|
||||
for player in players {
|
||||
print(player)
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
let count = try Player.fetchCount(db)
|
||||
print(count)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<playground version='5.0' target-platform='macos' buildActiveScheme='true'>
|
||||
<timeline fileName='timeline.xctimeline'/>
|
||||
</playground>
|
||||
@@ -0,0 +1,141 @@
|
||||
//: To run this playground:
|
||||
//:
|
||||
//: - Open GRDB.xcworkspace
|
||||
//: - Select the GRDB scheme: menu Product > Scheme > GRDB
|
||||
//: - Build: menu Product > Build
|
||||
//: - Select the playground in the Playgrounds Group
|
||||
//: - Run the playground
|
||||
//:
|
||||
//: Tour
|
||||
//: ======
|
||||
//:
|
||||
//: This playground is a quick tour of GRDB.
|
||||
|
||||
import GRDB
|
||||
import CoreLocation
|
||||
|
||||
|
||||
//: Open a connection to the database
|
||||
|
||||
// Open an in-memory database that logs all SQL statements
|
||||
var configuration = Configuration()
|
||||
configuration.prepareDatabase { db in
|
||||
db.trace { print("SQL> \($0)") }
|
||||
}
|
||||
let dbQueue = try DatabaseQueue(configuration: configuration)
|
||||
|
||||
|
||||
//: Execute SQL queries
|
||||
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute(sql: """
|
||||
CREATE TABLE place (
|
||||
id INTEGER PRIMARY KEY,
|
||||
title TEXT,
|
||||
isFavorite BOOLEAN NOT NULL,
|
||||
latitude DOUBLE NOT NULL,
|
||||
longitude DOUBLE NOT NULL
|
||||
)
|
||||
""")
|
||||
|
||||
try db.execute(sql: """
|
||||
INSERT INTO place (title, isFavorite, latitude, longitude)
|
||||
VALUES (?, ?, ?, ?)
|
||||
""", arguments: ["Paris", true, 48.85341, 2.3488])
|
||||
let parisId = db.lastInsertedRowID
|
||||
}
|
||||
|
||||
|
||||
//: Fetch database rows and values
|
||||
|
||||
try! dbQueue.inDatabase { db in
|
||||
let rows = try Row.fetchCursor(db, sql: "SELECT * FROM place")
|
||||
while let row = try rows.next() {
|
||||
let title: String = row["title"]
|
||||
let isFavorite: Bool = row["isFavorite"]
|
||||
let coordinate = CLLocationCoordinate2D(
|
||||
latitude: row["latitude"],
|
||||
longitude: row["longitude"])
|
||||
print("Fetched", title, isFavorite, coordinate)
|
||||
}
|
||||
|
||||
let placeCount = try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM place")! // Int
|
||||
let placeTitles = try String.fetchAll(db, sql: "SELECT title FROM place") // [String]
|
||||
}
|
||||
|
||||
|
||||
//: Insert and fetch records
|
||||
|
||||
struct Place {
|
||||
var id: Int64?
|
||||
var title: String?
|
||||
var isFavorite: Bool
|
||||
var coordinate: CLLocationCoordinate2D
|
||||
}
|
||||
|
||||
// Adopt FetchableRecord
|
||||
extension Place : FetchableRecord {
|
||||
init(row: Row) {
|
||||
id = row[Columns.id]
|
||||
title = row[Columns.title]
|
||||
isFavorite = row[Columns.isFavorite]
|
||||
coordinate = CLLocationCoordinate2DMake(
|
||||
row[Columns.latitude],
|
||||
row[Columns.longitude])
|
||||
}
|
||||
}
|
||||
|
||||
// Adopt TableRecord
|
||||
extension Place : TableRecord {
|
||||
static let databaseTableName = "place"
|
||||
|
||||
enum Columns {
|
||||
static let id = Column("id")
|
||||
static let title = Column("title")
|
||||
static let isFavorite = Column("isFavorite")
|
||||
static let latitude = Column("latitude")
|
||||
static let longitude = Column("longitude")
|
||||
}
|
||||
}
|
||||
|
||||
// Adopt MutablePersistableRecord
|
||||
extension Place : MutablePersistableRecord {
|
||||
func encode(to container: inout PersistenceContainer) throws {
|
||||
container[Columns.id] = id
|
||||
container[Columns.title] = title
|
||||
container[Columns.isFavorite] = isFavorite
|
||||
container[Columns.latitude] = coordinate.latitude
|
||||
container[Columns.longitude] = coordinate.longitude
|
||||
}
|
||||
|
||||
mutating func didInsert(_ inserted: InsertionSuccess) {
|
||||
id = inserted.rowID
|
||||
}
|
||||
}
|
||||
|
||||
try dbQueue.inDatabase { db in
|
||||
var berlin = Place(
|
||||
id: nil,
|
||||
title: "Berlin",
|
||||
isFavorite: false,
|
||||
coordinate: CLLocationCoordinate2DMake(52.52437, 13.41053))
|
||||
|
||||
try berlin.insert(db)
|
||||
berlin.id // some value
|
||||
|
||||
berlin.isFavorite = true
|
||||
try berlin.update(db)
|
||||
|
||||
// Fetch from SQL
|
||||
let places = try Place.fetchAll(db, sql: "SELECT * FROM place") // [Place]
|
||||
|
||||
|
||||
//: Avoid SQL with the query interface:
|
||||
|
||||
berlin = try Place.filter { $0.title == "Berlin" }.fetchOne(db)! // Place
|
||||
let paris = try Place.fetchOne(db, key: 1) // Place?
|
||||
let favoritePlaces = try Place // [Place]
|
||||
.filter { $0.isFavorite == true }
|
||||
.order { $0.title }
|
||||
.fetchAll(db)
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<playground version='5.0' target-platform='osx' display-mode='raw' buildActiveScheme='true'>
|
||||
<timeline fileName='timeline.xctimeline'/>
|
||||
</playground>
|
||||
@@ -0,0 +1,84 @@
|
||||
//: To run this playground:
|
||||
//:
|
||||
//: - Open GRDB.xcworkspace
|
||||
//: - Select the GRDB scheme: menu Product > Scheme > GRDB
|
||||
//: - Build: menu Product > Build
|
||||
//: - Select the playground in the Playgrounds Group
|
||||
//: - Run the playground
|
||||
|
||||
import GRDB
|
||||
|
||||
|
||||
// Create the database
|
||||
|
||||
let dbQueue = try DatabaseQueue() // Memory database
|
||||
var migrator = DatabaseMigrator()
|
||||
migrator.registerMigration("createPerson") { db in
|
||||
try db.create(table: "person") { t in
|
||||
t.autoIncrementedPrimaryKey("id")
|
||||
t.column("name", .text).notNull()
|
||||
}
|
||||
}
|
||||
migrator.registerMigration("createPet") { db in
|
||||
try db.create(table: "pet") { t in
|
||||
t.autoIncrementedPrimaryKey("id")
|
||||
t.column("name", .text).notNull()
|
||||
t.belongsTo("owner", inTable: "person", onDelete: .cascade)
|
||||
}
|
||||
}
|
||||
try! migrator.migrate(dbQueue)
|
||||
|
||||
|
||||
//
|
||||
|
||||
class TableChangeObserver : NSObject, TransactionObserver {
|
||||
private var changedTableNames: Set<String> = []
|
||||
|
||||
func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool { true }
|
||||
|
||||
func databaseDidChange(with event: DatabaseEvent) {
|
||||
changedTableNames.insert(event.tableName)
|
||||
}
|
||||
|
||||
func databaseDidCommit(_ db: Database) {
|
||||
print("Changed table(s): \(changedTableNames.joined(separator: ", "))")
|
||||
changedTableNames = []
|
||||
}
|
||||
|
||||
func databaseDidRollback(_ db: Database) {
|
||||
changedTableNames = []
|
||||
}
|
||||
}
|
||||
|
||||
let observer = TableChangeObserver()
|
||||
dbQueue.add(transactionObserver: observer)
|
||||
|
||||
|
||||
//
|
||||
|
||||
print("-- Changes without transaction")
|
||||
try dbQueue.inDatabase { db in
|
||||
try db.execute(sql: "INSERT INTO person (name) VALUES (?)", arguments: ["Arthur"])
|
||||
let arthurId = db.lastInsertedRowID
|
||||
try db.execute(sql: "INSERT INTO person (name) VALUES (?)", arguments: ["Barbara"])
|
||||
try db.execute(sql: "INSERT INTO pet (ownerId, name) VALUES (?, ?)", arguments: [arthurId, "Barbara"])
|
||||
try db.execute(sql: "DELETE FROM person WHERE id = ?", arguments: [arthurId])
|
||||
}
|
||||
|
||||
print("-- Rollbacked changes")
|
||||
try dbQueue.inTransaction { db in
|
||||
try db.execute(sql: "INSERT INTO person (name) VALUES ('Arthur')")
|
||||
try db.execute(sql: "INSERT INTO person (name) VALUES ('Barbara')")
|
||||
return .rollback
|
||||
}
|
||||
|
||||
|
||||
print("-- Changes wrapped in a transaction")
|
||||
try dbQueue.write { db in
|
||||
try db.execute(sql: "DELETE FROM person")
|
||||
try db.execute(sql: "INSERT INTO person (name) VALUES (?)", arguments: ["Arthur"])
|
||||
let arthurId = db.lastInsertedRowID
|
||||
try db.execute(sql: "INSERT INTO person (name) VALUES (?)", arguments: ["Barbara"])
|
||||
try db.execute(sql: "INSERT INTO pet (ownerId, name) VALUES (?, ?)", arguments: [arthurId, "Barbara"])
|
||||
try db.execute(sql: "DELETE FROM person WHERE id = ?", arguments: [arthurId])
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<playground version='5.0' target-platform='osx' display-mode='rendered' buildActiveScheme='true'>
|
||||
<timeline fileName='timeline.xctimeline'/>
|
||||
</playground>
|
||||
@@ -1,19 +1,27 @@
|
||||
# Releasing a New Version
|
||||
Release Process
|
||||
===============
|
||||
|
||||
**This is internal documentation.**
|
||||
|
||||
To release a new GRDB version:
|
||||
|
||||
- Tests
|
||||
- `make distclean test`
|
||||
- Build and run GRDBDemo
|
||||
- Check for performance regression with GRDBOSXPerformanceTests
|
||||
- On https://github.com/groue/sqlcipher.git upgrade, update SQLCipher version in README.md
|
||||
- On https://github.com/swiftlyfalling/SQLiteLib upgrade, update SQLite version in Documentation/CustomSQLiteBuilds.md
|
||||
- Update GRDB version number and release date in:
|
||||
- CHANGELOG.md
|
||||
- GRDB.swift.podspec
|
||||
- README.md
|
||||
- Support/Info.plist
|
||||
- Commit and tag
|
||||
- Look for undesired tags: `git for-each-ref --format '%(refname) %(authorname)' refs/tags | sort -V`
|
||||
- Look for undesired tags: `git for-each-ref --format '%(refname) %(authorname)' refs/tags`
|
||||
- Push to the `master` branch
|
||||
- Push to the `development` branch
|
||||
- Push to the `GRDB8` branch
|
||||
- Push to the `GRDB7` branch
|
||||
- `pod trunk push --allow-warnings GRDB.swift.podspec`
|
||||
- Update [performance comparison](https://github.com/groue/GRDB.swift/wiki/Performance):
|
||||
|
||||
`make test_performance | Tests/parsePerformanceTests.rb | Tests/generatePerformanceReport.rb`
|
||||
File renamed without changes.
|
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 86 KiB |
@@ -0,0 +1,38 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'GRDB.swift'
|
||||
s.version = '7.12.1'
|
||||
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.summary = 'A toolkit for SQLite databases, with a focus on application development.'
|
||||
s.homepage = 'https://github.com/groue/GRDB.swift'
|
||||
s.author = { 'Gwendal Roué' => 'gr@pierlis.com' }
|
||||
s.source = { :git => 'https://github.com/groue/GRDB.swift.git', :tag => "v#{s.version}" }
|
||||
s.module_name = 'GRDB'
|
||||
|
||||
s.swift_versions = ['6.1']
|
||||
s.ios.deployment_target = '13.0'
|
||||
s.osx.deployment_target = '10.15'
|
||||
s.watchos.deployment_target = '7.0'
|
||||
s.tvos.deployment_target = '13.0'
|
||||
s.default_subspec = 'standard'
|
||||
|
||||
s.subspec 'standard' do |ss|
|
||||
ss.source_files = 'GRDB/**/*.swift', 'Support/grdb_config.h'
|
||||
ss.framework = 'Foundation'
|
||||
ss.library = 'sqlite3'
|
||||
ss.xcconfig = {
|
||||
'OTHER_SWIFT_FLAGS' => '$(inherited) -D SQLITE_ENABLE_FTS5 -D GRDBFRAMEWORK',
|
||||
}
|
||||
end
|
||||
|
||||
s.subspec 'SQLCipher' do |ss|
|
||||
ss.source_files = 'GRDB/**/*.swift', 'Support/SQLCipher_config.h'
|
||||
ss.framework = 'Foundation'
|
||||
ss.dependency 'SQLCipher', '>= 3.4.2'
|
||||
ss.xcconfig = {
|
||||
'OTHER_SWIFT_FLAGS' => '$(inherited) -D SQLITE_HAS_CODEC -D GRDBCIPHER -D SQLITE_ENABLE_FTS5',
|
||||
'OTHER_CFLAGS' => '$(inherited) -DSQLITE_HAS_CODEC -DGRDBCIPHER -DSQLITE_ENABLE_FTS5',
|
||||
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) SQLITE_HAS_CODEC=1 GRDBCIPHER=1 SQLITE_ENABLE_FTS5=1'
|
||||
}
|
||||
end
|
||||
end
|
||||
+28
-405
@@ -7,23 +7,13 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
567DAF1C1EAB61ED00FC0928 /* grdb_config.h in Headers */ = {isa = PBXBuildFile; fileRef = 567DAF141EAB61ED00FC0928 /* grdb_config.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
56D0F20C30C17218004DBD2B /* GRDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC3773F319C8CBB3004FCF85 /* GRDB.framework */; };
|
||||
567DAF1C1EAB61ED00FC0928 /* grdb_config.h in Headers */ = {isa = PBXBuildFile; fileRef = 567DAF141EAB61ED00FC0928 /* grdb_config.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
56E5D7FE1B4D422E00430942 /* GRDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC3773F319C8CBB3004FCF85 /* GRDB.framework */; };
|
||||
7224817BA8FC2DD2316C7703 /* GRDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC3773F319C8CBB3004FCF85 /* GRDB.framework */; };
|
||||
96FB7AD736D973E8E9A30380 /* GRDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC3773F319C8CBB3004FCF85 /* GRDB.framework */; };
|
||||
DC2393C81ABE35F8003FF113 /* GRDB-Bridging.h in Headers */ = {isa = PBXBuildFile; fileRef = DC2393C61ABE35F8003FF113 /* GRDB-Bridging.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
DC3773F919C8CBB3004FCF85 /* GRDB.h in Headers */ = {isa = PBXBuildFile; fileRef = DC3773F819C8CBB3004FCF85 /* GRDB.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
56D0F20930C17218004DBD2B /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = DC3773EA19C8CBB3004FCF85 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = DC3773F219C8CBB3004FCF85;
|
||||
remoteInfo = GRDBOSX;
|
||||
};
|
||||
56E5D7FF1B4D422E00430942 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = DC3773EA19C8CBB3004FCF85 /* Project object */;
|
||||
@@ -31,20 +21,6 @@
|
||||
remoteGlobalIDString = DC3773F219C8CBB3004FCF85;
|
||||
remoteInfo = GRDBOSX;
|
||||
};
|
||||
829B064D4975B60C0623B1B2 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = DC3773EA19C8CBB3004FCF85 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = DC3773F219C8CBB3004FCF85;
|
||||
remoteInfo = GRDBOSX;
|
||||
};
|
||||
BDA5EFE64FE73E35F6D72D75 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = DC3773EA19C8CBB3004FCF85 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = DC3773F219C8CBB3004FCF85;
|
||||
remoteInfo = GRDBOSX;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@@ -57,17 +33,11 @@
|
||||
569530FF1C9067CC00CF1A2B /* RecordCrashTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecordCrashTests.swift; sourceTree = "<group>"; };
|
||||
569531001C9067CC00CF1A2B /* StatementColumnConvertibleCrashTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatementColumnConvertibleCrashTests.swift; sourceTree = "<group>"; };
|
||||
569531011C9067CC00CF1A2B /* StatementCrashTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatementCrashTests.swift; sourceTree = "<group>"; };
|
||||
5698C1C32CA844F4001C0EB0 /* GRDBSwift5Tests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = GRDBSwift5Tests.xcconfig; sourceTree = "<group>"; };
|
||||
5698C1C32CA844F4001C0EB0 /* GRDBTests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = GRDBTests.xcconfig; sourceTree = "<group>"; };
|
||||
56B8F49A1B4E2F3600C24296 /* GRDB.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = GRDB.xcconfig; sourceTree = "<group>"; };
|
||||
56C48E731C9A9923005DF1D9 /* module.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = "<group>"; };
|
||||
56C494401ED7255500CC72AF /* GRDBDeploymentTarget.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = GRDBDeploymentTarget.xcconfig; sourceTree = "<group>"; };
|
||||
56D0F21130C17218004DBD2B /* GRDBSwift6ApproachableConcurrencyTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GRDBSwift6ApproachableConcurrencyTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
56D0F21230C17218004DBD2B /* GRDBSwift6ApproachableConcurrencyTests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = GRDBSwift6ApproachableConcurrencyTests.xcconfig; sourceTree = "<group>"; };
|
||||
56E5D7F91B4D422D00430942 /* GRDBSwift5Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GRDBSwift5Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
6FC1DA2A6B5CD5D73C99E20E /* GRDBSwift6Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GRDBSwift6Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
970266BC29B4DCD6A1700E21 /* GRDBSwift6MainActorIsolationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GRDBSwift6MainActorIsolationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9961981D015C33AB03B08547 /* GRDBSwift6Tests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = GRDBSwift6Tests.xcconfig; sourceTree = "<group>"; };
|
||||
D585450E1D4D590FFEFBE90D /* GRDBSwift6MainActorIsolationTests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = GRDBSwift6MainActorIsolationTests.xcconfig; sourceTree = "<group>"; };
|
||||
56E5D7F91B4D422D00430942 /* GRDBTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GRDBTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
DC2393C61ABE35F8003FF113 /* GRDB-Bridging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GRDB-Bridging.h"; sourceTree = "<group>"; };
|
||||
DC3773F319C8CBB3004FCF85 /* GRDB.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GRDB.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
DC3773F719C8CBB3004FCF85 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
@@ -86,31 +56,11 @@
|
||||
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
||||
|
||||
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
||||
56A1E0012FD0A00000ABCDEF /* GRDBTestSupport */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = GRDBTestSupport; sourceTree = "<group>"; };
|
||||
56C883812FCC65300099DE9A /* Sources/GRDB */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (56C8842B2FCC65300099DE9A /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = Sources/GRDB; sourceTree = "<group>"; };
|
||||
56C887EB2FCC6B9A0099DE9A /* GRDBSwift5Tests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = GRDBSwift5Tests; sourceTree = "<group>"; };
|
||||
56D0F1FC30C171E0004DBD2B /* GRDBSwift6ApproachableConcurrencyTests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = GRDBSwift6ApproachableConcurrencyTests; sourceTree = "<group>"; };
|
||||
56D0F20130C171E0004DBD2B /* GRDBSwift6MainActorIsolationTests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = GRDBSwift6MainActorIsolationTests; sourceTree = "<group>"; };
|
||||
56D0F20630C171E0004DBD2B /* GRDBSwift6Tests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = GRDBSwift6Tests; sourceTree = "<group>"; };
|
||||
56C883812FCC65300099DE9A /* GRDB */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (56C8842B2FCC65300099DE9A /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = GRDB; sourceTree = "<group>"; };
|
||||
56C887EB2FCC6B9A0099DE9A /* GRDBTests */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = GRDBTests; sourceTree = "<group>"; };
|
||||
/* End PBXFileSystemSynchronizedRootGroup section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
454694034CA70B4BF5803855 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
7224817BA8FC2DD2316C7703 /* GRDB.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
56D0F20B30C17218004DBD2B /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
56D0F20C30C17218004DBD2B /* GRDB.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
56E5D7F61B4D422D00430942 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -126,14 +76,6 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
E0FF00E7AD6E7127766C65D2 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
96FB7AD736D973E8E9A30380 /* GRDB.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
@@ -156,11 +98,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
569530FA1C9067CC00CF1A2B /* Crash */,
|
||||
56C887EB2FCC6B9A0099DE9A /* GRDBSwift5Tests */,
|
||||
56D0F1FC30C171E0004DBD2B /* GRDBSwift6ApproachableConcurrencyTests */,
|
||||
56D0F20130C171E0004DBD2B /* GRDBSwift6MainActorIsolationTests */,
|
||||
56D0F20630C171E0004DBD2B /* GRDBSwift6Tests */,
|
||||
56A1E0012FD0A00000ABCDEF /* GRDBTestSupport */,
|
||||
56C887EB2FCC6B9A0099DE9A /* GRDBTests */,
|
||||
DC37740319C8CBB3004FCF85 /* Supporting Files */,
|
||||
);
|
||||
path = Tests;
|
||||
@@ -169,7 +107,7 @@
|
||||
DC3773E919C8CBB3004FCF85 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56C883812FCC65300099DE9A /* Sources/GRDB */,
|
||||
56C883812FCC65300099DE9A /* GRDB */,
|
||||
DC10500F19C904DD00D8CA30 /* Tests */,
|
||||
DC37743319C8CFCE004FCF85 /* Supporting Files */,
|
||||
DC3773F419C8CBB3004FCF85 /* Products */,
|
||||
@@ -183,10 +121,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DC3773F319C8CBB3004FCF85 /* GRDB.framework */,
|
||||
56E5D7F91B4D422D00430942 /* GRDBSwift5Tests.xctest */,
|
||||
56D0F21130C17218004DBD2B /* GRDBSwift6ApproachableConcurrencyTests.xctest */,
|
||||
970266BC29B4DCD6A1700E21 /* GRDBSwift6MainActorIsolationTests.xctest */,
|
||||
6FC1DA2A6B5CD5D73C99E20E /* GRDBSwift6Tests.xctest */,
|
||||
56E5D7F91B4D422D00430942 /* GRDBTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -208,11 +143,8 @@
|
||||
56C48E731C9A9923005DF1D9 /* module.modulemap */,
|
||||
DC3773F719C8CBB3004FCF85 /* Info.plist */,
|
||||
56B8F49A1B4E2F3600C24296 /* GRDB.xcconfig */,
|
||||
5698C1C32CA844F4001C0EB0 /* GRDBTests.xcconfig */,
|
||||
56C494401ED7255500CC72AF /* GRDBDeploymentTarget.xcconfig */,
|
||||
5698C1C32CA844F4001C0EB0 /* GRDBSwift5Tests.xcconfig */,
|
||||
56D0F21230C17218004DBD2B /* GRDBSwift6ApproachableConcurrencyTests.xcconfig */,
|
||||
D585450E1D4D590FFEFBE90D /* GRDBSwift6MainActorIsolationTests.xcconfig */,
|
||||
9961981D015C33AB03B08547 /* GRDBSwift6Tests.xcconfig */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
path = Support;
|
||||
@@ -234,51 +166,9 @@
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
137ECBDAB512C64A624D7C18 /* GRDBSwift6Tests */ = {
|
||||
56E5D7F81B4D422D00430942 /* GRDBTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 18070F9F8DFD5096561CA62F /* Build configuration list for PBXNativeTarget "GRDBSwift6Tests" */;
|
||||
buildPhases = (
|
||||
677B998369A0C1FAA69120B7 /* Sources */,
|
||||
E0FF00E7AD6E7127766C65D2 /* Frameworks */,
|
||||
4F95D7921FDFB2BFED66B471 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
064B54476CF36B181327EDFC /* PBXTargetDependency */,
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
56D0F20630C171E0004DBD2B /* GRDBSwift6Tests */,
|
||||
);
|
||||
name = GRDBSwift6Tests;
|
||||
productName = GRDBOSXTests;
|
||||
productReference = 6FC1DA2A6B5CD5D73C99E20E /* GRDBSwift6Tests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
56D0F20730C17218004DBD2B /* GRDBSwift6ApproachableConcurrencyTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 56D0F20E30C17218004DBD2B /* Build configuration list for PBXNativeTarget "GRDBSwift6ApproachableConcurrencyTests" */;
|
||||
buildPhases = (
|
||||
56D0F20A30C17218004DBD2B /* Sources */,
|
||||
56D0F20B30C17218004DBD2B /* Frameworks */,
|
||||
56D0F20D30C17218004DBD2B /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
56D0F20830C17218004DBD2B /* PBXTargetDependency */,
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
56D0F1FC30C171E0004DBD2B /* GRDBSwift6ApproachableConcurrencyTests */,
|
||||
);
|
||||
name = GRDBSwift6ApproachableConcurrencyTests;
|
||||
productName = GRDBOSXTests;
|
||||
productReference = 56D0F21130C17218004DBD2B /* GRDBSwift6ApproachableConcurrencyTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
56E5D7F81B4D422D00430942 /* GRDBSwift5Tests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 56E5D8011B4D422E00430942 /* Build configuration list for PBXNativeTarget "GRDBSwift5Tests" */;
|
||||
buildConfigurationList = 56E5D8011B4D422E00430942 /* Build configuration list for PBXNativeTarget "GRDBTests" */;
|
||||
buildPhases = (
|
||||
56E5D7F51B4D422D00430942 /* Sources */,
|
||||
56E5D7F61B4D422D00430942 /* Frameworks */,
|
||||
@@ -290,33 +180,11 @@
|
||||
56E5D8001B4D422E00430942 /* PBXTargetDependency */,
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
56A1E0012FD0A00000ABCDEF /* GRDBTestSupport */,
|
||||
56C887EB2FCC6B9A0099DE9A /* GRDBSwift5Tests */,
|
||||
56C887EB2FCC6B9A0099DE9A /* GRDBTests */,
|
||||
);
|
||||
name = GRDBSwift5Tests;
|
||||
name = GRDBTests;
|
||||
productName = GRDBOSXTests;
|
||||
productReference = 56E5D7F91B4D422D00430942 /* GRDBSwift5Tests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
AF4E64BCF2E3A40030D9C72E /* GRDBSwift6MainActorIsolationTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 44F4400344672EAFB8D49AC3 /* Build configuration list for PBXNativeTarget "GRDBSwift6MainActorIsolationTests" */;
|
||||
buildPhases = (
|
||||
8A3253E0E6F543AF8E4071B6 /* Sources */,
|
||||
454694034CA70B4BF5803855 /* Frameworks */,
|
||||
B5C3BD355A31911BA9D34C68 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
F0D310A8491E14866D6C126A /* PBXTargetDependency */,
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
56D0F20130C171E0004DBD2B /* GRDBSwift6MainActorIsolationTests */,
|
||||
);
|
||||
name = GRDBSwift6MainActorIsolationTests;
|
||||
productName = GRDBOSXTests;
|
||||
productReference = 970266BC29B4DCD6A1700E21 /* GRDBSwift6MainActorIsolationTests.xctest */;
|
||||
productReference = 56E5D7F91B4D422D00430942 /* GRDBTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
DC3773F219C8CBB3004FCF85 /* GRDB */ = {
|
||||
@@ -334,7 +202,7 @@
|
||||
dependencies = (
|
||||
);
|
||||
fileSystemSynchronizedGroups = (
|
||||
56C883812FCC65300099DE9A /* Sources/GRDB */,
|
||||
56C883812FCC65300099DE9A /* GRDB */,
|
||||
);
|
||||
name = GRDB;
|
||||
productName = GRDB;
|
||||
@@ -349,7 +217,7 @@
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = YES;
|
||||
LastSwiftUpdateCheck = 0730;
|
||||
LastUpgradeCheck = 2720;
|
||||
LastUpgradeCheck = 2600;
|
||||
ORGANIZATIONNAME = "Gwendal Roué";
|
||||
TargetAttributes = {
|
||||
56E5D7F81B4D422D00430942 = {
|
||||
@@ -376,29 +244,12 @@
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
DC3773F219C8CBB3004FCF85 /* GRDB */,
|
||||
56E5D7F81B4D422D00430942 /* GRDBSwift5Tests */,
|
||||
56D0F20730C17218004DBD2B /* GRDBSwift6ApproachableConcurrencyTests */,
|
||||
AF4E64BCF2E3A40030D9C72E /* GRDBSwift6MainActorIsolationTests */,
|
||||
137ECBDAB512C64A624D7C18 /* GRDBSwift6Tests */,
|
||||
56E5D7F81B4D422D00430942 /* GRDBTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
4F95D7921FDFB2BFED66B471 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
56D0F20D30C17218004DBD2B /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
56E5D7F71B4D422D00430942 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -406,13 +257,6 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
B5C3BD355A31911BA9D34C68 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
DC3773F119C8CBB3004FCF85 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -445,13 +289,6 @@
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
56D0F20A30C17218004DBD2B /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
56E5D7F51B4D422D00430942 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -459,20 +296,6 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
677B998369A0C1FAA69120B7 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
8A3253E0E6F543AF8E4071B6 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
DC3773EE19C8CBB3004FCF85 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -483,114 +306,17 @@
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
064B54476CF36B181327EDFC /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = DC3773F219C8CBB3004FCF85 /* GRDB */;
|
||||
targetProxy = 829B064D4975B60C0623B1B2 /* PBXContainerItemProxy */;
|
||||
};
|
||||
56D0F20830C17218004DBD2B /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = DC3773F219C8CBB3004FCF85 /* GRDB */;
|
||||
targetProxy = 56D0F20930C17218004DBD2B /* PBXContainerItemProxy */;
|
||||
};
|
||||
56E5D8001B4D422E00430942 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = DC3773F219C8CBB3004FCF85 /* GRDB */;
|
||||
targetProxy = 56E5D7FF1B4D422E00430942 /* PBXContainerItemProxy */;
|
||||
};
|
||||
F0D310A8491E14866D6C126A /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = DC3773F219C8CBB3004FCF85 /* GRDB */;
|
||||
targetProxy = BDA5EFE64FE73E35F6D72D75 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
551FEC7C0085DBB820263A1D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9961981D015C33AB03B08547 /* GRDBSwift6Tests.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
INFOPLIST_FILE = Tests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
TARGETED_DEVICE_FAMILY = "1,2,3,4";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
56D0F20F30C17218004DBD2B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 56D0F21230C17218004DBD2B /* GRDBSwift6ApproachableConcurrencyTests.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
INFOPLIST_FILE = Tests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TARGETED_DEVICE_FAMILY = "1,2,3,4";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
56D0F21030C17218004DBD2B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 56D0F21230C17218004DBD2B /* GRDBSwift6ApproachableConcurrencyTests.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
INFOPLIST_FILE = Tests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
TARGETED_DEVICE_FAMILY = "1,2,3,4";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
56E5D8021B4D422E00430942 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 5698C1C32CA844F4001C0EB0 /* GRDBSwift5Tests.xcconfig */;
|
||||
baseConfigurationReference = 5698C1C32CA844F4001C0EB0 /* GRDBTests.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
@@ -604,19 +330,23 @@
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
OTHER_SWIFT_FLAGS = "$(inherited) -D SQLITE_MODULE";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBOSXTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2,3,4";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
56E5D8031B4D422E00430942 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 5698C1C32CA844F4001C0EB0 /* GRDBSwift5Tests.xcconfig */;
|
||||
baseConfigurationReference = 5698C1C32CA844F4001C0EB0 /* GRDBTests.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
@@ -631,97 +361,21 @@
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
OTHER_SWIFT_FLAGS = "$(inherited) -D SQLITE_MODULE";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBOSXTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2,3,4";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
B1E19278BC423F6FE01ECE17 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = D585450E1D4D590FFEFBE90D /* GRDBSwift6MainActorIsolationTests.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
INFOPLIST_FILE = Tests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TARGETED_DEVICE_FAMILY = "1,2,3,4";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
C7C3656B2B513F520BC9764E /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = D585450E1D4D590FFEFBE90D /* GRDBSwift6MainActorIsolationTests.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
INFOPLIST_FILE = Tests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
TARGETED_DEVICE_FAMILY = "1,2,3,4";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
DB8B1F9D519E70A9C2BEB816 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9961981D015C33AB03B08547 /* GRDBSwift6Tests.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
INFOPLIST_FILE = Tests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator";
|
||||
SUPPORTS_MACCATALYST = YES;
|
||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TARGETED_DEVICE_FAMILY = "1,2,3,4";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
DC37740719C8CBB3004FCF85 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
@@ -756,7 +410,6 @@
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
@@ -815,7 +468,6 @@
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
@@ -850,7 +502,6 @@
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_MODULE_VERIFIER = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
INFOPLIST_FILE = Support/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
@@ -884,7 +535,6 @@
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_MODULE_VERIFIER = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
INFOPLIST_FILE = Support/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
@@ -906,34 +556,7 @@
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
18070F9F8DFD5096561CA62F /* Build configuration list for PBXNativeTarget "GRDBSwift6Tests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
DB8B1F9D519E70A9C2BEB816 /* Debug */,
|
||||
551FEC7C0085DBB820263A1D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
44F4400344672EAFB8D49AC3 /* Build configuration list for PBXNativeTarget "GRDBSwift6MainActorIsolationTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
B1E19278BC423F6FE01ECE17 /* Debug */,
|
||||
C7C3656B2B513F520BC9764E /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
56D0F20E30C17218004DBD2B /* Build configuration list for PBXNativeTarget "GRDBSwift6ApproachableConcurrencyTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
56D0F20F30C17218004DBD2B /* Debug */,
|
||||
56D0F21030C17218004DBD2B /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
56E5D8011B4D422E00430942 /* Build configuration list for PBXNativeTarget "GRDBSwift5Tests" */ = {
|
||||
56E5D8011B4D422E00430942 /* Build configuration list for PBXNativeTarget "GRDBTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
56E5D8021B4D422E00430942 /* Debug */,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "2720"
|
||||
LastUpgradeVersion = "2600"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -29,8 +29,8 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "56E5D7F81B4D422D00430942"
|
||||
BuildableName = "GRDBSwift5Tests.xctest"
|
||||
BlueprintName = "GRDBSwift5Tests"
|
||||
BuildableName = "GRDBTests.xctest"
|
||||
BlueprintName = "GRDBTests"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
@@ -49,38 +49,8 @@
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "56E5D7F81B4D422D00430942"
|
||||
BuildableName = "GRDBSwift5Tests.xctest"
|
||||
BlueprintName = "GRDBSwift5Tests"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "56D0F20730C17218004DBD2B"
|
||||
BuildableName = "GRDBSwift6ApproachableConcurrencyTests.xctest"
|
||||
BlueprintName = "GRDBSwift6ApproachableConcurrencyTests"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "AF4E64BCF2E3A40030D9C72E"
|
||||
BuildableName = "GRDBSwift6MainActorIsolationTests.xctest"
|
||||
BlueprintName = "GRDBSwift6MainActorIsolationTests"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "137ECBDAB512C64A624D7C18"
|
||||
BuildableName = "GRDBSwift6Tests.xctest"
|
||||
BlueprintName = "GRDBSwift6Tests"
|
||||
BuildableName = "GRDBTests.xctest"
|
||||
BlueprintName = "GRDBTests"
|
||||
ReferencedContainer = "container:GRDB.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
|
||||
+20
-1
@@ -1,6 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<Group
|
||||
location = "group:Documentation/Playgrounds"
|
||||
name = "Playgrounds">
|
||||
<FileRef
|
||||
location = "group:Tour.playground">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:TransactionObserver.playground">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Associations.playground">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:MyPlayground.playground">
|
||||
</FileRef>
|
||||
</Group>
|
||||
<FileRef
|
||||
location = "group:BRAG.md">
|
||||
</FileRef>
|
||||
@@ -14,7 +30,7 @@
|
||||
location = "group:TODO.md">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:RELEASING.md">
|
||||
location = "group:Documentation/ReleaseProcess.md">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Makefile">
|
||||
@@ -25,6 +41,9 @@
|
||||
<FileRef
|
||||
location = "group:GRDBCustom.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Tests/Performance/GRDBProfiling/GRDBProfiling.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Documentation/DemoApps/GRDBDemo/GRDBDemo.xcodeproj">
|
||||
</FileRef>
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
#if !canImport(Darwin)
|
||||
@@ -94,8 +92,8 @@ public struct Configuration: Sendable {
|
||||
/// The default configuration label is nil.
|
||||
public var label: String?
|
||||
|
||||
/// A boolean value indicating whether SQLite interprets double-quoted
|
||||
/// strings as string literals when they do not match any
|
||||
/// A boolean value indicating whether SQLite 3.29+ interprets
|
||||
/// double-quoted strings as string literals when they do not match any
|
||||
/// valid identifier.
|
||||
///
|
||||
/// The default and recommended value is false:
|
||||
@@ -107,9 +105,9 @@ public struct Configuration: Sendable {
|
||||
/// """)
|
||||
/// ```
|
||||
///
|
||||
/// When true, double-quoted strings that do not match any valid
|
||||
/// identifier are interpreted as string literals, as in the
|
||||
/// example below. This is an SQLite
|
||||
/// When true, or before SQLite version 3.29.0, double-quoted strings that
|
||||
/// do not match any valid identifier are interpreted as string literals,
|
||||
/// as in the example below. This is an SQLite
|
||||
/// [misfeature](https://sqlite.org/quirks.html#double_quoted_string_literals_are_accepted):
|
||||
///
|
||||
/// ```swift
|
||||
File renamed without changes.
@@ -1,5 +1,7 @@
|
||||
#if SQLITE_HAS_CODEC
|
||||
#if SQLCipher
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else
|
||||
#error("No SQLCipher library configured")
|
||||
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
extension Database {
|
||||
@@ -70,35 +68,27 @@ extension Database {
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/pragma.html#pragma_schema_version>
|
||||
public func schemaVersion() throws -> Int32 {
|
||||
try Int32.fetchOne(cachedStatement(sql: "PRAGMA schema_version"))!
|
||||
try Int32.fetchOne(internalCachedStatement(sql: "PRAGMA schema_version"))!
|
||||
}
|
||||
|
||||
/// Clears the database schema cache.
|
||||
///
|
||||
/// GRDB caches information about the database schema, such as the
|
||||
/// columns of tables. When another SQLite connection to the same
|
||||
/// database file modifies the schema, this information becomes
|
||||
/// outdated.
|
||||
///
|
||||
/// GRDB clears this cache when it detects a schema change at the
|
||||
/// beginning of a transaction opened by a database access method
|
||||
/// such as `read` or `write`, by ``inTransaction(_:_:)``, or by
|
||||
/// ``inSavepoint(_:)``. It does not check in `DEFERRED` transactions
|
||||
/// that can write.
|
||||
///
|
||||
/// Call this method when another connection may have modified the
|
||||
/// schema since the last check, for example in
|
||||
/// `writeWithoutTransaction`.
|
||||
/// If the database schema is modified by another SQLite connection to the
|
||||
/// same database file, your application may need to call this method in
|
||||
/// order to avoid undesired consequences.
|
||||
public func clearSchemaCache() {
|
||||
// TODO: can't we automatically clear the cache for writer connection,
|
||||
// just as we do for DatabasePool reader connections?
|
||||
|
||||
SchedulingWatchdog.preconditionValidQueue(self)
|
||||
schemaCache.clear()
|
||||
|
||||
// We also clear the statement cache. SQLite automatically
|
||||
// recompiles statements after a schema change (see
|
||||
// https://www.sqlite.org/c3ref/prepare.html), but the recompilation
|
||||
// does not update the statement information gathered by
|
||||
// `StatementAuthorizer` at compilation time.
|
||||
statementCache.clear()
|
||||
// We also clear statement cache despite the automatic statement
|
||||
// recompilation (see https://www.sqlite.org/c3ref/prepare.html)
|
||||
// because the automatic statement recompilation only happens a
|
||||
// limited number of times (`SQLITE_MAX_SCHEMA_RETRY`).
|
||||
internalStatementCache.clear()
|
||||
publicStatementCache.clear()
|
||||
}
|
||||
|
||||
/// Clears the database schema cache if the database schema has changed
|
||||
@@ -110,24 +100,8 @@ extension Database {
|
||||
// <https://sqlite.org/fileformat2.html#database_header>
|
||||
let schemaVersion = try self.schemaVersion()
|
||||
if lastSchemaVersion != schemaVersion {
|
||||
// The schema has changed.
|
||||
//
|
||||
// When we compile a database statement in this new schema,
|
||||
// SQLite might compile it against the previous schema. It's
|
||||
// generally not a problem, because SQLite will detect the
|
||||
// mismatch from `sqlite3_step`, and recompile it.
|
||||
//
|
||||
// However, the statement metadata recorded by
|
||||
// `StatementAuthorizer` from the initial compilation might be
|
||||
// wrong, with potential bad consequences on database
|
||||
// observation.
|
||||
//
|
||||
// Executing a statement that reads `sqlite_master` makes
|
||||
// SQLite reload its schema. This is the observed SQLite
|
||||
// behavior, not a documented guarantee.
|
||||
try execute(sql: "SELECT * FROM sqlite_master LIMIT 0")
|
||||
clearSchemaCache()
|
||||
lastSchemaVersion = schemaVersion
|
||||
clearSchemaCache()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +160,7 @@ extension Database {
|
||||
}
|
||||
#else
|
||||
/// Returns information about a table or a view
|
||||
@available(iOS 15.4, macOS 12.4, tvOS 15.4, *) // SQLite 3.37+
|
||||
@available(iOS 15.4, macOS 12.4, tvOS 15.4, watchOS 8.5, *) // SQLite 3.37+
|
||||
func table(_ tableName: String) throws -> TableInfo? {
|
||||
for schemaID in try fetchSchemaIdentifiers() {
|
||||
if let result = try table(for: DatabaseObjectID(name: tableName, schemaID: schemaID)) {
|
||||
@@ -197,7 +171,7 @@ extension Database {
|
||||
}
|
||||
|
||||
/// Returns information about a table or a view
|
||||
@available(iOS 15.4, macOS 12.4, tvOS 15.4, *) // SQLite 3.37+
|
||||
@available(iOS 15.4, macOS 12.4, tvOS 15.4, watchOS 8.5, *) // SQLite 3.37+
|
||||
func table(for table: DatabaseObjectID) throws -> TableInfo? {
|
||||
try _table(for: table)
|
||||
}
|
||||
@@ -608,7 +582,7 @@ extension Database {
|
||||
return try self.table(for: table)!.isWithoutRowIDTable == false
|
||||
}
|
||||
#else
|
||||
if #available(iOS 15.4, macOS 12.4, tvOS 15.4, *) { // SQLite 3.37+
|
||||
if #available(iOS 15.4, macOS 12.4, tvOS 15.4, watchOS 8.5, *) { // SQLite 3.37+
|
||||
return try self.table(for: table)!.isWithoutRowIDTable == false
|
||||
}
|
||||
#endif
|
||||
@@ -1054,12 +1028,58 @@ extension Database {
|
||||
/// Fetches the columns in the database table identified by `table`, or
|
||||
/// returns nil if the database schema does not contain that table.
|
||||
///
|
||||
/// This method relies entirely on SQLite schema introspection. It
|
||||
/// returns all columns, including
|
||||
/// This method relies entirely on SQLite schema introspection. Starting with
|
||||
/// SQLite 3.26.0, it returns all columns, including
|
||||
/// [generated columns](https://www.sqlite.org/gencol.html) and
|
||||
/// [hidden columns](https://www.sqlite.org/vtab.html#hiddencol).
|
||||
func fetchPrimitiveColumns(in table: DatabaseObjectID) throws -> [ColumnInfo]? {
|
||||
let columnInfoQuery = "PRAGMA \(table.schemaID.name).table_xinfo(\(table.name.quotedDatabaseIdentifier))"
|
||||
// https://www.sqlite.org/pragma.html
|
||||
//
|
||||
// > PRAGMA database.table_info(table-name);
|
||||
// >
|
||||
// > This pragma returns one row for each column in the named table.
|
||||
// > Columns in the result set include the column name, data type,
|
||||
// > whether or not the column can be NULL, and the default value for
|
||||
// > the column. The "pk" column in the result set is zero for columns
|
||||
// > that are not part of the primary key, and is the index of the
|
||||
// > column in the primary key for columns that are part of the primary
|
||||
// > key.
|
||||
//
|
||||
// sqlite> CREATE TABLE players (
|
||||
// id INTEGER PRIMARY KEY,
|
||||
// firstName TEXT,
|
||||
// lastName TEXT);
|
||||
//
|
||||
// sqlite> PRAGMA table_info("players");
|
||||
// cid | name | type | notnull | dflt_value | pk |
|
||||
// 0 | id | INTEGER | 0 | NULL | 1 |
|
||||
// 1 | name | TEXT | 0 | NULL | 0 |
|
||||
// 2 | score | INTEGER | 0 | NULL | 0 |
|
||||
//
|
||||
//
|
||||
// PRAGMA table_info does not expose hidden and generated columns. For
|
||||
// that, we need PRAGMA table_xinfo, introduced in SQLite 3.26.0:
|
||||
// https://sqlite.org/releaselog/3_26_0.html
|
||||
//
|
||||
// > PRAGMA schema.table_xinfo(table-name);
|
||||
//
|
||||
// > This pragma returns one row for each column in the named table,
|
||||
// > including hidden columns in virtual tables. The output is the same
|
||||
// > as for PRAGMA table_info except that hidden columns are shown
|
||||
// > rather than being omitted.
|
||||
//
|
||||
// sqlite> PRAGMA table_xinfo("players");
|
||||
// cid | name | type | notnull | dflt_value | pk | hidden
|
||||
// 0 | id | INTEGER | 0 | NULL | 1 | 0
|
||||
// 1 | firstName | TEXT | 0 | NULL | 0 | 0
|
||||
// 2 | lastName | TEXT | 0 | NULL | 0 | 0
|
||||
let columnInfoQuery: String
|
||||
if sqlite3_libversion_number() < 3026000 {
|
||||
columnInfoQuery = "PRAGMA \(table.schemaID.name).table_info(\(table.name.quotedDatabaseIdentifier))"
|
||||
} else {
|
||||
// Use PRAGMA table_xinfo so that we can load generated columns
|
||||
columnInfoQuery = "PRAGMA \(table.schemaID.name).table_xinfo(\(table.name.quotedDatabaseIdentifier))"
|
||||
}
|
||||
let columns = try ColumnInfo
|
||||
.fetchAll(self, sql: columnInfoQuery)
|
||||
.sorted(by: { $0.cid < $1.cid })
|
||||
@@ -1275,10 +1295,11 @@ public struct DatabaseObjectID: Hashable, Sendable {
|
||||
///
|
||||
/// Related SQLite documentation:
|
||||
///
|
||||
/// - [pragma `table_info`](https://www.sqlite.org/pragma.html#pragma_table_info)
|
||||
/// - [pragma `table_xinfo`](https://www.sqlite.org/pragma.html#pragma_table_xinfo)
|
||||
public struct ColumnInfo: FetchableRecord, Sendable {
|
||||
let cid: Int
|
||||
let hidden: Int
|
||||
let hidden: Int?
|
||||
|
||||
/// The column name.
|
||||
public let name: String
|
||||
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
@@ -94,8 +92,8 @@ extension Database {
|
||||
/// let moreThanThirtyCount = try Int.fetchOne(statement, arguments: [30])!
|
||||
///
|
||||
/// - parameter sql: An SQL string.
|
||||
/// - parameter prepFlags: Flags for `sqlite3_prepare_v3` see
|
||||
/// <http://www.sqlite.org/c3ref/prepare.html>.
|
||||
/// - parameter prepFlags: Flags for sqlite3_prepare_v3 (available from
|
||||
/// SQLite 3.20.0, see <http://www.sqlite.org/c3ref/prepare.html>)
|
||||
/// - returns: A prepared statement.
|
||||
/// - throws: A ``DatabaseError`` whenever an SQLite error occurs.
|
||||
func makeStatement(sql: String, prepFlags: CUnsignedInt) throws -> Statement {
|
||||
@@ -144,19 +142,14 @@ extension Database {
|
||||
/// try statement.execute(arguments: ["Barbara"])
|
||||
/// ```
|
||||
///
|
||||
/// The returned statement has no argument values.
|
||||
///
|
||||
/// The returned statement is distinct from any statement that is still
|
||||
/// in use (held by the application or by a cursor), even if it has the
|
||||
/// same SQL. For example, it is possible to iterate the results of a
|
||||
/// cached statement while executing the same SQL from another cached
|
||||
/// statement.
|
||||
/// The returned statement may have already been used: it may or may not
|
||||
/// contain values for its arguments, if any.
|
||||
///
|
||||
/// - parameter sql: An SQL string.
|
||||
/// - returns: A prepared statement.
|
||||
/// - throws: A ``DatabaseError`` whenever an SQLite error occurs.
|
||||
public func cachedStatement(sql: String) throws -> Statement {
|
||||
try statementCache.statement(sql)
|
||||
try publicStatementCache.statement(sql)
|
||||
}
|
||||
|
||||
/// Returns a prepared statement that can be reused.
|
||||
@@ -192,15 +185,6 @@ extension Database {
|
||||
/// """)
|
||||
/// ```
|
||||
///
|
||||
/// When the literal does not set any argument, the returned statement
|
||||
/// has no argument values.
|
||||
///
|
||||
/// The returned statement is distinct from any statement that is still
|
||||
/// in use (held by the application or by a cursor), even if it has the
|
||||
/// same SQL. For example, it is possible to iterate the results of a
|
||||
/// cached statement while executing the same SQL from another cached
|
||||
/// statement.
|
||||
///
|
||||
/// - parameter sqlLiteral: An ``SQL`` literal.
|
||||
/// - returns: A prepared statement.
|
||||
/// - throws: A ``DatabaseError`` whenever an SQLite error occurs.
|
||||
@@ -214,6 +198,11 @@ extension Database {
|
||||
return statement
|
||||
}
|
||||
|
||||
/// Returns a cached statement that does not conflict with user's cached statements.
|
||||
func internalCachedStatement(sql: String) throws -> Statement {
|
||||
try internalStatementCache.statement(sql)
|
||||
}
|
||||
|
||||
/// Returns a cursor of prepared statements.
|
||||
///
|
||||
/// For example:
|
||||
@@ -488,7 +477,8 @@ extension Database {
|
||||
// https://www.sqlite.org/c3ref/reset.html
|
||||
//
|
||||
// So make sure we clear this statement from the cache.
|
||||
statementCache.remove(statement)
|
||||
internalStatementCache.remove(statement)
|
||||
publicStatementCache.remove(statement)
|
||||
|
||||
checkForAutocommitTransition()
|
||||
|
||||
@@ -564,17 +554,8 @@ extension Database {
|
||||
}
|
||||
}
|
||||
|
||||
/// A thread-unsafe statement cache.
|
||||
///
|
||||
/// The cache holds one statement per SQL string. A cached statement is
|
||||
/// returned only if no one else holds a reference to it. Otherwise, the
|
||||
/// cache returns a new statement, which is not cached.
|
||||
///
|
||||
/// This class is a reference type so that `isKnownUniquelyReferenced` can
|
||||
/// check the cached statements in place. A value type would be copied when
|
||||
/// accessed through the lazy `Database.statementCache` property, and the
|
||||
/// copy would retain all statements.
|
||||
final class StatementCache {
|
||||
/// A thread-unsafe statement cache
|
||||
struct StatementCache {
|
||||
unowned let db: Database
|
||||
private var statements: [String: Statement] = [:]
|
||||
|
||||
@@ -582,20 +563,9 @@ final class StatementCache {
|
||||
self.db = database
|
||||
}
|
||||
|
||||
/// - precondition: this method is called on a valid dispatch queue.
|
||||
func statement(_ sql: String) throws -> Statement {
|
||||
if let index = statements.index(forKey: sql) {
|
||||
// Check the statement in place: a local copy would add
|
||||
// a reference.
|
||||
if isKnownUniquelyReferenced(&statements.values[index]) {
|
||||
let statement = statements.values[index]
|
||||
statement.prepareForReuse()
|
||||
return statement
|
||||
}
|
||||
|
||||
// The cached statement is in use: return a new statement,
|
||||
// which is not cached.
|
||||
return try db.makeStatement(sql: sql)
|
||||
mutating func statement(_ sql: String) throws -> Statement {
|
||||
if let statement = statements[sql] {
|
||||
return statement
|
||||
}
|
||||
|
||||
// http://www.sqlite.org/c3ref/c_prepare_persistent.html#sqlitepreparepersistent
|
||||
@@ -609,15 +579,15 @@ final class StatementCache {
|
||||
return statement
|
||||
}
|
||||
|
||||
func clear() {
|
||||
mutating func clear() {
|
||||
statements = [:]
|
||||
}
|
||||
|
||||
func remove(_ statement: Statement) {
|
||||
mutating func remove(_ statement: Statement) {
|
||||
statements.removeFirst { $0.value === statement }
|
||||
}
|
||||
|
||||
func removeAll(where shouldBeRemoved: (Statement) -> Bool) {
|
||||
mutating func removeAll(where shouldBeRemoved: (Statement) -> Bool) {
|
||||
statements = statements.filter { (_, statement) in !shouldBeRemoved(statement) }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,14 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
import GRDBSQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
import GRDBSQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
@@ -300,8 +298,13 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
/// The cache for the available database schemas (main, temp, attached databases).
|
||||
var schemaCache = SchemaCache()
|
||||
|
||||
/// The cache for statements, used by both GRDB and the user.
|
||||
lazy var statementCache = StatementCache(database: self)
|
||||
/// The cache for statements managed by GRDB. It is distinct from
|
||||
/// `publicStatementCache` so that we do not mess with statement arguments
|
||||
/// set by the user.
|
||||
lazy var internalStatementCache = StatementCache(database: self)
|
||||
|
||||
/// The cache for statements managed by the user.
|
||||
lazy var publicStatementCache = StatementCache(database: self)
|
||||
|
||||
/// The database authorizer provides information about compiled
|
||||
/// database statements, and prevents the truncate optimization when
|
||||
@@ -331,7 +334,7 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
/// // Prints, for example, "3048000"
|
||||
/// print(Database.sqliteLibVersionNumber)
|
||||
/// ```
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public static var sqliteLibVersionNumber: CInt {
|
||||
sqlite3_libversion_number()
|
||||
@@ -667,7 +670,8 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
|
||||
// Finalize all cached statements since they would prevent
|
||||
// immediate connection closing.
|
||||
statementCache.clear()
|
||||
internalStatementCache.clear()
|
||||
publicStatementCache.clear()
|
||||
|
||||
// https://www.sqlite.org/c3ref/close.html
|
||||
// > If the database connection is associated with unfinalized prepared
|
||||
@@ -710,7 +714,8 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
|
||||
// Finalize all cached statements since they would prevent
|
||||
// immediate connection closing.
|
||||
statementCache.clear()
|
||||
internalStatementCache.clear()
|
||||
publicStatementCache.clear()
|
||||
|
||||
// https://www.sqlite.org/c3ref/close.html
|
||||
// > If sqlite3_close_v2() is called with unfinalized prepared
|
||||
@@ -843,7 +848,7 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
// concurrent and we can pretend it occurred before or after
|
||||
// the PRAGMA.
|
||||
try ignoringInterruption {
|
||||
try cachedStatement(sql: "PRAGMA query_only = 1").execute()
|
||||
try internalCachedStatement(sql: "PRAGMA query_only = 1").execute()
|
||||
}
|
||||
}
|
||||
readOnlyDepth += 1
|
||||
@@ -863,7 +868,7 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
// concurrent and we can pretend it occurred before or after
|
||||
// the PRAGMA.
|
||||
try ignoringInterruption {
|
||||
try cachedStatement(sql: "PRAGMA query_only = 0").execute()
|
||||
try internalCachedStatement(sql: "PRAGMA query_only = 0").execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1519,7 +1524,6 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
/// error thrown by `operations`.
|
||||
public func inTransaction(_ kind: TransactionKind? = nil, _ operations: () throws -> TransactionCompletion) throws {
|
||||
// Begin transaction
|
||||
let kind = kind ?? defaultTransactionKind
|
||||
try beginTransaction(kind)
|
||||
|
||||
// Support for `checkForAbortedTransaction()`.
|
||||
@@ -1535,17 +1539,6 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
var firstError: Error?
|
||||
let needsRollback: Bool
|
||||
do {
|
||||
// Another connection may have modified the database schema.
|
||||
//
|
||||
// Don't check in a DEFERRED transaction that may write:
|
||||
// reading the schema version would start a read transaction,
|
||||
// and the later upgrade to a write transaction could fail with
|
||||
// SQLITE_BUSY, which can't be avoided with a busy timeout.
|
||||
// See `beginTransaction(_:)`.
|
||||
if kind != .deferred || isReadOnly {
|
||||
try clearSchemaCacheIfNeeded()
|
||||
}
|
||||
|
||||
let completion = try operations()
|
||||
switch completion {
|
||||
case .commit:
|
||||
@@ -1751,17 +1744,11 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
// cannot be avoided with a busy timeout.
|
||||
//
|
||||
// See <https://github.com/groue/GRDB.swift/issues/1483>.
|
||||
let kind = kind ?? defaultTransactionKind
|
||||
let kind = kind ?? (isReadOnly ? .deferred : .immediate)
|
||||
try execute(sql: "BEGIN \(kind.rawValue) TRANSACTION")
|
||||
assert(sqlite3_get_autocommit(sqliteConnection) == 0)
|
||||
}
|
||||
|
||||
/// The transaction kind of ``beginTransaction(_:)`` when no kind
|
||||
/// is provided.
|
||||
private var defaultTransactionKind: TransactionKind {
|
||||
isReadOnly ? .deferred : .immediate
|
||||
}
|
||||
|
||||
/// Rolls back a database transaction.
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/lang_transaction.html>
|
||||
@@ -1854,7 +1841,8 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
sqlite3_db_release_memory(sqliteConnection)
|
||||
}
|
||||
schemaCache.clear()
|
||||
statementCache.clear()
|
||||
internalStatementCache.clear()
|
||||
publicStatementCache.clear()
|
||||
}
|
||||
|
||||
// MARK: - Erasing
|
||||
File renamed without changes.
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
@@ -503,7 +501,7 @@ public final class DatabaseFunction: Identifiable, Sendable {
|
||||
/// try Int.fetchOne(db, sql: "SELECT mysum(i) FROM test")! // 3
|
||||
/// }
|
||||
/// ```
|
||||
public protocol DatabaseAggregate: SendableMetatype {
|
||||
public protocol DatabaseAggregate: GRDBSendableMetatype {
|
||||
/// Creates an aggregate.
|
||||
///
|
||||
/// A new instance is created for each aggregation.
|
||||
@@ -335,6 +335,7 @@ extension DatabasePool: DatabaseReader {
|
||||
|
||||
// MARK: - Reading from Database
|
||||
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func read<T>(_ value: (Database) throws -> T) throws -> T {
|
||||
GRDBPrecondition(currentReader == nil, "Database methods are not reentrant.")
|
||||
guard let readerPool else {
|
||||
@@ -342,10 +343,9 @@ extension DatabasePool: DatabaseReader {
|
||||
}
|
||||
return try readerPool.get { reader in
|
||||
try reader.sync { db in
|
||||
// clearSchemaCacheIfNeeded() is called by the transaction
|
||||
// started by `isolated`.
|
||||
try db.isolated {
|
||||
try value(db)
|
||||
try db.clearSchemaCacheIfNeeded()
|
||||
return try value(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -417,6 +417,7 @@ extension DatabasePool: DatabaseReader {
|
||||
}
|
||||
}
|
||||
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func unsafeRead<T>(_ value: (Database) throws -> T) throws -> T {
|
||||
GRDBPrecondition(currentReader == nil, "Database methods are not reentrant.")
|
||||
guard let readerPool else {
|
||||
@@ -783,6 +784,7 @@ extension DatabasePool: DatabaseReader {
|
||||
extension DatabasePool: DatabaseWriter {
|
||||
// MARK: - Writing in Database
|
||||
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func writeWithoutTransaction<T>(_ updates: (Database) throws -> T) rethrows -> T {
|
||||
try writer.sync(updates)
|
||||
}
|
||||
@@ -793,6 +795,7 @@ extension DatabasePool: DatabaseWriter {
|
||||
try await writer.execute(updates)
|
||||
}
|
||||
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func barrierWriteWithoutTransaction<T>(_ updates: (Database) throws -> T) throws -> T {
|
||||
guard let readerPool else {
|
||||
throw DatabaseError.connectionIsClosed()
|
||||
File renamed without changes.
@@ -224,6 +224,7 @@ extension DatabaseQueue: DatabaseReader {
|
||||
|
||||
// MARK: - Reading from Database
|
||||
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func read<T>(_ value: (Database) throws -> T) throws -> T {
|
||||
try writer.sync { db in
|
||||
try db.isolated(readOnly: true) {
|
||||
@@ -264,7 +265,6 @@ extension DatabaseQueue: DatabaseReader {
|
||||
// See <https://github.com/groue/GRDB.swift/pull/1213>.
|
||||
try db.beginReadOnly()
|
||||
try db.beginTransaction(.deferred)
|
||||
try db.clearSchemaCacheIfNeeded()
|
||||
value(.success(db))
|
||||
} catch {
|
||||
value(.failure(error))
|
||||
@@ -272,6 +272,7 @@ extension DatabaseQueue: DatabaseReader {
|
||||
}
|
||||
}
|
||||
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func unsafeRead<T>(_ value: (Database) throws -> T) rethrows -> T {
|
||||
try writer.sync(value)
|
||||
}
|
||||
@@ -318,7 +319,6 @@ extension DatabaseQueue: DatabaseReader {
|
||||
// See <https://github.com/groue/GRDB.swift/pull/1213>.
|
||||
try db.beginReadOnly()
|
||||
try db.beginTransaction(.deferred)
|
||||
try db.clearSchemaCacheIfNeeded()
|
||||
value(.success(db))
|
||||
} catch {
|
||||
value(.failure(error))
|
||||
@@ -391,6 +391,7 @@ extension DatabaseQueue: DatabaseWriter {
|
||||
}
|
||||
}
|
||||
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func writeWithoutTransaction<T>(_ updates: (Database) throws -> T) rethrows -> T {
|
||||
try writer.sync(updates)
|
||||
}
|
||||
@@ -401,6 +402,7 @@ extension DatabaseQueue: DatabaseWriter {
|
||||
try await writer.execute(updates)
|
||||
}
|
||||
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func barrierWriteWithoutTransaction<T>(_ updates: (Database) throws -> T) throws -> T {
|
||||
try writer.sync(updates)
|
||||
}
|
||||
@@ -185,6 +185,7 @@ public protocol DatabaseReader: AnyObject, Sendable {
|
||||
/// - parameter value: A closure which accesses the database.
|
||||
/// - throws: The error thrown by `value`, or any ``DatabaseError`` that
|
||||
/// would happen while establishing the database access.
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
func read<T>(_ value: (Database) throws -> T) throws -> T
|
||||
|
||||
/// Executes read-only database operations, and returns their result after
|
||||
@@ -282,6 +283,7 @@ public protocol DatabaseReader: AnyObject, Sendable {
|
||||
/// - parameter value: A closure which accesses the database.
|
||||
/// - throws: The error thrown by `value`, or any ``DatabaseError`` that
|
||||
/// would happen while establishing the database access.
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
func unsafeRead<T>(_ value: (Database) throws -> T) throws -> T
|
||||
|
||||
/// Executes database operations, and returns their result after they have
|
||||
@@ -644,6 +646,7 @@ extension AnyDatabaseReader: DatabaseReader {
|
||||
base.interrupt()
|
||||
}
|
||||
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func read<T>(_ value: (Database) throws -> T) throws -> T {
|
||||
try base.read(value)
|
||||
}
|
||||
@@ -660,6 +663,7 @@ extension AnyDatabaseReader: DatabaseReader {
|
||||
base.asyncRead(value)
|
||||
}
|
||||
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func unsafeRead<T>(_ value: (Database) throws -> T) throws -> T {
|
||||
try base.unsafeRead(value)
|
||||
}
|
||||
@@ -737,6 +741,7 @@ extension DatabaseSnapshotReader {
|
||||
}
|
||||
|
||||
// There is no such thing as an unsafe access to a snapshot.
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func unsafeRead<T>(_ value: (Database) throws -> T) throws -> T {
|
||||
try read(value)
|
||||
}
|
||||
File renamed without changes.
+2
-2
@@ -202,7 +202,7 @@ extension DatabasePublishers {
|
||||
}
|
||||
|
||||
public func receive<S>(subscriber: S)
|
||||
where S: Subscriber & SendableMetatype,
|
||||
where S: Subscriber & GRDBSendableMetatype,
|
||||
Failure == S.Failure,
|
||||
Output == S.Input
|
||||
{
|
||||
@@ -216,7 +216,7 @@ extension DatabasePublishers {
|
||||
|
||||
private class DatabaseRegionSubscription<Downstream>:
|
||||
Subscription, @unchecked Sendable
|
||||
where Downstream: Subscriber & SendableMetatype,
|
||||
where Downstream: Subscriber & GRDBSendableMetatype,
|
||||
Downstream.Failure == Error,
|
||||
Downstream.Input == Database
|
||||
{
|
||||
File renamed without changes.
File renamed without changes.
@@ -153,6 +153,7 @@ extension DatabaseSnapshot: DatabaseSnapshotReader {
|
||||
|
||||
// MARK: - Reading from Database
|
||||
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func read<T>(_ block: (Database) throws -> T) rethrows -> T {
|
||||
try reader.sync(block)
|
||||
}
|
||||
@@ -169,6 +170,7 @@ extension DatabaseSnapshot: DatabaseSnapshotReader {
|
||||
reader.async { value(.success($0)) }
|
||||
}
|
||||
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func unsafeRead<T>(_ value: (Database) throws -> T) rethrows -> T {
|
||||
try reader.sync(value)
|
||||
}
|
||||
@@ -1,16 +1,14 @@
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
/// A database connection that allows concurrent accesses to unchanging
|
||||
@@ -274,6 +272,7 @@ extension DatabaseSnapshotPool: DatabaseSnapshotReader {
|
||||
readerPool?.forEach { $0.interrupt() }
|
||||
}
|
||||
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func read<T>(_ value: (Database) throws -> T) throws -> T {
|
||||
GRDBPrecondition(currentReader == nil, "Database methods are not reentrant.")
|
||||
guard let readerPool else {
|
||||
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
@@ -239,7 +237,8 @@ extension DatabaseValue: StatementBinding {
|
||||
|
||||
extension DatabaseValue: Sendable { }
|
||||
|
||||
extension DatabaseValue.Storage: Sendable { }
|
||||
// @unchecked Sendable because Data is not Sendable in all target OS
|
||||
extension DatabaseValue.Storage: @unchecked Sendable { }
|
||||
|
||||
// MARK: - Hashable & Equatable
|
||||
|
||||
File renamed without changes.
@@ -97,6 +97,7 @@ public protocol DatabaseWriter: DatabaseReader {
|
||||
///
|
||||
/// - parameter updates: A closure which accesses the database.
|
||||
/// - throws: The error thrown by `updates`.
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
func writeWithoutTransaction<T>(_ updates: (Database) throws -> T) rethrows -> T
|
||||
|
||||
/// Executes database operations, and returns their result after they have
|
||||
@@ -169,6 +170,7 @@ public protocol DatabaseWriter: DatabaseReader {
|
||||
///
|
||||
/// - parameter updates: A closure which accesses the database.
|
||||
/// - throws: The error thrown by `updates`.
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
func barrierWriteWithoutTransaction<T>(_ updates: (Database) throws -> T) throws -> T
|
||||
|
||||
/// Executes database operations, and returns their result after they have
|
||||
@@ -410,6 +412,7 @@ extension DatabaseWriter {
|
||||
/// - throws: The error thrown by `updates`, or any ``DatabaseError`` that
|
||||
/// would happen while establishing the database access or committing
|
||||
/// the transaction.
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func write<T>(_ updates: (Database) throws -> T) throws -> T {
|
||||
try writeWithoutTransaction { db in
|
||||
var result: T?
|
||||
@@ -524,6 +527,7 @@ extension DatabaseWriter {
|
||||
// MARK: - Erasing the content of the database
|
||||
|
||||
/// Erase the database: delete all content, drop all tables, etc.
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func erase() throws {
|
||||
try barrierWriteWithoutTransaction { try $0.erase() }
|
||||
}
|
||||
@@ -534,10 +538,22 @@ extension DatabaseWriter {
|
||||
/// disk space.
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/lang_vacuum.html>
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func vacuum() throws {
|
||||
try writeWithoutTransaction { try $0.execute(sql: "VACUUM") }
|
||||
}
|
||||
|
||||
// VACUUM INTO was introduced in SQLite 3.27.0:
|
||||
// https://www.sqlite.org/releaselog/3_27_0.html
|
||||
//
|
||||
// Old versions of SQLCipher won't have it, but I don't know how to perform
|
||||
// availability checks that depend on the version of the SQLCipher CocoaPod
|
||||
// chosen by the application. So let's just have the method fail at runtime.
|
||||
//
|
||||
// This method is declared on DatabaseWriter instead of DatabaseReader,
|
||||
// so that it is not available on DatabaseSnaphot. VACUUM INTO is not
|
||||
// available inside the transaction that is kept open by DatabaseSnaphot.
|
||||
#if GRDBCUSTOMSQLITE || SQLITE_HAS_CODEC
|
||||
/// Creates a new database file at the specified path with a minimum
|
||||
/// amount of disk space.
|
||||
///
|
||||
@@ -547,11 +563,27 @@ extension DatabaseWriter {
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/lang_vacuum.html#vacuuminto>
|
||||
///
|
||||
/// - Parameter filePath: file path for new database
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func vacuum(into filePath: String) throws {
|
||||
try writeWithoutTransaction {
|
||||
try $0.execute(sql: "VACUUM INTO ?", arguments: [filePath])
|
||||
}
|
||||
}
|
||||
#else
|
||||
/// Creates a new database file at the specified path with a minimum
|
||||
/// amount of disk space.
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/lang_vacuum.html#vacuuminto>
|
||||
///
|
||||
/// - Parameter filePath: file path for new database
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
@available(iOS 14, macOS 10.16, tvOS 14, *)
|
||||
public func vacuum(into filePath: String) throws {
|
||||
try writeWithoutTransaction {
|
||||
try $0.execute(sql: "VACUUM INTO ?", arguments: [filePath])
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// MARK: - Database Observation
|
||||
|
||||
@@ -634,6 +666,7 @@ extension DatabaseWriter {
|
||||
try await writeWithoutTransaction { try $0.execute(sql: "VACUUM") }
|
||||
}
|
||||
|
||||
#if GRDBCUSTOMSQLITE || SQLITE_HAS_CODEC
|
||||
/// Creates a new database file at the specified path with a minimum
|
||||
/// amount of disk space.
|
||||
///
|
||||
@@ -648,6 +681,19 @@ extension DatabaseWriter {
|
||||
try $0.execute(sql: "VACUUM INTO ?", arguments: [filePath])
|
||||
}
|
||||
}
|
||||
#else
|
||||
/// Creates a new database file at the specified path with a minimum
|
||||
/// amount of disk space.
|
||||
///
|
||||
/// Related SQLite documentation: <https://www.sqlite.org/lang_vacuum.html#vacuuminto>
|
||||
///
|
||||
/// - Parameter filePath: file path for new database
|
||||
public func vacuum(into filePath: String) async throws {
|
||||
try await writeWithoutTransaction {
|
||||
try $0.execute(sql: "VACUUM INTO ?", arguments: [filePath])
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if canImport(Combine)
|
||||
@@ -834,6 +880,7 @@ extension AnyDatabaseWriter: DatabaseReader {
|
||||
base.interrupt()
|
||||
}
|
||||
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func read<T>(_ value: (Database) throws -> T) throws -> T {
|
||||
try base.read(value)
|
||||
}
|
||||
@@ -850,6 +897,7 @@ extension AnyDatabaseWriter: DatabaseReader {
|
||||
base.asyncRead(value)
|
||||
}
|
||||
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func unsafeRead<T>(_ value: (Database) throws -> T) throws -> T {
|
||||
try base.unsafeRead(value)
|
||||
}
|
||||
@@ -883,6 +931,7 @@ extension AnyDatabaseWriter: DatabaseReader {
|
||||
}
|
||||
|
||||
extension AnyDatabaseWriter: DatabaseWriter {
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func writeWithoutTransaction<T>(_ updates: (Database) throws -> T) rethrows -> T {
|
||||
try base.writeWithoutTransaction(updates)
|
||||
}
|
||||
@@ -893,6 +942,7 @@ extension AnyDatabaseWriter: DatabaseWriter {
|
||||
try await base.writeWithoutTransaction(updates)
|
||||
}
|
||||
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
public func barrierWriteWithoutTransaction<T>(_ updates: (Database) throws -> T) throws -> T {
|
||||
try base.barrierWriteWithoutTransaction(updates)
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
@@ -60,6 +58,7 @@ import Foundation
|
||||
/// - ``decode(_:atIndex:)-33ykh``
|
||||
/// - ``decode(_:atIndex:)-3btwn``
|
||||
/// - ``withUnsafeData(atIndex:_:)``
|
||||
/// - ``dataNoCopy(atIndex:)``
|
||||
///
|
||||
/// ### Accessing Row Values by Column Name
|
||||
///
|
||||
@@ -70,6 +69,7 @@ import Foundation
|
||||
/// - ``decode(_:forColumn:)-4i1o4``
|
||||
/// - ``decode(_:forColumn:)-4rhs4``
|
||||
/// - ``withUnsafeData(named:_:)``
|
||||
/// - ``dataNoCopy(named:)``
|
||||
///
|
||||
/// ### Accessing Row Values by Column
|
||||
///
|
||||
@@ -80,6 +80,7 @@ import Foundation
|
||||
/// - ``decode(_:forColumn:)-1ljuo``
|
||||
/// - ``decode(_:forColumn:)-47qeg``
|
||||
/// - ``withUnsafeData(at:_:)``
|
||||
/// - ``dataNoCopy(_:)``
|
||||
///
|
||||
/// ### Row Scopes & Associated Rows
|
||||
///
|
||||
@@ -320,8 +321,8 @@ extension Row {
|
||||
// MARK: - Extracting Values
|
||||
|
||||
/// Fatal errors if index is out of bounds
|
||||
@inline(always)
|
||||
@inlinable
|
||||
@inline(__always)
|
||||
@usableFromInline
|
||||
/* private */ func _checkIndex(_ index: Int, file: StaticString = #file, line: UInt = #line) {
|
||||
GRDBPrecondition(index >= 0 && index < count, "row index out of range", file: file, line: line)
|
||||
}
|
||||
@@ -424,7 +425,7 @@ extension Row {
|
||||
/// let row = try Row.fetchOne(db, sql: "SELECT NULL")!
|
||||
/// let name: String? = row[0] // nil
|
||||
/// ```
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public subscript<Value: DatabaseValueConvertible & StatementColumnConvertible>(_ index: Int) -> Value {
|
||||
try! decode(Value.self, atIndex: index)
|
||||
@@ -653,6 +654,56 @@ extension Row {
|
||||
try withUnsafeData(named: column.name, body)
|
||||
}
|
||||
|
||||
/// Returns the optional `Data` at given index.
|
||||
///
|
||||
/// Indexes span from `0` for the leftmost column to `row.count - 1` for the
|
||||
/// rightmost column.
|
||||
///
|
||||
/// If the SQLite value is NULL, the result is nil. If the SQLite value can
|
||||
/// not be converted to Data, a fatal error is raised.
|
||||
///
|
||||
/// The returned data does not own its bytes: it must not be used longer
|
||||
/// than the row's lifetime.
|
||||
@available(*, deprecated, message: "Use withUnsafeData(atIndex:_:) instead.")
|
||||
public func dataNoCopy(atIndex index: Int) -> Data? {
|
||||
try! withUnsafeData(atIndex: index, { $0 })
|
||||
}
|
||||
|
||||
/// Returns the optional `Data` at given column.
|
||||
///
|
||||
/// Column name lookup is case-insensitive. When several columns exist with
|
||||
/// the same name, the leftmost column is considered.
|
||||
///
|
||||
/// If the column is missing or if the SQLite value is NULL, the result is
|
||||
/// nil. If the SQLite value cannot be converted to Data, a fatal error
|
||||
/// is raised.
|
||||
///
|
||||
/// The returned data does not own its bytes: it must not be used longer
|
||||
/// than the row's lifetime.
|
||||
@available(*, deprecated, message: "Use withUnsafeData(named:_:) instead.")
|
||||
public func dataNoCopy(named columnName: String) -> Data? {
|
||||
guard let index = index(forColumn: columnName) else {
|
||||
return nil
|
||||
}
|
||||
return try! withUnsafeData(atUncheckedIndex: index, { $0 })
|
||||
}
|
||||
|
||||
/// Returns the optional `Data` at given column.
|
||||
///
|
||||
/// Column name lookup is case-insensitive. When several columns exist with
|
||||
/// the same name, the leftmost column is considered.
|
||||
///
|
||||
/// If the column is missing or if the SQLite value is NULL, the result is
|
||||
/// nil. If the SQLite value cannot be converted to Data, a fatal error
|
||||
/// is raised.
|
||||
///
|
||||
/// The returned data does not own its bytes: it must not be used longer
|
||||
/// than the row's lifetime.
|
||||
@available(*, deprecated, message: "Use withUnsafeData(at:_:) instead.")
|
||||
public func dataNoCopy(_ column: some ColumnExpression) -> Data? {
|
||||
dataNoCopy(named: column.name)
|
||||
}
|
||||
|
||||
/// Returns the first non-null value, if any. Identical to SQL `COALESCE` function.
|
||||
///
|
||||
/// For example:
|
||||
@@ -1202,7 +1253,7 @@ extension Row {
|
||||
/// ```
|
||||
///
|
||||
/// - throws: Any error that happens during the decoding.
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public func decode<Value: DatabaseValueConvertible & StatementColumnConvertible>(
|
||||
_ type: Value.Type = Value.self,
|
||||
@@ -2356,6 +2407,9 @@ extension Row: ExpressibleByDictionaryLiteral {
|
||||
|
||||
// MARK: - Index
|
||||
|
||||
@available(*, deprecated, renamed: "Row.Index")
|
||||
typealias RowIndex = Row.Index
|
||||
|
||||
extension Row {
|
||||
/// An index to a (column, value) pair in a ``Row``.
|
||||
public struct Index: Sendable {
|
||||
File renamed without changes.
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
/// A key that is used to decode a value in a row
|
||||
File renamed without changes.
File renamed without changes.
@@ -45,21 +45,33 @@
|
||||
/// - ``init(sql:arguments:adapter:cached:)-3qq8t``
|
||||
/// - ``init(sql:arguments:adapter:cached:)-5ecx2``
|
||||
public struct SQLRequest<RowDecoder> {
|
||||
/// There are two statement caches: one "public" for statements generated by
|
||||
/// the user, and one "internal" for the statements generated by GRDB. Those
|
||||
/// are separated so that GRDB has no opportunity to inadvertently modify
|
||||
/// the arguments of the user's cached statements.
|
||||
enum Cache {
|
||||
/// The public cache, for library user
|
||||
case `public`
|
||||
|
||||
/// The internal cache, for GRDB
|
||||
case `internal`
|
||||
}
|
||||
|
||||
/// The row adapter.
|
||||
public var adapter: (any RowAdapter)?
|
||||
|
||||
private(set) var sqlLiteral: SQL
|
||||
let cached: Bool
|
||||
let cache: Cache?
|
||||
|
||||
private init(
|
||||
literal sqlLiteral: SQL,
|
||||
adapter: (any RowAdapter)?,
|
||||
cached: Bool,
|
||||
fromCache cache: Cache?,
|
||||
type: RowDecoder.Type)
|
||||
{
|
||||
self.sqlLiteral = sqlLiteral
|
||||
self.adapter = adapter
|
||||
self.cached = cached
|
||||
self.cache = cache
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +102,7 @@ extension SQLRequest {
|
||||
self.init(
|
||||
literal: SQL(sql: sql, arguments: arguments),
|
||||
adapter: adapter,
|
||||
cached: cached,
|
||||
fromCache: cached ? .public : nil,
|
||||
type: RowDecoder.self)
|
||||
}
|
||||
|
||||
@@ -115,7 +127,7 @@ extension SQLRequest {
|
||||
self.init(
|
||||
literal: sqlLiteral,
|
||||
adapter: adapter,
|
||||
cached: cached,
|
||||
fromCache: cached ? .public : nil,
|
||||
type: RowDecoder.self)
|
||||
}
|
||||
}
|
||||
@@ -144,7 +156,7 @@ extension SQLRequest<Row> {
|
||||
self.init(
|
||||
literal: SQL(sql: sql, arguments: arguments),
|
||||
adapter: adapter,
|
||||
cached: cached,
|
||||
fromCache: cached ? .public : nil,
|
||||
type: Row.self)
|
||||
}
|
||||
|
||||
@@ -169,7 +181,7 @@ extension SQLRequest<Row> {
|
||||
self.init(
|
||||
literal: sqlLiteral,
|
||||
adapter: adapter,
|
||||
cached: cached,
|
||||
fromCache: cached ? .public : nil,
|
||||
type: Row.self)
|
||||
}
|
||||
}
|
||||
@@ -190,9 +202,15 @@ extension SQLRequest: FetchRequest {
|
||||
{
|
||||
let context = SQLGenerationContext(db)
|
||||
let sql = try sqlLiteral.sql(context)
|
||||
let statement = try cached
|
||||
? db.cachedStatement(sql: sql)
|
||||
: db.makeStatement(sql: sql)
|
||||
let statement: Statement
|
||||
switch cache {
|
||||
case .none:
|
||||
statement = try db.makeStatement(sql: sql)
|
||||
case .public:
|
||||
statement = try db.cachedStatement(sql: sql)
|
||||
case .internal:
|
||||
statement = try db.internalCachedStatement(sql: sql)
|
||||
}
|
||||
try statement.setArguments(context.arguments)
|
||||
return PreparedRequest(statement: statement, adapter: adapter)
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
@@ -165,8 +163,8 @@ public final class Statement {
|
||||
/// containing SQL.
|
||||
/// - parameter statementEnd: Upon success, the pointer to the next
|
||||
/// statement in the C string.
|
||||
/// - parameter prepFlags: Flags for `sqlite3_prepare_v3` see
|
||||
/// <http://www.sqlite.org/c3ref/prepare.html>.
|
||||
/// - parameter prepFlags: Flags for sqlite3_prepare_v3 (available from
|
||||
/// SQLite 3.20.0, see <http://www.sqlite.org/c3ref/prepare.html>)
|
||||
/// - throws: DatabaseError in case of compilation error.
|
||||
required init?(
|
||||
database: Database,
|
||||
@@ -467,20 +465,6 @@ public final class Statement {
|
||||
}
|
||||
}
|
||||
|
||||
/// Resets the statement, and clears its arguments, so that it is in the
|
||||
/// same state as a newly prepared statement.
|
||||
///
|
||||
/// - precondition: this method is called on a valid dispatch queue.
|
||||
func prepareForReuse() {
|
||||
// Ignore the result of sqlite3_reset, which might report the error
|
||||
// of the last sqlite3_step(), if any. This should not prevent reuse.
|
||||
// <https://www.sqlite.org/c3ref/reset.html>
|
||||
sqlite3_reset(sqliteStatement)
|
||||
clearBindings()
|
||||
_arguments = StatementArguments()
|
||||
argumentsAreValidAndBound = false
|
||||
}
|
||||
|
||||
// MARK: Execution
|
||||
|
||||
func reset() throws {
|
||||
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
#if canImport(string_h)
|
||||
@@ -215,7 +213,7 @@ final class StatementAuthorizer {
|
||||
|
||||
private func insertUpdateEventKind(tableName: String, columnName: String) {
|
||||
for (index, eventKind) in databaseEventKinds.enumerated() {
|
||||
if case let .update(t, columnNames) = eventKind, t == tableName {
|
||||
if case .update(let t, let columnNames) = eventKind, t == tableName {
|
||||
var columnNames = columnNames
|
||||
columnNames.insert(columnName)
|
||||
databaseEventKinds[index] = .update(tableName: tableName, columnNames: columnNames)
|
||||
+11
-13
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
/// A type that can decode itself from the low-level C interface to
|
||||
@@ -128,7 +126,7 @@ public protocol StatementColumnConvertible {
|
||||
extension StatementColumnConvertible {
|
||||
// `Optional` overrides this default behavior.
|
||||
/// Default implementation fails on decoding NULL.
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public static func fromStatement(_ sqliteStatement: SQLiteStatement, atUncheckedIndex index: CInt) -> Self? {
|
||||
if sqlite3_column_type(sqliteStatement, index) == SQLITE_NULL {
|
||||
@@ -155,7 +153,7 @@ extension DatabaseValueConvertible where Self: StatementColumnConvertible {
|
||||
context: context())
|
||||
}
|
||||
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
static func fastDecode(
|
||||
fromRow row: Row,
|
||||
@@ -172,7 +170,7 @@ extension DatabaseValueConvertible where Self: StatementColumnConvertible {
|
||||
return try row.fastDecode(Self.self, atUncheckedIndex: index)
|
||||
}
|
||||
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
static func fastDecode(
|
||||
fromStatement sqliteStatement: SQLiteStatement,
|
||||
@@ -188,7 +186,7 @@ extension DatabaseValueConvertible where Self: StatementColumnConvertible {
|
||||
}
|
||||
|
||||
// Support for Decodable
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
static func fastDecodeIfPresent(
|
||||
fromRow row: Row,
|
||||
File renamed without changes.
+7
-9
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
+8
-10
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
@@ -81,7 +79,7 @@ extension DatabaseDateComponents: StatementColumnConvertible {
|
||||
/// - parameters:
|
||||
/// - sqliteStatement: A pointer to an SQLite statement.
|
||||
/// - index: The column index.
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public init?(sqliteStatement: SQLiteStatement, index: CInt) {
|
||||
guard let cString = sqlite3_column_text(sqliteStatement, index) else {
|
||||
File renamed without changes.
+8
-10
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
@@ -134,7 +132,7 @@ extension Date: StatementColumnConvertible {
|
||||
/// - parameters:
|
||||
/// - sqliteStatement: A pointer to an SQLite statement.
|
||||
/// - index: The column index.
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public init?(sqliteStatement: SQLiteStatement, index: CInt) {
|
||||
switch sqlite3_column_type(sqliteStatement, index) {
|
||||
+8
-10
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
@@ -49,7 +47,7 @@ extension Decimal: DatabaseValueConvertible {
|
||||
|
||||
/// Decimal adopts StatementColumnConvertible
|
||||
extension Decimal: StatementColumnConvertible {
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public init?(sqliteStatement: SQLiteStatement, index: CInt) {
|
||||
switch sqlite3_column_type(sqliteStatement, index) {
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+8
-10
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
@@ -86,7 +84,7 @@ extension UUID: DatabaseValueConvertible {
|
||||
}
|
||||
|
||||
extension UUID: StatementColumnConvertible {
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public init?(sqliteStatement: SQLiteStatement, index: CInt) {
|
||||
switch sqlite3_column_type(sqliteStatement, index) {
|
||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -39,7 +39,7 @@ extension StatementBinding where Self: RawRepresentable, Self.RawValue: Statemen
|
||||
/// // adopt StatementColumnConvertible:
|
||||
/// extension Color: StatementColumnConvertible { }
|
||||
extension StatementColumnConvertible where Self: RawRepresentable, Self.RawValue: StatementColumnConvertible {
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public init?(sqliteStatement: SQLiteStatement, index: CInt) {
|
||||
guard let rawValue = RawValue(sqliteStatement: sqliteStatement, index: index) else {
|
||||
File renamed without changes.
+8
-10
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
extension Optional: StatementBinding where Wrapped: StatementBinding {
|
||||
@@ -87,7 +85,7 @@ extension Optional: DatabaseValueConvertible where Wrapped: DatabaseValueConvert
|
||||
}
|
||||
|
||||
extension Optional: StatementColumnConvertible where Wrapped: StatementColumnConvertible {
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public static func fromStatement(_ sqliteStatement: SQLiteStatement, atUncheckedIndex index: CInt) -> Self? {
|
||||
if let value = Wrapped.fromStatement(sqliteStatement, atUncheckedIndex: index) {
|
||||
+16
-18
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
import Foundation
|
||||
@@ -119,7 +117,7 @@ extension Int: DatabaseValueConvertible, StatementColumnConvertible {
|
||||
/// - parameters:
|
||||
/// - sqliteStatement: A pointer to an SQLite statement.
|
||||
/// - index: The column index.
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public init?(sqliteStatement: SQLiteStatement, index: CInt) {
|
||||
let int64 = sqlite3_column_int64(sqliteStatement, index)
|
||||
@@ -158,7 +156,7 @@ extension Int8: DatabaseValueConvertible, StatementColumnConvertible {
|
||||
/// - parameters:
|
||||
/// - sqliteStatement: A pointer to an SQLite statement.
|
||||
/// - index: The column index.
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public init?(sqliteStatement: SQLiteStatement, index: CInt) {
|
||||
let int64 = sqlite3_column_int64(sqliteStatement, index)
|
||||
@@ -197,7 +195,7 @@ extension Int16: DatabaseValueConvertible, StatementColumnConvertible {
|
||||
/// - parameters:
|
||||
/// - sqliteStatement: A pointer to an SQLite statement.
|
||||
/// - index: The column index.
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public init?(sqliteStatement: SQLiteStatement, index: CInt) {
|
||||
let int64 = sqlite3_column_int64(sqliteStatement, index)
|
||||
@@ -236,7 +234,7 @@ extension Int32: DatabaseValueConvertible, StatementColumnConvertible {
|
||||
/// - parameters:
|
||||
/// - sqliteStatement: A pointer to an SQLite statement.
|
||||
/// - index: The column index.
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public init?(sqliteStatement: SQLiteStatement, index: CInt) {
|
||||
let int64 = sqlite3_column_int64(sqliteStatement, index)
|
||||
@@ -318,7 +316,7 @@ extension UInt: DatabaseValueConvertible, StatementColumnConvertible {
|
||||
/// - parameters:
|
||||
/// - sqliteStatement: A pointer to an SQLite statement.
|
||||
/// - index: The column index.
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public init?(sqliteStatement: SQLiteStatement, index: CInt) {
|
||||
let int64 = sqlite3_column_int64(sqliteStatement, index)
|
||||
@@ -357,7 +355,7 @@ extension UInt8: DatabaseValueConvertible, StatementColumnConvertible {
|
||||
/// - parameters:
|
||||
/// - sqliteStatement: A pointer to an SQLite statement.
|
||||
/// - index: The column index.
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public init?(sqliteStatement: SQLiteStatement, index: CInt) {
|
||||
let int64 = sqlite3_column_int64(sqliteStatement, index)
|
||||
@@ -396,7 +394,7 @@ extension UInt16: DatabaseValueConvertible, StatementColumnConvertible {
|
||||
/// - parameters:
|
||||
/// - sqliteStatement: A pointer to an SQLite statement.
|
||||
/// - index: The column index.
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public init?(sqliteStatement: SQLiteStatement, index: CInt) {
|
||||
let int64 = sqlite3_column_int64(sqliteStatement, index)
|
||||
@@ -435,7 +433,7 @@ extension UInt32: DatabaseValueConvertible, StatementColumnConvertible {
|
||||
/// - parameters:
|
||||
/// - sqliteStatement: A pointer to an SQLite statement.
|
||||
/// - index: The column index.
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public init?(sqliteStatement: SQLiteStatement, index: CInt) {
|
||||
let int64 = sqlite3_column_int64(sqliteStatement, index)
|
||||
@@ -474,7 +472,7 @@ extension UInt64: DatabaseValueConvertible, StatementColumnConvertible {
|
||||
/// - parameters:
|
||||
/// - sqliteStatement: A pointer to an SQLite statement.
|
||||
/// - index: The column index.
|
||||
@inline(always)
|
||||
@inline(__always)
|
||||
@inlinable
|
||||
public init?(sqliteStatement: SQLiteStatement, index: CInt) {
|
||||
let int64 = sqlite3_column_int64(sqliteStatement, index)
|
||||
File renamed without changes.
@@ -1,15 +1,13 @@
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
extension Database {
|
||||
@@ -43,7 +41,8 @@ extension Database {
|
||||
|
||||
// Drop cached statements that delete, because the addition of an
|
||||
// observer may change the need for truncate optimization prevention.
|
||||
statementCache.removeAll { $0.canDeleteRows }
|
||||
publicStatementCache.removeAll { $0.canDeleteRows }
|
||||
internalStatementCache.removeAll { $0.canDeleteRows }
|
||||
|
||||
observationBroker.add(transactionObserver: transactionObserver, extent: extent)
|
||||
}
|
||||
@@ -64,7 +63,8 @@ extension Database {
|
||||
|
||||
// Drop cached statements that delete, because the removal of an
|
||||
// observer may change the need for truncate optimization prevention.
|
||||
statementCache.removeAll { $0.canDeleteRows }
|
||||
publicStatementCache.removeAll { $0.canDeleteRows }
|
||||
internalStatementCache.removeAll { $0.canDeleteRows }
|
||||
|
||||
observationBroker.remove(transactionObserver: transactionObserver)
|
||||
}
|
||||
@@ -1028,8 +1028,7 @@ final class TransactionObservation {
|
||||
guard let observer else {
|
||||
return false
|
||||
}
|
||||
return !observer.databaseEventObservationStrategy.requiresDatabaseEventKind ||
|
||||
observer.observes(eventsOfKind: eventKind)
|
||||
return !observer.databaseEventObservationStrategy.requiresDatabaseEventKind || observer.observes(eventsOfKind: eventKind)
|
||||
}
|
||||
|
||||
func statementObservation(for statement: Statement) -> StatementObservation? {
|
||||
@@ -1,16 +1,14 @@
|
||||
#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT
|
||||
// Import C SQLite functions
|
||||
#if GRDBFRAMEWORK // GRDB.xcodeproj
|
||||
#if GRDBCIPHER // CocoaPods (SQLCipher subspec)
|
||||
import SQLCipher
|
||||
#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec)
|
||||
import SQLite3
|
||||
#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework
|
||||
#else // SPM
|
||||
#if SQLCipher // Takes precedence over SystemSQLite
|
||||
import SQLCipher
|
||||
#elseif SystemSQLite
|
||||
import GRDBSQLite
|
||||
#else
|
||||
#error("Enable a GRDB trait that provides SQLite.")
|
||||
#endif
|
||||
#elseif SQLCipher
|
||||
import SQLCipher
|
||||
#else // Default SPM trait must be the default. It impossible to detect from Xcode.
|
||||
import GRDBSQLite
|
||||
#endif
|
||||
|
||||
/// An instance of WALSnapshot records the state of a WAL mode database for some
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 610 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user