mirror of
https://github.com/groue/GRDB.swift
synced 2026-12-06 05:28:44 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef07897ba4 | ||
|
|
dd7e7f39e8 | ||
|
|
8801adb21c | ||
|
|
f721af86cd | ||
|
|
23f4254ae3 | ||
|
|
2df6a17c1c | ||
|
|
5aeee0e429 | ||
|
|
3a61a8a0e0 | ||
|
|
e0766449f1 | ||
|
|
c1e752132c | ||
|
|
6ab90a03c4 | ||
|
|
23fa42a3e4 | ||
|
|
07eaeee123 | ||
|
|
0bfb4de02d | ||
|
|
d72b7109ad | ||
|
|
e1a63a4c05 | ||
|
|
caab403282 | ||
|
|
bbe94a9607 | ||
|
|
84bee1977e | ||
|
|
0aa561e61c | ||
|
|
b1b51c01f8 | ||
|
|
cc5196757d | ||
|
|
0e9766373d | ||
|
|
aacaa433c9 | ||
|
|
44ec3535c2 | ||
|
|
38c0d68db7 | ||
|
|
f3cc4add9f | ||
|
|
432670e13a | ||
|
|
3ba13b0af6 | ||
|
|
1a6228e2c5 | ||
|
|
e02f2c8aba | ||
|
|
c0e9c8746d | ||
|
|
d1cba5e5c8 | ||
|
|
bf824bf68c | ||
|
|
5e5b44aa7f | ||
|
|
806919b5be | ||
|
|
a289aecc3c | ||
|
|
3f7adec072 | ||
|
|
c9f3a1e17f | ||
|
|
cf2a79e12f | ||
|
|
a0212eb129 | ||
|
|
d5470b7278 | ||
|
|
cd6960f5e9 | ||
|
|
f72859b5b2 | ||
|
|
b947065d25 | ||
|
|
11f95806c4 | ||
|
|
2ac5c77353 | ||
|
|
2a849d380c | ||
|
|
fd31632203 | ||
|
|
4a98a53dad | ||
|
|
952ee0a137 | ||
|
|
ee92db9d6f | ||
|
|
de4266499c | ||
|
|
4b7a9bbe7b | ||
|
|
184d5aa4af | ||
|
|
6c48e492d1 | ||
|
|
26fedd2702 | ||
|
|
06216fd875 | ||
|
|
42050e5e28 | ||
|
|
9ed309b470 | ||
|
|
00d1a80b31 | ||
|
|
aaf3efe6df | ||
|
|
d8f2989542 | ||
|
|
28543109ea | ||
|
|
63c2bd0876 | ||
|
|
59bd10b1b5 | ||
|
|
758f561fbf | ||
|
|
40b0e98eb5 | ||
|
|
2ec0a4c69d | ||
|
|
ca43f1e803 | ||
|
|
0a7e7d1e5c | ||
|
|
1260980150 | ||
|
|
f0cfde682e | ||
|
|
096a3b2f0f | ||
|
|
f313a43ef9 |
No files matched your search
@@ -1,5 +0,0 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'xcpretty'
|
||||
gem 'xcpretty-travis-formatter'
|
||||
gem 'cocoapods', '~> 1.7'
|
||||
@@ -0,0 +1,6 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
+165
-12
@@ -1,19 +1,172 @@
|
||||
name: CI
|
||||
name: "GRDB CI"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, development ]
|
||||
branches:
|
||||
- master
|
||||
- development
|
||||
- GRDB5
|
||||
paths:
|
||||
- 'GRDB/**'
|
||||
- 'Tests/**'
|
||||
- '.github/workflows/**'
|
||||
- 'Package.swift'
|
||||
pull_request:
|
||||
branches: [ master, development ]
|
||||
paths:
|
||||
- 'GRDB/**'
|
||||
- 'Tests/**'
|
||||
- '.github/workflows/**'
|
||||
- 'Package.swift'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.ref_name }}
|
||||
cancel-in-progress: true
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: macos-latest
|
||||
|
||||
macOS:
|
||||
name: macOS
|
||||
runs-on: ${{ matrix.runsOn }}
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- xcode: "Xcode_13.3.1.app"
|
||||
runsOn: macOS-12
|
||||
name: "macOS 12, Xcode 13.3.1, Swift 5.6"
|
||||
shell: "/bin/zsh {0}"
|
||||
- xcode: "Xcode_13.2.1.app"
|
||||
runsOn: macOS-11
|
||||
name: "macOS 11, Xcode 13.2.1, Swift 5.5.2"
|
||||
shell: "/bin/zsh {0}"
|
||||
- xcode: "Xcode_13.1.app"
|
||||
runsOn: macOS-11
|
||||
name: "macOS 11, Xcode 13.1, Swift 5.5.1"
|
||||
shell: "/bin/zsh {0}"
|
||||
- xcode: "Xcode_13.0.app"
|
||||
runsOn: macOS-11
|
||||
name: "macOS 11, Xcode 13.0, Swift 5.5.0"
|
||||
shell: "/bin/zsh {0}"
|
||||
- xcode: "Xcode_12.5.1.app"
|
||||
runsOn: macOS-11
|
||||
name: "macOS 11, Xcode 12.5.1, Swift 5.4"
|
||||
shell: "/bin/zsh {0}"
|
||||
- xcode: "Xcode_12.4.app"
|
||||
runsOn: macOS-10.15
|
||||
name: "macOS 10.15, Xcode 12.4, Swift 5.3"
|
||||
shell: "/bin/zsh {0}"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Build
|
||||
run: swift build -v
|
||||
- name: Run tests
|
||||
run: swift test -v
|
||||
- uses: actions/checkout@v3
|
||||
- name: ${{ matrix.name }}
|
||||
run: make test_framework_GRDBOSX_maxSwift
|
||||
iOS:
|
||||
name: iOS
|
||||
runs-on: ${{ matrix.runsOn }}
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- xcode: "Xcode_13.3.1.app"
|
||||
runsOn: macOS-12
|
||||
name: "macOS 12, Xcode 13.3.1, Swift 5.6"
|
||||
shell: "/bin/zsh {0}"
|
||||
- xcode: "Xcode_12.4.app"
|
||||
runsOn: macOS-10.15
|
||||
name: "macOS 10.15, Xcode 12.4, Swift 5.3"
|
||||
shell: "/bin/zsh {0}"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: ${{ matrix.name }}
|
||||
run: make test_framework_GRDBiOS_maxTarget_maxSwift
|
||||
SPM:
|
||||
name: SPM
|
||||
runs-on: ${{ matrix.runsOn }}
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- xcode: "Xcode_13.3.1.app"
|
||||
runsOn: macOS-12
|
||||
name: "macOS 12, Xcode 13.3.1, Swift 5.6"
|
||||
shell: "/bin/zsh {0}"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: ${{ matrix.name }}
|
||||
run: make test_SPM test_install_SPM
|
||||
SQLCipher3:
|
||||
name: SQLCipher3
|
||||
runs-on: ${{ matrix.runsOn }}
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- xcode: "Xcode_13.3.1.app"
|
||||
runsOn: macOS-12
|
||||
name: "macOS 12, Xcode 13.3.1, Swift 5.6"
|
||||
shell: "/bin/zsh {0}"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: ${{ matrix.name }}
|
||||
run: make test_framework_SQLCipher3Encrypted
|
||||
SQLCipher4:
|
||||
name: SQLCipher4
|
||||
runs-on: ${{ matrix.runsOn }}
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- xcode: "Xcode_13.3.1.app"
|
||||
runsOn: macOS-12
|
||||
name: "macOS 12, Xcode 13.3.1, Swift 5.6"
|
||||
shell: "/bin/zsh {0}"
|
||||
- xcode: "Xcode_12.4.app"
|
||||
runsOn: macOS-10.15
|
||||
name: "macOS 10.15, Xcode 12.4, Swift 5.3"
|
||||
shell: "/bin/zsh {0}"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: ${{ matrix.name }}
|
||||
run: make test_framework_SQLCipher4Encrypted
|
||||
CustomSQLite:
|
||||
name: CustomSQLite
|
||||
runs-on: ${{ matrix.runsOn }}
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- xcode: "Xcode_13.3.1.app"
|
||||
runsOn: macOS-12
|
||||
name: "macOS 12, Xcode 13.3.1, Swift 5.6"
|
||||
shell: "/bin/zsh {0}"
|
||||
- xcode: "Xcode_12.4.app"
|
||||
runsOn: macOS-10.15
|
||||
name: "macOS 10.15, Xcode 12.4, Swift 5.3"
|
||||
shell: "/bin/zsh {0}"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: ${{ matrix.name }}
|
||||
run: make test_framework_GRDBCustomSQLiteOSX
|
||||
XCFramework:
|
||||
name: XCFramework
|
||||
runs-on: ${{ matrix.runsOn }}
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- xcode: "Xcode_13.3.1.app"
|
||||
runsOn: macOS-12
|
||||
name: "macOS 12, Xcode 13.3.1, Swift 5.6"
|
||||
shell: "/bin/zsh {0}"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: ${{ matrix.name }}
|
||||
run: make test_archive_GRDBOSX_xcframework
|
||||
|
||||
+33
-1
@@ -7,7 +7,9 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception:
|
||||
|
||||
#### 5.x Releases
|
||||
|
||||
- `5.24.x` Releases - [5.24.0](#5240)
|
||||
- `5.26.x` Releases - [5.26.0](#5260) | [5.26.1](#5261)
|
||||
- `5.25.x` Releases - [5.25.0](#5250)
|
||||
- `5.24.x` Releases - [5.24.0](#5240) | [5.24.1](#5241)
|
||||
- `5.23.x` Releases - [5.23.0](#5230)
|
||||
- `5.22.x` Releases - [5.22.0](#5220) | [5.22.1](#5221) | [5.22.2](#5222)
|
||||
- `5.21.x` Releases - [5.21.0](#5210)
|
||||
@@ -91,6 +93,36 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception:
|
||||
|
||||
---
|
||||
|
||||
## 5.26.1
|
||||
|
||||
Released September 8, 2022 • [diff](https://github.com/groue/GRDB.swift/compare/v5.26.0...v5.26.1)
|
||||
|
||||
- **Fixed**: [#1276](https://github.com/groue/GRDB.swift/pull/1276) Fix build error with Xcode 14.0 RC (14A309)
|
||||
|
||||
## 5.26.0
|
||||
|
||||
Released July 9, 2022 • [diff](https://github.com/groue/GRDB.swift/compare/v5.25.0...v5.26.0)
|
||||
|
||||
- **New**: [#1248](https://github.com/groue/GRDB.swift/pull/1248) by [@groue](https://github.com/groue): Avoid double notification of the initial value for ValueObservation on DatabasePool
|
||||
- **New**: [#1253](https://github.com/groue/GRDB.swift/pull/1253) by [@george-signal](https://github.com/george-signal): Make memory management optional
|
||||
- **Fixed**: DatabasePool no longer prevents database reads when UIKit posts `UIApplication.didReceiveMemoryWarningNotification` (see [#1253](https://github.com/groue/GRDB.swift/pull/1253) for more information).
|
||||
|
||||
## 5.25.0
|
||||
|
||||
Released June 11, 2022 • [diff](https://github.com/groue/GRDB.swift/compare/v5.24.1...v5.25.0)
|
||||
|
||||
- **New**: [#1226](https://github.com/groue/GRDB.swift/pull/1226) by [@naveensrinivasan](https://github.com/naveensrinivasan): Included githubactions in the dependabot config
|
||||
- **New**: [#1228](https://github.com/groue/GRDB.swift/pull/1228) by [@naveensrinivasan](https://github.com/naveensrinivasan): Set permissions for GitHub actions
|
||||
- **New**: [#1235](https://github.com/groue/GRDB.swift/pull/1235) by [@groue](https://github.com/groue): Raise default Quality of Service to `.userInitiated`.
|
||||
- **Fixed**: [#1233](https://github.com/groue/GRDB.swift/pull/1233) by [@GetToSet](https://github.com/GetToSet): Fix warnings of redundant conformance constraint on Xcode 14.
|
||||
|
||||
## 5.24.1
|
||||
|
||||
Released May 26, 2022 • [diff](https://github.com/groue/GRDB.swift/compare/v5.24.0...v5.24.1)
|
||||
|
||||
- **Fixed**: [#1217](https://github.com/groue/GRDB.swift/pull/1217) by [@GetToSet](https://github.com/GetToSet): Fix doc issue on TableRequest.filter(keys:).
|
||||
- **Fixed**: [#1225](https://github.com/groue/GRDB.swift/pull/1225) by [@groue](https://github.com/groue): Prevent heavy DatabasePool concurrent reads from creating too many threads
|
||||
|
||||
## 5.24.0
|
||||
|
||||
Released May 1, 2022 • [diff](https://github.com/groue/GRDB.swift/compare/v5.23.0...v5.24.0)
|
||||
|
||||
@@ -1510,7 +1510,7 @@ let sortedAuthor = Book.author.order(Column("name"))
|
||||
let request = Book.including(required: sortedAuthor)
|
||||
```
|
||||
|
||||
When you sort both the base record on the associated record, the request is sorted on the base record first, and on the associated record next:
|
||||
When you sort both the base record and the associated record, the request is sorted on the base record first, and on the associated record next:
|
||||
|
||||
```swift
|
||||
// SELECT book.*, person.*
|
||||
|
||||
@@ -304,7 +304,7 @@ let pattern = FTS3Pattern(matchingAnyTokenIn: "") // nil
|
||||
let pattern = FTS3Pattern(matchingAnyTokenIn: "*") // nil
|
||||
```
|
||||
|
||||
FTS3Pattern are regular [values](../README.md#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/5.24/Structs/StatementArguments.html):
|
||||
FTS3Pattern are regular [values](../README.md#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/5.26/Structs/StatementArguments.html):
|
||||
|
||||
```swift
|
||||
let documents = try Document.fetchAll(db,
|
||||
@@ -587,7 +587,7 @@ let pattern = FTS5Pattern(matchingAnyTokenIn: "") // nil
|
||||
let pattern = FTS5Pattern(matchingAnyTokenIn: "*") // nil
|
||||
```
|
||||
|
||||
FTS5Pattern are regular [values](../README.md#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/5.24/Structs/StatementArguments.html):
|
||||
FTS5Pattern are regular [values](../README.md#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/5.26/Structs/StatementArguments.html):
|
||||
|
||||
```swift
|
||||
let documents = try Document.fetchAll(db,
|
||||
|
||||
@@ -77,7 +77,7 @@ try dbQueue.read { db in
|
||||
}
|
||||
```
|
||||
|
||||
See the [DatabaseMigrator reference](http://groue.github.io/GRDB.swift/docs/5.24/Structs/DatabaseMigrator.html) for more migrator methods.
|
||||
See the [DatabaseMigrator reference](http://groue.github.io/GRDB.swift/docs/5.26/Structs/DatabaseMigrator.html) for more migrator methods.
|
||||
|
||||
|
||||
## The `eraseDatabaseOnSchemaChange` Option
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'GRDB.swift'
|
||||
s.version = '5.24.0'
|
||||
s.version = '5.26.1'
|
||||
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.summary = 'A toolkit for SQLite databases, with a focus on application development.'
|
||||
|
||||
@@ -733,6 +733,10 @@
|
||||
56B14E831D4DAE54000BF4A3 /* RowFromDictionaryLiteralTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B14E7E1D4DAE54000BF4A3 /* RowFromDictionaryLiteralTests.swift */; };
|
||||
56B6EF56208CB4E3002F0ACB /* ColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF55208CB4E3002F0ACB /* ColumnExpressionTests.swift */; };
|
||||
56B6EF57208CB4E3002F0ACB /* ColumnExpressionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6EF55208CB4E3002F0ACB /* ColumnExpressionTests.swift */; };
|
||||
56B7EE832863781300C0525F /* WALSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B7EE822863781300C0525F /* WALSnapshot.swift */; };
|
||||
56B7EE842863781300C0525F /* WALSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B7EE822863781300C0525F /* WALSnapshot.swift */; };
|
||||
56B7EE852863781300C0525F /* WALSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B7EE822863781300C0525F /* WALSnapshot.swift */; };
|
||||
56B7EE862863781300C0525F /* WALSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B7EE822863781300C0525F /* WALSnapshot.swift */; };
|
||||
56B7F42A1BE14A1900E39BBF /* CGFloatTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B7F4291BE14A1900E39BBF /* CGFloatTests.swift */; };
|
||||
56B7F43A1BEB42D500E39BBF /* Migration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B7F4391BEB42D500E39BBF /* Migration.swift */; };
|
||||
56B7F43B1BEB42D500E39BBF /* Migration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B7F4391BEB42D500E39BBF /* Migration.swift */; };
|
||||
@@ -924,6 +928,9 @@
|
||||
56F5ABDA1D814330001F60CB /* NSData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5657AAB81D107001006283EF /* NSData.swift */; };
|
||||
56F5ABDC1D814330001F60CB /* URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5657AB0E1D10899D006283EF /* URL.swift */; };
|
||||
56F5ABDD1D814330001F60CB /* UUID.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A8C22F1D1914540096E9D4 /* UUID.swift */; };
|
||||
56F61DD5283D344E00AF9884 /* getThreadsCount.c in Sources */ = {isa = PBXBuildFile; fileRef = 56F61DD4283D344E00AF9884 /* getThreadsCount.c */; };
|
||||
56F61DD6283D344E00AF9884 /* getThreadsCount.c in Sources */ = {isa = PBXBuildFile; fileRef = 56F61DD4283D344E00AF9884 /* getThreadsCount.c */; };
|
||||
56F61DD7283D344E00AF9884 /* getThreadsCount.c in Sources */ = {isa = PBXBuildFile; fileRef = 56F61DD4283D344E00AF9884 /* getThreadsCount.c */; };
|
||||
56FBFED92210731A00945324 /* SQLRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FBFED82210731A00945324 /* SQLRequest.swift */; };
|
||||
56FBFEDA2210731A00945324 /* SQLRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FBFED82210731A00945324 /* SQLRequest.swift */; };
|
||||
56FBFEDB2210731A00945324 /* SQLRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FBFED82210731A00945324 /* SQLRequest.swift */; };
|
||||
@@ -1592,6 +1599,7 @@
|
||||
56B021C81D8C0D3900B239BB /* MutablePersistableRecordPersistenceConflictPolicyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutablePersistableRecordPersistenceConflictPolicyTests.swift; sourceTree = "<group>"; };
|
||||
56B14E7E1D4DAE54000BF4A3 /* RowFromDictionaryLiteralTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowFromDictionaryLiteralTests.swift; sourceTree = "<group>"; };
|
||||
56B6EF55208CB4E3002F0ACB /* ColumnExpressionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColumnExpressionTests.swift; sourceTree = "<group>"; };
|
||||
56B7EE822863781300C0525F /* WALSnapshot.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WALSnapshot.swift; sourceTree = "<group>"; };
|
||||
56B7F4291BE14A1900E39BBF /* CGFloatTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGFloatTests.swift; sourceTree = "<group>"; };
|
||||
56B7F4391BEB42D500E39BBF /* Migration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Migration.swift; sourceTree = "<group>"; };
|
||||
56B86E72220FF4E000524C16 /* SQLLiteralTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLLiteralTests.swift; sourceTree = "<group>"; };
|
||||
@@ -1646,6 +1654,9 @@
|
||||
56F34FB924B094B6007513FC /* SQLExpressionIsConstantTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLExpressionIsConstantTests.swift; sourceTree = "<group>"; };
|
||||
56F34FC124B0A0B7007513FC /* SQLIdentifyingColumnsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLIdentifyingColumnsTests.swift; sourceTree = "<group>"; };
|
||||
56F3E7481E66F83A00BF0F01 /* ResultCodeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultCodeTests.swift; sourceTree = "<group>"; };
|
||||
56F61DD0283D344D00AF9884 /* GRDBTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "GRDBTests-Bridging-Header.h"; path = "GRDBTests/GRDBTests-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
56F61DD3283D344E00AF9884 /* getThreadsCount.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = getThreadsCount.h; sourceTree = "<group>"; };
|
||||
56F61DD4283D344E00AF9884 /* getThreadsCount.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getThreadsCount.c; sourceTree = "<group>"; };
|
||||
56FBFED82210731A00945324 /* SQLRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLRequest.swift; sourceTree = "<group>"; };
|
||||
56FDECE11BB32DFD009AD709 /* RowFromStatementTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowFromStatementTests.swift; sourceTree = "<group>"; };
|
||||
56FEB8F6248402E10081AF83 /* DatabaseTraceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseTraceTests.swift; sourceTree = "<group>"; };
|
||||
@@ -1796,6 +1807,8 @@
|
||||
569531361C919DF700CF1A2B /* DatabasePoolFunctionTests.swift */,
|
||||
56EA869D1C932597002BB4DF /* DatabasePoolReadOnlyTests.swift */,
|
||||
563C67B224628BEA00E94EDC /* DatabasePoolTests.swift */,
|
||||
56F61DD3283D344E00AF9884 /* getThreadsCount.h */,
|
||||
56F61DD4283D344E00AF9884 /* getThreadsCount.c */,
|
||||
);
|
||||
name = DatabasePool;
|
||||
sourceTree = "<group>";
|
||||
@@ -2367,8 +2380,9 @@
|
||||
56A238781B9C75030082EB20 /* Statement.swift */,
|
||||
566B912A1FA4D0CC0012D5B0 /* StatementAuthorizer.swift */,
|
||||
560D923F1C672C3E00F4F92B /* StatementColumnConvertible.swift */,
|
||||
5605F1471C672E4000235C62 /* Support */,
|
||||
566B91321FA4D3810012D5B0 /* TransactionObserver.swift */,
|
||||
56B7EE822863781300C0525F /* WALSnapshot.swift */,
|
||||
5605F1471C672E4000235C62 /* Support */,
|
||||
);
|
||||
path = Core;
|
||||
sourceTree = "<group>";
|
||||
@@ -2502,6 +2516,7 @@
|
||||
DC37740319C8CBB3004FCF85 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56F61DD0283D344D00AF9884 /* GRDBTests-Bridging-Header.h */,
|
||||
DC37740419C8CBB3004FCF85 /* Info.plist */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
@@ -2752,17 +2767,18 @@
|
||||
};
|
||||
56E5D7D21B4D3FEE00430942 = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
LastSwiftMigration = 1130;
|
||||
LastSwiftMigration = 1340;
|
||||
ProvisioningStyle = Manual;
|
||||
};
|
||||
56E5D7F81B4D422D00430942 = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
LastSwiftMigration = 1020;
|
||||
LastSwiftMigration = 1340;
|
||||
};
|
||||
AAA4DC75230F1E0600C74B15 = {
|
||||
ProvisioningStyle = Manual;
|
||||
};
|
||||
AAA4DD07230F262000C74B15 = {
|
||||
LastSwiftMigration = 1340;
|
||||
ProvisioningStyle = Manual;
|
||||
};
|
||||
DC3773F219C8CBB3004FCF85 = {
|
||||
@@ -2864,6 +2880,7 @@
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
56EB54F322C8ED5100850069 /* Swiftlint */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
@@ -2882,6 +2899,7 @@
|
||||
};
|
||||
56EB54FA22C9115E00850069 /* Swiftlint */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
@@ -2900,6 +2918,7 @@
|
||||
};
|
||||
AAA4DCFA230F1E0600C74B15 /* Swiftlint */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
@@ -2963,6 +2982,7 @@
|
||||
565490D81D5AE252005622CB /* DatabaseMigrator.swift in Sources */,
|
||||
5656A8AF2295BFD7001FF3FF /* TableRecord+Association.swift in Sources */,
|
||||
565490C21D5AE236005622CB /* Row.swift in Sources */,
|
||||
56B7EE852863781300C0525F /* WALSnapshot.swift in Sources */,
|
||||
565490C71D5AE236005622CB /* StatementColumnConvertible.swift in Sources */,
|
||||
565490D91D5AE252005622CB /* Migration.swift in Sources */,
|
||||
56CEB5001EAA2F4D00BFAF62 /* FTS3.swift in Sources */,
|
||||
@@ -3132,6 +3152,7 @@
|
||||
5671FC231DA3CAC9003BF4FF /* FTS3TokenizerDescriptor.swift in Sources */,
|
||||
56D51D031EA789FA0074638A /* FetchableRecord+TableRecord.swift in Sources */,
|
||||
56DDDDF5242F87C60025E381 /* ValueObservationScheduler.swift in Sources */,
|
||||
56B7EE842863781300C0525F /* WALSnapshot.swift in Sources */,
|
||||
560D924C1C672C4B00F4F92B /* TableRecord.swift in Sources */,
|
||||
56A2FA3B24424F4700E97D23 /* Export.swift in Sources */,
|
||||
569BBA4F229170F900478429 /* Inflections+English.swift in Sources */,
|
||||
@@ -3432,6 +3453,7 @@
|
||||
56A2383A1B9C74A90082EB20 /* DatabaseQueueInMemoryTests.swift in Sources */,
|
||||
56A5E40A1BA2BCF900707640 /* RecordWithColumnNameManglingTests.swift in Sources */,
|
||||
56677C1A241D217F0050755D /* ValueObservationRecorderTests.swift in Sources */,
|
||||
56F61DD6283D344E00AF9884 /* getThreadsCount.c in Sources */,
|
||||
5653EAF520944B4F00F46237 /* AssociationParallelSQLTests.swift in Sources */,
|
||||
563B06BE2185CCD300B38F35 /* ValueObservationTests.swift in Sources */,
|
||||
56FF455A1D2CDA5200F21EF9 /* RecordUniqueIndexTests.swift in Sources */,
|
||||
@@ -3667,6 +3689,7 @@
|
||||
56DF001D228DDBA300D611F3 /* AssociationPrefetchingCodableRecordTests.swift in Sources */,
|
||||
5653EAD820944B4F00F46237 /* AssociationBelongsToRowScopeTests.swift in Sources */,
|
||||
562205F11E420E47005860AC /* DatabasePoolReleaseMemoryTests.swift in Sources */,
|
||||
56F61DD5283D344E00AF9884 /* getThreadsCount.c in Sources */,
|
||||
56677C19241D217F0050755D /* ValueObservationRecorderTests.swift in Sources */,
|
||||
5653EAF420944B4F00F46237 /* AssociationParallelSQLTests.swift in Sources */,
|
||||
563B06BD2185CCD300B38F35 /* ValueObservationTests.swift in Sources */,
|
||||
@@ -3738,6 +3761,7 @@
|
||||
AAA4DCA5230F1E0600C74B15 /* FTS3TokenizerDescriptor.swift in Sources */,
|
||||
AAA4DCA6230F1E0600C74B15 /* FetchableRecord+TableRecord.swift in Sources */,
|
||||
56DDDDF7242F87C70025E381 /* ValueObservationScheduler.swift in Sources */,
|
||||
56B7EE862863781300C0525F /* WALSnapshot.swift in Sources */,
|
||||
AAA4DCA7230F1E0600C74B15 /* TableRecord.swift in Sources */,
|
||||
56A2FA3D24424F4800E97D23 /* Export.swift in Sources */,
|
||||
AAA4DCA8230F1E0600C74B15 /* Inflections+English.swift in Sources */,
|
||||
@@ -4038,6 +4062,7 @@
|
||||
AAA4DDC0230F262000C74B15 /* DatabaseQueueInMemoryTests.swift in Sources */,
|
||||
AAA4DDC1230F262000C74B15 /* RecordWithColumnNameManglingTests.swift in Sources */,
|
||||
56677C1B241D217F0050755D /* ValueObservationRecorderTests.swift in Sources */,
|
||||
56F61DD7283D344E00AF9884 /* getThreadsCount.c in Sources */,
|
||||
AAA4DDC2230F262000C74B15 /* AssociationParallelSQLTests.swift in Sources */,
|
||||
AAA4DDC3230F262000C74B15 /* ValueObservationTests.swift in Sources */,
|
||||
AAA4DDC4230F262000C74B15 /* RecordUniqueIndexTests.swift in Sources */,
|
||||
@@ -4109,6 +4134,7 @@
|
||||
569BBA4E229170F800478429 /* Inflections+English.swift in Sources */,
|
||||
5656A81E2295B12F001FF3FF /* SQLAssociation.swift in Sources */,
|
||||
5617294E223533F40006E219 /* EncodableRecord.swift in Sources */,
|
||||
56B7EE832863781300C0525F /* WALSnapshot.swift in Sources */,
|
||||
5698AD181DAAD17A0056AF8C /* FTS5Tokenizer.swift in Sources */,
|
||||
56A2FA3624424D2A00E97D23 /* Export.swift in Sources */,
|
||||
56B964B11DA51D010002DA19 /* FTS5TokenizerDescriptor.swift in Sources */,
|
||||
@@ -4382,6 +4408,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 56C494401ED7255500CC72AF /* GRDBDeploymentTarget.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
@@ -4400,6 +4427,9 @@
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -4407,6 +4437,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 56C494401ED7255500CC72AF /* GRDBDeploymentTarget.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
@@ -4427,7 +4458,9 @@
|
||||
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -4435,6 +4468,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 56C494401ED7255500CC72AF /* GRDBDeploymentTarget.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
@@ -4449,6 +4483,9 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBOSXTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -4456,6 +4493,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 56C494401ED7255500CC72AF /* GRDBDeploymentTarget.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
@@ -4472,7 +4510,9 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -4544,6 +4584,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 56C494401ED7255500CC72AF /* GRDBDeploymentTarget.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
@@ -4562,6 +4603,9 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = appletvos;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -4569,6 +4613,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 56C494401ED7255500CC72AF /* GRDBDeploymentTarget.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
@@ -4589,7 +4634,9 @@
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = appletvos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -245,8 +245,13 @@ public struct Configuration {
|
||||
///
|
||||
/// The quality of service is ignored if you supply a target queue.
|
||||
///
|
||||
/// Default: .default
|
||||
public var qos: DispatchQoS = .default
|
||||
/// Default: .userInitiated
|
||||
public var qos: DispatchQoS = .userInitiated
|
||||
|
||||
/// The quality of service of read accesses
|
||||
var readQoS: DispatchQoS {
|
||||
targetQueue?.qos ?? self.qos
|
||||
}
|
||||
|
||||
/// A target queue for database accesses.
|
||||
///
|
||||
@@ -270,7 +275,15 @@ public struct Configuration {
|
||||
///
|
||||
/// Default: nil
|
||||
public var writeTargetQueue: DispatchQueue? = nil
|
||||
|
||||
|
||||
#if os(iOS)
|
||||
/// Sets whether GRDB will release memory when entering the background or
|
||||
/// upon receiving a memory warning in iOS.
|
||||
///
|
||||
/// Default: true
|
||||
public var automaticMemoryManagement = true
|
||||
#endif
|
||||
|
||||
// MARK: - Factory Configuration
|
||||
|
||||
/// Creates a factory configuration
|
||||
@@ -316,17 +329,4 @@ public struct Configuration {
|
||||
return DispatchQueue(label: label, qos: qos)
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a DispatchQueue which has the quality of service of
|
||||
/// read accesses.
|
||||
///
|
||||
/// The returned queue has no target queue, and won't create deadlocks when
|
||||
/// used synchronously from a database access.
|
||||
func makeDispatchQueue(label: String) -> DispatchQueue {
|
||||
if let targetQueue = targetQueue {
|
||||
return DispatchQueue(label: label, qos: targetQueue.qos)
|
||||
} else {
|
||||
return DispatchQueue(label: label, qos: qos)
|
||||
}
|
||||
}
|
||||
}
|
||||
+24
-2
@@ -21,8 +21,9 @@ extension RangeReplaceableCollection {
|
||||
/// - parameter cursor: The cursor whose elements feed the collection.
|
||||
public init<C: Cursor>(_ cursor: C) throws where C.Element == Element {
|
||||
self.init()
|
||||
// Use `forEach` in order to deal with <https://github.com/groue/GRDB.swift/issues/1124>.
|
||||
// See `Statement.forEachStep(_:)` for more information.
|
||||
// Prefer `forEach` over `next()` looping, as a slight performance
|
||||
// improvement due to the single `sqlite3_stmt_busy` check for
|
||||
// database cursors.
|
||||
try cursor.forEach { append($0) }
|
||||
}
|
||||
|
||||
@@ -38,6 +39,9 @@ extension RangeReplaceableCollection {
|
||||
public init<C: Cursor>(_ cursor: C, minimumCapacity: Int) throws where C.Element == Element {
|
||||
self.init()
|
||||
reserveCapacity(minimumCapacity)
|
||||
// Prefer `forEach` over `next()` looping, as a slight performance
|
||||
// improvement due to the single `sqlite3_stmt_busy` check for
|
||||
// database cursors.
|
||||
try cursor.forEach { append($0) }
|
||||
}
|
||||
}
|
||||
@@ -58,6 +62,9 @@ extension Dictionary {
|
||||
throws where Value == [C.Element]
|
||||
{
|
||||
self.init()
|
||||
// Prefer `forEach` over `next()` looping, as a slight performance
|
||||
// improvement due to the single `sqlite3_stmt_busy` check for
|
||||
// database cursors.
|
||||
try cursor.forEach { value in
|
||||
try self[keyForValue(value), default: []].append(value)
|
||||
}
|
||||
@@ -84,6 +91,9 @@ extension Dictionary {
|
||||
throws where Value == [C.Element]
|
||||
{
|
||||
self.init(minimumCapacity: minimumCapacity)
|
||||
// Prefer `forEach` over `next()` looping, as a slight performance
|
||||
// improvement due to the single `sqlite3_stmt_busy` check for
|
||||
// database cursors.
|
||||
try cursor.forEach { value in
|
||||
try self[keyForValue(value), default: []].append(value)
|
||||
}
|
||||
@@ -106,6 +116,9 @@ extension Dictionary {
|
||||
throws where C.Element == (Key, Value)
|
||||
{
|
||||
self.init()
|
||||
// Prefer `forEach` over `next()` looping, as a slight performance
|
||||
// improvement due to the single `sqlite3_stmt_busy` check for
|
||||
// database cursors.
|
||||
try keysAndValues.forEach { key, value in
|
||||
if updateValue(value, forKey: key) != nil {
|
||||
fatalError("Duplicate values for key: '\(String(describing: key))'")
|
||||
@@ -135,6 +148,9 @@ extension Dictionary {
|
||||
throws where C.Element == (Key, Value)
|
||||
{
|
||||
self.init(minimumCapacity: minimumCapacity)
|
||||
// Prefer `forEach` over `next()` looping, as a slight performance
|
||||
// improvement due to the single `sqlite3_stmt_busy` check for
|
||||
// database cursors.
|
||||
try keysAndValues.forEach { key, value in
|
||||
if updateValue(value, forKey: key) != nil {
|
||||
fatalError("Duplicate values for key: '\(String(describing: key))'")
|
||||
@@ -153,6 +169,9 @@ extension Set {
|
||||
/// - parameter cursor: A cursor of values to gather into a set.
|
||||
public init<C: Cursor>(_ cursor: C) throws where C.Element == Element {
|
||||
self.init()
|
||||
// Prefer `forEach` over `next()` looping, as a slight performance
|
||||
// improvement due to the single `sqlite3_stmt_busy` check for
|
||||
// database cursors.
|
||||
try cursor.forEach { insert($0) }
|
||||
}
|
||||
|
||||
@@ -168,6 +187,9 @@ extension Set {
|
||||
/// storage buffer.
|
||||
public init<C: Cursor>(_ cursor: C, minimumCapacity: Int) throws where C.Element == Element {
|
||||
self.init(minimumCapacity: minimumCapacity)
|
||||
// Prefer `forEach` over `next()` looping, as a slight performance
|
||||
// improvement due to the single `sqlite3_stmt_busy` check for
|
||||
// database cursors.
|
||||
try cursor.forEach { insert($0) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -553,38 +553,6 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
_readOnlyDepth > 0 || configuration.readonly
|
||||
}
|
||||
|
||||
// MARK: - Snapshots
|
||||
|
||||
#if SQLITE_ENABLE_SNAPSHOT
|
||||
/// Returns a snapshot that must be freed with `sqlite3_snapshot_free`.
|
||||
///
|
||||
/// See <https://www.sqlite.org/c3ref/snapshot.html>
|
||||
func takeVersionSnapshot() throws -> UnsafeMutablePointer<sqlite3_snapshot> {
|
||||
var snapshot: UnsafeMutablePointer<sqlite3_snapshot>?
|
||||
let code = withUnsafeMutablePointer(to: &snapshot) {
|
||||
sqlite3_snapshot_get(sqliteConnection, "main", $0)
|
||||
}
|
||||
guard code == SQLITE_OK else {
|
||||
throw DatabaseError(resultCode: code, message: lastErrorMessage)
|
||||
}
|
||||
if let snapshot = snapshot {
|
||||
return snapshot
|
||||
} else {
|
||||
throw DatabaseError(resultCode: .SQLITE_INTERNAL) // WTF SQLite?
|
||||
}
|
||||
}
|
||||
|
||||
func wasChanged(since initialSnapshot: UnsafeMutablePointer<sqlite3_snapshot>) throws -> Bool {
|
||||
let secondSnapshot = try takeVersionSnapshot()
|
||||
defer {
|
||||
sqlite3_snapshot_free(secondSnapshot)
|
||||
}
|
||||
let cmp = sqlite3_snapshot_cmp(initialSnapshot, secondSnapshot)
|
||||
assert(cmp <= 0, "Unexpected snapshot ordering")
|
||||
return cmp < 0
|
||||
}
|
||||
#endif
|
||||
|
||||
// MARK: - Recording of the selected region
|
||||
|
||||
func recordingSelection<T>(_ region: inout DatabaseRegion, _ block: () throws -> T) rethrows -> T {
|
||||
@@ -1216,7 +1184,8 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
|
||||
// MARK: - Memory Management
|
||||
|
||||
func releaseMemory() {
|
||||
public func releaseMemory() {
|
||||
SchedulingWatchdog.preconditionValidQueue(self)
|
||||
sqlite3_db_release_memory(sqliteConnection)
|
||||
schemaCache.clear()
|
||||
internalStatementCache.clear()
|
||||
|
||||
+105
-85
@@ -57,14 +57,17 @@ public final class DatabasePool: DatabaseWriter {
|
||||
readerConfiguration.allowsUnsafeTransactions = false
|
||||
|
||||
var readerCount = 0
|
||||
readerPool = Pool(maximumCount: configuration.maximumReaderCount, makeElement: {
|
||||
readerCount += 1 // protected by Pool (TODO: document this protection behavior)
|
||||
return try SerializedDatabase(
|
||||
path: path,
|
||||
configuration: readerConfiguration,
|
||||
defaultLabel: "GRDB.DatabasePool",
|
||||
purpose: "reader.\(readerCount)")
|
||||
})
|
||||
readerPool = Pool(
|
||||
maximumCount: configuration.maximumReaderCount,
|
||||
qos: configuration.readQoS,
|
||||
makeElement: {
|
||||
readerCount += 1 // protected by Pool (TODO: document this protection behavior)
|
||||
return try SerializedDatabase(
|
||||
path: path,
|
||||
configuration: readerConfiguration,
|
||||
defaultLabel: "GRDB.DatabasePool",
|
||||
purpose: "reader.\(readerCount)")
|
||||
})
|
||||
|
||||
// Activate WAL Mode unless readonly
|
||||
if !configuration.readonly {
|
||||
@@ -100,7 +103,9 @@ public final class DatabasePool: DatabaseWriter {
|
||||
// Be a nice iOS citizen, and don't consume too much memory
|
||||
// See https://github.com/groue/GRDB.swift/#memory-management
|
||||
#if os(iOS)
|
||||
setupMemoryManagement()
|
||||
if configuration.automaticMemoryManagement {
|
||||
setupMemoryManagement()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -151,13 +156,6 @@ public final class DatabasePool: DatabaseWriter {
|
||||
|
||||
return configuration
|
||||
}
|
||||
|
||||
/// Blocks the current thread until all database connections have
|
||||
/// executed the *body* block.
|
||||
fileprivate func forEachConnection(_ body: (Database) -> Void) {
|
||||
writer.sync(body)
|
||||
readerPool?.forEach { $0.sync(body) }
|
||||
}
|
||||
}
|
||||
|
||||
#if swift(>=5.6) && canImport(_Concurrency)
|
||||
@@ -169,19 +167,49 @@ extension DatabasePool {
|
||||
|
||||
// MARK: - Memory management
|
||||
|
||||
/// Free as much memory as possible.
|
||||
/// Frees as much memory as possible, by disposing non-essential memory from
|
||||
/// the writer connection, and closing all reader connections.
|
||||
///
|
||||
/// This method blocks the current thread until all database accesses
|
||||
/// are completed.
|
||||
/// This method is synchronous, and blocks the current thread until all
|
||||
/// database accesses are completed.
|
||||
///
|
||||
/// - warning: This method can prevent concurrent reads from executing,
|
||||
/// until it returns. Prefer ``releaseMemoryEventually()`` if you intend
|
||||
/// to keep on using the database while releasing memory.
|
||||
public func releaseMemory() {
|
||||
// Release writer memory
|
||||
writer.sync { $0.releaseMemory() }
|
||||
// Release readers memory by closing all connections
|
||||
|
||||
// Release readers memory by closing all connections.
|
||||
//
|
||||
// We must use a barrier in order to guarantee that memory has been
|
||||
// freed (reader connections closed) when the method exits, as
|
||||
// documented.
|
||||
//
|
||||
// Without the barrier, connections would only close _eventually_ (after
|
||||
// their eventual concurrent jobs have completed).
|
||||
readerPool?.barrier {
|
||||
readerPool?.removeAll()
|
||||
}
|
||||
}
|
||||
|
||||
/// Eventually frees as much memory as possible, by disposing non-essential
|
||||
/// memory from the writer connection, and closing all reader connections.
|
||||
///
|
||||
/// Unlike ``releaseMemory()``, this method does not prevent concurrent
|
||||
/// database accesses when it is executing. But it does not notify when
|
||||
/// non-essential memory has been freed.
|
||||
public func releaseMemoryEventually() {
|
||||
// Release readers memory by eventually closing all reader connections
|
||||
// (they will close after their current jobs have completed).
|
||||
readerPool?.removeAll()
|
||||
|
||||
// Release writer memory eventually.
|
||||
writer.async { db in
|
||||
db.releaseMemory()
|
||||
}
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
/// Listens to UIApplicationDidEnterBackgroundNotification and
|
||||
/// UIApplicationDidReceiveMemoryWarningNotification in order to release
|
||||
@@ -213,12 +241,20 @@ extension DatabasePool {
|
||||
|
||||
let task: UIBackgroundTaskIdentifier = application.beginBackgroundTask(expirationHandler: nil)
|
||||
if task == .invalid {
|
||||
// Perform releaseMemory() synchronously.
|
||||
// Release memory synchronously
|
||||
releaseMemory()
|
||||
} else {
|
||||
// Perform releaseMemory() asynchronously.
|
||||
DispatchQueue.global().async {
|
||||
self.releaseMemory()
|
||||
// Release memory eventually.
|
||||
//
|
||||
// We don't know when reader connections will be closed (because
|
||||
// they may be currently in use), so we don't quite know when
|
||||
// reader memory will be freed (which would be the ideal timing for
|
||||
// ending our background task).
|
||||
//
|
||||
// So let's just end the background task after the writer connection
|
||||
// has freed its memory. That's better than nothing.
|
||||
releaseMemoryEventually()
|
||||
writer.async { _ in
|
||||
application.endBackgroundTask(task)
|
||||
}
|
||||
}
|
||||
@@ -226,9 +262,7 @@ extension DatabasePool {
|
||||
|
||||
@objc
|
||||
private func applicationDidReceiveMemoryWarning(_ notification: NSNotification) {
|
||||
DispatchQueue.global().async {
|
||||
self.releaseMemory()
|
||||
}
|
||||
releaseMemoryEventually()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -330,40 +364,33 @@ extension DatabasePool: DatabaseReader {
|
||||
}
|
||||
|
||||
public func asyncRead(_ value: @escaping (Result<Database, Error>) -> Void) {
|
||||
// First async jump in order to grab a reader connection.
|
||||
// Honor configuration dispatching (qos/targetQueue).
|
||||
let label = configuration.identifier(
|
||||
defaultLabel: "GRDB.DatabasePool",
|
||||
purpose: "asyncRead")
|
||||
configuration
|
||||
.makeReaderDispatchQueue(label: label)
|
||||
.async {
|
||||
do {
|
||||
guard let readerPool = self.readerPool else {
|
||||
throw DatabaseError.connectionIsClosed()
|
||||
guard let readerPool = self.readerPool else {
|
||||
value(.failure(DatabaseError(resultCode: .SQLITE_MISUSE, message: "Connection is closed")))
|
||||
return
|
||||
}
|
||||
|
||||
readerPool.asyncGet { result in
|
||||
do {
|
||||
let (reader, releaseReader) = try result.get()
|
||||
// Second async jump because that's how `Pool.async` has to be used.
|
||||
reader.async { db in
|
||||
defer {
|
||||
try? db.commit() // Ignore commit error
|
||||
releaseReader()
|
||||
}
|
||||
let (reader, releaseReader) = try readerPool.get()
|
||||
|
||||
// Second async jump because sync could deadlock if
|
||||
// configuration has a serial targetQueue.
|
||||
reader.async { db in
|
||||
defer {
|
||||
try? db.commit() // Ignore commit error
|
||||
releaseReader()
|
||||
}
|
||||
do {
|
||||
// The block isolation comes from the DEFERRED transaction.
|
||||
try db.beginTransaction(.deferred)
|
||||
try db.clearSchemaCacheIfNeeded()
|
||||
value(.success(db))
|
||||
} catch {
|
||||
value(.failure(error))
|
||||
}
|
||||
do {
|
||||
// The block isolation comes from the DEFERRED transaction.
|
||||
try db.beginTransaction(.deferred)
|
||||
try db.clearSchemaCacheIfNeeded()
|
||||
value(.success(db))
|
||||
} catch {
|
||||
value(.failure(error))
|
||||
}
|
||||
} catch {
|
||||
value(.failure(error))
|
||||
}
|
||||
} catch {
|
||||
value(.failure(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@_disfavoredOverload // SR-15150 Async overloading in protocol implementation fails
|
||||
@@ -381,38 +408,31 @@ extension DatabasePool: DatabaseReader {
|
||||
}
|
||||
|
||||
public func asyncUnsafeRead(_ value: @escaping (Result<Database, Error>) -> Void) {
|
||||
// First async jump in order to grab a reader connection.
|
||||
// Honor configuration dispatching (qos/targetQueue).
|
||||
let label = configuration.identifier(
|
||||
defaultLabel: "GRDB.DatabasePool",
|
||||
purpose: "asyncUnsafeRead")
|
||||
configuration
|
||||
.makeReaderDispatchQueue(label: label)
|
||||
.async {
|
||||
do {
|
||||
guard let readerPool = self.readerPool else {
|
||||
throw DatabaseError(resultCode: .SQLITE_MISUSE, message: "Connection is closed")
|
||||
guard let readerPool = self.readerPool else {
|
||||
value(.failure(DatabaseError(resultCode: .SQLITE_MISUSE, message: "Connection is closed")))
|
||||
return
|
||||
}
|
||||
|
||||
readerPool.asyncGet { result in
|
||||
do {
|
||||
let (reader, releaseReader) = try result.get()
|
||||
// Second async jump because that's how `Pool.async` has to be used.
|
||||
reader.async { db in
|
||||
defer {
|
||||
releaseReader()
|
||||
}
|
||||
let (reader, releaseReader) = try readerPool.get()
|
||||
|
||||
// Second async jump because sync could deadlock if
|
||||
// configuration has a serial targetQueue.
|
||||
reader.async { db in
|
||||
defer {
|
||||
releaseReader()
|
||||
}
|
||||
do {
|
||||
// The block isolation comes from the DEFERRED transaction.
|
||||
try db.clearSchemaCacheIfNeeded()
|
||||
value(.success(db))
|
||||
} catch {
|
||||
value(.failure(error))
|
||||
}
|
||||
do {
|
||||
// The block isolation comes from the DEFERRED transaction.
|
||||
try db.clearSchemaCacheIfNeeded()
|
||||
value(.success(db))
|
||||
} catch {
|
||||
value(.failure(error))
|
||||
}
|
||||
} catch {
|
||||
value(.failure(error))
|
||||
}
|
||||
} catch {
|
||||
value(.failure(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func unsafeReentrantRead<T>(_ value: (Database) throws -> T) throws -> T {
|
||||
|
||||
@@ -43,7 +43,9 @@ public final class DatabaseQueue: DatabaseWriter {
|
||||
// Be a nice iOS citizen, and don't consume too much memory
|
||||
// See https://github.com/groue/GRDB.swift/#memory-management
|
||||
#if os(iOS)
|
||||
setupMemoryManagement()
|
||||
if configuration.automaticMemoryManagement {
|
||||
setupMemoryManagement()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -117,12 +119,12 @@ extension DatabaseQueue {
|
||||
|
||||
let task: UIBackgroundTaskIdentifier = application.beginBackgroundTask(expirationHandler: nil)
|
||||
if task == .invalid {
|
||||
// Perform releaseMemory() synchronously.
|
||||
// Release memory synchronously
|
||||
releaseMemory()
|
||||
} else {
|
||||
// Perform releaseMemory() asynchronously.
|
||||
DispatchQueue.global().async {
|
||||
self.releaseMemory()
|
||||
// Release memory asynchronously
|
||||
writer.async { db in
|
||||
db.releaseMemory()
|
||||
application.endBackgroundTask(task)
|
||||
}
|
||||
}
|
||||
@@ -130,8 +132,8 @@ extension DatabaseQueue {
|
||||
|
||||
@objc
|
||||
private func applicationDidReceiveMemoryWarning(_ notification: NSNotification) {
|
||||
DispatchQueue.global().async {
|
||||
self.releaseMemory()
|
||||
writer.async { db in
|
||||
db.releaseMemory()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -14,14 +14,6 @@ public final class DatabaseSnapshot: DatabaseReader {
|
||||
serializedDatabase.configuration
|
||||
}
|
||||
|
||||
#if SQLITE_ENABLE_SNAPSHOT
|
||||
typealias Version = UnsafeMutablePointer<sqlite3_snapshot>
|
||||
// Support for ValueObservation in DatabasePool
|
||||
let version: Version?
|
||||
#else
|
||||
typealias Version = Void
|
||||
#endif
|
||||
|
||||
init(path: String, configuration: Configuration = Configuration(), defaultLabel: String, purpose: String) throws {
|
||||
var configuration = DatabasePool.readerConfiguration(configuration)
|
||||
configuration.allowsUnsafeTransactions = true // Snaphost keeps a long-lived transaction
|
||||
@@ -31,8 +23,8 @@ public final class DatabaseSnapshot: DatabaseReader {
|
||||
configuration: configuration,
|
||||
defaultLabel: defaultLabel,
|
||||
purpose: purpose)
|
||||
|
||||
let version: Version? = try serializedDatabase.sync { db in
|
||||
|
||||
try serializedDatabase.sync { db in
|
||||
// Assert WAL mode
|
||||
let journalMode = try String.fetchOne(db, sql: "PRAGMA journal_mode")
|
||||
guard journalMode == "wal" else {
|
||||
@@ -44,29 +36,12 @@ public final class DatabaseSnapshot: DatabaseReader {
|
||||
|
||||
// Acquire snapshot isolation
|
||||
try db.internalCachedStatement(sql: "SELECT rootpage FROM sqlite_master LIMIT 1").makeCursor().next()
|
||||
|
||||
#if SQLITE_ENABLE_SNAPSHOT
|
||||
// We must expect an error: https://www.sqlite.org/c3ref/snapshot_get.html
|
||||
// > At least one transaction must be written to it first.
|
||||
return try? db.takeVersionSnapshot()
|
||||
#else
|
||||
return nil
|
||||
#endif
|
||||
}
|
||||
|
||||
#if SQLITE_ENABLE_SNAPSHOT
|
||||
self.version = version
|
||||
#endif
|
||||
}
|
||||
|
||||
deinit {
|
||||
// Leave snapshot isolation
|
||||
serializedDatabase.reentrantSync { db in
|
||||
#if SQLITE_ENABLE_SNAPSHOT
|
||||
if let version = version {
|
||||
sqlite3_snapshot_free(version)
|
||||
}
|
||||
#endif
|
||||
try? db.commit()
|
||||
}
|
||||
}
|
||||
|
||||
+13
-13
@@ -287,7 +287,7 @@ extension Row {
|
||||
/// The result is nil if the row does not contain the column.
|
||||
public subscript(_ columnName: String) -> DatabaseValueConvertible? {
|
||||
// IMPLEMENTATION NOTE
|
||||
// This method has a single know use case: checking if the value is nil,
|
||||
// This method has a single known use case: checking if the value is nil,
|
||||
// as in:
|
||||
//
|
||||
// if row["foo"] != nil { ... }
|
||||
@@ -1285,7 +1285,7 @@ extension Row {
|
||||
throws -> [Row]
|
||||
{
|
||||
// The cursor reuses a single mutable row. Return immutable copies.
|
||||
return try Array(fetchCursor(statement, arguments: arguments, adapter: adapter).map { $0.copy() })
|
||||
try Array(fetchCursor(statement, arguments: arguments, adapter: adapter).map { $0.copy() })
|
||||
}
|
||||
|
||||
/// Returns a set of rows fetched from a prepared statement.
|
||||
@@ -1306,7 +1306,7 @@ extension Row {
|
||||
throws -> Set<Row>
|
||||
{
|
||||
// The cursor reuses a single mutable row. Return immutable copies.
|
||||
return try Set(fetchCursor(statement, arguments: arguments, adapter: adapter).map { $0.copy() })
|
||||
try Set(fetchCursor(statement, arguments: arguments, adapter: adapter).map { $0.copy() })
|
||||
}
|
||||
|
||||
/// Returns a single row fetched from a prepared statement.
|
||||
@@ -2089,27 +2089,27 @@ protocol RowImpl {
|
||||
extension RowImpl {
|
||||
func copiedRow(_ row: Row) -> Row {
|
||||
// unless customized, assume unsafe and unadapted row
|
||||
return Row(impl: ArrayRowImpl(columns: Array(row)))
|
||||
Row(impl: ArrayRowImpl(columns: Array(row)))
|
||||
}
|
||||
|
||||
func unscopedRow(_ row: Row) -> Row {
|
||||
// unless customized, assume unadapted row (see AdaptedRowImpl for customization)
|
||||
return row
|
||||
row
|
||||
}
|
||||
|
||||
func unadaptedRow(_ row: Row) -> Row {
|
||||
// unless customized, assume unadapted row (see AdaptedRowImpl for customization)
|
||||
return row
|
||||
row
|
||||
}
|
||||
|
||||
func scopes(prefetchedRows: Row.PrefetchedRowsView) -> Row.ScopesView {
|
||||
// unless customized, assume unuscoped row (see AdaptedRowImpl for customization)
|
||||
return Row.ScopesView()
|
||||
Row.ScopesView()
|
||||
}
|
||||
|
||||
func hasNull(atUncheckedIndex index: Int) -> Bool {
|
||||
// unless customized, use slow check (see StatementRowImpl and AdaptedRowImpl for customization)
|
||||
return databaseValue(atUncheckedIndex: index).isNull
|
||||
databaseValue(atUncheckedIndex: index).isNull
|
||||
}
|
||||
|
||||
func fastDecode<Value: DatabaseValueConvertible & StatementColumnConvertible>(
|
||||
@@ -2118,7 +2118,7 @@ extension RowImpl {
|
||||
throws -> Value
|
||||
{
|
||||
// unless customized, use slow decoding (see StatementRowImpl and AdaptedRowImpl for customization)
|
||||
return try Value.decode(
|
||||
try Value.decode(
|
||||
fromDatabaseValue: databaseValue(atUncheckedIndex: index),
|
||||
context: RowDecodingContext(row: Row(impl: self), key: .columnIndex(index)))
|
||||
}
|
||||
@@ -2129,21 +2129,21 @@ extension RowImpl {
|
||||
throws -> Value?
|
||||
{
|
||||
// unless customized, use slow decoding (see StatementRowImpl and AdaptedRowImpl for customization)
|
||||
return try Value.decodeIfPresent(
|
||||
try Value.decodeIfPresent(
|
||||
fromDatabaseValue: databaseValue(atUncheckedIndex: index),
|
||||
context: RowDecodingContext(row: Row(impl: self), key: .columnIndex(index)))
|
||||
}
|
||||
|
||||
func fastDecodeDataNoCopy(atUncheckedIndex index: Int) throws -> Data {
|
||||
// unless customized, copy data (see StatementRowImpl and AdaptedRowImpl for customization)
|
||||
return try Data.decode(
|
||||
try Data.decode(
|
||||
fromDatabaseValue: databaseValue(atUncheckedIndex: index),
|
||||
context: RowDecodingContext(row: Row(impl: self), key: .columnIndex(index)))
|
||||
}
|
||||
|
||||
func fastDecodeDataNoCopyIfPresent(atUncheckedIndex index: Int) throws -> Data? {
|
||||
// unless customized, copy data (see StatementRowImpl and AdaptedRowImpl for customization)
|
||||
return try Data.decodeIfPresent(
|
||||
try Data.decodeIfPresent(
|
||||
fromDatabaseValue: databaseValue(atUncheckedIndex: index),
|
||||
context: RowDecodingContext(row: Row(impl: self), key: .columnIndex(index)))
|
||||
}
|
||||
@@ -2254,7 +2254,7 @@ private struct StatementRowImpl: RowImpl {
|
||||
|
||||
func hasNull(atUncheckedIndex index: Int) -> Bool {
|
||||
// Avoid extracting values, because this modifies the SQLite statement.
|
||||
return sqlite3_column_type(sqliteStatement, Int32(index)) == SQLITE_NULL
|
||||
sqlite3_column_type(sqliteStatement, Int32(index)) == SQLITE_NULL
|
||||
}
|
||||
|
||||
func databaseValue(atUncheckedIndex index: Int) -> DatabaseValue {
|
||||
|
||||
@@ -316,24 +316,15 @@ public final class Statement {
|
||||
|
||||
/// Calls the given closure after each successful call to `sqlite3_step()`.
|
||||
///
|
||||
/// Unlike multiple calls to `step(_:)`, this method is able to deal with
|
||||
/// statements that need a specific authorizer.
|
||||
///
|
||||
/// That's how we deal with TransactionObservers that observe deletion:
|
||||
/// the authorizer prevents the truncate optimization
|
||||
/// <https://www.sqlite.org/lang_delete.html#the_truncate_optimization>.
|
||||
///
|
||||
/// That's also how we deal with <https://github.com/groue/GRDB.swift/issues/1124>,
|
||||
/// in four steps:
|
||||
///
|
||||
/// 1. `T.fetchAll(...)` calls `Array(T.fetchCursor(...))`
|
||||
/// 2. `Array(T.fetchCursor(...))` calls `Cursor.forEach(...)`
|
||||
/// 3. `DatabaseCursor.forEach(...)` calls `Statement.forEachStep(...)`
|
||||
/// 4. `Statement.forEachStep(...)` deals with the eventual authorizer.
|
||||
/// This method is slighly faster than calling `step(_:)` repeatedly, due
|
||||
/// to the single `sqlite3_stmt_busy` check.
|
||||
@usableFromInline
|
||||
func forEachStep(_ body: (SQLiteStatement) throws -> Void) throws {
|
||||
SchedulingWatchdog.preconditionValidQueue(database)
|
||||
try database.statementWillExecute(self)
|
||||
|
||||
if sqlite3_stmt_busy(sqliteStatement) == 0 {
|
||||
try database.statementWillExecute(self)
|
||||
}
|
||||
|
||||
while true {
|
||||
switch sqlite3_step(sqliteStatement) {
|
||||
@@ -349,12 +340,8 @@ public final class Statement {
|
||||
}
|
||||
|
||||
/// Calls the given closure after one successful call to `sqlite3_step()`.
|
||||
///
|
||||
/// This method is unable to deal with statements that need a specific
|
||||
/// authorizer. See `forEachStep(_:)`.
|
||||
@usableFromInline
|
||||
func step<Element>(_ body: (SQLiteStatement) throws -> Element) throws -> Element? {
|
||||
// This check takes 0 time when profiled. It is, practically speaking, free.
|
||||
func step<T>(_ body: (SQLiteStatement) throws -> T) throws -> T? {
|
||||
if sqlite3_stmt_busy(sqliteStatement) == 0 {
|
||||
try database.statementWillExecute(self)
|
||||
}
|
||||
@@ -439,9 +426,8 @@ extension DatabaseCursor {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Specific implementation of `forEach` in order to deal with
|
||||
// <https://github.com/groue/GRDB.swift/issues/1124>.
|
||||
// See `Statement.forEachStep(_:)` for more information.
|
||||
/// Specific implementation of `forEach`, for a slight performance
|
||||
/// improvement due to the single `sqlite3_stmt_busy` check.
|
||||
@inlinable
|
||||
public func forEach(_ body: (Element) throws -> Void) throws {
|
||||
if _isDone { return }
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/// An instance of WALSnapshot records the state of a WAL mode database for some
|
||||
/// specific point in history.
|
||||
///
|
||||
/// We use `WALSnapshot` to help `ValueObservation` check for changes
|
||||
/// that would happen between the initial fetch, and the start of the
|
||||
/// actual observation. This class has no other purpose, and is not intended to
|
||||
/// become public.
|
||||
///
|
||||
/// It does not work with SQLCipher, because SQLCipher does not support
|
||||
/// `SQLITE_ENABLE_SNAPSHOT` correctly: we have linker errors.
|
||||
/// See <https://github.com/ericsink/SQLitePCL.raw/issues/452>.
|
||||
///
|
||||
/// With custom SQLite builds, it only works if `SQLITE_ENABLE_SNAPSHOT`
|
||||
/// is defined.
|
||||
///
|
||||
/// With system SQLite, it can only work when the SDK exposes the C apis and
|
||||
/// their availability, which means XCode 14 (identified with Swift 5.7).
|
||||
///
|
||||
/// Yes, this is an awfully complex logic.
|
||||
///
|
||||
/// See <https://www.sqlite.org/c3ref/snapshot.html>.
|
||||
final class WALSnapshot {
|
||||
#if os(macOS) || targetEnvironment(macCatalyst) || GRDBCIPHER || (GRDBCUSTOMSQLITE && !SQLITE_ENABLE_SNAPSHOT) || compiler(<5.7)
|
||||
init?(_ db: Database) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func compare(_ other: WALSnapshot) -> CInt {
|
||||
preconditionFailure("snapshots are not available")
|
||||
}
|
||||
#else
|
||||
private let snapshot: UnsafeMutablePointer<sqlite3_snapshot>?
|
||||
|
||||
/// Returns nil if `SQLITE_ENABLE_SNAPSHOT` is not enabled, or if an
|
||||
/// error occurs.
|
||||
init?(_ db: Database) {
|
||||
var snapshot: UnsafeMutablePointer<sqlite3_snapshot>?
|
||||
let code: CInt = withUnsafeMutablePointer(to: &snapshot) {
|
||||
#if GRDBCUSTOMSQLITE
|
||||
return sqlite3_snapshot_get(db.sqliteConnection, "main", $0)
|
||||
#else
|
||||
// iOS 10.0 is always true because our minimum requirement is iOS 11.
|
||||
if #available(macOS 10.12, watchOS 3.0, tvOS 10.0, *) {
|
||||
return sqlite3_snapshot_get(db.sqliteConnection, "main", $0)
|
||||
} else {
|
||||
return SQLITE_ERROR
|
||||
}
|
||||
#endif
|
||||
}
|
||||
guard code == SQLITE_OK, let s = snapshot else {
|
||||
return nil
|
||||
}
|
||||
self.snapshot = s
|
||||
}
|
||||
|
||||
deinit {
|
||||
#if GRDBCUSTOMSQLITE
|
||||
sqlite3_snapshot_free(snapshot)
|
||||
#else
|
||||
// iOS 10.0 is always true because our minimum requirement is iOS 11.
|
||||
if #available(macOS 10.12, watchOS 3.0, tvOS 10.0, *) {
|
||||
sqlite3_snapshot_free(snapshot)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Compares two WAL snapshots.
|
||||
///
|
||||
/// `a.compare(b) < 0` iff a is older than b.
|
||||
///
|
||||
/// See <https://www.sqlite.org/c3ref/snapshot_cmp.html>.
|
||||
func compare(_ other: WALSnapshot) -> CInt {
|
||||
#if GRDBCUSTOMSQLITE
|
||||
return sqlite3_snapshot_cmp(snapshot, other.snapshot)
|
||||
#else
|
||||
// iOS 10.0 is always true because our minimum requirement is iOS 11.
|
||||
if #available(macOS 10.12, watchOS 3.0, tvOS 10.0, *) {
|
||||
return sqlite3_snapshot_cmp(snapshot, other.snapshot)
|
||||
} else {
|
||||
preconditionFailure("snapshots are not available")
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif // os(macOS) || targetEnvironment(macCatalyst) || GRDBCIPHER || (GRDBCUSTOMSQLITE && !SQLITE_ENABLE_SNAPSHOT) || compiler(<5.7)
|
||||
}
|
||||
+11
-60
@@ -314,19 +314,14 @@ extension ValueObservation {
|
||||
{ preconditionFailure() }
|
||||
|
||||
@available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.")
|
||||
public func combine<
|
||||
R1: _ValueReducer,
|
||||
Combined>(
|
||||
public func combine<R1, Combined>(
|
||||
_ other: ValueObservation<R1>,
|
||||
_ transform: @escaping (Reducer.Value, R1.Value) -> Combined)
|
||||
-> ValueObservation<ValueReducers.Unavailable<Combined>>
|
||||
{ preconditionFailure() }
|
||||
|
||||
@available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.")
|
||||
public func combine<
|
||||
R1: _ValueReducer,
|
||||
R2: _ValueReducer,
|
||||
Combined>(
|
||||
public func combine<R1, R2, Combined>(
|
||||
_ observation1: ValueObservation<R1>,
|
||||
_ observation2: ValueObservation<R2>,
|
||||
_ transform: @escaping (Reducer.Value, R1.Value, R2.Value) -> Combined)
|
||||
@@ -334,11 +329,7 @@ extension ValueObservation {
|
||||
{ preconditionFailure() }
|
||||
|
||||
@available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.")
|
||||
public func combine<
|
||||
R1: _ValueReducer,
|
||||
R2: _ValueReducer,
|
||||
R3: _ValueReducer,
|
||||
Combined>(
|
||||
public func combine<R1, R2, R3, Combined>(
|
||||
_ observation1: ValueObservation<R1>,
|
||||
_ observation2: ValueObservation<R2>,
|
||||
_ observation3: ValueObservation<R3>,
|
||||
@@ -347,12 +338,7 @@ extension ValueObservation {
|
||||
{ preconditionFailure() }
|
||||
|
||||
@available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.")
|
||||
public func combine<
|
||||
R1: _ValueReducer,
|
||||
R2: _ValueReducer,
|
||||
R3: _ValueReducer,
|
||||
R4: _ValueReducer,
|
||||
Combined>(
|
||||
public func combine<R1, R2, R3, R4, Combined>(
|
||||
_ observation1: ValueObservation<R1>,
|
||||
_ observation2: ValueObservation<R2>,
|
||||
_ observation3: ValueObservation<R3>,
|
||||
@@ -374,19 +360,14 @@ extension ValueObservation {
|
||||
|
||||
extension ValueObservation where Reducer == ValueReducers.Auto {
|
||||
@available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.")
|
||||
public static func combine<
|
||||
R1: _ValueReducer,
|
||||
R2: _ValueReducer>(
|
||||
public static func combine<R1, R2>(
|
||||
_ o1: ValueObservation<R1>,
|
||||
_ o2: ValueObservation<R2>)
|
||||
-> ValueObservation<ValueReducers.Unavailable<(R1.Value, R2.Value)>>
|
||||
{ preconditionFailure() }
|
||||
|
||||
@available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.")
|
||||
public static func combine<
|
||||
R1: _ValueReducer,
|
||||
R2: _ValueReducer,
|
||||
R3: _ValueReducer>(
|
||||
public static func combine<R1, R2, R3>(
|
||||
_ o1: ValueObservation<R1>,
|
||||
_ o2: ValueObservation<R2>,
|
||||
_ o3: ValueObservation<R3>)
|
||||
@@ -394,11 +375,7 @@ extension ValueObservation where Reducer == ValueReducers.Auto {
|
||||
{ preconditionFailure() }
|
||||
|
||||
@available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.")
|
||||
public static func combine<
|
||||
R1: _ValueReducer,
|
||||
R2: _ValueReducer,
|
||||
R3: _ValueReducer,
|
||||
R4: _ValueReducer>(
|
||||
public static func combine<R1, R2, R3, R4>(
|
||||
_ o1: ValueObservation<R1>,
|
||||
_ o2: ValueObservation<R2>,
|
||||
_ o3: ValueObservation<R3>,
|
||||
@@ -407,12 +384,7 @@ extension ValueObservation where Reducer == ValueReducers.Auto {
|
||||
{ preconditionFailure() }
|
||||
|
||||
@available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.")
|
||||
public static func combine<
|
||||
R1: _ValueReducer,
|
||||
R2: _ValueReducer,
|
||||
R3: _ValueReducer,
|
||||
R4: _ValueReducer,
|
||||
R5: _ValueReducer>(
|
||||
public static func combine<R1, R2, R3, R4, R5>(
|
||||
_ o1: ValueObservation<R1>,
|
||||
_ o2: ValueObservation<R2>,
|
||||
_ o3: ValueObservation<R3>,
|
||||
@@ -422,13 +394,7 @@ extension ValueObservation where Reducer == ValueReducers.Auto {
|
||||
{ preconditionFailure() }
|
||||
|
||||
@available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.")
|
||||
public static func combine<
|
||||
R1: _ValueReducer,
|
||||
R2: _ValueReducer,
|
||||
R3: _ValueReducer,
|
||||
R4: _ValueReducer,
|
||||
R5: _ValueReducer,
|
||||
R6: _ValueReducer>(
|
||||
public static func combine<R1, R2, R3, R4, R5, R6>(
|
||||
_ o1: ValueObservation<R1>,
|
||||
_ o2: ValueObservation<R2>,
|
||||
_ o3: ValueObservation<R3>,
|
||||
@@ -439,14 +405,7 @@ extension ValueObservation where Reducer == ValueReducers.Auto {
|
||||
{ preconditionFailure() }
|
||||
|
||||
@available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.")
|
||||
public static func combine<
|
||||
R1: _ValueReducer,
|
||||
R2: _ValueReducer,
|
||||
R3: _ValueReducer,
|
||||
R4: _ValueReducer,
|
||||
R5: _ValueReducer,
|
||||
R6: _ValueReducer,
|
||||
R7: _ValueReducer>(
|
||||
public static func combine<R1, R2, R3, R4, R5, R6, R7>(
|
||||
_ o1: ValueObservation<R1>,
|
||||
_ o2: ValueObservation<R2>,
|
||||
_ o3: ValueObservation<R3>,
|
||||
@@ -458,15 +417,7 @@ extension ValueObservation where Reducer == ValueReducers.Auto {
|
||||
{ preconditionFailure() }
|
||||
|
||||
@available(*, unavailable, message: "combine is no longer available. See the \"Migrating From GRDB 4 to GRDB 5\" guide.")
|
||||
public static func combine<
|
||||
R1: _ValueReducer,
|
||||
R2: _ValueReducer,
|
||||
R3: _ValueReducer,
|
||||
R4: _ValueReducer,
|
||||
R5: _ValueReducer,
|
||||
R6: _ValueReducer,
|
||||
R7: _ValueReducer,
|
||||
R8: _ValueReducer>(
|
||||
public static func combine<R1, R2, R3, R4, R5, R6, R7, R8>(
|
||||
_ o1: ValueObservation<R1>,
|
||||
_ o2: ValueObservation<R2>,
|
||||
_ o3: ValueObservation<R3>,
|
||||
|
||||
@@ -325,7 +325,7 @@ extension TableRequest where Self: FilteredRequest, Self: TypedRequest {
|
||||
|
||||
/// Creates a request filtered by unique key.
|
||||
///
|
||||
/// // SELECT * FROM player WHERE ... email = 'arthur@example.com' OR ...
|
||||
/// // SELECT * FROM player WHERE ... email = 'arthur@example.com' AND ...
|
||||
/// let request = try Player...filter(keys: [["email": "arthur@example.com"], ...])
|
||||
///
|
||||
/// When executed, this request raises a fatal error if there is no unique
|
||||
|
||||
@@ -196,8 +196,6 @@ extension FetchableRecord {
|
||||
adapter: RowAdapter? = nil)
|
||||
throws -> [Self]
|
||||
{
|
||||
// Use Array initializer in order to deal with <https://github.com/groue/GRDB.swift/issues/1124>.
|
||||
// See `Statement.forEachStep(_:)` for more information.
|
||||
try Array(fetchCursor(statement, arguments: arguments, adapter: adapter))
|
||||
}
|
||||
|
||||
|
||||
+34
-2
@@ -51,13 +51,26 @@ final class Pool<T> {
|
||||
private let itemsSemaphore: DispatchSemaphore // limits the number of elements
|
||||
private let itemsGroup: DispatchGroup // knows when no element is used
|
||||
private let barrierQueue: DispatchQueue
|
||||
private let semaphoreWaitingQueue: DispatchQueue // Inspired by https://khanlou.com/2016/04/the-GCD-handbook/
|
||||
|
||||
init(maximumCount: Int, makeElement: @escaping () throws -> T) {
|
||||
/// Creates a Pool.
|
||||
///
|
||||
/// - parameters:
|
||||
/// - maximumCount: The maximum number of elements.
|
||||
/// - qos: The quality of service of asynchronous accesses.
|
||||
/// - makeElement: A function that creates an element. It is called
|
||||
/// on demand.
|
||||
init(
|
||||
maximumCount: Int,
|
||||
qos: DispatchQoS = .unspecified,
|
||||
makeElement: @escaping () throws -> T)
|
||||
{
|
||||
GRDBPrecondition(maximumCount > 0, "Pool size must be at least 1")
|
||||
self.makeElement = makeElement
|
||||
self.itemsSemaphore = DispatchSemaphore(value: maximumCount)
|
||||
self.itemsGroup = DispatchGroup()
|
||||
self.barrierQueue = DispatchQueue(label: "GRDB.Pool.barrier", attributes: [.concurrent])
|
||||
self.barrierQueue = DispatchQueue(label: "GRDB.Pool.barrier", qos: qos, attributes: [.concurrent])
|
||||
self.semaphoreWaitingQueue = DispatchQueue(label: "GRDB.Pool.wait", qos: qos)
|
||||
}
|
||||
|
||||
/// Returns a tuple (element, release)
|
||||
@@ -87,6 +100,25 @@ final class Pool<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Eventually produces a tuple (element, release), where element is
|
||||
/// intended to be used asynchronously.
|
||||
///
|
||||
/// Client must call release(), only once, after the element has been used.
|
||||
///
|
||||
/// - important: The `execute` argument is executed in a serial dispatch
|
||||
/// queue, so make sure you use the element asynchronously.
|
||||
func asyncGet(_ execute: @escaping (Result<(element: T, release: () -> Void), Error>) -> Void) {
|
||||
// Inspired by https://khanlou.com/2016/04/the-GCD-handbook/
|
||||
// > We wait on the semaphore in the serial queue, which means that
|
||||
// > we’ll have at most one blocked thread when we reach maximum
|
||||
// > executing blocks on the concurrent queue. Any other tasks the user
|
||||
// > enqueues will sit inertly on the serial queue waiting to be
|
||||
// > executed, and won’t cause new threads to be started.
|
||||
semaphoreWaitingQueue.async {
|
||||
execute(Result { try self.get() })
|
||||
}
|
||||
}
|
||||
|
||||
/// Performs a synchronous block with an element. The element turns
|
||||
/// available after the block has executed.
|
||||
func get<U>(block: (T) throws -> U) throws -> U {
|
||||
|
||||
@@ -138,9 +138,11 @@ final class ValueConcurrentObserver<Reducer: ValueReducer> {
|
||||
fetch: reducer._fetch)
|
||||
self.notificationCallbacks = NotificationCallbacks(events: events, onChange: onChange)
|
||||
self.reducer = reducer
|
||||
self.reduceQueue = dbPool.configuration.makeDispatchQueue(label: dbPool.configuration.identifier(
|
||||
defaultLabel: "GRDB",
|
||||
purpose: "ValueObservation"))
|
||||
self.reduceQueue = DispatchQueue(
|
||||
label: dbPool.configuration.identifier(
|
||||
defaultLabel: "GRDB",
|
||||
purpose: "ValueObservation"),
|
||||
qos: dbPool.configuration.readQoS)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,6 +186,9 @@ final class ValueConcurrentObserver<Reducer: ValueReducer> {
|
||||
// 1. Start the observation without waiting for a write access (the expected
|
||||
// benefit of `DatabasePool`).
|
||||
// 2. Make sure we do not miss a change (a documented guarantee)
|
||||
//
|
||||
// Support for `SQLITE_ENABLE_SNAPSHOT` is implemented by our
|
||||
// `WALSnapshot` class.
|
||||
extension ValueConcurrentObserver {
|
||||
// Starts the observation
|
||||
func start() -> DatabaseCancellable {
|
||||
@@ -232,7 +237,6 @@ extension ValueConcurrentObserver {
|
||||
}
|
||||
}
|
||||
|
||||
#if SQLITE_ENABLE_SNAPSHOT
|
||||
// MARK: - Starting the Observation (with SQLITE_ENABLE_SNAPSHOT)
|
||||
|
||||
extension ValueConcurrentObserver {
|
||||
@@ -246,14 +250,23 @@ extension ValueConcurrentObserver {
|
||||
// transaction to complete.
|
||||
//
|
||||
// Fetch value & tracked region in a synchronous way.
|
||||
//
|
||||
// TODO: we currently perform the initial read from a snapshot, because
|
||||
// it is a handy way to keep a read transaction open until we grab a
|
||||
// write access, and compare the database versions. The problem is that
|
||||
// we do not control the number of created shapshots: we should instead
|
||||
// use a reader from the pool.
|
||||
let initialSnapshot = try databaseAccess.dbPool.makeSnapshot()
|
||||
let (fetchedValue, initialRegion): (Reducer.Fetched, DatabaseRegion) = try initialSnapshot.read { db in
|
||||
let (fetchedValue, initialRegion, initialWALSnapshot) = try initialSnapshot.read {
|
||||
db -> (Reducer.Fetched, DatabaseRegion, WALSnapshot?) in
|
||||
// swiftlint:disable:previous closure_parameter_position
|
||||
|
||||
switch trackingMode {
|
||||
case let .constantRegion(regions):
|
||||
let fetchedValue = try databaseAccess.fetch(db)
|
||||
let region = try DatabaseRegion.union(regions)(db)
|
||||
let initialRegion = try region.observableRegion(db)
|
||||
return (fetchedValue, initialRegion)
|
||||
return (fetchedValue, initialRegion, WALSnapshot(db))
|
||||
|
||||
case .constantRegionRecordedFromSelection,
|
||||
.nonConstantRegionRecordedFromSelection:
|
||||
@@ -262,7 +275,7 @@ extension ValueConcurrentObserver {
|
||||
try databaseAccess.fetch(db)
|
||||
}
|
||||
let initialRegion = try region.observableRegion(db)
|
||||
return (fetchedValue, initialRegion)
|
||||
return (fetchedValue, initialRegion, WALSnapshot(db))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,6 +291,7 @@ extension ValueConcurrentObserver {
|
||||
asyncStartObservation(
|
||||
from: databaseAccess,
|
||||
initialSnapshot: initialSnapshot,
|
||||
initialWALSnapshot: initialWALSnapshot,
|
||||
initialRegion: initialRegion)
|
||||
|
||||
return initialValue
|
||||
@@ -291,6 +305,12 @@ extension ValueConcurrentObserver {
|
||||
// for observing the database is to be able to fetch the initial value
|
||||
// without having to wait for an eventual long-running write
|
||||
// transaction to complete.
|
||||
//
|
||||
// TODO: we currently perform the initial read from a snapshot, because
|
||||
// it is a handy way to keep a read transaction open until we grab a
|
||||
// write access, and compare the database versions. The problem is that
|
||||
// we do not control the number of created shapshots: we should instead
|
||||
// use a reader from the pool.
|
||||
do {
|
||||
let initialSnapshot = try databaseAccess.dbPool.makeSnapshot()
|
||||
initialSnapshot.asyncRead { dbResult in
|
||||
@@ -342,6 +362,7 @@ extension ValueConcurrentObserver {
|
||||
self.asyncStartObservation(
|
||||
from: databaseAccess,
|
||||
initialSnapshot: initialSnapshot,
|
||||
initialWALSnapshot: WALSnapshot(db),
|
||||
initialRegion: initialRegion)
|
||||
} catch {
|
||||
self.notifyError(error)
|
||||
@@ -355,6 +376,7 @@ extension ValueConcurrentObserver {
|
||||
private func asyncStartObservation(
|
||||
from databaseAccess: DatabaseAccess,
|
||||
initialSnapshot: DatabaseSnapshot,
|
||||
initialWALSnapshot: WALSnapshot?,
|
||||
initialRegion: DatabaseRegion)
|
||||
{
|
||||
databaseAccess.dbPool.asyncWriteWithoutTransaction { writerDB in
|
||||
@@ -369,13 +391,17 @@ extension ValueConcurrentObserver {
|
||||
try writerDB.isolated(readOnly: true) {
|
||||
// Keep DatabaseSnaphot alive until we have compared
|
||||
// database versions. It prevents database checkpointing,
|
||||
// and keeps versions (`sqlite3_snapshot`) valid
|
||||
// and keeps WAL snapshots (`sqlite3_snapshot`) valid
|
||||
// and comparable.
|
||||
let isModified: Bool = try withExtendedLifetime(initialSnapshot) {
|
||||
guard let initialVersion = initialSnapshot.version else {
|
||||
let isModified: Bool = withExtendedLifetime(initialSnapshot) {
|
||||
guard let initialWALSnapshot = initialWALSnapshot,
|
||||
let currentWALSnapshot = WALSnapshot(writerDB)
|
||||
else {
|
||||
return true
|
||||
}
|
||||
return try writerDB.wasChanged(since: initialVersion)
|
||||
let ordering = initialWALSnapshot.compare(currentWALSnapshot)
|
||||
assert(ordering <= 0, "Unexpected snapshot ordering")
|
||||
return ordering < 0
|
||||
}
|
||||
|
||||
if isModified {
|
||||
@@ -436,156 +462,6 @@ extension ValueConcurrentObserver {
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
// MARK: - Starting the Observation (without SQLITE_ENABLE_SNAPSHOT)
|
||||
|
||||
extension ValueConcurrentObserver {
|
||||
/// Synchronously starts the observation, and returns the initial value.
|
||||
///
|
||||
/// Unlike `asyncStart()`, this method does not notify the initial value or error.
|
||||
private func syncStart(from databaseAccess: DatabaseAccess) throws -> Reducer.Value {
|
||||
// Start from a read access. The whole point of using a DatabasePool
|
||||
// for observing the database is to be able to fetch the initial value
|
||||
// without having to wait for an eventual long-running write
|
||||
// transaction to complete.
|
||||
//
|
||||
// Fetch in a synchronous reentrant way, in case this method is called
|
||||
// from a database access.
|
||||
let fetchedValue = try databaseAccess.dbPool.unsafeReentrantRead { db in
|
||||
try db.isolated(readOnly: true) {
|
||||
try databaseAccess.fetch(db)
|
||||
}
|
||||
}
|
||||
|
||||
// Reduce
|
||||
let initialValue: Reducer.Value = reduceQueue.sync {
|
||||
guard let initialValue = reducer._value(fetchedValue) else {
|
||||
fatalError("Broken contract: reducer has no initial value")
|
||||
}
|
||||
return initialValue
|
||||
}
|
||||
|
||||
// Start observation
|
||||
asyncStartObservation(from: databaseAccess)
|
||||
|
||||
return initialValue
|
||||
}
|
||||
|
||||
/// Asynchronously starts the observation
|
||||
///
|
||||
/// Unlike `syncStart()`, this method does notify the initial value or error.
|
||||
private func asyncStart(from databaseAccess: DatabaseAccess) {
|
||||
// Start from a read access. The whole point of using a DatabasePool
|
||||
// for observing the database is to be able to fetch the initial value
|
||||
// without having to wait for an eventual long-running write
|
||||
// transaction to complete.
|
||||
databaseAccess.dbPool.asyncRead { dbResult in
|
||||
let isNotifying = self.lock.synchronized { self.notificationCallbacks != nil }
|
||||
guard isNotifying else { return /* Cancelled */ }
|
||||
|
||||
do {
|
||||
// Fetch
|
||||
let fetchedValue = try databaseAccess.fetch(dbResult.get())
|
||||
|
||||
// Reduce
|
||||
//
|
||||
// Reducing is performed asynchronously, so that we do not lock
|
||||
// a database dispatch queue longer than necessary.
|
||||
self.reduceQueue.async {
|
||||
let isNotifying = self.lock.synchronized { self.notificationCallbacks != nil }
|
||||
guard isNotifying else { return /* Cancelled */ }
|
||||
|
||||
guard let initialValue = self.reducer._value(fetchedValue) else {
|
||||
fatalError("Broken contract: reducer has no initial value")
|
||||
}
|
||||
|
||||
// Notify
|
||||
self.scheduler.schedule {
|
||||
// TODO: [SR-214] remove -Opt suffix when we only support Xcode 12.5.1+
|
||||
let onChangeOpt = self.lock.synchronized { self.notificationCallbacks?.onChange }
|
||||
guard let onChange = onChangeOpt else { return /* Cancelled */ }
|
||||
onChange(initialValue)
|
||||
}
|
||||
|
||||
// Start observation
|
||||
self.asyncStartObservation(from: databaseAccess)
|
||||
}
|
||||
} catch {
|
||||
self.notifyError(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func asyncStartObservation(from databaseAccess: DatabaseAccess) {
|
||||
databaseAccess.dbPool.asyncWriteWithoutTransaction { writerDB in
|
||||
// TODO: [SR-214] remove -Opt suffix when we only support Xcode 12.5.1+
|
||||
let eventsOpt = self.lock.synchronized { self.notificationCallbacks?.events }
|
||||
guard let events = eventsOpt else { return /* Cancelled */ }
|
||||
|
||||
// We don't know if database has changed or not.
|
||||
// So we assume it did, so that we are sure that we do
|
||||
// not miss a database change.
|
||||
events.databaseDidChange?()
|
||||
|
||||
do {
|
||||
// Fetch
|
||||
let fetchedValue: Reducer.Fetched
|
||||
|
||||
switch self.trackingMode {
|
||||
case let .constantRegion(regions):
|
||||
fetchedValue = try writerDB.isolated(readOnly: true) {
|
||||
try databaseAccess.fetch(writerDB)
|
||||
}
|
||||
let region = try DatabaseRegion.union(regions)(writerDB)
|
||||
let observedRegion = try region.observableRegion(writerDB)
|
||||
events.willTrackRegion?(observedRegion)
|
||||
self.startObservation(writerDB, observedRegion: observedRegion)
|
||||
|
||||
case .constantRegionRecordedFromSelection,
|
||||
.nonConstantRegionRecordedFromSelection:
|
||||
var region = DatabaseRegion()
|
||||
fetchedValue = try writerDB.recordingSelection(®ion) {
|
||||
try writerDB.isolated(readOnly: true) {
|
||||
try databaseAccess.fetch(writerDB)
|
||||
}
|
||||
}
|
||||
let observedRegion = try region.observableRegion(writerDB)
|
||||
events.willTrackRegion?(observedRegion)
|
||||
self.startObservation(writerDB, observedRegion: observedRegion)
|
||||
}
|
||||
|
||||
// Reduce
|
||||
//
|
||||
// Reducing is performed asynchronously, so that we do not lock
|
||||
// the writer dispatch queue longer than necessary.
|
||||
//
|
||||
// Important: reduceQueue.async guarantees the same ordering
|
||||
// between transactions and notifications!
|
||||
self.reduceQueue.async {
|
||||
let isNotifying = self.lock.synchronized { self.notificationCallbacks != nil }
|
||||
guard isNotifying else { return /* Cancelled */ }
|
||||
|
||||
let value = self.reducer._value(fetchedValue)
|
||||
|
||||
// Notify
|
||||
if let value = value {
|
||||
self.scheduler.schedule {
|
||||
// TODO: [SR-214] remove -Opt suffix when we only support Xcode 12.5.1+
|
||||
let onChangeOpt = self.lock.synchronized { self.notificationCallbacks?.onChange }
|
||||
guard let onChange = onChangeOpt else { return /* Cancelled */ }
|
||||
onChange(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
self.stopDatabaseObservation(writerDB)
|
||||
self.notifyError(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// MARK: - Observing Database Transactions
|
||||
|
||||
extension ValueConcurrentObserver: TransactionObserver {
|
||||
|
||||
@@ -139,9 +139,11 @@ final class ValueWriteOnlyObserver<Writer: DatabaseWriter, Reducer: ValueReducer
|
||||
fetch: reducer._fetch)
|
||||
self.notificationCallbacks = NotificationCallbacks(events: events, onChange: onChange)
|
||||
self.reducer = reducer
|
||||
self.reduceQueue = writer.configuration.makeDispatchQueue(label: writer.configuration.identifier(
|
||||
defaultLabel: "GRDB",
|
||||
purpose: "ValueObservation"))
|
||||
self.reduceQueue = DispatchQueue(
|
||||
label: writer.configuration.identifier(
|
||||
defaultLabel: "GRDB",
|
||||
purpose: "ValueObservation"),
|
||||
qos: writer.configuration.readQoS)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -214,6 +214,8 @@
|
||||
5653EB8120961FB200F46237 /* AssociationBelongsToDecodableRecordTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EB6420961FB200F46237 /* AssociationBelongsToDecodableRecordTests.swift */; };
|
||||
5653EB8220961FB200F46237 /* AssociationBelongsToRowScopeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EB6520961FB200F46237 /* AssociationBelongsToRowScopeTests.swift */; };
|
||||
5653EB8320961FB200F46237 /* AssociationBelongsToRowScopeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EB6520961FB200F46237 /* AssociationBelongsToRowScopeTests.swift */; };
|
||||
56564F3928637C9900A19E9F /* WALSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56564F3828637C9900A19E9F /* WALSnapshot.swift */; };
|
||||
56564F3A28637C9900A19E9F /* WALSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56564F3828637C9900A19E9F /* WALSnapshot.swift */; };
|
||||
5656A7F622946B1B001FF3FF /* ValueObservationQueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5656A7F422946B1B001FF3FF /* ValueObservationQueryInterfaceRequestTests.swift */; };
|
||||
5656A7F722946B1B001FF3FF /* ValueObservationQueryInterfaceRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5656A7F422946B1B001FF3FF /* ValueObservationQueryInterfaceRequestTests.swift */; };
|
||||
5656A8512295BD56001FF3FF /* SQLInterpolation+QueryInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5656A8262295BD56001FF3FF /* SQLInterpolation+QueryInterface.swift */; };
|
||||
@@ -535,6 +537,8 @@
|
||||
56F34FC724B0A0C9007513FC /* SQLIdentifyingColumnsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56F34FC524B0A0C8007513FC /* SQLIdentifyingColumnsTests.swift */; };
|
||||
56F3E74C1E66F83A00BF0F01 /* ResultCodeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56F3E7481E66F83A00BF0F01 /* ResultCodeTests.swift */; };
|
||||
56F3E7501E66F83A00BF0F01 /* ResultCodeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56F3E7481E66F83A00BF0F01 /* ResultCodeTests.swift */; };
|
||||
56F61DEA283D469F00AF9884 /* getThreadsCount.c in Sources */ = {isa = PBXBuildFile; fileRef = 56F61DE8283D469F00AF9884 /* getThreadsCount.c */; };
|
||||
56F61DEB283D469F00AF9884 /* getThreadsCount.c in Sources */ = {isa = PBXBuildFile; fileRef = 56F61DE8283D469F00AF9884 /* getThreadsCount.c */; };
|
||||
56FBFED62210731100945324 /* SQLRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FBFED52210731000945324 /* SQLRequest.swift */; };
|
||||
56FBFED72210731100945324 /* SQLRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FBFED52210731000945324 /* SQLRequest.swift */; };
|
||||
56FEB8FE248403270081AF83 /* DatabaseTraceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56FEB8FC248403270081AF83 /* DatabaseTraceTests.swift */; };
|
||||
@@ -911,6 +915,7 @@
|
||||
5653EB6320961FB200F46237 /* AssociationChainSQLTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationChainSQLTests.swift; sourceTree = "<group>"; };
|
||||
5653EB6420961FB200F46237 /* AssociationBelongsToDecodableRecordTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationBelongsToDecodableRecordTests.swift; sourceTree = "<group>"; };
|
||||
5653EB6520961FB200F46237 /* AssociationBelongsToRowScopeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationBelongsToRowScopeTests.swift; sourceTree = "<group>"; };
|
||||
56564F3828637C9900A19E9F /* WALSnapshot.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WALSnapshot.swift; sourceTree = "<group>"; };
|
||||
5656A7F422946B1B001FF3FF /* ValueObservationQueryInterfaceRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueObservationQueryInterfaceRequestTests.swift; sourceTree = "<group>"; };
|
||||
5656A8262295BD56001FF3FF /* SQLInterpolation+QueryInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SQLInterpolation+QueryInterface.swift"; sourceTree = "<group>"; };
|
||||
5656A8282295BD56001FF3FF /* FTS5+QueryInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FTS5+QueryInterface.swift"; sourceTree = "<group>"; };
|
||||
@@ -1133,6 +1138,8 @@
|
||||
56F34FBD24B094D1007513FC /* SQLExpressionIsConstantTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLExpressionIsConstantTests.swift; sourceTree = "<group>"; };
|
||||
56F34FC524B0A0C8007513FC /* SQLIdentifyingColumnsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLIdentifyingColumnsTests.swift; sourceTree = "<group>"; };
|
||||
56F3E7481E66F83A00BF0F01 /* ResultCodeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultCodeTests.swift; sourceTree = "<group>"; };
|
||||
56F61DE8283D469F00AF9884 /* getThreadsCount.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = getThreadsCount.c; sourceTree = "<group>"; };
|
||||
56F61DE9283D469F00AF9884 /* getThreadsCount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getThreadsCount.h; sourceTree = "<group>"; };
|
||||
56FBFED52210731000945324 /* SQLRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLRequest.swift; sourceTree = "<group>"; };
|
||||
56FDECE11BB32DFD009AD709 /* RowFromStatementTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowFromStatementTests.swift; sourceTree = "<group>"; };
|
||||
56FEB8FC248403270081AF83 /* DatabaseTraceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseTraceTests.swift; sourceTree = "<group>"; };
|
||||
@@ -1262,6 +1269,8 @@
|
||||
569531361C919DF700CF1A2B /* DatabasePoolFunctionTests.swift */,
|
||||
56EA869D1C932597002BB4DF /* DatabasePoolReadOnlyTests.swift */,
|
||||
563C67B624628C0C00E94EDC /* DatabasePoolTests.swift */,
|
||||
56F61DE8283D469F00AF9884 /* getThreadsCount.c */,
|
||||
56F61DE9283D469F00AF9884 /* getThreadsCount.h */,
|
||||
);
|
||||
name = DatabasePool;
|
||||
sourceTree = "<group>";
|
||||
@@ -1824,8 +1833,9 @@
|
||||
56A238781B9C75030082EB20 /* Statement.swift */,
|
||||
566B912A1FA4D0CC0012D5B0 /* StatementAuthorizer.swift */,
|
||||
560D923F1C672C3E00F4F92B /* StatementColumnConvertible.swift */,
|
||||
5605F1471C672E4000235C62 /* Support */,
|
||||
566B91321FA4D3810012D5B0 /* TransactionObserver.swift */,
|
||||
56564F3828637C9900A19E9F /* WALSnapshot.swift */,
|
||||
5605F1471C672E4000235C62 /* Support */,
|
||||
);
|
||||
path = Core;
|
||||
sourceTree = "<group>";
|
||||
@@ -1955,8 +1965,8 @@
|
||||
DC37742D19C8CC90004FCF85 /* GRDB */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56A2386F1B9C75030082EB20 /* Core */,
|
||||
56A2FA3724424F4200E97D23 /* Export.swift */,
|
||||
56A2386F1B9C75030082EB20 /* Core */,
|
||||
5614089D221596A100DAD589 /* Fixit */,
|
||||
5698AC291D9E5A480056AF8C /* FTS */,
|
||||
56A238911B9C750B0082EB20 /* Migration */,
|
||||
@@ -2138,7 +2148,7 @@
|
||||
};
|
||||
F3BA80401CFB2AD7003DC1BA = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
LastSwiftMigration = 1020;
|
||||
LastSwiftMigration = 1340;
|
||||
};
|
||||
F3BA80591CFB2BB2003DC1BA = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
@@ -2146,7 +2156,7 @@
|
||||
};
|
||||
F3BA809A1CFB2F6F003DC1BA = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
LastSwiftMigration = 1020;
|
||||
LastSwiftMigration = 1340;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -2225,6 +2235,7 @@
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
56EB54FB22C9118600850069 /* Swiftlint */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
@@ -2243,6 +2254,7 @@
|
||||
};
|
||||
56EB54FD22C9119B00850069 /* Swiftlint */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
@@ -2352,6 +2364,7 @@
|
||||
56A6EB2526076F6A00C27594 /* SQL.swift in Sources */,
|
||||
5656A8762295BD56001FF3FF /* RequestProtocols.swift in Sources */,
|
||||
568ECB3625D91CEF00B71526 /* SQLSubquery.swift in Sources */,
|
||||
56564F3A28637C9900A19E9F /* WALSnapshot.swift in Sources */,
|
||||
561729552235340E0006E219 /* EncodableRecord.swift in Sources */,
|
||||
5656A87E2295BD56001FF3FF /* SQLAssociation.swift in Sources */,
|
||||
F3BA80131CFB2876003DC1BA /* DatabaseValue.swift in Sources */,
|
||||
@@ -2558,6 +2571,7 @@
|
||||
56419C8724A51D6F004967E1 /* ValueObservationPublisherTests.swift in Sources */,
|
||||
560432A7228F167A009D3FE2 /* AssociationPrefetchingObservationTests.swift in Sources */,
|
||||
5690C33E1D23E7D200E59934 /* FoundationDateTests.swift in Sources */,
|
||||
56F61DEB283D469F00AF9884 /* getThreadsCount.c in Sources */,
|
||||
567A805A1D41350C00C7DCEC /* IndexInfoTests.swift in Sources */,
|
||||
5674A7291F30A9090095F066 /* FetchableRecordDecodableTests.swift in Sources */,
|
||||
56057C5A2291B18E00A7CB10 /* AssociationHasManyRowScopeTests.swift in Sources */,
|
||||
@@ -2722,6 +2736,7 @@
|
||||
56A6EB2426076F6A00C27594 /* SQL.swift in Sources */,
|
||||
5656A8752295BD56001FF3FF /* RequestProtocols.swift in Sources */,
|
||||
568ECB3525D91CEF00B71526 /* SQLSubquery.swift in Sources */,
|
||||
56564F3928637C9900A19E9F /* WALSnapshot.swift in Sources */,
|
||||
561729562235340E0006E219 /* EncodableRecord.swift in Sources */,
|
||||
5656A87D2295BD56001FF3FF /* SQLAssociation.swift in Sources */,
|
||||
F3BA806F1CFB2E55003DC1BA /* DatabaseValue.swift in Sources */,
|
||||
@@ -2928,6 +2943,7 @@
|
||||
56419C8224A51D6E004967E1 /* ValueObservationPublisherTests.swift in Sources */,
|
||||
560432A6228F167A009D3FE2 /* AssociationPrefetchingObservationTests.swift in Sources */,
|
||||
5698AC061D9B9FCF0056AF8C /* QueryInterfaceExtensibilityTests.swift in Sources */,
|
||||
56F61DEA283D469F00AF9884 /* getThreadsCount.c in Sources */,
|
||||
F3BA80FA1CFB3021003DC1BA /* SelectStatementTests.swift in Sources */,
|
||||
5674A7271F30A9090095F066 /* FetchableRecordDecodableTests.swift in Sources */,
|
||||
56057C592291B18E00A7CB10 /* AssociationHasManyRowScopeTests.swift in Sources */,
|
||||
@@ -3237,6 +3253,7 @@
|
||||
baseConfigurationReference = F3BA813B1CFB3770003DC1BA /* GRDBCustomSQLite-Testing.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
@@ -3250,6 +3267,9 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCustomSQLite.GRDBCustomSQLiteiOSTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -3258,6 +3278,7 @@
|
||||
baseConfigurationReference = F3BA813B1CFB3770003DC1BA /* GRDBCustomSQLite-Testing.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
@@ -3273,7 +3294,9 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -3339,6 +3362,7 @@
|
||||
baseConfigurationReference = F3BA813B1CFB3770003DC1BA /* GRDBCustomSQLite-Testing.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
@@ -3353,6 +3377,9 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCustomSQLiteOSXTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -3361,6 +3388,7 @@
|
||||
baseConfigurationReference = F3BA813B1CFB3770003DC1BA /* GRDBCustomSQLite-Testing.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
@@ -3377,7 +3405,9 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Tests/GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# make distclean - Restore repository to a pristine state
|
||||
|
||||
default: test
|
||||
smokeTest: test_framework_GRDBiOS_maxTarget test_framework_GRDBiOS_minTarget test_framework_SQLCipher4 test_framework_GRDBCustomSQLiteiOS_maxTarget test_SPM
|
||||
smokeTest: test_framework_GRDBiOS_maxTarget test_framework_GRDBiOS_minTarget test_framework_SQLCipher4Encrypted test_framework_GRDBCustomSQLiteiOS_maxTarget test_SPM
|
||||
|
||||
# Requirements
|
||||
# ============
|
||||
@@ -50,14 +50,32 @@ TEST_ACTIONS = clean build build-for-testing test-without-building
|
||||
|
||||
# When adding support for an Xcode version, look for available devices with
|
||||
# `xcrun xctrace list devices` (or the deprecated `instruments -s devices`).
|
||||
ifeq ($(XCODEVERSION),13.3)
|
||||
ifeq ($(XCODEVERSION),14.0)
|
||||
MAX_SWIFT_VERSION = 5.7
|
||||
MIN_SWIFT_VERSION = 5.3
|
||||
MAX_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 13,OS=16.0"
|
||||
MIN_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 8,OS=12.4"
|
||||
MAX_TVOS_DESTINATION = "platform=tvOS Simulator,name=Apple TV,OS=16.0"
|
||||
#MIN_TVOS_DESTINATION = "platform=tvOS Simulator,name=Apple TV,OS=11.4" TODO: restore
|
||||
OTHER_SWIFT_FLAGS = '$$(inherited) -D SQLITE_ENABLE_FTS5 -D SQLITE_ENABLE_PREUPDATE_HOOK'
|
||||
GCC_PREPROCESSOR_DEFINITIONS = '$$(inherited) GRDB_SQLITE_ENABLE_PREUPDATE_HOOK=1'
|
||||
else ifeq ($(XCODEVERSION),13.4)
|
||||
MAX_SWIFT_VERSION = 5.6
|
||||
MIN_SWIFT_VERSION = 5.3
|
||||
MAX_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 13,OS=15.5"
|
||||
MIN_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 8,OS=13.7"
|
||||
MAX_TVOS_DESTINATION = "platform=tvOS Simulator,name=Apple TV,OS=15.4"
|
||||
#MIN_TVOS_DESTINATION = "platform=tvOS Simulator,name=Apple TV,OS=11.4" TODO: restore
|
||||
OTHER_SWIFT_FLAGS = '$$(inherited) -D SQLITE_ENABLE_FTS5 -D SQLITE_ENABLE_PREUPDATE_HOOK'
|
||||
GCC_PREPROCESSOR_DEFINITIONS = '$$(inherited) GRDB_SQLITE_ENABLE_PREUPDATE_HOOK=1'
|
||||
else ifeq ($(XCODEVERSION),13.3)
|
||||
MAX_SWIFT_VERSION = 5.6
|
||||
MIN_SWIFT_VERSION = 5.3
|
||||
MAX_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 13,OS=15.4"
|
||||
MIN_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 8,OS=13.7"
|
||||
MAX_TVOS_DESTINATION = "platform=tvOS Simulator,name=Apple TV,OS=15.4"
|
||||
#MIN_TVOS_DESTINATION = "platform=tvOS Simulator,name=Apple TV,OS=11.4" TODO: restore
|
||||
OTHER_SWIFT_FLAGS = '$$(inherited) -D SQLITE_ENABLE_FTS5 -D SQLITE_ENABLE_PREUPDATE_HOOK -Xfrontend -warn-concurrency -Xfrontend -enable-actor-data-race-checks'
|
||||
OTHER_SWIFT_FLAGS = '$$(inherited) -D SQLITE_ENABLE_FTS5 -D SQLITE_ENABLE_PREUPDATE_HOOK'
|
||||
GCC_PREPROCESSOR_DEFINITIONS = '$$(inherited) GRDB_SQLITE_ENABLE_PREUPDATE_HOOK=1'
|
||||
else ifeq ($(XCODEVERSION),13.2)
|
||||
MAX_SWIFT_VERSION = 5.5
|
||||
@@ -66,7 +84,7 @@ else ifeq ($(XCODEVERSION),13.2)
|
||||
MIN_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 8,OS=13.7"
|
||||
MAX_TVOS_DESTINATION = "platform=tvOS Simulator,name=Apple TV,OS=15.2"
|
||||
#MIN_TVOS_DESTINATION = "platform=tvOS Simulator,name=Apple TV,OS=11.4" TODO: restore
|
||||
OTHER_SWIFT_FLAGS = '$$(inherited) -D SQLITE_ENABLE_FTS5 -D SQLITE_ENABLE_PREUPDATE_HOOK -Xfrontend -warn-concurrency -Xfrontend -enable-actor-data-race-checks'
|
||||
OTHER_SWIFT_FLAGS = '$$(inherited) -D SQLITE_ENABLE_FTS5 -D SQLITE_ENABLE_PREUPDATE_HOOK'
|
||||
GCC_PREPROCESSOR_DEFINITIONS = '$$(inherited) GRDB_SQLITE_ENABLE_PREUPDATE_HOOK=1'
|
||||
else ifeq ($(XCODEVERSION),13.1)
|
||||
MAX_SWIFT_VERSION = 5.5
|
||||
@@ -171,7 +189,7 @@ test_framework: test_framework_darwin
|
||||
test_framework_darwin: test_framework_GRDB test_framework_GRDBCustom test_framework_SQLCipher test_SPM
|
||||
test_framework_GRDB: test_framework_GRDBOSX test_framework_GRDBWatchOS test_framework_GRDBiOS test_framework_GRDBtvOS
|
||||
test_framework_GRDBCustom: test_framework_GRDBCustomSQLiteOSX test_framework_GRDBCustomSQLiteiOS
|
||||
test_framework_SQLCipher: test_framework_SQLCipher3 test_framework_SQLCipher4
|
||||
test_framework_SQLCipher: test_framework_SQLCipher3 test_framework_SQLCipher3Encrypted test_framework_SQLCipher4 test_framework_SQLCipher4Encrypted
|
||||
test_archive: test_archive_GRDBOSX_xcframework
|
||||
test_install: test_install_manual test_install_SPM test_install_customSQLite test_install_GRDB_CocoaPods test_CocoaPodsLint
|
||||
test_CocoaPodsLint: test_CocoaPodsLint_GRDB
|
||||
@@ -339,6 +357,21 @@ else
|
||||
@exit 1
|
||||
endif
|
||||
|
||||
test_framework_SQLCipher3Encrypted:
|
||||
ifdef POD
|
||||
cd Tests/CocoaPods/SQLCipher3 && \
|
||||
$(POD) install && \
|
||||
$(XCODEBUILD) \
|
||||
-workspace GRDBTests.xcworkspace \
|
||||
-scheme GRDBEncryptedTests \
|
||||
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
|
||||
build-for-testing test-without-building \
|
||||
$(XCPRETTY)
|
||||
else
|
||||
@echo CocoaPods must be installed for test_framework_SQLCipher3Encrypted
|
||||
@exit 1
|
||||
endif
|
||||
|
||||
test_framework_SQLCipher4:
|
||||
ifdef POD
|
||||
cd Tests/CocoaPods/SQLCipher4 && \
|
||||
@@ -354,6 +387,21 @@ else
|
||||
@exit 1
|
||||
endif
|
||||
|
||||
test_framework_SQLCipher4Encrypted:
|
||||
ifdef POD
|
||||
cd Tests/CocoaPods/SQLCipher4 && \
|
||||
$(POD) install && \
|
||||
$(XCODEBUILD) \
|
||||
-workspace GRDBTests.xcworkspace \
|
||||
-scheme GRDBEncryptedTests \
|
||||
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
|
||||
build-for-testing test-without-building \
|
||||
$(XCPRETTY)
|
||||
else
|
||||
@echo CocoaPods must be installed for test_framework_SQLCipher4Encrypted
|
||||
@exit 1
|
||||
endif
|
||||
|
||||
test_SPM:
|
||||
# Add sanitizers when available: https://twitter.com/simjp/status/929140877540278272
|
||||
$(SWIFT) package clean
|
||||
@@ -538,10 +586,10 @@ ifdef JAZZY
|
||||
--author 'Gwendal Roué' \
|
||||
--author_url https://github.com/groue \
|
||||
--github_url https://github.com/groue/GRDB.swift \
|
||||
--github-file-prefix https://github.com/groue/GRDB.swift/tree/v5.24.0 \
|
||||
--module-version 5.24.0 \
|
||||
--github-file-prefix https://github.com/groue/GRDB.swift/tree/v5.26.1 \
|
||||
--module-version 5.26.1 \
|
||||
--module GRDB \
|
||||
--root-url http://groue.github.io/GRDB.swift/docs/5.24/ \
|
||||
--root-url http://groue.github.io/GRDB.swift/docs/5.26/ \
|
||||
--output Documentation/Reference \
|
||||
--xcodebuild-arguments -project,GRDB.xcodeproj,-scheme,GRDBiOS
|
||||
else
|
||||
|
||||
@@ -35,6 +35,7 @@ let package = Package(
|
||||
"Crash",
|
||||
"Performance",
|
||||
"SPM",
|
||||
"GRDBTests/getThreadsCount.c",
|
||||
])
|
||||
],
|
||||
swiftLanguageVersions: [.v5]
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
|
||||
---
|
||||
|
||||
**Latest release**: May 1, 2022 • [version 5.24.0](https://github.com/groue/GRDB.swift/tree/v5.24.0) • [CHANGELOG](CHANGELOG.md) • [Migrating From GRDB 4 to GRDB 5](Documentation/GRDB5MigrationGuide.md)
|
||||
**Latest release**: September 8, 2022 • [version 5.26.1](https://github.com/groue/GRDB.swift/tree/v5.26.1) • [CHANGELOG](CHANGELOG.md) • [Migrating From GRDB 4 to GRDB 5](Documentation/GRDB5MigrationGuide.md)
|
||||
|
||||
**Requirements**: iOS 11.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+ • SQLite 3.8.5+ • Swift 5.3+ / Xcode 12+
|
||||
|
||||
| Swift version | GRDB version |
|
||||
| -------------- | ----------------------------------------------------------- |
|
||||
| **Swift 5.3+** | **v5.24.0** |
|
||||
| **Swift 5.3+** | **v5.26.1** |
|
||||
| Swift 5.2 | [v5.12.0](https://github.com/groue/GRDB.swift/tree/v5.12.0) |
|
||||
| Swift 5.1 | [v4.14.0](https://github.com/groue/GRDB.swift/tree/v4.14.0) |
|
||||
| Swift 5 | [v4.14.0](https://github.com/groue/GRDB.swift/tree/v4.14.0) |
|
||||
@@ -321,7 +321,7 @@ Documentation
|
||||
|
||||
#### Reference
|
||||
|
||||
- [GRDB Reference](http://groue.github.io/GRDB.swift/docs/5.24/index.html) (generated by [Jazzy](https://github.com/realm/jazzy))
|
||||
- [GRDB Reference](http://groue.github.io/GRDB.swift/docs/5.26/index.html) (generated by [Jazzy](https://github.com/realm/jazzy))
|
||||
|
||||
#### Getting Started
|
||||
|
||||
@@ -491,6 +491,8 @@ let newPlaceCount = try dbQueue.write { db -> Int in
|
||||
}
|
||||
```
|
||||
|
||||
See the [Concurrency] guide for asynchronous database accesses.
|
||||
|
||||
**A database queue serializes accesses to the database**, which means that there is never more than one thread that uses the database.
|
||||
|
||||
- When you don't need to modify the database, prefer the `read` method. It prevents any modification to the database.
|
||||
@@ -548,6 +550,8 @@ let newPlaceCount = try dbPool.write { db -> Int in
|
||||
}
|
||||
```
|
||||
|
||||
See the [Concurrency] guide for asynchronous database accesses.
|
||||
|
||||
**Database pools allow several threads to access the database at the same time:**
|
||||
|
||||
- When you don't need to modify the database, prefer the `read` method, because several threads can perform reads in parallel.
|
||||
@@ -613,7 +617,7 @@ do {
|
||||
>
|
||||
> :warning: **Warning**: The SQLite version that ships with old operating systems (prior to OSX 10.12, tvOS 10.0, and watchOS 3.0) outputs statement arguments in the [trace events](#how-do-i-print-a-request-as-sql), regardless of the `publicStatementArguments` flag.
|
||||
|
||||
See [Configuration](http://groue.github.io/GRDB.swift/docs/5.24/Structs/Configuration.html) for more details and configuration options.
|
||||
See [Configuration](http://groue.github.io/GRDB.swift/docs/5.26/Structs/Configuration.html) for more details and configuration options.
|
||||
|
||||
|
||||
SQLite API
|
||||
@@ -670,7 +674,7 @@ try dbQueue.write { db in
|
||||
}
|
||||
```
|
||||
|
||||
The `?` and colon-prefixed keys like `:score` in the SQL query are the **statements arguments**. You pass arguments with arrays or dictionaries, as in the example above. See [Values](#values) for more information on supported arguments types (Bool, Int, String, Date, Swift enums, etc.), and [StatementArguments](http://groue.github.io/GRDB.swift/docs/5.24/Structs/StatementArguments.html) for a detailed documentation of SQLite arguments.
|
||||
The `?` and colon-prefixed keys like `:score` in the SQL query are the **statements arguments**. You pass arguments with arrays or dictionaries, as in the example above. See [Values](#values) for more information on supported arguments types (Bool, Int, String, Date, Swift enums, etc.), and [StatementArguments](http://groue.github.io/GRDB.swift/docs/5.26/Structs/StatementArguments.html) for a detailed documentation of SQLite arguments.
|
||||
|
||||
You can also embed query arguments right into your SQL queries, with the `literal` argument label, as in the example below. See [SQL Interpolation] for more details.
|
||||
|
||||
@@ -928,7 +932,7 @@ try dbQueue.read { db in
|
||||
let dictionary = try Dictionary(uniqueKeysWithValues: cursor)
|
||||
```
|
||||
|
||||
- **Cursors adopt the [Cursor](http://groue.github.io/GRDB.swift/docs/5.24/Protocols/Cursor.html) protocol, which looks a lot like standard [lazy sequences](https://developer.apple.com/reference/swift/lazysequenceprotocol) of Swift.** As such, cursors come with many convenience methods: `compactMap`, `contains`, `dropFirst`, `dropLast`, `drop(while:)`, `enumerated`, `filter`, `first`, `flatMap`, `forEach`, `joined`, `joined(separator:)`, `max`, `max(by:)`, `min`, `min(by:)`, `map`, `prefix`, `prefix(while:)`, `reduce`, `reduce(into:)`, `suffix`:
|
||||
- **Cursors adopt the [Cursor](http://groue.github.io/GRDB.swift/docs/5.26/Protocols/Cursor.html) protocol, which looks a lot like standard [lazy sequences](https://developer.apple.com/reference/swift/lazysequenceprotocol) of Swift.** As such, cursors come with many convenience methods: `compactMap`, `contains`, `dropFirst`, `dropLast`, `drop(while:)`, `enumerated`, `filter`, `first`, `flatMap`, `forEach`, `joined`, `joined(separator:)`, `max`, `max(by:)`, `min`, `min(by:)`, `map`, `prefix`, `prefix(while:)`, `reduce`, `reduce(into:)`, `suffix`:
|
||||
|
||||
```swift
|
||||
// Prints all Github links
|
||||
@@ -1007,7 +1011,7 @@ let rows = try Row.fetchAll(db,
|
||||
arguments: ["name": "Arthur"])
|
||||
```
|
||||
|
||||
See [Values](#values) for more information on supported arguments types (Bool, Int, String, Date, Swift enums, etc.), and [StatementArguments](http://groue.github.io/GRDB.swift/docs/5.24/Structs/StatementArguments.html) for a detailed documentation of SQLite arguments.
|
||||
See [Values](#values) for more information on supported arguments types (Bool, Int, String, Date, Swift enums, etc.), and [StatementArguments](http://groue.github.io/GRDB.swift/docs/5.26/Structs/StatementArguments.html) for a detailed documentation of SQLite arguments.
|
||||
|
||||
Unlike row arrays that contain copies of the database rows, row cursors are close to the SQLite metal, and require a little care:
|
||||
|
||||
@@ -1292,7 +1296,7 @@ GRDB ships with built-in support for the following value types:
|
||||
|
||||
- Generally speaking, all types that adopt the [DatabaseValueConvertible](#custom-value-types) protocol.
|
||||
|
||||
Values can be used as [statement arguments](http://groue.github.io/GRDB.swift/docs/5.24/Structs/StatementArguments.html):
|
||||
Values can be used as [statement arguments](http://groue.github.io/GRDB.swift/docs/5.26/Structs/StatementArguments.html):
|
||||
|
||||
```swift
|
||||
let url: URL = ...
|
||||
@@ -1763,7 +1767,7 @@ try dbQueue.inDatabase { db in // or dbPool.writeWithoutTransaction
|
||||
}
|
||||
```
|
||||
|
||||
Transactions can't be left opened unless you set the [allowsUnsafeTransactions](http://groue.github.io/GRDB.swift/docs/5.24/Structs/Configuration.html) configuration flag:
|
||||
Transactions can't be left opened unless you set the [allowsUnsafeTransactions](http://groue.github.io/GRDB.swift/docs/5.26/Structs/Configuration.html) configuration flag:
|
||||
|
||||
```swift
|
||||
// fatal error: A transaction has been left opened at the end of a database access
|
||||
@@ -1875,7 +1879,7 @@ try dbQueue.write { db in
|
||||
}
|
||||
```
|
||||
|
||||
The `?` and colon-prefixed keys like `:name` in the SQL query are the statement arguments. You set them with arrays or dictionaries (arguments are actually of type [StatementArguments](http://groue.github.io/GRDB.swift/docs/5.24/Structs/StatementArguments.html), which happens to adopt the ExpressibleByArrayLiteral and ExpressibleByDictionaryLiteral protocols).
|
||||
The `?` and colon-prefixed keys like `:name` in the SQL query are the statement arguments. You set them with arrays or dictionaries (arguments are actually of type [StatementArguments](http://groue.github.io/GRDB.swift/docs/5.26/Structs/StatementArguments.html), which happens to adopt the ExpressibleByArrayLiteral and ExpressibleByDictionaryLiteral protocols).
|
||||
|
||||
```swift
|
||||
insertStatement.arguments = ["name": "Arthur", "score": 1000]
|
||||
@@ -1958,7 +1962,7 @@ See also `Database.execute(sql:)` in the [Executing Updates](#executing-updates)
|
||||
|
||||
> :point_up: **Note**: it is a programmer error to reuse a prepared statement that has failed: GRDB may crash if you do so.
|
||||
|
||||
For more information about prepared statements, see the [Statement reference](http://groue.github.io/GRDB.swift/docs/5.24/Classes/Statement.html).
|
||||
For more information about prepared statements, see the [Statement reference](http://groue.github.io/GRDB.swift/docs/5.26/Classes/Statement.html).
|
||||
|
||||
|
||||
### Prepared Statements Cache
|
||||
@@ -2701,7 +2705,7 @@ try Place.fetchSet(db, sql: "SELECT ...", arguments:...) // Set<Place>
|
||||
try Place.fetchOne(db, sql: "SELECT ...", arguments:...) // Place?
|
||||
```
|
||||
|
||||
See [fetching methods](#fetching-methods) for information about the `fetchCursor`, `fetchAll`, `fetchSet` and `fetchOne` methods. See [StatementArguments](http://groue.github.io/GRDB.swift/docs/5.24/Structs/StatementArguments.html) for more information about the query arguments.
|
||||
See [fetching methods](#fetching-methods) for information about the `fetchCursor`, `fetchAll`, `fetchSet` and `fetchOne` methods. See [StatementArguments](http://groue.github.io/GRDB.swift/docs/5.26/Structs/StatementArguments.html) for more information about the query arguments.
|
||||
|
||||
> :point_up: **Note**: for performance reasons, the same row argument to `init(row:)` is reused during the iteration of a fetch query. If you want to keep the row for later use, make sure to store a copy: `self.row = row.copy()`.
|
||||
|
||||
@@ -3141,7 +3145,7 @@ protocol EncodableRecord {
|
||||
}
|
||||
```
|
||||
|
||||
See [DatabaseColumnDecodingStrategy](https://groue.github.io/GRDB.swift/docs/5.24/Enums/DatabaseColumnDecodingStrategy.html) and [DatabaseColumnEncodingStrategy](https://groue.github.io/GRDB.swift/docs/5.24/Enums/DatabaseColumnEncodingStrategy.html) to learn about all available strategies.
|
||||
See [DatabaseColumnDecodingStrategy](https://groue.github.io/GRDB.swift/docs/5.26/Enums/DatabaseColumnDecodingStrategy.html) and [DatabaseColumnEncodingStrategy](https://groue.github.io/GRDB.swift/docs/5.26/Enums/DatabaseColumnEncodingStrategy.html) to learn about all available strategies.
|
||||
|
||||
|
||||
### Date and UUID Coding Strategies
|
||||
@@ -3163,7 +3167,7 @@ protocol EncodableRecord {
|
||||
}
|
||||
```
|
||||
|
||||
See [DatabaseDateDecodingStrategy](https://groue.github.io/GRDB.swift/docs/5.24/Enums/DatabaseDateDecodingStrategy.html), [DatabaseDateEncodingStrategy](https://groue.github.io/GRDB.swift/docs/5.24/Enums/DatabaseDateEncodingStrategy.html), and [DatabaseUUIDEncodingStrategy](https://groue.github.io/GRDB.swift/docs/5.24/Enums/DatabaseUUIDEncodingStrategy.html) to learn about all available strategies.
|
||||
See [DatabaseDateDecodingStrategy](https://groue.github.io/GRDB.swift/docs/5.26/Enums/DatabaseDateDecodingStrategy.html), [DatabaseDateEncodingStrategy](https://groue.github.io/GRDB.swift/docs/5.26/Enums/DatabaseDateEncodingStrategy.html), and [DatabaseUUIDEncodingStrategy](https://groue.github.io/GRDB.swift/docs/5.26/Enums/DatabaseUUIDEncodingStrategy.html) to learn about all available strategies.
|
||||
|
||||
There is no customization of uuid decoding, because UUID can already decode all its encoded variants (16-bytes blobs and uuid strings, both uppercase and lowercase).
|
||||
|
||||
@@ -4688,7 +4692,7 @@ Player // SELECT * FROM player
|
||||
```
|
||||
|
||||
|
||||
Raw SQL snippets are also accepted, with eventual [arguments](http://groue.github.io/GRDB.swift/docs/5.24/Structs/StatementArguments.html):
|
||||
Raw SQL snippets are also accepted, with eventual [arguments](http://groue.github.io/GRDB.swift/docs/5.26/Structs/StatementArguments.html):
|
||||
|
||||
```swift
|
||||
// SELECT DATE(creationDate), COUNT(*) FROM player WHERE name = 'Arthur' GROUP BY date(creationDate)
|
||||
@@ -5594,7 +5598,7 @@ try Player.customRequest().fetchAll(db) // [Player]
|
||||
|
||||
- The `adapted(_:)` method eases the consumption of complex rows with [row adapters](#row-adapters). See [Joined Queries Support](#joined-queries-support) for some sample code that uses this method.
|
||||
|
||||
- [AnyFetchRequest](http://groue.github.io/GRDB.swift/docs/5.24/Structs/AnyFetchRequest.html): a type-erased request.
|
||||
- [AnyFetchRequest](http://groue.github.io/GRDB.swift/docs/5.26/Structs/AnyFetchRequest.html): a type-erased request.
|
||||
|
||||
|
||||
## Joined Queries Support
|
||||
@@ -6896,7 +6900,7 @@ DatabaseRegion helps [ValueObservation] and [DatabaseRegionObservation] track ch
|
||||
|
||||
For example, if you observe the region of `Player.select(max(Column("score")))`, then you'll get be notified of all changes performed on the `score` column of the `player` table (updates, insertions and deletions), even if they do not modify the value of the maximum score. However, you will not get any notification for changes performed on other database tables, or updates to other columns of the player table.
|
||||
|
||||
For more details, see the [reference](https://groue.github.io/GRDB.swift/docs/5.24/Structs/DatabaseRegion.html).
|
||||
For more details, see the [reference](https://groue.github.io/GRDB.swift/docs/5.26/Structs/DatabaseRegion.html).
|
||||
|
||||
|
||||
#### The DatabaseRegionConvertible Protocol
|
||||
@@ -7714,12 +7718,36 @@ dbPool.releaseMemory()
|
||||
|
||||
This method blocks the current thread until all current database accesses are completed, and the memory collected.
|
||||
|
||||
> :warning: **Warning**: If `DatabasePool.releaseMemory()` is called while a long read is performed concurrently, then no other read access will be possible until this long read has completed, and the memory has been released. If this does not suit your application needs, look for the asynchronous options below:
|
||||
|
||||
You can release memory in an asynchronous way as well:
|
||||
|
||||
```swift
|
||||
// On a DatabaseQueue
|
||||
dbQueue.asyncWriteWithoutTransaction { db in
|
||||
db.releaseMemory()
|
||||
}
|
||||
|
||||
// On a DatabasePool
|
||||
dbPool.releaseMemoryEventually()
|
||||
```
|
||||
|
||||
`DatabasePool.releaseMemoryEventually()` does not block the current thread, and does not prevent concurrent database accesses. In exchange for this convenience, you don't know when memory has been freed.
|
||||
|
||||
|
||||
### Memory Management on iOS
|
||||
|
||||
**The iOS operating system likes applications that do not consume much memory.**
|
||||
|
||||
[Database queues](#database-queues) and [pools](#database-pools) automatically call the `releaseMemory` method when the application receives a memory warning, and when the application enters background.
|
||||
[Database queues](#database-queues) and [pools](#database-pools) automatically free non-essential memory when the application receives a memory warning, and when the application enters background.
|
||||
|
||||
You can opt out of this automatic memory management:
|
||||
|
||||
```swift
|
||||
var config = Configuration()
|
||||
config.automaticMemoryManagement = false
|
||||
let dbQueue = try DatabaseQueue(path: dbPath, configuration: config) // or DatabasePool
|
||||
```
|
||||
|
||||
|
||||
## Data Protection
|
||||
@@ -8236,7 +8264,7 @@ When this is the case, there are two possible explanations:
|
||||
try db.execute(sql: "UPDATE player SET name = ?", arguments: [name])
|
||||
```
|
||||
|
||||
For more information, see [Double-quoted String Literals Are Accepted](https://sqlite.org/quirks.html#dblquote), and [Configuration.acceptsDoubleQuotedStringLiterals](http://groue.github.io/GRDB.swift/docs/5.24/Structs/Configuration.html#/s:4GRDB13ConfigurationV33acceptsDoubleQuotedStringLiteralsSbvp).
|
||||
For more information, see [Double-quoted String Literals Are Accepted](https://sqlite.org/quirks.html#dblquote), and [Configuration.acceptsDoubleQuotedStringLiterals](http://groue.github.io/GRDB.swift/docs/5.26/Structs/Configuration.html#/s:4GRDB13ConfigurationV33acceptsDoubleQuotedStringLiteralsSbvp).
|
||||
|
||||
|
||||
|
||||
@@ -8377,7 +8405,7 @@ This chapter has [moved](Documentation/Concurrency.md#database-snapshots).
|
||||
|
||||
#### DatabaseWriter and DatabaseReader Protocols
|
||||
|
||||
This chapter was removed. See the references of [DatabaseReader](http://groue.github.io/GRDB.swift/docs/5.24/Protocols/DatabaseReader.html) and [DatabaseWriter](http://groue.github.io/GRDB.swift/docs/5.24/Protocols/DatabaseWriter.html).
|
||||
This chapter was removed. See the references of [DatabaseReader](http://groue.github.io/GRDB.swift/docs/5.26/Protocols/DatabaseReader.html) and [DatabaseWriter](http://groue.github.io/GRDB.swift/docs/5.26/Protocols/DatabaseWriter.html).
|
||||
|
||||
#### Asynchronous APIs
|
||||
|
||||
@@ -8430,7 +8458,7 @@ This chapter was renamed to [Embedding SQL in Query Interface Requests].
|
||||
[Sharing a Database]: Documentation/SharingADatabase.md
|
||||
[FAQ]: #faq
|
||||
[Database Observation]: #database-changes-observation
|
||||
[SQLRequest]: http://groue.github.io/GRDB.swift/docs/5.24/Structs/SQLRequest.html
|
||||
[SQLRequest]: http://groue.github.io/GRDB.swift/docs/5.26/Structs/SQLRequest.html
|
||||
[SQL literal]: Documentation/SQLInterpolation.md#sql-literal
|
||||
[Identifiable]: https://developer.apple.com/documentation/swift/identifiable
|
||||
[Query Interface Organization]: Documentation/QueryInterfaceOrganization.md
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.24.0</string>
|
||||
<string>5.26.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -23,6 +23,11 @@
|
||||
- [ ] Property wrapper that decodes dictionaries (but how to tell the key column?)
|
||||
- [X] See if SQLITE_FCNTL_DATA_VERSION could help working around the lack of snapshots in order to avoid double initial fetch of ValueObservation. Result: no, it does not look it returns values that are comparable between two distinct SQLite connections (from the initial reader, and from the writer thhat starts the observation)
|
||||
- [ ] Grab all FTS tokens in a string
|
||||
- [ ] GRDB 6: Swift 5.7
|
||||
- [ ] GRDB 6: any / some
|
||||
- [ ] GRDB 6: primary associated types (cursor, requests, ...)
|
||||
- [ ] GRDB 6: remove existential/generic duplicated methods
|
||||
- [ ] GRDB 6: remove useless AnyXXX Type erasers
|
||||
- [ ] GRDB 6: decoding errors
|
||||
- [ ] GRDB 6: conflict resolution in persistence methods
|
||||
- [ ] GRDB 6: UPSERT
|
||||
|
||||
@@ -447,6 +447,8 @@
|
||||
565A27CD27871FFF00659A62 /* BackupTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 565A27CB27871FFF00659A62 /* BackupTestCase.swift */; };
|
||||
5691D97527257CE40021D540 /* AvailableElements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5691D97427257CE40021D540 /* AvailableElements.swift */; };
|
||||
5691D97627257CE40021D540 /* AvailableElements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5691D97427257CE40021D540 /* AvailableElements.swift */; };
|
||||
56F61DF0283D484700AF9884 /* getThreadsCount.c in Sources */ = {isa = PBXBuildFile; fileRef = 56F61DEE283D484700AF9884 /* getThreadsCount.c */; };
|
||||
56F61DF1283D484700AF9884 /* getThreadsCount.c in Sources */ = {isa = PBXBuildFile; fileRef = 56F61DEE283D484700AF9884 /* getThreadsCount.c */; };
|
||||
5B33E6E34F941B4C839A714F /* (null) in Frameworks */ = {isa = PBXBuildFile; };
|
||||
98AB0B01EB11B33719AE412E /* Pods_GRDBTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FE2436BF42B9FCD6552E7076 /* Pods_GRDBTests.framework */; };
|
||||
F2B3C4250D67969FF3948955 /* Pods_GRDBTestsEncrypted.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D5C7999E7D9CE7145687F5D /* Pods_GRDBTestsEncrypted.framework */; };
|
||||
@@ -678,6 +680,9 @@
|
||||
564A2156226B8E18001F64F1 /* GRDBTestsEncrypted.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GRDBTestsEncrypted.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
565A27CB27871FFF00659A62 /* BackupTestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BackupTestCase.swift; sourceTree = "<group>"; };
|
||||
5691D97427257CE40021D540 /* AvailableElements.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AvailableElements.swift; sourceTree = "<group>"; };
|
||||
56F61DEC283D484700AF9884 /* GRDBTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "GRDBTests-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
56F61DEE283D484700AF9884 /* getThreadsCount.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = getThreadsCount.c; sourceTree = "<group>"; };
|
||||
56F61DEF283D484700AF9884 /* getThreadsCount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getThreadsCount.h; sourceTree = "<group>"; };
|
||||
6A4788C0F815F6C5E4EBDE12 /* Pods-GRDBTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GRDBTests.debug.xcconfig"; path = "Target Support Files/Pods-GRDBTests/Pods-GRDBTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
7D5C7999E7D9CE7145687F5D /* Pods_GRDBTestsEncrypted.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GRDBTestsEncrypted.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
83BFB5733A86DAA3D0BEE684 /* Pods-GRDBTestsEncrypted.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GRDBTestsEncrypted.debug.xcconfig"; path = "Target Support Files/Pods-GRDBTestsEncrypted/Pods-GRDBTestsEncrypted.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
@@ -768,6 +773,9 @@
|
||||
564A1F1F226B876D001F64F1 /* GRDBTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56F61DEE283D484700AF9884 /* getThreadsCount.c */,
|
||||
56F61DEF283D484700AF9884 /* getThreadsCount.h */,
|
||||
56F61DEC283D484700AF9884 /* GRDBTests-Bridging-Header.h */,
|
||||
564A1F6F226B89D6001F64F1 /* Betty.jpeg */,
|
||||
56419CDA24A54058004967E1 /* InflectionsTests.json */,
|
||||
56419CE724A54058004967E1 /* AnyCursorTests.swift */,
|
||||
@@ -900,11 +908,9 @@
|
||||
56419D0024A5405A004967E1 /* JoinSupportTests.swift */,
|
||||
56419CDC24A54058004967E1 /* MapCursorTests.swift */,
|
||||
56419D0224A5405A004967E1 /* MutablePersistableRecordChangesTests.swift */,
|
||||
56419D3A24A5405F004967E1 /* TableRecordDeleteTests.swift */,
|
||||
56419D2F24A5405E004967E1 /* MutablePersistableRecordEncodableTests.swift */,
|
||||
56419D4424A5405F004967E1 /* MutablePersistableRecordPersistenceConflictPolicyTests.swift */,
|
||||
56419D3B24A5405F004967E1 /* MutablePersistableRecordTests.swift */,
|
||||
56419CD224A54057004967E1 /* TableRecordUpdateTests.swift */,
|
||||
56419CFD24A5405A004967E1 /* NumericOverflowTests.swift */,
|
||||
56419D4F24A54060004967E1 /* OrderedDictionaryTests.swift */,
|
||||
56419D4524A5405F004967E1 /* PersistableRecordTests.swift */,
|
||||
@@ -952,7 +958,9 @@
|
||||
56419D6124A54062004967E1 /* StatementColumnConvertibleFetchTests.swift */,
|
||||
56419D5724A54061004967E1 /* TableDefinitionTests.swift */,
|
||||
56419D4A24A54060004967E1 /* TableRecord+QueryInterfaceRequestTests.swift */,
|
||||
56419D3A24A5405F004967E1 /* TableRecordDeleteTests.swift */,
|
||||
56419CA224A54054004967E1 /* TableRecordTests.swift */,
|
||||
56419CD224A54057004967E1 /* TableRecordUpdateTests.swift */,
|
||||
56419CB624A54055004967E1 /* TransactionObserverSavepointsTests.swift */,
|
||||
56419D0924A5405B004967E1 /* TransactionObserverTests.swift */,
|
||||
56419D2224A5405D004967E1 /* TruncateOptimizationTests.swift */,
|
||||
@@ -1051,10 +1059,10 @@
|
||||
TargetAttributes = {
|
||||
564A1F1C226B876D001F64F1 = {
|
||||
CreatedOnToolsVersion = 10.2.1;
|
||||
LastSwiftMigration = 1150;
|
||||
LastSwiftMigration = 1340;
|
||||
};
|
||||
564A2095226B8E18001F64F1 = {
|
||||
LastSwiftMigration = 1150;
|
||||
LastSwiftMigration = 1340;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -1243,6 +1251,7 @@
|
||||
56419EAB24A54063004967E1 /* DatabaseValueTests.swift in Sources */,
|
||||
56419D7724A54062004967E1 /* DatabaseCursorTests.swift in Sources */,
|
||||
56419E1524A54062004967E1 /* AssociationChainRowScopesTests.swift in Sources */,
|
||||
56F61DF0283D484700AF9884 /* getThreadsCount.c in Sources */,
|
||||
56419EC724A54063004967E1 /* RecordPrimaryKeyMultipleTests.swift in Sources */,
|
||||
56419DF724A54062004967E1 /* DatabaseDateEncodingStrategyTests.swift in Sources */,
|
||||
56419EB724A54063004967E1 /* MutablePersistableRecordPersistenceConflictPolicyTests.swift in Sources */,
|
||||
@@ -1468,6 +1477,7 @@
|
||||
56419EAC24A54063004967E1 /* DatabaseValueTests.swift in Sources */,
|
||||
56419D7824A54062004967E1 /* DatabaseCursorTests.swift in Sources */,
|
||||
56419E1624A54062004967E1 /* AssociationChainRowScopesTests.swift in Sources */,
|
||||
56F61DF1283D484700AF9884 /* getThreadsCount.c in Sources */,
|
||||
56419EC824A54063004967E1 /* RecordPrimaryKeyMultipleTests.swift in Sources */,
|
||||
56419DF824A54062004967E1 /* DatabaseDateEncodingStrategyTests.swift in Sources */,
|
||||
56419EB824A54063004967E1 /* MutablePersistableRecordPersistenceConflictPolicyTests.swift in Sources */,
|
||||
@@ -1766,6 +1776,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "../../GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
@@ -1829,6 +1840,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "../../GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
@@ -1900,6 +1912,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "../../GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
@@ -1964,6 +1977,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "../../GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1340"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "564A2095226B8E18001F64F1"
|
||||
BuildableName = "GRDBTestsEncrypted.xctest"
|
||||
BlueprintName = "GRDBTestsEncrypted"
|
||||
ReferencedContainer = "container:GRDBTests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "564A2095226B8E18001F64F1"
|
||||
BuildableName = "GRDBTestsEncrypted.xctest"
|
||||
BlueprintName = "GRDBTestsEncrypted"
|
||||
ReferencedContainer = "container:GRDBTests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
-24
@@ -20,20 +20,6 @@
|
||||
ReferencedContainer = "container:GRDBTests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "564A2095226B8E18001F64F1"
|
||||
BuildableName = "GRDBTestsEncrypted.xctest"
|
||||
BlueprintName = "GRDBTestsEncrypted"
|
||||
ReferencedContainer = "container:GRDBTests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
@@ -61,16 +47,6 @@
|
||||
ReferencedContainer = "container:GRDBTests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "564A2095226B8E18001F64F1"
|
||||
BuildableName = "GRDBTestsEncrypted.xctest"
|
||||
BlueprintName = "GRDBTestsEncrypted"
|
||||
ReferencedContainer = "container:GRDBTests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
|
||||
@@ -449,6 +449,8 @@
|
||||
565A27CA27871FE500659A62 /* BackupTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 565A27C827871FE500659A62 /* BackupTestCase.swift */; };
|
||||
5691D97227257C930021D540 /* AvailableElements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5691D97127257C930021D540 /* AvailableElements.swift */; };
|
||||
5691D97327257C930021D540 /* AvailableElements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5691D97127257C930021D540 /* AvailableElements.swift */; };
|
||||
56F61DF6283D4AB100AF9884 /* getThreadsCount.c in Sources */ = {isa = PBXBuildFile; fileRef = 56F61DF4283D4AB100AF9884 /* getThreadsCount.c */; };
|
||||
56F61DF7283D4AB100AF9884 /* getThreadsCount.c in Sources */ = {isa = PBXBuildFile; fileRef = 56F61DF4283D4AB100AF9884 /* getThreadsCount.c */; };
|
||||
5B33E6E34F941B4C839A714F /* (null) in Frameworks */ = {isa = PBXBuildFile; };
|
||||
E158370AAEED49ECD53CE24A /* Pods_GRDBTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67377FE4CDAD675809F93AD4 /* Pods_GRDBTests.framework */; };
|
||||
F2B3C4250D67969FF3948955 /* Pods_GRDBTestsEncrypted.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D5C7999E7D9CE7145687F5D /* Pods_GRDBTestsEncrypted.framework */; };
|
||||
@@ -681,6 +683,9 @@
|
||||
564A2158226C8F24001F64F1 /* db.SQLCipher3 */ = {isa = PBXFileReference; lastKnownFileType = file; path = db.SQLCipher3; sourceTree = SOURCE_ROOT; };
|
||||
565A27C827871FE500659A62 /* BackupTestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BackupTestCase.swift; sourceTree = "<group>"; };
|
||||
5691D97127257C930021D540 /* AvailableElements.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AvailableElements.swift; sourceTree = "<group>"; };
|
||||
56F61DF2283D4AB100AF9884 /* GRDBTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "GRDBTests-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
56F61DF4283D4AB100AF9884 /* getThreadsCount.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = getThreadsCount.c; sourceTree = "<group>"; };
|
||||
56F61DF5283D4AB100AF9884 /* getThreadsCount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getThreadsCount.h; sourceTree = "<group>"; };
|
||||
67377FE4CDAD675809F93AD4 /* Pods_GRDBTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GRDBTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
6A4788C0F815F6C5E4EBDE12 /* Pods-GRDBTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GRDBTests.debug.xcconfig"; path = "Target Support Files/Pods-GRDBTests/Pods-GRDBTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
7D5C7999E7D9CE7145687F5D /* Pods_GRDBTestsEncrypted.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GRDBTestsEncrypted.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -771,6 +776,9 @@
|
||||
564A1F1F226B876D001F64F1 /* GRDBTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56F61DF4283D4AB100AF9884 /* getThreadsCount.c */,
|
||||
56F61DF5283D4AB100AF9884 /* getThreadsCount.h */,
|
||||
56F61DF2283D4AB100AF9884 /* GRDBTests-Bridging-Header.h */,
|
||||
564A1F6F226B89D6001F64F1 /* Betty.jpeg */,
|
||||
56419F4E24A54098004967E1 /* InflectionsTests.json */,
|
||||
564A2158226C8F24001F64F1 /* db.SQLCipher3 */,
|
||||
@@ -904,11 +912,9 @@
|
||||
56419F6D24A5409A004967E1 /* JoinSupportTests.swift */,
|
||||
56419F7B24A5409B004967E1 /* MapCursorTests.swift */,
|
||||
56419F4524A54097004967E1 /* MutablePersistableRecordChangesTests.swift */,
|
||||
56419EFF24A54093004967E1 /* TableRecordDeleteTests.swift */,
|
||||
56419F0224A54093004967E1 /* MutablePersistableRecordEncodableTests.swift */,
|
||||
56419F3124A54096004967E1 /* MutablePersistableRecordPersistenceConflictPolicyTests.swift */,
|
||||
56419F0124A54093004967E1 /* MutablePersistableRecordTests.swift */,
|
||||
56419F0624A54093004967E1 /* TableRecordUpdateTests.swift */,
|
||||
56419F0824A54093004967E1 /* NumericOverflowTests.swift */,
|
||||
56419F0324A54093004967E1 /* OrderedDictionaryTests.swift */,
|
||||
56419F1A24A54094004967E1 /* PersistableRecordTests.swift */,
|
||||
@@ -956,7 +962,9 @@
|
||||
56419FA624A5409E004967E1 /* StatementColumnConvertibleFetchTests.swift */,
|
||||
56419F5F24A54099004967E1 /* TableDefinitionTests.swift */,
|
||||
56419F9C24A5409D004967E1 /* TableRecord+QueryInterfaceRequestTests.swift */,
|
||||
56419EFF24A54093004967E1 /* TableRecordDeleteTests.swift */,
|
||||
56419F9024A5409C004967E1 /* TableRecordTests.swift */,
|
||||
56419F0624A54093004967E1 /* TableRecordUpdateTests.swift */,
|
||||
56419F8B24A5409C004967E1 /* TransactionObserverSavepointsTests.swift */,
|
||||
56419F7A24A5409B004967E1 /* TransactionObserverTests.swift */,
|
||||
56419FB624A5409F004967E1 /* TruncateOptimizationTests.swift */,
|
||||
@@ -1055,10 +1063,10 @@
|
||||
TargetAttributes = {
|
||||
564A1F1C226B876D001F64F1 = {
|
||||
CreatedOnToolsVersion = 10.2.1;
|
||||
LastSwiftMigration = 1150;
|
||||
LastSwiftMigration = 1340;
|
||||
};
|
||||
564A2095226B8E18001F64F1 = {
|
||||
LastSwiftMigration = 1150;
|
||||
LastSwiftMigration = 1340;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -1249,6 +1257,7 @@
|
||||
5641A01824A540A1004967E1 /* FoundationDateComponentsTests.swift in Sources */,
|
||||
5641A01E24A540A1004967E1 /* DatabaseDateEncodingStrategyTests.swift in Sources */,
|
||||
56419FCE24A540A1004967E1 /* AssociationBelongsToSQLDerivationTests.swift in Sources */,
|
||||
56F61DF6283D4AB100AF9884 /* getThreadsCount.c in Sources */,
|
||||
5641A0A024A540A1004967E1 /* SQLRequestTests.swift in Sources */,
|
||||
5641A02224A540A1004967E1 /* ValueObservationFetchTests.swift in Sources */,
|
||||
5641A12624A540A1004967E1 /* DatabasePoolSchemaCacheTests.swift in Sources */,
|
||||
@@ -1474,6 +1483,7 @@
|
||||
5641A01924A540A1004967E1 /* FoundationDateComponentsTests.swift in Sources */,
|
||||
5641A01F24A540A1004967E1 /* DatabaseDateEncodingStrategyTests.swift in Sources */,
|
||||
56419FCF24A540A1004967E1 /* AssociationBelongsToSQLDerivationTests.swift in Sources */,
|
||||
56F61DF7283D4AB100AF9884 /* getThreadsCount.c in Sources */,
|
||||
5641A0A124A540A1004967E1 /* SQLRequestTests.swift in Sources */,
|
||||
5641A02324A540A1004967E1 /* ValueObservationFetchTests.swift in Sources */,
|
||||
5641A12724A540A1004967E1 /* DatabasePoolSchemaCacheTests.swift in Sources */,
|
||||
@@ -1775,6 +1785,7 @@
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "../../GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
@@ -1841,6 +1852,7 @@
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "../../GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
@@ -1915,6 +1927,7 @@
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "../../GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
@@ -1982,6 +1995,7 @@
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "../../GRDBTests/GRDBTests-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1340"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "564A2095226B8E18001F64F1"
|
||||
BuildableName = "GRDBTestsEncrypted.xctest"
|
||||
BlueprintName = "GRDBTestsEncrypted"
|
||||
ReferencedContainer = "container:GRDBTests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "564A2095226B8E18001F64F1"
|
||||
BuildableName = "GRDBTestsEncrypted.xctest"
|
||||
BlueprintName = "GRDBTestsEncrypted"
|
||||
ReferencedContainer = "container:GRDBTests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
-24
@@ -20,20 +20,6 @@
|
||||
ReferencedContainer = "container:GRDBTests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "564A2095226B8E18001F64F1"
|
||||
BuildableName = "GRDBTestsEncrypted.xctest"
|
||||
BlueprintName = "GRDBTestsEncrypted"
|
||||
ReferencedContainer = "container:GRDBTests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
@@ -61,16 +47,6 @@
|
||||
ReferencedContainer = "container:GRDBTests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "564A2095226B8E18001F64F1"
|
||||
BuildableName = "GRDBTestsEncrypted.xctest"
|
||||
BlueprintName = "GRDBTestsEncrypted"
|
||||
ReferencedContainer = "container:GRDBTests.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
|
||||
@@ -36,7 +36,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
try Player.fetchCount(db)
|
||||
})
|
||||
let recorder = publisher.record()
|
||||
let value = try wait(for: recorder.single, timeout: 1)
|
||||
let value = try wait(for: recorder.single, timeout: 5)
|
||||
XCTAssertEqual(value, 0)
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
try Row.fetchAll(db, sql: "THIS IS NOT SQL")
|
||||
})
|
||||
let recorder = publisher.record()
|
||||
let recording = try wait(for: recorder.recording, timeout: 1)
|
||||
let recording = try wait(for: recorder.recording, timeout: 5)
|
||||
XCTAssertTrue(recording.output.isEmpty)
|
||||
assertFailure(recording.completion) { (error: DatabaseError) in
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_ERROR)
|
||||
@@ -177,7 +177,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
})
|
||||
|
||||
semaphore.signal()
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
dispatchPrecondition(condition: .onQueue(.main))
|
||||
})
|
||||
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
dispatchPrecondition(condition: .onQueue(queue))
|
||||
})
|
||||
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase {
|
||||
try Player.createTable(db)
|
||||
})
|
||||
let recorder = publisher.record()
|
||||
let recording = try wait(for: recorder.recording, timeout: 1)
|
||||
let recording = try wait(for: recorder.recording, timeout: 5)
|
||||
XCTAssertTrue(recording.output.isEmpty)
|
||||
assertFailure(recording.completion) { (error: DatabaseError) in
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_READONLY)
|
||||
|
||||
@@ -37,7 +37,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
try Player(id: 1, name: "Arthur", score: 1000).insert(db)
|
||||
})
|
||||
let recorder = publisher.record()
|
||||
try wait(for: recorder.single, timeout: 1)
|
||||
try wait(for: recorder.single, timeout: 5)
|
||||
try XCTAssertEqual(writer.read(Player.fetchCount), 1)
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
return try Player.fetchCount(db)
|
||||
})
|
||||
let recorder = publisher.record()
|
||||
let count = try wait(for: recorder.single, timeout: 1)
|
||||
let count = try wait(for: recorder.single, timeout: 5)
|
||||
XCTAssertEqual(count, 1)
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
try db.execute(sql: "THIS IS NOT SQL")
|
||||
})
|
||||
let recorder = publisher.record()
|
||||
let recording = try wait(for: recorder.recording, timeout: 1)
|
||||
let recording = try wait(for: recorder.recording, timeout: 5)
|
||||
XCTAssertTrue(recording.output.isEmpty)
|
||||
assertFailure(recording.completion) { (error: DatabaseError) in
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_ERROR)
|
||||
@@ -117,7 +117,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
try db.execute(sql: "THIS IS NOT SQL")
|
||||
})
|
||||
let recorder = publisher.record()
|
||||
let recording = try wait(for: recorder.recording, timeout: 1)
|
||||
let recording = try wait(for: recorder.recording, timeout: 5)
|
||||
XCTAssertTrue(recording.output.isEmpty)
|
||||
assertFailure(recording.completion) { (error: DatabaseError) in
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_ERROR)
|
||||
@@ -160,7 +160,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
})
|
||||
|
||||
semaphore.signal()
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
expectation.fulfill()
|
||||
})
|
||||
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
expectation.fulfill()
|
||||
})
|
||||
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
updates: { db in try Player(id: 1, name: "Arthur", score: 1000).insert(db) },
|
||||
thenRead: { db, _ in try Player.fetchCount(db) })
|
||||
let recorder = publisher.record()
|
||||
let count = try wait(for: recorder.single, timeout: 1)
|
||||
let count = try wait(for: recorder.single, timeout: 5)
|
||||
XCTAssertEqual(count, 1)
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
updates: { _ in },
|
||||
thenRead: { db, _ in try Player.createTable(db) })
|
||||
let recorder = publisher.record()
|
||||
let recording = try wait(for: recorder.recording, timeout: 1)
|
||||
let recording = try wait(for: recorder.recording, timeout: 5)
|
||||
XCTAssertTrue(recording.output.isEmpty)
|
||||
assertFailure(recording.completion) { (error: DatabaseError) in
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_READONLY)
|
||||
@@ -317,7 +317,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
updates: { db in try db.execute(sql: "THIS IS NOT SQL") },
|
||||
thenRead: { _, _ in XCTFail("Should not read") })
|
||||
let recorder = publisher.record()
|
||||
let recording = try wait(for: recorder.recording, timeout: 1)
|
||||
let recording = try wait(for: recorder.recording, timeout: 5)
|
||||
XCTAssertTrue(recording.output.isEmpty)
|
||||
assertFailure(recording.completion) { (error: DatabaseError) in
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_ERROR)
|
||||
@@ -349,7 +349,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
},
|
||||
thenRead: { _, _ in XCTFail("Should not read") })
|
||||
let recorder = publisher.record()
|
||||
let recording = try wait(for: recorder.recording, timeout: 1)
|
||||
let recording = try wait(for: recorder.recording, timeout: 5)
|
||||
XCTAssertTrue(recording.output.isEmpty)
|
||||
assertFailure(recording.completion) { (error: DatabaseError) in
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_ERROR)
|
||||
@@ -379,7 +379,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
updates: { _ in },
|
||||
thenRead: { db, _ in try Row.fetchAll(db, sql: "THIS IS NOT SQL") })
|
||||
let recorder = publisher.record()
|
||||
let recording = try wait(for: recorder.recording, timeout: 1)
|
||||
let recording = try wait(for: recorder.recording, timeout: 5)
|
||||
XCTAssertTrue(recording.output.isEmpty)
|
||||
assertFailure(recording.completion) { (error: DatabaseError) in
|
||||
XCTAssertEqual(error.resultCode, .SQLITE_ERROR)
|
||||
@@ -421,7 +421,7 @@ class DatabaseWriterWritePublisherTests : XCTestCase {
|
||||
.prefix(1)
|
||||
let recorder = publisher.record()
|
||||
scoreSubject.send(0)
|
||||
let count = try wait(for: recorder.single, timeout: 1)
|
||||
let count = try wait(for: recorder.single, timeout: 5)
|
||||
XCTAssertEqual(count, 1)
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
try! db.execute(sql: "CREATE TABLE t(a)")
|
||||
expectation.fulfill()
|
||||
})
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
}
|
||||
|
||||
try Test(test)
|
||||
@@ -141,7 +141,7 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
expectation.fulfill()
|
||||
})
|
||||
})
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
}
|
||||
|
||||
try Test(test)
|
||||
@@ -224,7 +224,7 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
})
|
||||
|
||||
semaphore.signal()
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
})
|
||||
|
||||
semaphore.signal()
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
expectation.fulfill()
|
||||
})
|
||||
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
expectation.fulfill()
|
||||
})
|
||||
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
cancellable.cancel()
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ class DatabaseMigratorTests : GRDBTestCase {
|
||||
|
||||
expectation.fulfill()
|
||||
})
|
||||
waitForExpectations(timeout: 1, handler: nil)
|
||||
waitForExpectations(timeout: 5, handler: nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,85 @@ class DatabasePoolReleaseMemoryTests: GRDBTestCase {
|
||||
XCTAssertEqual(openConnectionCount, 0)
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
func testDatabasePoolReleasesMemoryOnPressureEvent() throws {
|
||||
// Create a database pool, and expect a reader connection to be closed
|
||||
let expectation = self.expectation(description: "Reader connection closed")
|
||||
|
||||
var configuration = Configuration()
|
||||
configuration.SQLiteConnectionWillClose = { conn in
|
||||
if sqlite3_db_readonly(conn, nil) != 0 {
|
||||
expectation.fulfill()
|
||||
}
|
||||
}
|
||||
let dbPool = try makeDatabasePool(configuration: configuration)
|
||||
|
||||
// Precondition: there is one reader.
|
||||
try dbPool.read { _ in }
|
||||
|
||||
// Simulate memory warning.
|
||||
NotificationCenter.default.post(
|
||||
name: NSNotification.Name(rawValue: "UIApplicationDidReceiveMemoryWarningNotification"),
|
||||
object: nil)
|
||||
|
||||
// Postcondition: reader connection was closed
|
||||
withExtendedLifetime(dbPool) { _ in
|
||||
waitForExpectations(timeout: 0.5)
|
||||
}
|
||||
}
|
||||
|
||||
func testDatabasePoolDoesNotReleaseMemoryOnPressureEventIfDisabled() throws {
|
||||
// Create a database pool, and do not expect any reader connection to be closed
|
||||
let expectation = self.expectation(description: "Reader connection closed")
|
||||
expectation.isInverted = true
|
||||
|
||||
var configuration = Configuration()
|
||||
configuration.automaticMemoryManagement = false
|
||||
configuration.SQLiteConnectionWillClose = { conn in
|
||||
if sqlite3_db_readonly(conn, nil) != 0 {
|
||||
expectation.fulfill()
|
||||
}
|
||||
}
|
||||
let dbPool = try makeDatabasePool(configuration: configuration)
|
||||
|
||||
// Precondition: there is one reader.
|
||||
try dbPool.read { _ in }
|
||||
|
||||
// Simulate memory warning.
|
||||
NotificationCenter.default.post(
|
||||
name: NSNotification.Name(rawValue: "UIApplicationDidReceiveMemoryWarningNotification"),
|
||||
object: nil)
|
||||
|
||||
// Postcondition: no reader connection was closed
|
||||
withExtendedLifetime(dbPool) { _ in
|
||||
waitForExpectations(timeout: 0.5)
|
||||
}
|
||||
}
|
||||
|
||||
// Regression test for <https://github.com/groue/GRDB.swift/pull/1253#issuecomment-1177166630>
|
||||
func testDatabasePoolDoesNotPreventConcurrentReadsOnPressureEvent() throws {
|
||||
let dbPool = try makeDatabasePool()
|
||||
|
||||
// Start a read that blocks
|
||||
let semaphore = DispatchSemaphore(value: 0)
|
||||
dbPool.asyncRead { _ in
|
||||
semaphore.wait()
|
||||
}
|
||||
|
||||
// Simulate memory warning.
|
||||
NotificationCenter.default.post(
|
||||
name: NSNotification.Name(rawValue: "UIApplicationDidReceiveMemoryWarningNotification"),
|
||||
object: nil)
|
||||
|
||||
// Make sure we can read
|
||||
try dbPool.read { _ in }
|
||||
|
||||
// Cleanup
|
||||
semaphore.signal()
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// TODO: fix flaky test
|
||||
// func testDatabasePoolReleaseMemoryClosesReaderConnections() throws {
|
||||
// let countQueue = DispatchQueue(label: "GRDB")
|
||||
|
||||
@@ -76,6 +76,90 @@ class DatabasePoolTests: GRDBTestCase {
|
||||
try migrator.migrate(dbQueue)
|
||||
}
|
||||
|
||||
func testNumberOfThreads_asyncUnsafeRead() throws {
|
||||
#if SWIFT_PACKAGE
|
||||
// Can't access getThreadsCount() C function
|
||||
throw XCTSkip("Thread count is not available")
|
||||
#else
|
||||
if getThreadsCount() < 0 {
|
||||
throw XCTSkip("Thread count is not available")
|
||||
}
|
||||
|
||||
let pool = try makeDatabasePool()
|
||||
|
||||
// Keep this number big, so that we have a good chance to detect
|
||||
// thread explosion.
|
||||
let numberOfConcurrentReads = 10000
|
||||
|
||||
// Wait for all concurrent reads to end
|
||||
let group = DispatchGroup()
|
||||
|
||||
// The maximum number of threads we could witness
|
||||
var maxThreadCount: CInt = 0
|
||||
let lock = NSLock()
|
||||
|
||||
for _ in (0..<numberOfConcurrentReads) {
|
||||
group.enter()
|
||||
pool.asyncUnsafeRead { result in
|
||||
if case let .failure(error) = result {
|
||||
XCTFail("Unexpected error \(error)")
|
||||
}
|
||||
|
||||
let threadsCount = getThreadsCount()
|
||||
lock.lock()
|
||||
maxThreadCount = max(maxThreadCount, threadsCount)
|
||||
lock.unlock()
|
||||
|
||||
group.leave()
|
||||
}
|
||||
}
|
||||
group.wait()
|
||||
XCTAssert(maxThreadCount < 50)
|
||||
#endif
|
||||
}
|
||||
|
||||
func testNumberOfThreads_asyncRead() throws {
|
||||
#if SWIFT_PACKAGE
|
||||
// Can't access getThreadsCount() C function
|
||||
throw XCTSkip("Thread count is not available")
|
||||
#else
|
||||
if getThreadsCount() < 0 {
|
||||
throw XCTSkip("Thread count is not available")
|
||||
}
|
||||
|
||||
let pool = try makeDatabasePool()
|
||||
|
||||
// Keep this number big, so that we have a good chance to detect
|
||||
// thread explosion.
|
||||
let numberOfConcurrentReads = 10000
|
||||
|
||||
// Wait for all concurrent reads to end
|
||||
let group = DispatchGroup()
|
||||
|
||||
// The maximum number of threads we could witness
|
||||
var maxThreadCount: CInt = 0
|
||||
let lock = NSLock()
|
||||
|
||||
for _ in (0..<numberOfConcurrentReads) {
|
||||
group.enter()
|
||||
pool.asyncRead { result in
|
||||
if case let .failure(error) = result {
|
||||
XCTFail("Unexpected error \(error)")
|
||||
}
|
||||
|
||||
let threadsCount = getThreadsCount()
|
||||
lock.lock()
|
||||
maxThreadCount = max(maxThreadCount, threadsCount)
|
||||
lock.unlock()
|
||||
|
||||
group.leave()
|
||||
}
|
||||
}
|
||||
group.wait()
|
||||
XCTAssert(maxThreadCount < 50)
|
||||
#endif
|
||||
}
|
||||
|
||||
// MARK: - Closing
|
||||
|
||||
func testClose() throws {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//
|
||||
// Use this file to import your target's public headers that you would like to expose to Swift.
|
||||
//
|
||||
|
||||
#include "getThreadsCount.h"
|
||||
@@ -80,7 +80,7 @@ class ValueObservationQueryInterfaceRequestTests: GRDBTestCase {
|
||||
|
||||
let recorder = observation.record(in: dbQueue)
|
||||
try dbQueue.writeWithoutTransaction(performDatabaseModifications)
|
||||
let results = try wait(for: recorder.next(6), timeout: 1)
|
||||
let results = try wait(for: recorder.next(6), timeout: 5)
|
||||
|
||||
XCTAssertNil(results[0])
|
||||
|
||||
@@ -117,7 +117,7 @@ class ValueObservationQueryInterfaceRequestTests: GRDBTestCase {
|
||||
|
||||
let recorder = observation.record(in: dbQueue)
|
||||
try dbQueue.writeWithoutTransaction(performDatabaseModifications)
|
||||
let results = try wait(for: recorder.next(6), timeout: 1)
|
||||
let results = try wait(for: recorder.next(6), timeout: 5)
|
||||
|
||||
XCTAssertEqual(results[0].count, 0)
|
||||
|
||||
|
||||
@@ -422,13 +422,6 @@ extension GRDBTestCase {
|
||||
throws
|
||||
where Reducer.Value: Equatable
|
||||
{
|
||||
#if SQLITE_HAS_CODEC || GRDBCUSTOMSQLITE
|
||||
// debug SQLite builds can be *very* slow
|
||||
let timeout: TimeInterval = 4
|
||||
#else
|
||||
let timeout: TimeInterval = 1
|
||||
#endif
|
||||
|
||||
func test(
|
||||
observation: ValueObservation<Reducer>,
|
||||
scheduling scheduler: ValueObservationScheduler,
|
||||
@@ -455,7 +448,7 @@ extension GRDBTestCase {
|
||||
try writer.writeWithoutTransaction(recordedUpdates)
|
||||
|
||||
let expectation = recorder.next(expectedValues.count)
|
||||
let values = try wait(for: expectation, timeout: timeout)
|
||||
let values = try wait(for: expectation, timeout: 5)
|
||||
XCTAssertEqual(
|
||||
values, expectedValues,
|
||||
"\(#function), \(writer), \(scheduler)", file: file, line: line)
|
||||
@@ -485,7 +478,7 @@ extension GRDBTestCase {
|
||||
}
|
||||
|
||||
let expectation = recorder.next(expectedValues.count)
|
||||
let values = try wait(for: expectation, timeout: timeout)
|
||||
let values = try wait(for: expectation, timeout: 5)
|
||||
XCTAssertEqual(
|
||||
values, expectedValues,
|
||||
"\(#function), \(writer), \(scheduler)", file: file, line: line)
|
||||
@@ -516,14 +509,14 @@ extension GRDBTestCase {
|
||||
if waitForLast {
|
||||
// Optimization!
|
||||
let expectation = recorder.prefix(until: { $0 == lastExpectedValue } )
|
||||
recordedValues = try wait(for: expectation, timeout: timeout)
|
||||
recordedValues = try wait(for: expectation, timeout: 5)
|
||||
} else {
|
||||
// Slow!
|
||||
assertionFailure("Please rewrite your test, because it is too slow: make sure the last expected value is unique.")
|
||||
let expectation = recorder
|
||||
.prefix(expectedValues.count + 2 /* pool may perform double initial fetch */)
|
||||
.inverted
|
||||
recordedValues = try wait(for: expectation, timeout: timeout)
|
||||
recordedValues = try wait(for: expectation, timeout: 5)
|
||||
}
|
||||
|
||||
if scheduler.immediateInitialValue() {
|
||||
@@ -565,14 +558,14 @@ extension GRDBTestCase {
|
||||
if waitForLast {
|
||||
// Optimization!
|
||||
let expectation = recorder.prefix(until: { $0 == lastExpectedValue } )
|
||||
recordedValues = try wait(for: expectation, timeout: timeout)
|
||||
recordedValues = try wait(for: expectation, timeout: 5)
|
||||
} else {
|
||||
// Slow!
|
||||
assertionFailure("Please rewrite your test, because it is too slow: make sure the last expected value is unique.")
|
||||
let expectation = recorder
|
||||
.prefix(expectedValues.count + 2 /* pool may perform double initial fetch */)
|
||||
.inverted
|
||||
recordedValues = try wait(for: expectation, timeout: timeout)
|
||||
recordedValues = try wait(for: expectation, timeout: 5)
|
||||
}
|
||||
|
||||
XCTAssertEqual(recordedValues.first, expectedValues.first)
|
||||
@@ -639,13 +632,6 @@ extension GRDBTestCase {
|
||||
line: UInt)
|
||||
throws
|
||||
{
|
||||
#if SQLITE_HAS_CODEC || GRDBCUSTOMSQLITE
|
||||
// debug SQLite builds can be *very* slow
|
||||
let timeout: TimeInterval = 2
|
||||
#else
|
||||
let timeout: TimeInterval = 1
|
||||
#endif
|
||||
|
||||
func test(
|
||||
observation: ValueObservation<Reducer>,
|
||||
scheduling scheduler: ValueObservationScheduler,
|
||||
@@ -659,7 +645,7 @@ extension GRDBTestCase {
|
||||
scheduling: scheduler,
|
||||
onError: { _ in testErrorDispatching() })
|
||||
|
||||
let (_, error) = try wait(for: recorder.failure(), timeout: timeout)
|
||||
let (_, error) = try wait(for: recorder.failure(), timeout: 5)
|
||||
if let error = error as? Failure {
|
||||
try testFailure(error, writer)
|
||||
} else {
|
||||
|
||||
@@ -418,39 +418,38 @@ class ValueObservationTests: GRDBTestCase {
|
||||
return try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM t")!
|
||||
}
|
||||
|
||||
#if SQLITE_ENABLE_SNAPSHOT
|
||||
let expectation = self.expectation(description: "")
|
||||
expectation.expectedFulfillmentCount = 2
|
||||
var observedCounts: [Int] = []
|
||||
let cancellable = observation.start(
|
||||
in: dbPool,
|
||||
scheduling: .async(onQueue: .main),
|
||||
onError: { error in XCTFail("Unexpected error: \(error)") },
|
||||
onChange: { count in
|
||||
observedCounts.append(count)
|
||||
expectation.fulfill()
|
||||
})
|
||||
withExtendedLifetime(cancellable) {
|
||||
waitForExpectations(timeout: 2, handler: nil)
|
||||
XCTAssertEqual(observedCounts, [0, 1])
|
||||
}
|
||||
let expectedCounts: [Int]
|
||||
#if os(macOS) || targetEnvironment(macCatalyst) || GRDBCIPHER || (GRDBCUSTOMSQLITE && !SQLITE_ENABLE_SNAPSHOT) || compiler(<5.7)
|
||||
// Optimization not available
|
||||
expectedCounts = [0, 0, 1]
|
||||
#elseif GRDBCUSTOMSQLITE
|
||||
// Optimization available
|
||||
expectedCounts = [0, 1]
|
||||
#else
|
||||
let expectation = self.expectation(description: "")
|
||||
expectation.expectedFulfillmentCount = 3
|
||||
var observedCounts: [Int] = []
|
||||
let cancellable = observation.start(
|
||||
in: dbPool,
|
||||
scheduling: .async(onQueue: .main),
|
||||
onError: { error in XCTFail("Unexpected error: \(error)") },
|
||||
onChange: { count in
|
||||
observedCounts.append(count)
|
||||
expectation.fulfill()
|
||||
})
|
||||
withExtendedLifetime(cancellable) {
|
||||
waitForExpectations(timeout: 2, handler: nil)
|
||||
XCTAssertEqual(observedCounts, [0, 0, 1])
|
||||
if #available(macOS 10.12, watchOS 3.0, tvOS 10.0, *) {
|
||||
// Optimization available
|
||||
expectedCounts = [0, 1]
|
||||
} else {
|
||||
// Optimization not available
|
||||
expectedCounts = [0, 0, 1]
|
||||
}
|
||||
#endif
|
||||
|
||||
let expectation = self.expectation(description: "")
|
||||
expectation.expectedFulfillmentCount = expectedCounts.count
|
||||
var observedCounts: [Int] = []
|
||||
let cancellable = observation.start(
|
||||
in: dbPool,
|
||||
scheduling: .async(onQueue: .main),
|
||||
onError: { error in XCTFail("Unexpected error: \(error)") },
|
||||
onChange: { count in
|
||||
observedCounts.append(count)
|
||||
expectation.fulfill()
|
||||
})
|
||||
withExtendedLifetime(cancellable) {
|
||||
waitForExpectations(timeout: 2, handler: nil)
|
||||
XCTAssertEqual(observedCounts, expectedCounts)
|
||||
}
|
||||
}
|
||||
|
||||
func testAllowedSnapshotOptimizationWithImmediateScheduler() throws {
|
||||
@@ -477,39 +476,38 @@ class ValueObservationTests: GRDBTestCase {
|
||||
return try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM t")!
|
||||
}
|
||||
|
||||
#if SQLITE_ENABLE_SNAPSHOT
|
||||
let expectation = self.expectation(description: "")
|
||||
expectation.expectedFulfillmentCount = 2
|
||||
var observedCounts: [Int] = []
|
||||
let cancellable = observation.start(
|
||||
in: dbPool,
|
||||
scheduling: .immediate,
|
||||
onError: { error in XCTFail("Unexpected error: \(error)") },
|
||||
onChange: { count in
|
||||
observedCounts.append(count)
|
||||
expectation.fulfill()
|
||||
})
|
||||
withExtendedLifetime(cancellable) {
|
||||
waitForExpectations(timeout: 2, handler: nil)
|
||||
XCTAssertEqual(observedCounts, [0, 1])
|
||||
}
|
||||
let expectedCounts: [Int]
|
||||
#if os(macOS) || targetEnvironment(macCatalyst) || GRDBCIPHER || (GRDBCUSTOMSQLITE && !SQLITE_ENABLE_SNAPSHOT) || compiler(<5.7)
|
||||
// Optimization not available
|
||||
expectedCounts = [0, 0, 1]
|
||||
#elseif GRDBCUSTOMSQLITE
|
||||
// Optimization available
|
||||
expectedCounts = [0, 1]
|
||||
#else
|
||||
let expectation = self.expectation(description: "")
|
||||
expectation.expectedFulfillmentCount = 3
|
||||
var observedCounts: [Int] = []
|
||||
let cancellable = observation.start(
|
||||
in: dbPool,
|
||||
scheduling: .immediate,
|
||||
onError: { error in XCTFail("Unexpected error: \(error)") },
|
||||
onChange: { count in
|
||||
observedCounts.append(count)
|
||||
expectation.fulfill()
|
||||
})
|
||||
withExtendedLifetime(cancellable) {
|
||||
waitForExpectations(timeout: 2, handler: nil)
|
||||
XCTAssertEqual(observedCounts, [0, 0, 1])
|
||||
if #available(macOS 10.12, watchOS 3.0, tvOS 10.0, *) {
|
||||
// Optimization available
|
||||
expectedCounts = [0, 1]
|
||||
} else {
|
||||
// Optimization not available
|
||||
expectedCounts = [0, 0, 1]
|
||||
}
|
||||
#endif
|
||||
|
||||
let expectation = self.expectation(description: "")
|
||||
expectation.expectedFulfillmentCount = expectedCounts.count
|
||||
var observedCounts: [Int] = []
|
||||
let cancellable = observation.start(
|
||||
in: dbPool,
|
||||
scheduling: .immediate,
|
||||
onError: { error in XCTFail("Unexpected error: \(error)") },
|
||||
onChange: { count in
|
||||
observedCounts.append(count)
|
||||
expectation.fulfill()
|
||||
})
|
||||
withExtendedLifetime(cancellable) {
|
||||
waitForExpectations(timeout: 2, handler: nil)
|
||||
XCTAssertEqual(observedCounts, expectedCounts)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Cancellation
|
||||
@@ -728,11 +726,11 @@ class ValueObservationTests: GRDBTestCase {
|
||||
})
|
||||
}
|
||||
|
||||
wait(for: [initialValueExpectation], timeout: 1)
|
||||
wait(for: [initialValueExpectation], timeout: 5)
|
||||
dbWriter.asyncWriteWithoutTransaction {
|
||||
try! $0.execute(sql: "INSERT INTO t DEFAULT VALUES")
|
||||
}
|
||||
wait(for: [changeExpectation], timeout: 1)
|
||||
wait(for: [changeExpectation], timeout: 5)
|
||||
|
||||
// Cleanup
|
||||
for cancellable in cancellables { cancellable.cancel() }
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#include <unistd.h>
|
||||
#include <mach/mach.h>
|
||||
#include "getThreadsCount.h"
|
||||
|
||||
// https://stackoverflow.com/a/21571172/525656
|
||||
int getThreadsCount(void) {
|
||||
thread_array_t threadList;
|
||||
mach_msg_type_number_t threadCount;
|
||||
task_t task;
|
||||
|
||||
kern_return_t kernReturn = task_for_pid(mach_task_self(), getpid(), &task);
|
||||
if (kernReturn != KERN_SUCCESS) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
kernReturn = task_threads(task, &threadList, &threadCount);
|
||||
if (kernReturn != KERN_SUCCESS) {
|
||||
return -1;
|
||||
}
|
||||
vm_deallocate (mach_task_self(), (vm_address_t)threadList, threadCount * sizeof(thread_act_t));
|
||||
|
||||
return threadCount;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#ifndef getThreadsCount_h
|
||||
#define getThreadsCount_h
|
||||
|
||||
/// Returns the number of mach threads, or -1 in case of error.
|
||||
int getThreadsCount(void);
|
||||
|
||||
#endif /* getThreadsCount_h */
|
||||
+6
-6
@@ -14,8 +14,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/realm/realm-core",
|
||||
"state" : {
|
||||
"revision" : "dcd3788f75bafb0cc397d145e1651aab3ad4bf0e",
|
||||
"version" : "11.12.0"
|
||||
"revision" : "d97eed3ae7dff2f2e2ffbda83fa8f3b8c445c6ba",
|
||||
"version" : "11.17.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -23,8 +23,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/realm/realm-swift.git",
|
||||
"state" : {
|
||||
"revision" : "628cf20632d65d3a3e90ae8aaf52bce596d7ad8f",
|
||||
"version" : "10.24.2"
|
||||
"revision" : "7f123e48ec12926bb5080e449df360127ee0352d",
|
||||
"version" : "10.26.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -32,8 +32,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/stephencelis/SQLite.swift.git",
|
||||
"state" : {
|
||||
"revision" : "5f5ad81ac0d0a0f3e56e39e646e8423c617df523",
|
||||
"version" : "0.13.2"
|
||||
"revision" : "4d543d811ee644fa4cc4bfa0be996b4dd6ba0f54",
|
||||
"version" : "0.13.3"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user