Compare commits

...
69 Commits
Author SHA1 Message Date
Gwendal Roué 58e05d13d1 v2.4.1 2017-12-16 15:09:59 +01:00
Gwendal Roué d8c9692d4d Fix typo 2017-12-16 14:40:58 +01:00
Gwendal Roué f83ffd3a25 Remove unused file 2017-12-16 14:35:09 +01:00
Gwendal Roué d12ff2a92b Scripts that generate performance comparison report 2017-12-16 14:35:02 +01:00
Gwendal Roué 8709d6f9a9 FMDB 2.7.4 2017-12-16 14:25:24 +01:00
Gwendal Roué e2806c55ff Upgrade Makefile test_performance target for Xcode 9.2 and Swift 4.0.3 2017-12-16 13:44:19 +01:00
Gwendal Roué 08d6c843d6 Upgrade performance comparison tests for Xcode 9.2 and Swift 4.0.3 2017-12-16 13:42:53 +01:00
Gwendal Roué 0da3726a89 Realm 3.0.2 2017-12-16 13:36:13 +01:00
Gwendal Roué 36676bcad3 SQLite.swift 0.11.4 2017-12-16 13:33:36 +01:00
Gwendal Roué 1509e1e9a8 Clean up projects & workspace 2017-12-16 13:29:05 +01:00
Gwendal Roué 4c71dd9ebe Remove compiler warning 2017-12-16 13:14:07 +01:00
Gwendal Roué ef8d0d6334 TODO.md 2017-12-15 18:49:36 +01:00
Gwendal Roué 7477b7a173 CHANGELOG.md 2017-12-13 08:24:14 +01:00
Gwendal Roué 246f36821b Merge pull request #284 from groue/Issue283
Don't call sqlite3_config() unless explicitly required to do so
2017-12-13 08:10:57 +01:00
Gwendal Roué d567ee60bf Remove compiler warning 2017-12-08 10:51:31 +01:00
Gwendal Roué 3a157d2808 Test for global SQLite error log requires global variables 2017-12-08 10:51:20 +01:00
Gwendal Roué 7d0c2f9ef8 Fix tests for Database.logError 2017-12-08 10:03:27 +01:00
Gwendal Roué f356f8734a Update Database.logError documentation, and make it clear that it has to be called very very early. 2017-12-07 13:35:19 +01:00
Gwendal Roué 5b7f4a7ff5 Call sqlite3_config(SQLITE_CONFIG_LOG, ...) if and only if Database.logError is set. 2017-12-07 13:14:49 +01:00
Gwendal Roué e10efca17a Fix typo 2017-12-03 16:27:59 +01:00
Gwendal Roué 578b9a5275 v2.4.0 2017-12-03 16:04:07 +01:00
Gwendal Roué 63304b3d12 Merge pull request #281 from groue/DropSynchronizationTriggers
Drop full-text synchronization triggers
2017-12-03 15:57:08 +01:00
Gwendal Roué 39f6ca0035 Merge branch 'master' into DropSynchronizationTriggers 2017-12-03 15:56:23 +01:00
Gwendal Roué 5e3c62c963 Merge pull request #282 from groue/preventXcodeWarningsForMissingFiles
Prevent Xcode warnings for missing files
2017-12-03 15:55:14 +01:00
Gwendal Roué 6966600223 Fix scheme references to projects 2017-12-03 14:41:16 +01:00
Gwendal Roué e028cbb6d5 Declare new GRDBCipher.xcodeproj and GRDBCustom.xcodeproj in CHANGELOG.md 2017-12-03 14:37:21 +01:00
Gwendal Roué 8b3c3f48a8 Update documention for embedding GRDBCipher & GRDBCustom 2017-12-03 14:23:49 +01:00
Gwendal Roué 2d84e72097 Restore GRDBOSXPerformanceComparisonTests 2017-12-03 14:20:08 +01:00
Gwendal Roué d91fe7b633 Extract GRDBCipher.xcodeproj and GRDBCustom.xcodeproj from GRDB.xcodeproj 2017-12-03 14:07:05 +01:00
Gwendal Roué 090df10831 Revert attempt at preventing Xcode warnings with Run Script phases 2017-12-03 12:52:37 +01:00
Gwendal Roué f21037bb69 Run make preventXcodeWarningsForMissingFiles as a Run Script Phase in all targets except custom SQLite 2017-12-01 13:47:06 +01:00
Gwendal Roué f3041bcc9a Run make preventXcodeWarningsForMissingFiles as a Run Script Phase in the GRDBiOS target 2017-12-01 13:41:47 +01:00
Gwendal Roué 67b1225dfa make preventXcodeWarningsForMissingFiles 2017-12-01 13:37:02 +01:00
Gwendal Roué 23f2e0371e Fix documentation typo 2017-12-01 13:24:04 +01:00
Gwendal Roué a3d8df222f Fix documentation typo 2017-12-01 13:20:17 +01:00
Gwendal Roué 632ef3707c CHANGELOG.md 2017-12-01 13:17:58 +01:00
Gwendal Roué 79dc099e6d Documentation for Database.dropFTS4SynchronizationTriggers & Database.dropFTS5SynchronizationTriggers 2017-12-01 13:17:54 +01:00
Gwendal Roué 75035fb40c Documentation for Database.dropFTS4SynchronizationTriggers & Database.dropFTS5SynchronizationTriggers 2017-12-01 13:14:30 +01:00
Gwendal Roué b4887b661c Tests for Database.dropFTS4SynchronizationTriggers & Database.dropFTS5SynchronizationTriggers 2017-12-01 13:14:24 +01:00
Gwendal Roué e8835af363 Database.dropFTS4SynchronizationTriggers & Database.dropFTS5SynchronizationTriggers 2017-12-01 13:14:13 +01:00
Gwendal Roué 1fabe08332 Trust SQLite: don't assert anything about the remaining characters after a statement 2017-11-30 08:53:10 +01:00
Gwendal Roué c2e3638e8d More failing tests for Database.execute() 2017-11-30 08:50:42 +01:00
Gwendal Roué 71abced420 CHANGELOG.md 2017-11-30 08:09:15 +01:00
Gwendal Roué ac00046b07 CHANGELOG.md 2017-11-29 20:29:33 +01:00
Gwendal Roué 38b5204713 Merge pull request #280 from groue/AddUntypedColumn
Table alteration: add untyped column
2017-11-29 20:21:13 +01:00
Gwendal Roué 4b173dece5 Test for t.add(column:) without any explicit column type 2017-11-29 20:17:26 +01:00
Gwendal Roué 8ce2c09b52 TableAlteration.add(column:type:) accepts nil type 2017-11-29 20:11:28 +01:00
Gwendal Roué 8125574f8f Fix typo in ISSUE_TEMPLATE.md 2017-11-22 08:56:48 +01:00
Gwendal Roué 8974360cac ISSUE_TEMPLATE.md 2017-11-22 08:24:21 +01:00
Gwendal Roué 6e48cc1524 Reminder: enable sanitizers when running tests 2017-11-11 06:43:59 +01:00
Gwendal Roué a1ea75ca34 TODO.md 2017-11-10 12:58:04 +01:00
Gwendal Roué 81d2f21093 Cleanup 2017-11-10 08:45:05 +01:00
Gwendal Roué fd73a31abc Fix failing tests and faulty assert 2017-11-09 14:29:59 +01:00
Gwendal Roué 1583ac0c08 Add failing test for Database.execute() 2017-11-09 14:29:35 +01:00
Gwendal Roué cafbecd8af v2.3.1 2017-11-08 07:50:58 +01:00
Gwendal Roué 78c36612b7 Enhance documentation of Codable Records 2017-11-07 19:29:51 +01:00
Gwendal Roué a95385c740 Simplify TransactionObserverTests with Codable 2017-11-07 19:22:54 +01:00
Gwendal Roué a58ebf7c48 CHANGELOG.md 2017-11-07 17:47:24 +01:00
Gwendal Roué 13623575ff Fix encryption tests broken by 681460a415 2017-11-07 17:21:32 +01:00
Gwendal Roué 87c5f913b8 CHANGELOG.md 2017-11-07 14:56:51 +01:00
Gwendal Roué 41172d7967 Documentation: no more exception for empty deferred transactions 2017-11-07 14:42:58 +01:00
Gwendal Roué 820bc87cfe No more exception for empty deferred transactions 2017-11-07 14:42:02 +01:00
Gwendal Roué 2901acfb41 Refactor tests of observation of transaction completion. Make them fail for empty deferred transactions. 2017-11-07 13:55:17 +01:00
Gwendal Roué 681460a415 Tests: generate a unique database by default 2017-11-07 13:54:19 +01:00
Gwendal Roué 19b067405f v2.3.0 2017-11-05 13:56:10 +01:00
Gwendal Roué 3b494b5737 Update SQLite to 3.21.0 2017-11-05 11:21:46 +01:00
Gwendal Roué 5f11a19296 Travis: use Xcode 9.1 2017-11-01 13:19:12 +01:00
Gwendal Roué 3ff7675eb7 Makefile: add support for Xcode 9.1 and Xcode 9.2 beta 1 2017-11-01 13:13:05 +01:00
Gwendal Roué 3d06841eba Remove Xcode9.1 warnings about deprecated string.characters 2017-11-01 07:33:03 +01:00
53 changed files with 7061 additions and 4843 deletions

No files matched your search

+41 -38
View File
@@ -1,3 +1,6 @@
# The OS X Build Environment
# https://docs.travis-ci.com/user/reference/osx/#Xcode-version
language: objective-c
xcode_project: GRDB.xcodeproj
@@ -12,98 +15,98 @@ jobs:
###########################################
## Test GRDB
# Test GRDBOSX (Xcode 9)
# Test GRDBOSX (Xcode 9.1)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode9.1
env:
- TID=GRDBOSX (Xcode 9, macOS 10.12)
- TID=GRDBOSX (Xcode 9.1, macOS)
script: make test_framework_GRDBOSX
# Test GRDBWatchOS (Xcode 9)
# Test GRDBWatchOS (Xcode 9.1)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode9.1
env:
- TID=GRDBWatchOS (Xcode 9, watchOS)
- TID=GRDBWatchOS (Xcode 9.1, watchOS)
script: make test_framework_GRDBWatchOS
# Test GRDBiOS (Xcode 9, iOS <MAXIMUM VERSION>)
# Test GRDBiOS (Xcode 9.1, iOS <MAXIMUM VERSION>)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode9.1
env:
- TID=GRDBiOS (Xcode 9, iOS <MAX>)
- TID=GRDBiOS (Xcode 9.1, iOS <MAX>)
script: make test_framework_GRDBiOS_maxTarget
# Test GRDBiOS (Xcode 9, iOS <MINIMUM VERSION>))
# Test GRDBiOS (Xcode 9.1, iOS <MINIMUM VERSION>))
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode9.1
env:
- TID=GRDBiOS (Xcode 9, iOS <MIN>)
- TID=GRDBiOS (Xcode 9.1, iOS <MIN>)
script: make test_framework_GRDBiOS_minTarget
# Test GRDB [SPM] (Xcode 9, macOS 10.12)
# Test GRDB [SPM] (Xcode 9.1, macOS)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode9.1
env:
- TID=GRDB [SPM] (Xcode 9, macOS 10.12)
- TID=GRDB [SPM] (Xcode 9.1, macOS)
script: make test_SPM
###########################################
## Test GRDB (Custom SQLite)
# Test GRDBCustomSQLiteOSX (Xcode 9)
# Test GRDBCustomSQLiteOSX (Xcode 9.1)
- stage: Test GRDB + Custom SQLite
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode9.1
env:
- TID=GRDBCustomSQLiteOSX (Xcode 9, macOS 10.12)
- TID=GRDBCustomSQLiteOSX (Xcode 9.1, macOS)
script: make test_framework_GRDBCustomSQLiteOSX
# Test GRDBCustomSQLiteiOS (Xcode 9, iOS <MAXIMUM VERSION>)
# Test GRDBCustomSQLiteiOS (Xcode 9.1, iOS <MAXIMUM VERSION>)
- stage: Test GRDB + Custom SQLite
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode9.1
env:
- TID=GRDBCustomSQLiteiOS (Xcode 9, iOS <MAX>)
- TID=GRDBCustomSQLiteiOS (Xcode 9.1, iOS <MAX>)
script: make test_framework_GRDBCustomSQLiteiOS_maxTarget
# Test GRDBCustomSQLiteiOS (Xcode 9, iOS <MINIMUM VERSION>))
# Test GRDBCustomSQLiteiOS (Xcode 9.1, iOS <MINIMUM VERSION>))
- stage: Test GRDB + Custom SQLite
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode9.1
env:
- TID=GRDBCustomSQLiteiOS (Xcode 9, iOS <MIN>)
- TID=GRDBCustomSQLiteiOS (Xcode 9.1, iOS <MIN>)
script: make test_framework_GRDBCustomSQLiteiOS_minTarget
###########################################
## Test GRDB (SQLCipher)
# Test GRDBCipherOSX (Xcode 9)
# Test GRDBCipherOSX (Xcode 9.1)
- stage: Test GRDB + SQLCipher
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode9.1
env:
- TID=GRDBCipherOSX (Xcode 9, macOS 10.12)
- TID=GRDBCipherOSX (Xcode 9.1, macOS)
script: make test_framework_GRDBCipherOSX
# Test GRDBCipheriOS (Xcode 9, iOS <MAXIMUM VERSION>)
# Test GRDBCipheriOS (Xcode 9.1, iOS <MAXIMUM VERSION>)
- stage: Test GRDB + SQLCipher
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode9.1
env:
- TID=GRDBCipheriOS (Xcode 9, iOS <MAX>)
- TID=GRDBCipheriOS (Xcode 9.1, iOS <MAX>)
script: make test_framework_GRDBCipheriOS_maxTarget
# Test GRDBCipheriOS (Xcode 9, iOS <MINIMUM VERSION>))
# Test GRDBCipheriOS (Xcode 9.1, iOS <MINIMUM VERSION>))
- stage: Test GRDB + SQLCipher
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode9.1
env:
- TID=GRDBCipheriOS (Xcode 9, iOS <MIN>)
- TID=GRDBCipheriOS (Xcode 9.1, iOS <MIN>)
script: make test_framework_GRDBCipheriOS_minTarget
###########################################
@@ -112,7 +115,7 @@ jobs:
# Manual Install
- stage: Test Installation
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode9.1
env:
- TID=Manual Install
script: make test_install_manual
@@ -120,14 +123,14 @@ jobs:
# Manual Install (GRDBCipher)
- stage: Test Installation
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode9.1
env:
- TID=Manual Install (GRDBCipher)
script: make test_install_GRDBCipher
# Cocoapods Lint
- stage: Test Installation
osx_image: xcode9
osx_image: xcode9.1
install:
- gem install cocoapods # Since Travis is not always on latest version
env:
@@ -136,7 +139,7 @@ jobs:
# SPM Install
- stage: Test Installation
osx_image: xcode9
osx_image: xcode9.1
env:
- TID=SPM
script: make test_install_SPM
@@ -145,7 +148,7 @@ jobs:
## Commented out until `make test_CarthageBuild` performs *reliably*.
## See https://github.com/groue/GRDB.swift/pull/262
# - stage: Test Installation
# osx_image: xcode9
# osx_image: xcode9.1
# before_install:
# - brew update
# - brew outdated carthage || brew upgrade carthage
+57
View File
@@ -1,6 +1,63 @@
Release Notes
=============
## 2.4.1
Released December 16, 2017 &bull; [diff](https://github.com/groue/GRDB.swift/compare/v2.4.0...v2.4.1)
**Fixed**
- [#284](https://github.com/groue/GRDB.swift/pull/284): fixes a misuse of the sqlite3_config() function when configuring the global SQLite [Error Log](https://github.com/groue/GRDB.swift/blob/master/README.md#error-log)
## 2.4.0
Released December 3, 2017 &bull; [diff](https://github.com/groue/GRDB.swift/compare/v2.3.1...v2.4.0)
**New**
- [#280](https://github.com/groue/GRDB.swift/pull/280): It is now possible to add an untyped column to an existing table.
```swift
try db.alter(table: "players") { t in
t.add(column: "score")
}
```
- [#281](https://github.com/groue/GRDB.swift/pull/280): The `Database.dropFTS4SynchronizationTriggers` & `Database.dropFTS5SynchronizationTriggers` method help cleaning up synchronized full-text table ([documentation](https://github.com/groue/GRDB.swift/blob/master/README.md#deleting-synchronized-full-text-tables))
**Breaking Change**
- [#282](https://github.com/groue/GRDB.swift/issues/282): This version comes with a breaking change that affects users who manually embed the GRDBCipher and GRDBCustom frameworks in their projects. This change does not affect users of the GRDB framework, or users of GRDBCipher through CocoaPods. Now, instead of embedding the GRDB.xcodeproj project, you have to embed the GRDBCipher.xcodeproj or GRDBCustom.xcodeproj. Please have a look at the updated [Encryption](https://github.com/groue/GRDB.swift/blob/master/README.md#encryption) and [Custom SQLite Builds](https://github.com/groue/GRDB.swift/blob/master/Documentation/CustomSQLiteBuilds.md) documentation chapters.
## 2.3.1
Released November 8, 2017 &bull; [diff](https://github.com/groue/GRDB.swift/compare/v2.3.0...v2.3.1)
**Fixed**
- GRDB 2.2.0 has introduced a fix in the way [transaction observers](https://github.com/groue/GRDB.swift/blob/master/README.md#transactionobserver-protocol) are notified of empty deferred transactions (`BEGIN; COMMIT;`). That fix was incomplete, and inconsistent.
Now all transactions are notified, without any exception, including:
```swift
try db.execute("BEGIN; COMMIT;")
try db.execute("SAVEPOINT foo; RELEASE SAVEPOINT foo;")
```
[Rationale](https://github.com/groue/GRDB.swift/commit/820bc87cfeee701743da852f3634e2c695e911ee#diff-3e791e9db648cd302590c9b86c70757fR376)
## 2.3.0
Released November 5, 2017 &bull; [diff](https://github.com/groue/GRDB.swift/compare/v2.2.0...v2.3.0)
**New**
- Upgrade custom SQLite builds to [v3.21.0](http://www.sqlite.org/changes.html) (thanks to [@swiftlyfalling](https://github.com/swiftlyfalling/SQLiteLib)).
## 2.2.0
Released October 31, 2017 &bull; [diff](https://github.com/groue/GRDB.swift/compare/v2.1.0...v2.2.0)
+4 -4
View File
@@ -3,7 +3,7 @@ Custom SQLite Builds
By default, GRDB uses the version of SQLite that ships with the target operating system.
**You can build GRDB with a custom build of [SQLite 3.20.1](https://www.sqlite.org/changes.html).**
**You can build GRDB with a custom build of [SQLite 3.21.0](https://www.sqlite.org/changes.html).**
A custom SQLite build can activate extra SQLite features, and extra GRDB features as well, such as support for the [FTS5 full-text search engine](../../../#full-text-search), and [SQLite Pre-Update Hooks](../../../#support-for-sqlite-pre-update-hooks).
@@ -15,7 +15,7 @@ GRDB builds SQLite with [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfal
```sh
cd [GRDB directory]
git checkout v2.2.0
git checkout v2.4.1
git submodule update --init SQLiteCustom/src
````
@@ -60,7 +60,7 @@ GRDB builds SQLite with [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfal
# !! MODIFY THESE TO MATCH YOUR PROJECT HIERARCHY !!
#######################################################
# The path to the folder containing GRDB.xcodeproj:
# The path to the folder containing GRDBCustom.xcodeproj:
GRDB_SOURCE_PATH="${PROJECT_DIR}/GRDB"
# The path to your custom "SQLiteLib-USER.xcconfig":
@@ -107,7 +107,7 @@ GRDB builds SQLite with [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfal
Modify the top of `GRDBCustomSQLite-INSTALL.sh` file so that it contains correct paths.
5. Embed the `GRDB.xcodeproj` project in your own project.
5. Embed the `GRDBCustom.xcodeproj` project in your own project.
6. Add the `GRDBCustomSQLiteOSX` or `GRDBCustomSQLiteiOS` target in the **Target Dependencies** section of the **Build Phases** tab of your **application target**.
+2 -2
View File
@@ -497,7 +497,7 @@ Build a `value BETWEEN min AND max` expression from Swift ranges:
#### The COUNT Function
Build a `COUNT(...)` expression from the [count](http://groue.github.io/GRDB.swift/docs/2.2/Functions.html) and [count(distinct:)](http://groue.github.io/GRDB.swift/docs/2.2/Functions.html) functions:
Build a `COUNT(...)` expression from the [count](http://groue.github.io/GRDB.swift/docs/2.4/Functions.html) and [count(distinct:)](http://groue.github.io/GRDB.swift/docs/2.4/Functions.html) functions:
```swift
// SQLExpression: COUNT(email)
@@ -588,4 +588,4 @@ You may want to compare it to another protocol, SQLSpecificExpressible, which ha
> :point_up: **Note**: whenever you extend GRDB with a Swift function, method, or operator, you should generally make sure that its signature contains at least one GRDB-specific type. In the `cast` function, it is Database.ColumnType.
**If SQLExpressionLiteral reveals too limited for your purpose**, you may have to implement a new type that adopts the [SQLExpression](http://groue.github.io/GRDB.swift/docs/2.2/Protocols/SQLExpression.html) protocol.
**If SQLExpressionLiteral reveals too limited for your purpose**, you may have to implement a new type that adopts the [SQLExpression](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/SQLExpression.html) protocol.
+3
View File
@@ -30,3 +30,6 @@ To release a new GRDB version:
- `make doc`, and update index.html in the `gh-pages` branch
- Update http://github.com/groue/GRDBDemo
- Update http://github.com/groue/WWDCCompanion
- Update [performance comparison](https://github.com/groue/GRDB.swift/wiki/Performance):
`make test_performance | Tests/parsePerformanceTests.rb | Tests/generatePerformanceReport.rb`
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'GRDB.swift'
s.version = '2.2.0'
s.version = '2.4.1'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'A Swift application toolkit for SQLite databases.'
File diff suppressed because it is too large. Load diff
+21
View File
@@ -23,9 +23,30 @@
location = "group:MyPlayground.playground">
</FileRef>
</Group>
<FileRef
location = "group:CHANGELOG.md">
</FileRef>
<FileRef
location = "group:README.md">
</FileRef>
<FileRef
location = "group:TODO.md">
</FileRef>
<FileRef
location = "group:Documentation/ReleaseProcess.md">
</FileRef>
<FileRef
location = "group:Makefile">
</FileRef>
<FileRef
location = "group:GRDB.xcodeproj">
</FileRef>
<FileRef
location = "group:GRDBCustom.xcodeproj">
</FileRef>
<FileRef
location = "group:GRDBCipher.xcodeproj">
</FileRef>
<FileRef
location = "group:Tests/Performance/GRDBProfiling/GRDBProfiling.xcodeproj">
</FileRef>
+3 -3
View File
@@ -211,7 +211,7 @@ extension Database {
bytesNoCopy: UnsafeMutableRawPointer(mutating: statementEnd!),
count: statementStart + sqlCodeUnits.count - statementEnd! - 1,
deallocator: .none)
remainingSQL = String(data: remainingData, encoding: .utf8)!.trimmingCharacters(in: .whitespacesAndNewlines)
remainingSQL = String(data: remainingData, encoding: .utf8)!.trimmingCharacters(in: statementSeparatorCharacterSet)
}
guard remainingSQL.isEmpty else {
@@ -228,12 +228,12 @@ extension Database {
observationBroker.updateStatementWillExecute(statement)
}
func updateStatementDidExecute(_ statement: UpdateStatement) {
func updateStatementDidExecute(_ statement: UpdateStatement) throws {
if statement.invalidatesDatabaseSchemaCache {
clearSchemaCache()
}
observationBroker.updateStatementDidExecute(statement)
try observationBroker.updateStatementDidExecute(statement)
}
func updateStatementDidFail(_ statement: UpdateStatement) throws {
+14 -24
View File
@@ -46,7 +46,20 @@ public final class Database {
/// > advantage of the error logging facility of SQLite in their products,
/// > as it is very low CPU and memory cost but can be a huge aid
/// > for debugging.
public static var logError: LogErrorFunction? = nil
public static var logError: LogErrorFunction? = nil {
didSet {
if logError != nil {
registerErrorLogCallback { (_, code, message) in
guard let logError = Database.logError else { return }
guard let message = message.map({ String(cString: $0) }) else { return }
let resultCode = ResultCode(rawValue: code)
logError(resultCode, message)
}
} else {
registerErrorLogCallback(nil)
}
}
}
/// The database configuration
public let configuration: Configuration
@@ -145,9 +158,6 @@ public final class Database {
// MARK: - Initializer
init(path: String, configuration: Configuration, schemaCache: DatabaseSchemaCache) throws {
// Setup the global SQLite error log before connecting to the database.
Database.setupGlobalErrorLog()
let sqliteConnection = try Database.openConnection(path: path, flags: configuration.SQLiteOpenFlags)
do {
try Database.activateExtendedCodes(sqliteConnection)
@@ -179,26 +189,6 @@ extension Database {
// MARK: - Database Opening
/// Registers the public Database.logError function as the global SQLite
/// error log, with sqlite3_config(SQLITE_CONFIG_LOG).
///
/// See https://sqlite.org/c3ref/c_config_covering_index_scan.html#sqliteconfiglog
private static func setupGlobalErrorLog() {
// We use a Swift static variable as a way to ensure that the error log
// is registered once and only once.
struct Impl {
static let setupErrorLog: () = {
registerErrorLogCallback { (_, code, message) in
guard let log = Database.logError else { return }
guard let message = message.map({ String(cString: $0) }) else { return }
let resultCode = ResultCode(rawValue: code)
log(resultCode, message)
}
}()
}
Impl.setupErrorLog
}
private static func openConnection(path: String, flags: Int32) throws -> SQLiteConnection {
// See https://www.sqlite.org/c3ref/open.html
var sqliteConnection: SQLiteConnection? = nil
+5 -6
View File
@@ -8,6 +8,9 @@ import Foundation
/// A raw SQLite statement, suitable for the SQLite C API.
public typealias SQLiteStatement = OpaquePointer
/// Statements are separated by semicolons and white spaces
let statementSeparatorCharacterSet = CharacterSet(charactersIn: ";").union(.whitespacesAndNewlines)
/// An error emitted when one tries to compile an empty statement.
struct EmptyStatementError : Error {
}
@@ -35,10 +38,9 @@ public class Statement {
public var sql: String {
// trim white space and semicolumn for homogeneous output
return String(cString: sqlite3_sql(sqliteStatement))
.trimmingCharacters(in: CharacterSet(charactersIn: ";").union(.whitespacesAndNewlines))
.trimmingCharacters(in: statementSeparatorCharacterSet)
}
/// The database
unowned let database: Database
/// Creates a prepared statement.
@@ -73,9 +75,6 @@ public class Statement {
}
guard let statement = sqliteStatement else {
// Sanity check: verify that the string contains only whitespace
assert(String(data: Data(bytesNoCopy: UnsafeMutableRawPointer(mutating: statementStart), count: statementEnd.pointee! - statementStart, deallocator: .none), encoding: .utf8)!.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)
// I wish we could simply return nil, and make this initializer failable.
//
// Unfortunately, there is a Swift bug with failable+throwing initializers:
@@ -510,7 +509,7 @@ public final class UpdateStatement : Statement, AuthorizedStatement {
case SQLITE_DONE:
database.authorizer = nil
database.updateStatementDidExecute(self)
try database.updateStatementDidExecute(self)
return
case let code:
+68 -59
View File
@@ -250,45 +250,24 @@ class DatabaseObservationBroker {
}
}
func updateStatementDidExecute(_ statement: UpdateStatement) {
func updateStatementDidExecute(_ statement: UpdateStatement) throws {
// Wait for next statement
activeTransactionObservations = []
// Has statement any effect on transaction/savepoints?
if let transactionEffect = statement.transactionEffect {
// Statement has modified transaction/savepoint state
switch transactionEffect {
case .beginTransaction:
break
case .commitTransaction:
if case .none = self.transactionState {
// A COMMIT statement has ended an empty deferred
// transaction. For SQLite, no transaction has ever begun:
case .commitTransaction: // 1. A COMMIT statement has been executed
if case .none = self.transactionState { // 2. sqlite3_commit_hook was not triggered
// 1+2 mean that an empty deferred transaction has been completed:
//
// BEGIN DEFERRED TRANSACTION
// COMMIT
// BEGIN DEFERRED TRANSACTION; COMMIT
//
// We don't need to tell transaction observers about it.
//
// But we have to take care of the .nextTransaction
// observation extent. In the sample code below, the
// observer must not be notified of the second transaction,
// because this is the intent of the programmer:
//
// // Register an observer for next transaction only
// let observer = Observer()
// dbQueue.add(transactionObserver:observer, extent: .nextTransaction)
//
// try dbQueue.inTransaction(.deferred) { db in
// return .commit
// }
//
// // Must not notify observer
// try dbQueue.inTransaction(.deferred) { db in
// try db.execute("...")
// return .commit
// }
emptyDeferredTransactionDidCommit()
// This special case has a dedicated handling:
return try emptyDeferredTransactionDidCommit()
}
case .rollbackTransaction:
@@ -297,17 +276,22 @@ class DatabaseObservationBroker {
case .beginSavepoint(let name):
savepointStack.savepointDidBegin(name)
case .releaseSavepoint(let name):
case .releaseSavepoint(let name): // 1. A RELEASE SAVEPOINT statement has been executed
savepointStack.savepointDidRelease(name)
if case .none = self.transactionState, // 2. sqlite3_commit_hook was not triggered
!database.isInsideTransaction // 3. database is no longer inside a transaction
{
// 1+2+3 mean that an empty deferred transaction has been completed:
//
// SAVEPOINT foo; RELEASE SAVEPOINT foo
//
// This special case has a dedicated handling:
return try emptyDeferredTransactionDidCommit()
}
if savepointStack.isEmpty {
// Notify buffered events
let eventsBuffer = savepointStack.eventsBuffer
savepointStack.clear()
for (event, observations) in eventsBuffer {
for observation in observations {
event.send(to: observation)
}
}
notifyBufferedEvents()
}
case .rollbackSavepoint(let name):
@@ -358,10 +342,15 @@ class DatabaseObservationBroker {
}
}
// Called from sqlite3_commit_hook
// Called from sqlite3_commit_hook and emptyDeferredTransactionDidCommit()
private func databaseWillCommit() throws {
// Time to send all buffered events
notifyBufferedEvents()
for observation in transactionObservations {
try observation.databaseWillCommit()
}
}
private func notifyBufferedEvents() {
let eventsBuffer = savepointStack.eventsBuffer
savepointStack.clear()
@@ -370,10 +359,6 @@ class DatabaseObservationBroker {
event.send(to: observation)
}
}
for observation in transactionObservations {
try observation.databaseWillCommit()
}
}
// Called from updateStatementDidExecute
@@ -387,11 +372,45 @@ class DatabaseObservationBroker {
}
// Called from updateStatementDidExecute
private func emptyDeferredTransactionDidCommit() {
for observation in transactionObservations {
observation.emptyDeferredTransactionDidCommit(database)
private func emptyDeferredTransactionDidCommit() throws {
// A statement that ends a transaction has been executed. But for
// SQLite, no transaction at all has started, and sqlite3_commit_hook
// was not triggered:
//
// try db.execute("BEGIN DEFERRED TRANSACTION")
// try db.execute("COMMIT") // <- no sqlite3_commit_hook callback invocation
//
// Should we tell transaction observers of this transaction, or not?
// The code says that a transaction was open, but SQLite says the
// opposite. How do we lift this ambiguity? Should we notify of
// *transactions expressed in the code*, or *SQLite transactions* only?
//
// If we would notify of SQLite transactions only, then we'd notify of
// all transactions expressed in the code, but empty deferred
// transaction. This means that we'd make an exception. And exceptions
// are the recipe for both surprise and confusion.
//
// For example, is the code below expected to print "did commit"?
//
// db.afterNextTransactionCommit { _ in print("did commit") }
// try db.inTransaction {
// performSomeTask(db)
// return .commit
// }
//
// Yes it is. And the only way to make it reliably print "did commit" is
// to behave consistently, regardless of the implementation of the
// `performSomeTask` function. Even if the `performSomeTask` is empty,
// even if we actually execute an empty deferred transaction.
//
// For better or for worse, let's simulate a transaction:
do {
try databaseWillCommit()
databaseDidCommit()
} catch {
databaseDidRollback(notifyTransactionObservers: true)
throw error
}
cleanupTransactionObservations()
}
// Called from updateStatementDidExecute or updateStatementDidFails
@@ -591,16 +610,6 @@ final class TransactionObservation {
}
}
func emptyDeferredTransactionDidCommit(_ db: Database) {
switch extent {
case .observerLifetime, .databaseLifetime:
break
case .nextTransaction:
// Observer most not get any further notification.
strongObserver = nil
}
}
func databaseDidRollback(_ db: Database) {
switch extent {
case .observerLifetime, .databaseLifetime:
+16 -4
View File
@@ -111,16 +111,16 @@ public struct FTS4 : VirtualTableModule {
let oldRowID = "old.\(rowIDColumn.quotedDatabaseIdentifier)"
try db.execute("""
CREATE TRIGGER \("__\(contentTable)_bu".quotedDatabaseIdentifier) BEFORE UPDATE ON \(content) BEGIN
CREATE TRIGGER \("__\(tableName)_bu".quotedDatabaseIdentifier) BEFORE UPDATE ON \(content) BEGIN
DELETE FROM \(ftsTable) WHERE docid=\(oldRowID);
END;
CREATE TRIGGER \("__\(contentTable)_bd".quotedDatabaseIdentifier) BEFORE DELETE ON \(content) BEGIN
CREATE TRIGGER \("__\(tableName)_bd".quotedDatabaseIdentifier) BEFORE DELETE ON \(content) BEGIN
DELETE FROM \(ftsTable) WHERE docid=\(oldRowID);
END;
CREATE TRIGGER \("__\(contentTable)_au".quotedDatabaseIdentifier) AFTER UPDATE ON \(content) BEGIN
CREATE TRIGGER \("__\(tableName)_au".quotedDatabaseIdentifier) AFTER UPDATE ON \(content) BEGIN
INSERT INTO \(ftsTable)(\(ftsColumns)) VALUES(\(newContentColumns));
END;
CREATE TRIGGER \("__\(contentTable)_ai".quotedDatabaseIdentifier) AFTER INSERT ON \(content) BEGIN
CREATE TRIGGER \("__\(tableName)_ai".quotedDatabaseIdentifier) AFTER INSERT ON \(content) BEGIN
INSERT INTO \(ftsTable)(\(ftsColumns)) VALUES(\(newContentColumns));
END;
""")
@@ -313,3 +313,15 @@ public final class FTS4ColumnDefinition {
return self
}
}
extension Database {
/// Deletes the synchronization triggers for a synchronized FTS4 table
public func dropFTS4SynchronizationTriggers(forTable tableName: String) throws {
try execute("""
DROP TRIGGER IF EXISTS \("__\(tableName)_bu".quotedDatabaseIdentifier);
DROP TRIGGER IF EXISTS \("__\(tableName)_bd".quotedDatabaseIdentifier);
DROP TRIGGER IF EXISTS \("__\(tableName)_au".quotedDatabaseIdentifier);
DROP TRIGGER IF EXISTS \("__\(tableName)_ai".quotedDatabaseIdentifier);
""")
}
}
+14 -3
View File
@@ -111,13 +111,13 @@
.joined(separator: ", ")
try db.execute("""
CREATE TRIGGER \("__\(contentTable)_ai".quotedDatabaseIdentifier) AFTER INSERT ON \(content) BEGIN
CREATE TRIGGER \("__\(tableName)_ai".quotedDatabaseIdentifier) AFTER INSERT ON \(content) BEGIN
INSERT INTO \(ftsTable)(\(ftsColumns)) VALUES (\(newContentColumns));
END;
CREATE TRIGGER \("__\(contentTable)_ad".quotedDatabaseIdentifier) AFTER DELETE ON \(content) BEGIN
CREATE TRIGGER \("__\(tableName)_ad".quotedDatabaseIdentifier) AFTER DELETE ON \(content) BEGIN
INSERT INTO \(ftsTable)(\(ftsTable), \(ftsColumns)) VALUES('delete', \(oldContentColumns));
END;
CREATE TRIGGER \("__\(contentTable)_au".quotedDatabaseIdentifier) AFTER UPDATE ON \(content) BEGIN
CREATE TRIGGER \("__\(tableName)_au".quotedDatabaseIdentifier) AFTER UPDATE ON \(content) BEGIN
INSERT INTO \(ftsTable)(\(ftsTable), \(ftsColumns)) VALUES('delete', \(oldContentColumns));
INSERT INTO \(ftsTable)(\(ftsColumns)) VALUES (\(newContentColumns));
END;
@@ -319,4 +319,15 @@
/// The FTS5 rank column
public static let rank = Column("rank")
}
extension Database {
/// Deletes the synchronization triggers for a synchronized FTS5 table
public func dropFTS5SynchronizationTriggers(forTable tableName: String) throws {
try execute("""
DROP TRIGGER IF EXISTS \("__\(tableName)_ai".quotedDatabaseIdentifier);
DROP TRIGGER IF EXISTS \("__\(tableName)_ad".quotedDatabaseIdentifier);
DROP TRIGGER IF EXISTS \("__\(tableName)_au".quotedDatabaseIdentifier);
""")
}
}
#endif
+1 -1
View File
@@ -495,7 +495,7 @@ public final class TableAlteration {
/// - returns: An ColumnDefinition that allows you to refine the
/// column definition.
@discardableResult
public func add(column name: String, _ type: Database.ColumnType) -> ColumnDefinition {
public func add(column name: String, _ type: Database.ColumnType? = nil) -> ColumnDefinition {
let column = ColumnDefinition(name: name, type: type)
addedColumns.append(column)
return column
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'GRDBCipher'
s.version = '2.2.0'
s.version = '2.4.1'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'A Swift application toolkit for SQLite databases.'
+3091
View File
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:GRDBCipher.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<false/>
</dict>
</plist>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -17,7 +17,35 @@
BlueprintIdentifier = "560FC5191CB003810014AA8E"
BuildableName = "GRDBCipher.framework"
BlueprintName = "GRDBCipherOSX"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "560FC55D1CB00B880014AA8E"
BuildableName = "GRDBCipherOSXTests.xctest"
BlueprintName = "GRDBCipherOSXTests"
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "567156191CB16729007DC145"
BuildableName = "GRDBCipherOSXEncryptedTests.xctest"
BlueprintName = "GRDBCipherOSXEncryptedTests"
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
@@ -26,6 +54,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
@@ -35,7 +64,7 @@
BlueprintIdentifier = "560FC55D1CB00B880014AA8E"
BuildableName = "GRDBCipherOSXTests.xctest"
BlueprintName = "GRDBCipherOSXTests"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
@@ -45,7 +74,7 @@
BlueprintIdentifier = "567156191CB16729007DC145"
BuildableName = "GRDBCipherOSXEncryptedTests.xctest"
BlueprintName = "GRDBCipherOSXEncryptedTests"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
@@ -55,7 +84,7 @@
BlueprintIdentifier = "560FC5191CB003810014AA8E"
BuildableName = "GRDBCipher.framework"
BlueprintName = "GRDBCipherOSX"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
@@ -65,6 +94,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
@@ -77,7 +107,7 @@
BlueprintIdentifier = "560FC5191CB003810014AA8E"
BuildableName = "GRDBCipher.framework"
BlueprintName = "GRDBCipherOSX"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
@@ -95,7 +125,7 @@
BlueprintIdentifier = "560FC5191CB003810014AA8E"
BuildableName = "GRDBCipher.framework"
BlueprintName = "GRDBCipherOSX"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -17,7 +17,35 @@
BlueprintIdentifier = "56AFC9EE1CB1A8BB00F48B96"
BuildableName = "GRDBCipher.framework"
BlueprintName = "GRDBCipheriOS"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "56AFCA841CB1ABC800F48B96"
BuildableName = "GRDBCipheriOSEncryptedTests.xctest"
BlueprintName = "GRDBCipheriOSEncryptedTests"
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "56AFCA2B1CB1AA9900F48B96"
BuildableName = "GRDBCipheriOSTests.xctest"
BlueprintName = "GRDBCipheriOSTests"
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
@@ -26,6 +54,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
@@ -35,7 +64,7 @@
BlueprintIdentifier = "56AFCA2B1CB1AA9900F48B96"
BuildableName = "GRDBCipheriOSTests.xctest"
BlueprintName = "GRDBCipheriOSTests"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
@@ -45,7 +74,7 @@
BlueprintIdentifier = "56AFCA841CB1ABC800F48B96"
BuildableName = "GRDBCipheriOSEncryptedTests.xctest"
BlueprintName = "GRDBCipheriOSEncryptedTests"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
@@ -55,7 +84,7 @@
BlueprintIdentifier = "56AFC9EE1CB1A8BB00F48B96"
BuildableName = "GRDBCipher.framework"
BlueprintName = "GRDBCipheriOS"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
@@ -65,6 +94,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
@@ -77,7 +107,7 @@
BlueprintIdentifier = "56AFC9EE1CB1A8BB00F48B96"
BuildableName = "GRDBCipher.framework"
BlueprintName = "GRDBCipheriOS"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
@@ -89,15 +119,6 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "56AFC9EE1CB1A8BB00F48B96"
BuildableName = "GRDBCipher.framework"
BlueprintName = "GRDBCipheriOS"
ReferencedContainer = "container:GRDB.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
+2446
View File
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:GRDBCustom.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<false/>
</dict>
</plist>
@@ -17,7 +17,21 @@
BlueprintIdentifier = "F3BA80591CFB2BB2003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteOSX"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F3BA809A1CFB2F6F003DC1BA"
BuildableName = "GRDBCustomSQLiteOSXTests.xctest"
BlueprintName = "GRDBCustomSQLiteOSXTests"
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
@@ -26,6 +40,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
@@ -35,7 +50,7 @@
BlueprintIdentifier = "F3BA809A1CFB2F6F003DC1BA"
BuildableName = "GRDBCustomSQLiteOSXTests.xctest"
BlueprintName = "GRDBCustomSQLiteOSXTests"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
@@ -45,7 +60,7 @@
BlueprintIdentifier = "F3BA80591CFB2BB2003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteOSX"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
@@ -55,21 +70,13 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F3BA80591CFB2BB2003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteOSX"
ReferencedContainer = "container:GRDB.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
@@ -79,15 +86,6 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F3BA80591CFB2BB2003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteOSX"
ReferencedContainer = "container:GRDB.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
@@ -17,7 +17,21 @@
BlueprintIdentifier = "F3BA7FFD1CFB25E4003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteiOS"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F3BA80401CFB2AD7003DC1BA"
BuildableName = "GRDBCustomSQLiteiOSTests.xctest"
BlueprintName = "GRDBCustomSQLiteiOSTests"
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
@@ -36,7 +50,7 @@
BlueprintIdentifier = "F3BA80401CFB2AD7003DC1BA"
BuildableName = "GRDBCustomSQLiteiOSTests.xctest"
BlueprintName = "GRDBCustomSQLiteiOSTests"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
@@ -46,7 +60,7 @@
BlueprintIdentifier = "F3BA7FFD1CFB25E4003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteiOS"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
@@ -69,7 +83,7 @@
BlueprintIdentifier = "F3BA7FFD1CFB25E4003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteiOS"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
@@ -87,7 +101,7 @@
BlueprintIdentifier = "F3BA7FFD1CFB25E4003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteiOS"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
+29
View File
@@ -0,0 +1,29 @@
> ℹ We use Github issues for bug reports, feature requests, general support, and questions about the library.
>
> Please fill out this template when filing an issue, and remove this header before submitting.
## What did you do?
> Please replace this with what you did.
## What did you expect to happen?
> Please replace this with what you expected to happen.
## What happened instead?
> Please replace this with of what happened instead.
## Environment
**GRDB flavor(s):** (GRDB, GRDBCipher, GRDBCustom?)
**GRDB version:**
**Installation method:** (CocoaPods, SPM, manual?)
**Xcode version:**
**Swift version:**
**Platform(s) running GRDB:** (iOS, macOS, watchOS?)
**macOS version running Xcode:**
## Demo Project
> Please link to or upload a project we can download that reproduces the issue.
+17 -13
View File
@@ -46,8 +46,11 @@ TEST_ACTIONS = clean build build-for-testing test-without-building
# xcodebuild destination to run tests on iOS 8.1 (requires a pre-installed simulator)
MIN_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 4s,OS=8.1"
ifeq ($(XCODEVERSION),9.0)
# xcodebuild destination to run tests on latest iOS (Xcode 9.0)
ifeq ($(XCODEVERSION),9.2)
MAX_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 8,OS=11.2"
else ifeq ($(XCODEVERSION),9.1)
MAX_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 8,OS=11.1"
else ifeq ($(XCODEVERSION),9.0)
MAX_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 8,OS=11.0"
else
# Xcode < 9.0 is not supported
@@ -127,7 +130,7 @@ test_framework_GRDBiOS_minTarget:
test_framework_GRDBCustomSQLiteOSX: SQLiteCustom
$(XCODEBUILD) \
-project GRDB.xcodeproj \
-project GRDBCustom.xcodeproj \
-scheme GRDBCustomSQLiteOSX \
$(TEST_ACTIONS) \
$(XCPRETTY)
@@ -136,7 +139,7 @@ test_framework_GRDBCustomSQLiteiOS: test_framework_GRDBCustomSQLiteiOS_maxTarget
test_framework_GRDBCustomSQLiteiOS_maxTarget: SQLiteCustom
$(XCODEBUILD) \
-project GRDB.xcodeproj \
-project GRDBCustom.xcodeproj \
-scheme GRDBCustomSQLiteiOS \
-destination $(MAX_IOS_DESTINATION) \
$(TEST_ACTIONS) \
@@ -144,7 +147,7 @@ test_framework_GRDBCustomSQLiteiOS_maxTarget: SQLiteCustom
test_framework_GRDBCustomSQLiteiOS_minTarget: SQLiteCustom
$(XCODEBUILD) \
-project GRDB.xcodeproj \
-project GRDBCustom.xcodeproj \
-scheme GRDBCustomSQLiteiOS \
-destination $(MIN_IOS_DESTINATION) \
$(TEST_ACTIONS) \
@@ -152,7 +155,7 @@ test_framework_GRDBCustomSQLiteiOS_minTarget: SQLiteCustom
test_framework_GRDBCipherOSX: SQLCipher
$(XCODEBUILD) \
-project GRDB.xcodeproj \
-project GRDBCipher.xcodeproj \
-scheme GRDBCipherOSX \
$(TEST_ACTIONS) \
$(XCPRETTY)
@@ -161,7 +164,7 @@ test_framework_GRDBCipheriOS: test_framework_GRDBCipheriOS_maxTarget test_framew
test_framework_GRDBCipheriOS_maxTarget: SQLCipher
$(XCODEBUILD) \
-project GRDB.xcodeproj \
-project GRDBCipher.xcodeproj \
-scheme GRDBCipheriOS \
-destination $(MAX_IOS_DESTINATION) \
$(TEST_ACTIONS) \
@@ -169,13 +172,14 @@ test_framework_GRDBCipheriOS_maxTarget: SQLCipher
test_framework_GRDBCipheriOS_minTarget: SQLCipher
$(XCODEBUILD) \
-project GRDB.xcodeproj \
-project GRDBCipher.xcodeproj \
-scheme GRDBCipheriOS \
-destination $(MIN_IOS_DESTINATION) \
$(TEST_ACTIONS) \
$(XCPRETTY)
test_SPM:
# Add sanitizers when available: https://twitter.com/simjp/status/929140877540278272
$(SWIFT) package clean
$(SWIFT) build
$(SWIFT) build -c release
@@ -240,10 +244,10 @@ test_performance: Realm FMDB SQLite.swift
-scheme GRDBOSXPerformanceComparisonTests \
build-for-testing test-without-building
Realm: Tests/Performance/Realm/build/osx/swift-4.0/RealmSwift.framework
Realm: Tests/Performance/Realm/build/osx/swift-4.0.3/RealmSwift.framework
# Makes sure the Tests/Performance/Realm submodule has been downloaded, and Realm framework has been built.
Tests/Performance/Realm/build/osx/swift-4.0/RealmSwift.framework:
Tests/Performance/Realm/build/osx/swift-4.0.3/RealmSwift.framework:
$(GIT) submodule update --init --recursive Tests/Performance/Realm
cd Tests/Performance/Realm && sh build.sh osx-swift
@@ -292,10 +296,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/v2.2.0 \
--module-version 2.2 \
--github-file-prefix https://github.com/groue/GRDB.swift/tree/v2.4.0 \
--module-version 2.4 \
--module GRDB \
--root-url http://groue.github.io/GRDB.swift/docs/2.2/ \
--root-url http://groue.github.io/GRDB.swift/docs/2.4/ \
--output Documentation/Reference \
--podspec GRDB.swift.podspec
else
+95 -81
View File
@@ -3,7 +3,7 @@ GRDB 2 [![Swift](https://img.shields.io/badge/swift-4-orange.svg?style=flat)](ht
### A toolkit for SQLite databases, with a focus on application development
**Latest release**: October 31, 2017 • version 2.2.0 • [CHANGELOG](CHANGELOG.md)
**Latest release**: December 16, 2017 • version 2.4.1 • [CHANGELOG](CHANGELOG.md)
**Requirements**: iOS 8.0+ / OSX 10.9+ / watchOS 2.0+ &bull; Swift 4.0 / Xcode 9+
@@ -14,7 +14,7 @@ GRDB 2 [![Swift](https://img.shields.io/badge/swift-4-orange.svg?style=flat)](ht
| Swift 3 | [v1.0](https://github.com/groue/GRDB.swift/tree/v1.0) |
| Swift 3.1 | [v1.3.0](https://github.com/groue/GRDB.swift/tree/v1.3.0) |
| Swift 3.2 | [v1.3.0](https://github.com/groue/GRDB.swift/tree/v1.3.0) |
| **Swift 4** | **v2.2.0** |
| **Swift 4** | **v2.4.1** |
Follow [@groue](http://twitter.com/groue) on Twitter for release announcements and usage tips.
@@ -197,7 +197,7 @@ Documentation
**Reference**
- [GRDB Reference](http://groue.github.io/GRDB.swift/docs/2.2/index.html) (generated by [Jazzy](https://github.com/realm/jazzy))
- [GRDB Reference](http://groue.github.io/GRDB.swift/docs/2.4/index.html) (generated by [Jazzy](https://github.com/realm/jazzy))
**Getting Started**
@@ -245,7 +245,7 @@ Installation
See [Encryption](#encryption) for the installation procedure of GRDB with SQLCipher.
See [Custom SQLite builds](Documentation/CustomSQLiteBuilds.md) for the installation procedure of GRDB with a customized build of SQLite 3.20.1.
See [Custom SQLite builds](Documentation/CustomSQLiteBuilds.md) for the installation procedure of GRDB with a customized build of SQLite 3.21.0.
## CocoaPods
@@ -265,7 +265,7 @@ The [Swift Package Manager](https://swift.org/package-manager/) automates the di
```swift
let package = Package(
dependencies: [
.package(url: "https://github.com/groue/GRDB.swift.git", from: "2.2.0")
.package(url: "https://github.com/groue/GRDB.swift.git", from: "2.4.1")
]
)
```
@@ -282,7 +282,7 @@ If you decide to use Carthage despite this warning, and get any Carthage-related
## Manually
1. [Download](https://github.com/groue/GRDB.swift/releases/tag/v2.2.0) a copy of GRDB, or clone its repository and make sure you use the latest tagged version with the `git checkout v2.2.0` command.
1. [Download](https://github.com/groue/GRDB.swift/releases/tag/v2.4.1) a copy of GRDB, or clone its repository and make sure you use the latest tagged version with the `git checkout v2.4.1` command.
2. Embed the `GRDB.xcodeproj` project in your own project.
@@ -379,7 +379,7 @@ let dbQueue = try DatabaseQueue(
configuration: config)
```
See [Configuration](http://groue.github.io/GRDB.swift/docs/2.2/Structs/Configuration.html) for more details.
See [Configuration](http://groue.github.io/GRDB.swift/docs/2.4/Structs/Configuration.html) for more details.
## Database Pools
@@ -460,7 +460,7 @@ let dbPool = try DatabasePool(
configuration: config)
```
See [Configuration](http://groue.github.io/GRDB.swift/docs/2.2/Structs/Configuration.html) for more details.
See [Configuration](http://groue.github.io/GRDB.swift/docs/2.4/Structs/Configuration.html) for more details.
Database pools are more memory-hungry than database queues. See [Memory Management](#memory-management) for more information.
@@ -650,7 +650,7 @@ Both arrays and cursors can iterate over database results. How do you choose one
- Cursors can not be used on any thread: you must consume them in a protected database queue.
- Cursors iterate database results in a lazy fashion, and don't consume much memory.
- Cursors can be iterated only one time.
- Cursors are granted with direct access to SQLite: you can especially expect the best performance from cursors of raw database rows and some primitive types like `Int`, `String`, or `Bool` that adopt the [StatementColumnConvertible](http://groue.github.io/GRDB.swift/docs/2.2/Protocols/StatementColumnConvertible.html) protocol.
- Cursors are granted with direct access to SQLite: you can especially expect the best performance from cursors of raw database rows and some primitive types like `Int`, `String`, or `Bool` that adopt the [StatementColumnConvertible](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/StatementColumnConvertible.html) protocol.
If you don't see, or don't care about the difference, use arrays. If you care about memory and performance, use cursors when appropriate.
@@ -663,7 +663,7 @@ Date.fetchCursor(...) // DatabaseValueCursor<Date>
Player.fetchCursor(...) // RecordCursor<Player>
```
All cursor types adopt the [Cursor](http://groue.github.io/GRDB.swift/docs/2.2/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 methods: `contains`, `enumerated`, `filter`, `first`, `flatMap`, `forEach`, `joined`, `map`, `reduce`:
All cursor types adopt the [Cursor](http://groue.github.io/GRDB.swift/docs/2.4/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 methods: `contains`, `enumerated`, `filter`, `first`, `flatMap`, `forEach`, `joined`, `map`, `reduce`:
```swift
// Iterate all Github links
@@ -734,7 +734,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/2.2/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/2.4/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:
@@ -1005,7 +1005,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/2.2/Structs/StatementArguments.html):
Values can be used as [statement arguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html):
```swift
let url: URL = ...
@@ -1397,7 +1397,7 @@ try dbQueue.inDatabase { 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/2.2/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/2.4/Structs/StatementArguments.html), which happens to adopt the ExpressibleByArrayLiteral and ExpressibleByDictionaryLiteral protocols).
```swift
updateStatement.arguments = ["name": "Arthur", "score": 1000]
@@ -1659,7 +1659,7 @@ row["consumed"] // "Hello"
row["produced"] // nil
```
Row adapters are values that adopt the [RowAdapter](http://groue.github.io/GRDB.swift/docs/2.2/Protocols/RowAdapter.html) protocol. You can implement your own custom adapters ([**:fire: EXPERIMENTAL**](#what-are-experimental-features)), or use one of the four built-in adapters:
Row adapters are values that adopt the [RowAdapter](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/RowAdapter.html) protocol. You can implement your own custom adapters ([**:fire: EXPERIMENTAL**](#what-are-experimental-features)), or use one of the four built-in adapters:
### ColumnMapping
@@ -1786,8 +1786,8 @@ Before jumping in the low-level wagon, here is the list of all SQLite APIs used
- `sqlite3_aggregate_context`, `sqlite3_create_function_v2`, `sqlite3_result_blob`, `sqlite3_result_double`, `sqlite3_result_error`, `sqlite3_result_error_code`, `sqlite3_result_int64`, `sqlite3_result_null`, `sqlite3_result_text`, `sqlite3_user_data`, `sqlite3_value_blob`, `sqlite3_value_bytes`, `sqlite3_value_double`, `sqlite3_value_int64`, `sqlite3_value_text`, `sqlite3_value_type`: see [Custom SQL Functions and Aggregates](#custom-sql-functions-and-aggregates)
- `sqlite3_backup_finish`, `sqlite3_backup_init`, `sqlite3_backup_step`: see [Backup](#backup)
- `sqlite3_bind_blob`, `sqlite3_bind_double`, `sqlite3_bind_int64`, `sqlite3_bind_null`, `sqlite3_bind_parameter_count`, `sqlite3_bind_parameter_name`, `sqlite3_bind_text`, `sqlite3_clear_bindings`, `sqlite3_column_blob`, `sqlite3_column_bytes`, `sqlite3_column_count`, `sqlite3_column_double`, `sqlite3_column_int64`, `sqlite3_column_name`, `sqlite3_column_text`, `sqlite3_column_type`, `sqlite3_exec`, `sqlite3_finalize`, `sqlite3_prepare_v2`, `sqlite3_reset`, `sqlite3_step`: see [Executing Updates](#executing-updates), [Fetch Queries](#fetch-queries), [Prepared Statements](#prepared-statements), [Values](#values)
- `sqlite3_busy_handler`, `sqlite3_busy_timeout`: see [Configuration.busyMode](http://groue.github.io/GRDB.swift/docs/2.2/Structs/Configuration.html)
- `sqlite3_changes`, `sqlite3_total_changes`: see [Database.changesCount and Database.totalChangesCount](http://groue.github.io/GRDB.swift/docs/2.2/Classes/Database.html)
- `sqlite3_busy_handler`, `sqlite3_busy_timeout`: see [Configuration.busyMode](http://groue.github.io/GRDB.swift/docs/2.4/Structs/Configuration.html)
- `sqlite3_changes`, `sqlite3_total_changes`: see [Database.changesCount and Database.totalChangesCount](http://groue.github.io/GRDB.swift/docs/2.4/Classes/Database.html)
- `sqlite3_close`, `sqlite3_close_v2`, `sqlite3_next_stmt`, `sqlite3_open_v2`: see [Database Connections](#database-connections)
- `sqlite3_commit_hook`, `sqlite3_rollback_hook`, `sqlite3_update_hook`: see [TransactionObserver Protocol](#transactionobserver-protocol), [FetchedRecordsController](#fetchedrecordscontroller)
- `sqlite3_config`: see [Error Log](#error-log)
@@ -1798,9 +1798,9 @@ Before jumping in the low-level wagon, here is the list of all SQLite APIs used
- `sqlite3_last_insert_rowid`: see [Executing Updates](#executing-updates)
- `sqlite3_preupdate_count`, `sqlite3_preupdate_depth`, `sqlite3_preupdate_hook`, `sqlite3_preupdate_new`, `sqlite3_preupdate_old`: see [Support for SQLite Pre-Update Hooks](#support-for-sqlite-pre-update-hooks)
- `sqlite3_set_authorizer`: **reserved by GRDB**
- `sqlite3_sql`: see [Statement.sql](http://groue.github.io/GRDB.swift/docs/2.2/Classes/Statement.html)
- `sqlite3_trace`: see [Configuration.trace](http://groue.github.io/GRDB.swift/docs/2.2/Structs/Configuration.html)
- `sqlite3_wal_checkpoint_v2`: see [DatabasePool.checkpoint](http://groue.github.io/GRDB.swift/docs/2.2/Classes/DatabasePool.html)
- `sqlite3_sql`: see [Statement.sql](http://groue.github.io/GRDB.swift/docs/2.4/Classes/Statement.html)
- `sqlite3_trace`: see [Configuration.trace](http://groue.github.io/GRDB.swift/docs/2.4/Structs/Configuration.html)
- `sqlite3_wal_checkpoint_v2`: see [DatabasePool.checkpoint](http://groue.github.io/GRDB.swift/docs/2.4/Classes/DatabasePool.html)
Records
@@ -2125,7 +2125,7 @@ try Place.fetchAll(db, "SELECT ...", arguments:...) // [Place]
try Place.fetchOne(db, "SELECT ...", arguments:...) // Place?
```
See [fetching methods](#fetching-methods) for information about the `fetchCursor`, `fetchAll` and `fetchOne` methods. See [StatementArguments](http://groue.github.io/GRDB.swift/docs/2.2/Structs/StatementArguments.html) for more information about the query arguments.
See [fetching methods](#fetching-methods) for information about the `fetchCursor`, `fetchAll` and `fetchOne` methods. See [StatementArguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html) for more information about the query arguments.
## TableMapping Protocol
@@ -2439,15 +2439,18 @@ try player.insert(db)
GRDB provides default implementations for [`RowConvertible.init(row:)`](#rowconvertible-protocol) and [`Persistable.encode(to:)`](#persistable-protocol) for record types that also adopt an archival protocol (`Codable`, `Encodable` or `Decodable`). When all their properties are themselves codable, Swift generates the archiving methods, and you don't need to write them down:
```swift
// This is just enough...
struct Player: RowConvertible, Persistable, Codable {
static let databaseTableName = "players"
// Declare a plain Codable struct or class...
struct Player: Codable {
let name: String
let score: Int
}
// ... so that you can save and fetch players:
// Adopt Record protocols...
extension Player: RowConvertible, Persistable {
static let databaseTableName = "players"
}
// ...and you can save and fetch players:
try dbQueue.inDatabase { db in
try Player(name: "Arthur", score: 100).insert(db)
let players = try Player.fetchAll(db)
@@ -2462,22 +2465,20 @@ struct Place: RowConvertible, Persistable, Codable {
static let databaseTableName = "places"
var title: String
var coordinate: CLLocationCoordinate2D // <- Not a simple value
var coordinate: CLLocationCoordinate2D // <- Not a simple value!
}
```
Make it flat, as below, and you'll be granted with all Codable and GRDB advantages:
```swift
struct Place: RowConvertible, Persistable, Codable {
static let databaseTableName = "places"
// Stored properties are all plain values:
struct Place: Codable {
// Stored properties are plain values:
var title: String
var latitude: CLLocationDegrees
var longitude: CLLocationDegrees
// Complex properties are computed properties:
// Complex property is computed:
var coordinate: CLLocationCoordinate2D {
get {
return CLLocationCoordinate2D(
@@ -2490,19 +2491,26 @@ struct Place: RowConvertible, Persistable, Codable {
}
}
}
// Free database support!
extension Place: RowConvertible, Persistable {
static let databaseTableName = "places"
}
```
As documented with the [Persistable](#persistable-protocol) protocol, have you struct records use MutablePersistable instead of Persistable when they store their automatically incremented row id:
As documented with the [Persistable](#persistable-protocol) protocol, have your struct records use MutablePersistable instead of Persistable when they store their automatically incremented row id:
```swift
struct Place: RowConvertible, MutablePersistable, Codable {
static let databaseTableName = "places"
struct Place: Codable {
var id: Int64? // <- the row id
var title: String
var latitude: CLLocationDegrees
var longitude: CLLocationDegrees
var coordinate: CLLocationCoordinate2D { ... }
}
extension Place: RowConvertible, MutablePersistable {
static let databaseTableName = "places"
mutating func didInsert(with rowID: Int64, for column: String?) {
// Update id after insertion
@@ -3181,7 +3189,7 @@ Player // SELECT * FROM players
```
Raw SQL snippets are also accepted, with eventual [arguments](http://groue.github.io/GRDB.swift/docs/2.2/Structs/StatementArguments.html):
Raw SQL snippets are also accepted, with eventual [arguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html):
```swift
// SELECT DATE(creationDate), COUNT(*) FROM players WHERE name = 'Arthur' GROUP BY date(creationDate)
@@ -3650,9 +3658,9 @@ try request.fetchOne(db) // Player?
**To build custom requests**, you can create your own type that adopts the protocols, or derive requests from other requests, or use one of the built-in concrete types:
- [SQLRequest](http://groue.github.io/GRDB.swift/docs/2.2/Structs/SQLRequest.html): a Request built from raw SQL
- [AnyRequest](http://groue.github.io/GRDB.swift/docs/2.2/Structs/AnyRequest.html): a type-erased Request
- [AnyTypedRequest](http://groue.github.io/GRDB.swift/docs/2.2/Structs/AnyTypedRequest.html): a type-erased TypedRequest
- [SQLRequest](http://groue.github.io/GRDB.swift/docs/2.4/Structs/SQLRequest.html): a Request built from raw SQL
- [AnyRequest](http://groue.github.io/GRDB.swift/docs/2.4/Structs/AnyRequest.html): a type-erased Request
- [AnyTypedRequest](http://groue.github.io/GRDB.swift/docs/2.4/Structs/AnyTypedRequest.html): a type-erased TypedRequest
Use the `asRequest(of:)` method to define the type fetched by the request:
@@ -4082,7 +4090,7 @@ let pattern = FTS3Pattern(matchingAnyTokenIn: "") // nil
let pattern = FTS3Pattern(matchingAnyTokenIn: "*") // nil
```
FTS3Pattern are regular [values](#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/2.2/Structs/StatementArguments.html):
FTS3Pattern are regular [values](#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html):
```swift
let documents = try Document.fetchAll(db,
@@ -4295,7 +4303,7 @@ let pattern = FTS5Pattern(matchingAnyTokenIn: "") // nil
let pattern = FTS5Pattern(matchingAnyTokenIn: "*") // nil
```
FTS5Pattern are regular [values](#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/2.2/Structs/StatementArguments.html):
FTS5Pattern are regular [values](#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html):
```swift
let documents = try Document.fetchAll(db,
@@ -4355,13 +4363,49 @@ try db.create(virtualTable: "books_ft", using: FTS4()) { t in // or FTS5()
}
```
The eventual content already present in the regular table is indexed, and every insert, update or delete that happens in the regular table is automatically applied to the full-text index by the mean of SQL triggers.
The eventual content already present in the regular table is indexed, and every insert, update or delete that happens in the regular table is automatically applied to the full-text index.
For more information, see the SQLite documentation about external content tables: [FTS4](https://www.sqlite.org/fts3.html#_external_content_fts4_tables_), [FTS5](https://sqlite.org/fts5.html#external_content_tables).
See also [WWDC Companion](https://github.com/groue/WWDCCompanion), a sample app that uses external content tables to store, display, and let the user search the WWDC sessions.
#### Deleting Synchronized Full-Text Tables
Synchronization of full-text tables with their content table happens by the mean of SQL triggers.
SQLite automatically deletes those triggers when the content (not full-text) table is dropped.
However, those triggers remain after the full-text table has been dropped. Unless they are dropped too, they will prevent future insertion, updates, and deletions in the content table, and the creation of a new full-text table.
To drop those triggers, use the `dropFTS4SynchronizationTriggers` or `dropFTS5SynchronizationTriggers` methods:
```swift
// Create tables
try db.create(table: "books") { t in
...
}
try db.create(virtualTable: "books_ft", using: FTS4()) { t in
t.synchronize(withTable: "books")
...
}
// Drop full-text table
try db.drop(table: "books_ft")
try db.dropFTS4SynchronizationTriggers(forTable: "books_ft")
```
> :warning: **Warning**: there was a bug in GRDB up to version 2.3.1 included, which created triggers with a wrong name. If it is possible that the full-text table was created by an old version of GRDB, then delete the synchronization triggers **twice**: once with the name of the deleted full-text table, and once with the name of the content table:
>
> ```swift
> // Drop full-text table
> try db.drop(table: "books_ft")
> try db.dropFTS4SynchronizationTriggers(forTable: "books_ft")
> try db.dropFTS4SynchronizationTriggers(forTable: "books") // Support for GRDB <= 2.3.1
> ```
#### Querying External Content Full-Text Tables
When you need to perform a full-text search, and the external content table contains all the data you need, you can simply query the full-text table.
@@ -4496,19 +4540,6 @@ try dbQueue.inTransaction { db in
}
```
> :point_up: **Note**: for SQLite, empty [deferred](#transaction-kinds) transactions are no transaction at all. In this case, the transaction callback is never executed:
>
> ```swift
> // Empty deferred transaction
> dbQueue.inTransaction { db in
> db.afterNextTransactionCommit { db in
> // Never executed
> print("success")
> }
> return .commit
> }
> ```
### TransactionObserver Protocol
@@ -4627,15 +4658,6 @@ do {
> :point_up: **Note**: all callbacks are called in a protected dispatch queue, and serialized with all database updates.
>
> :point_up: **Note**: the databaseDidChange(with:) and databaseWillCommit() callbacks must not touch the SQLite database. This limitation does not apply to databaseDidCommit and databaseDidRollback which can use their database argument.
>
> :point_up: **Note**: for SQLite, empty [deferred](#transaction-kinds) transactions are no transaction at all. In this case, transaction observers are not notified:
>
> ```swift
> // Empty deferred transaction does not notify transaction observers
> dbQueue.inTransaction { db in
> return .commit
> }
> ```
[FetchedRecordsController](#fetchedrecordscontroller) and [RxGRDB](http://github.com/RxSwiftCommunity/RxGRDB) are based on the TransactionObserver protocol.
@@ -4737,16 +4759,6 @@ dbQueue.inDatabase { db in
- `.databaseLifetime` has the database retain and notify the observer until the database connection is closed.
> :point_up: **Note**: for SQLite, empty [deferred](#transaction-kinds) transactions are no transaction at all. In this case, an observer added with the `.nextTransaction` extent is never notified of any transaction:
>
> ```swift
> // Empty deferred transaction
> dbQueue.inTransaction { db in
> // Observer is never notified of any transaction
> db.add(transactionObserver: observer, extent: .nextTransaction)
> return .commit
> }
> ```
#### Support for SQLite Pre-Update Hooks
@@ -5118,11 +5130,11 @@ Alternatively, perform a manual installation of GRDB and SQLCipher:
```sh
cd [GRDB directory]
git checkout v2.2.0
git checkout v2.4.1
git submodule update --init SQLCipher/src
```
2. Embed the `GRDB.xcodeproj` project in your own project.
2. Embed the `GRDBCipher.xcodeproj` project in your own project.
3. Add the `GRDBCipherOSX` or `GRDBCipheriOS` target in the **Target Dependencies** section of the **Build Phases** tab of your application target.
@@ -5225,7 +5237,7 @@ DROP TABLE students;
--' WHERE id = 1
```
To avoid those problems, **never embed raw values in your SQL queries**. The only correct technique is to provide [arguments](http://groue.github.io/GRDB.swift/docs/2.2/Structs/StatementArguments.html) to your SQL queries:
To avoid those problems, **never embed raw values in your SQL queries**. The only correct technique is to provide [arguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html) to your SQL queries:
```swift
// Good
@@ -5454,7 +5466,7 @@ See [prepared statements](#prepared-statements) and [DatabaseValue](#databaseval
**SQLite can be configured to invoke a callback function containing an error code and a terse error message whenever anomalies occur.**
It is recommended that you setup, early in the lifetime of your application, the error logging callback:
This global error callback must be configured early in the lifetime of your application:
```swift
Database.logError = { (resultCode, message) in
@@ -5462,6 +5474,8 @@ Database.logError = { (resultCode, message) in
}
```
> :warning: **Warning**: Database.logError must be set before any database connection is opened. This includes the connections that your application opens with GRDB, but also connections opened by other tools, such as third-party libraries. Setting it after a connection has been opened is an SQLite misuse, and has no effect.
See [The Error And Warning Log](https://sqlite.org/errlog.html) for more information.
@@ -5804,7 +5818,7 @@ try dbPool.write { db in
### DatabaseWriter and DatabaseReader Protocols
Both DatabaseQueue and DatabasePool adopt the [DatabaseReader](http://groue.github.io/GRDB.swift/docs/2.2/Protocols/DatabaseReader.html) and [DatabaseWriter](http://groue.github.io/GRDB.swift/docs/2.2/Protocols/DatabaseWriter.html) protocols.
Both DatabaseQueue and DatabasePool adopt the [DatabaseReader](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/DatabaseReader.html) and [DatabaseWriter](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/DatabaseWriter.html) protocols.
These protocols provide a unified API that lets you write safe concurrent code that targets both classes.
@@ -5812,7 +5826,7 @@ However, database queues are not database pools, and DatabaseReader and Database
- Pools are less forgiving than queues when one overlooks a transaction (see [concurrency rule 3](#guarantees-and-rules)).
- DatabaseWriter.readFromCurrentState is synchronous, or asynchronous, depending on whether it is run by a queue or a pool (see [advanced DatabasePool](#advanced-databasepool)). It thus requires higher libDispatch skills, and more complex synchronization code.
- The definition of "current state" in DatabaseWriter.readFromCurrentState is [delicate](http://groue.github.io/GRDB.swift/docs/2.2/Protocols/DatabaseWriter.html#/s:FP4GRDB14DatabaseWriter20readFromCurrentStateFzFCS_8DatabaseT_T_).
- The definition of "current state" in DatabaseWriter.readFromCurrentState is [delicate](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/DatabaseWriter.html#/s:FP4GRDB14DatabaseWriter20readFromCurrentStateFzFCS_8DatabaseT_T_).
DatabaseReader and DatabaseWriter are not a tool for applications that hesitate between DatabaseQueue and DatabasePool, and look for a common API. As seen above, the protocols actually make applications harder to write correctly. Instead, they target generic code that has *both* queues and pools in mind. The built-in AnyDatabaseReader and AnyDatabaseWriter type erasers serve the same purpose.
@@ -5899,7 +5913,7 @@ If you absolutely need multiple connections, then:
- Read about [isolation in SQLite](https://www.sqlite.org/isolation.html)
- Learn about [locks and transactions](https://www.sqlite.org/lang_transaction.html)
- Become a master of the [WAL mode](https://www.sqlite.org/wal.html)
- Prepare to setup a [busy handler](https://www.sqlite.org/c3ref/busy_handler.html) with [Configuration.busyMode](http://groue.github.io/GRDB.swift/docs/2.2/Structs/Configuration.html)
- Prepare to setup a [busy handler](https://www.sqlite.org/c3ref/busy_handler.html) with [Configuration.busyMode](http://groue.github.io/GRDB.swift/docs/2.4/Structs/Configuration.html)
- [Ask questions](https://github.com/groue/GRDB.swift/issues)
+1 -1
View File
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.2.0</string>
<string>2.4.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
+4 -3
View File
@@ -12,12 +12,12 @@
- [ ] REGEXP https://www.sqlite.org/lang_expr.html
- [ ] CASE x WHEN w1 THEN r1 WHEN w2 THEN r2 ELSE r3 END https://www.sqlite.org/lang_expr.html
- [ ] Write regression tests for #156 and #157
- [ ] Truncate optimization: tests for drop temp table, drop view, drop temp view
- [ ] "Documents" and "Application Support" directories: see https://github.com/ccgus/fmdb/commit/7ebbfd055c48d75dfb0119abbd9b5fc2f9001b9f#diff-2f831b88cf9e6758355acd8f88f7d996R16
GRDB 3.0
- [ ] Rename Request to DatabaseRequest, SQLiteRequest, SQLRequest, because Request is a bad name: https://github.com/swift-server/http/pull/7#issuecomment-308448528
- [ ] Rename Request to FetchRequest, because Request is a bad name: https://github.com/swift-server/http/pull/7#issuecomment-308448528
- [ ] Rename RowConvertible, TableMapping, MutablePersistable and Persistable so that their names contain Record: FetchableRecord, TableRecord, MutablePersistableRecord, PersistableRecord?
- [ ] Not sure: Consider introducing RowDecodable and RowEncodable on top of FetchableRecord and MutablePersistableRecord. This would allow keeping fetching and persistence methods private in some files.
Not sure
@@ -98,3 +98,4 @@ Reading list:
- React oddity: http://stackoverflow.com/questions/41721769/realm-update-object-without-updating-lists
- File protection: https://github.com/ccgus/fmdb/issues/262
- File protection: https://lists.apple.com/archives/cocoa-dev/2012/Aug/msg00527.html
- [iOS apps are terminated every time they enter the background if they share an encrypted database with an app extension](https://github.com/sqlcipher/sqlcipher/issues/255)
@@ -7,147 +7,70 @@
objects = {
/* Begin PBXBuildFile section */
56288F841FD4256C0091310B /* GRDBCipher.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 56288F7D1FD424A40091310B /* GRDBCipher.framework */; };
56288F851FD4256C0091310B /* GRDBCipher.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 56288F7D1FD424A40091310B /* GRDBCipher.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
56B0372B1E8E31D0003B6DA4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B0372A1E8E31D0003B6DA4 /* AppDelegate.swift */; };
56B0372D1E8E31D0003B6DA4 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B0372C1E8E31D0003B6DA4 /* ViewController.swift */; };
56B037301E8E31D0003B6DA4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 56B0372E1E8E31D0003B6DA4 /* Main.storyboard */; };
56B037321E8E31D0003B6DA4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 56B037311E8E31D0003B6DA4 /* Assets.xcassets */; };
56B037351E8E31D0003B6DA4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 56B037331E8E31D0003B6DA4 /* LaunchScreen.storyboard */; };
56B0373D1E8E3219003B6DA4 /* Database.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B0373C1E8E3219003B6DA4 /* Database.swift */; };
56B037791E8E328C003B6DA4 /* GRDBCipher.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 56B0376C1E8E3250003B6DA4 /* GRDBCipher.framework */; };
56B0377A1E8E328C003B6DA4 /* GRDBCipher.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 56B0376C1E8E3250003B6DA4 /* GRDBCipher.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
56B0377F1E8E32B9003B6DA4 /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B0377E1E8E32B9003B6DA4 /* Person.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
56B037551E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
56288F761FD424A40091310B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = DC3773F319C8CBB3004FCF85;
remoteInfo = GRDBOSX;
};
56B037571E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56E5D7F91B4D422D00430942;
remoteInfo = GRDBOSXTests;
};
56B037591E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 560C981A1C0E22D300BF8471;
remoteInfo = GRDBOSXPerformanceTests;
};
56B0375B1E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56553C181C3E906C00522B5C;
remoteInfo = GRDBOSXCrashTests;
};
56B0375D1E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 560FC54D1CB003810014AA8E;
remoteInfo = GRDBCipherOSX;
};
56B0375F1E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
56288F781FD424A40091310B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 560FC5B01CB00B880014AA8E;
remoteInfo = GRDBCipherOSXTests;
};
56B037611E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
56288F7A1FD424A40091310B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 5671566C1CB16729007DC145;
remoteInfo = GRDBCipherOSXEncryptedTests;
};
56B037631E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
56288F7C1FD424A40091310B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F3BA805A1CFB2BB2003DC1BA;
remoteInfo = GRDBCustomSQLiteOSX;
};
56B037651E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F3BA809B1CFB2F6F003DC1BA;
remoteInfo = GRDBCustomSQLiteOSXTests;
};
56B037671E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56E5D7CA1B4D3FED00430942;
remoteInfo = GRDBiOS;
};
56B037691E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56E5D7D31B4D3FEE00430942;
remoteInfo = GRDBiOSTests;
};
56B0376B1E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56AFCA231CB1A8BB00F48B96;
remoteInfo = GRDBCipheriOS;
};
56B0376D1E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
56288F7E1FD424A40091310B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56AFCA7F1CB1AA9900F48B96;
remoteInfo = GRDBCipheriOSTests;
};
56B0376F1E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
56288F801FD424A40091310B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56AFCAD71CB1ABC800F48B96;
remoteInfo = GRDBCipheriOSEncryptedTests;
};
56B037711E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
56288F821FD424AD0091310B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F3BA7FFE1CFB25E4003DC1BA;
remoteInfo = GRDBCustomSQLiteiOS;
};
56B037731E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F3BA80411CFB2AD7003DC1BA;
remoteInfo = GRDBCustomSQLiteiOSTests;
};
56B037751E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 565490A01D5A4798005622CB;
remoteInfo = GRDBWatchOS;
};
56B037771E8E3263003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 56AFC9EE1CB1A8BB00F48B96;
remoteInfo = GRDBCipheriOS;
};
56B0377B1E8E328C003B6DA4 /* PBXContainerItemProxy */ = {
56288F861FD4256C0091310B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 56AFC9EE1CB1A8BB00F48B96;
remoteInfo = GRDBCipheriOS;
@@ -161,7 +84,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
56B0377A1E8E328C003B6DA4 /* GRDBCipher.framework in Embed Frameworks */,
56288F851FD4256C0091310B /* GRDBCipher.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
@@ -177,7 +100,7 @@
56B037341E8E31D0003B6DA4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
56B037361E8E31D0003B6DA4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
56B0373C1E8E3219003B6DA4 /* Database.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Database.swift; sourceTree = "<group>"; };
56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = GRDB.xcodeproj; path = ../../../GRDB.xcodeproj; sourceTree = "<group>"; };
56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = GRDBCipher.xcodeproj; path = ../../../GRDBCipher.xcodeproj; sourceTree = "<group>"; };
56B0377E1E8E32B9003B6DA4 /* Person.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Person.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -186,17 +109,30 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
56B037791E8E328C003B6DA4 /* GRDBCipher.framework in Frameworks */,
56288F841FD4256C0091310B /* GRDBCipher.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
56288F6E1FD424A40091310B /* Products */ = {
isa = PBXGroup;
children = (
56288F771FD424A40091310B /* GRDBCipher.framework */,
56288F791FD424A40091310B /* GRDBCipherOSXTests.xctest */,
56288F7B1FD424A40091310B /* GRDBCipherOSXEncryptedTests.xctest */,
56288F7D1FD424A40091310B /* GRDBCipher.framework */,
56288F7F1FD424A40091310B /* GRDBCipheriOSTests.xctest */,
56288F811FD424A40091310B /* GRDBCipheriOSEncryptedTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
56B0371E1E8E31D0003B6DA4 = {
isa = PBXGroup;
children = (
56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */,
56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */,
56B037291E8E31D0003B6DA4 /* GRDBiOS */,
56B037281E8E31D0003B6DA4 /* Products */,
);
@@ -225,30 +161,6 @@
path = GRDBiOS;
sourceTree = "<group>";
};
56B0373F1E8E3250003B6DA4 /* Products */ = {
isa = PBXGroup;
children = (
56B037561E8E3250003B6DA4 /* GRDB.framework */,
56B037581E8E3250003B6DA4 /* GRDBOSXTests.xctest */,
56B0375A1E8E3250003B6DA4 /* GRDBOSXPerformanceTests.xctest */,
56B0375C1E8E3250003B6DA4 /* GRDBOSXCrashTests.xctest */,
56B0375E1E8E3250003B6DA4 /* GRDBCipher.framework */,
56B037601E8E3250003B6DA4 /* GRDBCipherOSXTests.xctest */,
56B037621E8E3250003B6DA4 /* GRDBCipherOSXEncryptedTests.xctest */,
56B037641E8E3250003B6DA4 /* GRDBCustomSQLite.framework */,
56B037661E8E3250003B6DA4 /* GRDBCustomSQLiteOSXTests.xctest */,
56B037681E8E3250003B6DA4 /* GRDB.framework */,
56B0376A1E8E3250003B6DA4 /* GRDBiOSTests.xctest */,
56B0376C1E8E3250003B6DA4 /* GRDBCipher.framework */,
56B0376E1E8E3250003B6DA4 /* GRDBCipheriOSTests.xctest */,
56B037701E8E3250003B6DA4 /* GRDBCipheriOSEncryptedTests.xctest */,
56B037721E8E3250003B6DA4 /* GRDBCustomSQLite.framework */,
56B037741E8E3250003B6DA4 /* GRDBCustomSQLiteiOSTests.xctest */,
56B037761E8E3250003B6DA4 /* GRDB.framework */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -264,8 +176,8 @@
buildRules = (
);
dependencies = (
56B037781E8E3263003B6DA4 /* PBXTargetDependency */,
56B0377C1E8E328C003B6DA4 /* PBXTargetDependency */,
56288F831FD424AD0091310B /* PBXTargetDependency */,
56288F871FD4256C0091310B /* PBXTargetDependency */,
);
name = GRDBiOS;
productName = GRDBiOS;
@@ -279,7 +191,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0910;
ORGANIZATIONNAME = "Gwendal Roué";
TargetAttributes = {
56B037261E8E31D0003B6DA4 = {
@@ -302,8 +214,8 @@
projectDirPath = "";
projectReferences = (
{
ProductGroup = 56B0373F1E8E3250003B6DA4 /* Products */;
ProjectRef = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
ProductGroup = 56288F6E1FD424A40091310B /* Products */;
ProjectRef = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
},
);
projectRoot = "";
@@ -314,123 +226,46 @@
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
56B037561E8E3250003B6DA4 /* GRDB.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDB.framework;
remoteRef = 56B037551E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037581E8E3250003B6DA4 /* GRDBOSXTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBOSXTests.xctest;
remoteRef = 56B037571E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B0375A1E8E3250003B6DA4 /* GRDBOSXPerformanceTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBOSXPerformanceTests.xctest;
remoteRef = 56B037591E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B0375C1E8E3250003B6DA4 /* GRDBOSXCrashTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBOSXCrashTests.xctest;
remoteRef = 56B0375B1E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B0375E1E8E3250003B6DA4 /* GRDBCipher.framework */ = {
56288F771FD424A40091310B /* GRDBCipher.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDBCipher.framework;
remoteRef = 56B0375D1E8E3250003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56288F761FD424A40091310B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037601E8E3250003B6DA4 /* GRDBCipherOSXTests.xctest */ = {
56288F791FD424A40091310B /* GRDBCipherOSXTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBCipherOSXTests.xctest;
remoteRef = 56B0375F1E8E3250003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56288F781FD424A40091310B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037621E8E3250003B6DA4 /* GRDBCipherOSXEncryptedTests.xctest */ = {
56288F7B1FD424A40091310B /* GRDBCipherOSXEncryptedTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBCipherOSXEncryptedTests.xctest;
remoteRef = 56B037611E8E3250003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56288F7A1FD424A40091310B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037641E8E3250003B6DA4 /* GRDBCustomSQLite.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDBCustomSQLite.framework;
remoteRef = 56B037631E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037661E8E3250003B6DA4 /* GRDBCustomSQLiteOSXTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBCustomSQLiteOSXTests.xctest;
remoteRef = 56B037651E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037681E8E3250003B6DA4 /* GRDB.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDB.framework;
remoteRef = 56B037671E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B0376A1E8E3250003B6DA4 /* GRDBiOSTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBiOSTests.xctest;
remoteRef = 56B037691E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B0376C1E8E3250003B6DA4 /* GRDBCipher.framework */ = {
56288F7D1FD424A40091310B /* GRDBCipher.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDBCipher.framework;
remoteRef = 56B0376B1E8E3250003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56288F7C1FD424A40091310B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B0376E1E8E3250003B6DA4 /* GRDBCipheriOSTests.xctest */ = {
56288F7F1FD424A40091310B /* GRDBCipheriOSTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBCipheriOSTests.xctest;
remoteRef = 56B0376D1E8E3250003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56288F7E1FD424A40091310B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037701E8E3250003B6DA4 /* GRDBCipheriOSEncryptedTests.xctest */ = {
56288F811FD424A40091310B /* GRDBCipheriOSEncryptedTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBCipheriOSEncryptedTests.xctest;
remoteRef = 56B0376F1E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037721E8E3250003B6DA4 /* GRDBCustomSQLite.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDBCustomSQLite.framework;
remoteRef = 56B037711E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037741E8E3250003B6DA4 /* GRDBCustomSQLiteiOSTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBCustomSQLiteiOSTests.xctest;
remoteRef = 56B037731E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037761E8E3250003B6DA4 /* GRDB.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDB.framework;
remoteRef = 56B037751E8E3250003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56288F801FD424A40091310B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
@@ -463,15 +298,15 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
56B037781E8E3263003B6DA4 /* PBXTargetDependency */ = {
56288F831FD424AD0091310B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = GRDBCipheriOS;
targetProxy = 56B037771E8E3263003B6DA4 /* PBXContainerItemProxy */;
targetProxy = 56288F821FD424AD0091310B /* PBXContainerItemProxy */;
};
56B0377C1E8E328C003B6DA4 /* PBXTargetDependency */ = {
56288F871FD4256C0091310B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = GRDBCipheriOS;
targetProxy = 56B0377B1E8E328C003B6DA4 /* PBXContainerItemProxy */;
targetProxy = 56288F861FD4256C0091310B /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
@@ -505,7 +340,9 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
@@ -513,7 +350,11 @@
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -536,7 +377,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
IPHONEOS_DEPLOYMENT_TARGET = 11.1;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -555,7 +396,9 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
@@ -563,7 +406,11 @@
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -580,7 +427,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
IPHONEOS_DEPLOYMENT_TARGET = 11.1;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
@@ -598,7 +445,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBiOS;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
@@ -612,7 +459,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBiOS;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
@@ -635,6 +482,7 @@
56B0373B1E8E31D0003B6DA4 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
@@ -45,6 +46,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
@@ -9,7 +9,41 @@ import XCTest
class DatabaseAfterNextTransactionCommitTests: GRDBTestCase {
func testDatabaseAfterNextTransactionCommit() throws {
func testTransactionCompletions() throws {
// implicit transaction
try assertTransaction(start: "", end: "CREATE TABLE t(a)", isNotifiedAs: .commit)
// explicit commit
try assertTransaction(start: "BEGIN DEFERRED TRANSACTION", end: "COMMIT", isNotifiedAs: .commit)
try assertTransaction(start: "BEGIN DEFERRED TRANSACTION; CREATE TABLE t(a)", end: "COMMIT", isNotifiedAs: .commit)
try assertTransaction(start: "BEGIN IMMEDIATE TRANSACTION", end: "COMMIT", isNotifiedAs: .commit)
try assertTransaction(start: "BEGIN IMMEDIATE TRANSACTION; CREATE TABLE t(a)", end: "COMMIT", isNotifiedAs: .commit)
try assertTransaction(start: "BEGIN EXCLUSIVE TRANSACTION", end: "COMMIT", isNotifiedAs: .commit)
try assertTransaction(start: "BEGIN EXCLUSIVE TRANSACTION; CREATE TABLE t(a)", end: "COMMIT", isNotifiedAs: .commit)
try assertTransaction(start: "SAVEPOINT test", end: "COMMIT", isNotifiedAs: .commit)
try assertTransaction(start: "SAVEPOINT test; CREATE TABLE t(a)", end: "COMMIT", isNotifiedAs: .commit)
try assertTransaction(start: "SAVEPOINT test; ROLLBACK TRANSACTION TO SAVEPOINT test", end: "RELEASE SAVEPOINT test", isNotifiedAs: .commit)
try assertTransaction(start: "SAVEPOINT test; CREATE TABLE t(a); ROLLBACK TRANSACTION TO SAVEPOINT test", end: "RELEASE SAVEPOINT test", isNotifiedAs: .commit)
try assertTransaction(start: "SAVEPOINT test", end: "RELEASE SAVEPOINT test", isNotifiedAs: .commit)
try assertTransaction(start: "SAVEPOINT test; CREATE TABLE t(a)", end: "RELEASE SAVEPOINT test", isNotifiedAs: .commit)
// explicit rollback
try assertTransaction(start: "BEGIN DEFERRED TRANSACTION", end: "ROLLBACK", isNotifiedAs: .rollback)
try assertTransaction(start: "BEGIN DEFERRED TRANSACTION; CREATE TABLE t(a)", end: "ROLLBACK", isNotifiedAs: .rollback)
try assertTransaction(start: "BEGIN IMMEDIATE TRANSACTION", end: "ROLLBACK", isNotifiedAs: .rollback)
try assertTransaction(start: "BEGIN IMMEDIATE TRANSACTION; CREATE TABLE t(a)", end: "ROLLBACK", isNotifiedAs: .rollback)
try assertTransaction(start: "BEGIN EXCLUSIVE TRANSACTION", end: "ROLLBACK", isNotifiedAs: .rollback)
try assertTransaction(start: "BEGIN EXCLUSIVE TRANSACTION; CREATE TABLE t(a)", end: "ROLLBACK", isNotifiedAs: .rollback)
try assertTransaction(start: "SAVEPOINT test", end: "ROLLBACK", isNotifiedAs: .rollback)
try assertTransaction(start: "SAVEPOINT test; CREATE TABLE t(a)", end: "ROLLBACK", isNotifiedAs: .rollback)
}
func assertTransaction(start startSQL: String, end endSQL: String, isNotifiedAs expectedCompletion: Database.TransactionCompletion) throws {
try assertTransaction_registerBefore(start: startSQL, end: endSQL, isNotifiedAs: expectedCompletion)
try assertTransaction_registerBetween(start: startSQL, end: endSQL, isNotifiedAs: expectedCompletion)
}
func assertTransaction_registerBefore(start startSQL: String, end endSQL: String, isNotifiedAs expectedCompletion: Database.TransactionCompletion) throws {
class Witness { }
let dbQueue = try makeDatabaseQueue()
@@ -26,29 +60,39 @@ class DatabaseAfterNextTransactionCommitTests: GRDBTestCase {
}
}
XCTAssertNotNil(deallocationWitness)
XCTAssertEqual(transactionCount, 0)
try db.inTransaction {
try db.execute("CREATE TABLE t(a)")
return .commit
try db.execute(startSQL)
try db.execute(endSQL)
switch expectedCompletion {
case .commit:
XCTAssertEqual(transactionCount, 1, "\(startSQL); \(endSQL)")
case .rollback:
XCTAssertEqual(transactionCount, 0, "\(startSQL); \(endSQL)")
}
XCTAssertEqual(transactionCount, 1)
XCTAssertNil(deallocationWitness)
try db.inTransaction {
try db.execute("DROP TABLE t")
try db.execute("DROP TABLE IF EXISTS t; CREATE TABLE t(a); ")
return .commit
}
XCTAssertEqual(transactionCount, 1)
switch expectedCompletion {
case .commit:
XCTAssertEqual(transactionCount, 1, "\(startSQL); \(endSQL)")
case .rollback:
XCTAssertEqual(transactionCount, 0, "\(startSQL); \(endSQL)")
}
}
}
func testDatabaseAfterNextTransactionWithEmptyDeferredTransaction() throws {
func assertTransaction_registerBetween(start startSQL: String, end endSQL: String, isNotifiedAs expectedCompletion: Database.TransactionCompletion) throws {
class Witness { }
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
var transactionCount = 0
try db.execute(startSQL)
weak var deallocationWitness: Witness? = nil
do {
let witness = Witness()
@@ -60,51 +104,27 @@ class DatabaseAfterNextTransactionCommitTests: GRDBTestCase {
}
}
XCTAssertNotNil(deallocationWitness)
XCTAssertEqual(transactionCount, 0)
try db.inTransaction(.deferred) { .commit }
XCTAssertEqual(transactionCount, 0)
try db.execute(endSQL)
switch expectedCompletion {
case .commit:
XCTAssertEqual(transactionCount, 1, "\(startSQL); \(endSQL)")
case .rollback:
XCTAssertEqual(transactionCount, 0, "\(startSQL); \(endSQL)")
}
XCTAssertNil(deallocationWitness)
try db.inTransaction {
try db.execute("CREATE TABLE t(a)")
try db.execute("DROP TABLE IF EXISTS t; CREATE TABLE t(a); ")
return .commit
}
XCTAssertEqual(transactionCount, 0)
}
}
func testDatabaseAfterNextTransactionCommitWithRollback() throws {
class Witness { }
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
var transactionCount = 0
weak var deallocationWitness: Witness? = nil
do {
let witness = Witness()
deallocationWitness = witness
db.afterNextTransactionCommit { _ in
// use witness
withExtendedLifetime(witness, { })
transactionCount += 1
}
switch expectedCompletion {
case .commit:
XCTAssertEqual(transactionCount, 1, "\(startSQL); \(endSQL)")
case .rollback:
XCTAssertEqual(transactionCount, 0, "\(startSQL); \(endSQL)")
}
XCTAssertEqual(transactionCount, 0)
try db.inTransaction {
try db.execute("CREATE TABLE t(a)")
return .rollback
}
XCTAssertEqual(transactionCount, 0)
XCTAssertNil(deallocationWitness)
try db.inTransaction {
try db.execute("CREATE TABLE t(a)")
return .commit
}
XCTAssertEqual(transactionCount, 0)
}
}
}
@@ -10,23 +10,11 @@ import XCTest
class DatabaseLogErrorTests: GRDBTestCase {
func testErrorLog() throws {
// Remember current log function
let currentLogError = Database.logError
var lastResultCode: ResultCode? = nil
var lastMessage: String? = nil
Database.logError = { (resultCode, message) in
lastResultCode = resultCode
lastMessage = message
}
let dbQueue = try makeDatabaseQueue()
dbQueue.inDatabase { db in
_ = try? db.execute("That's not SQL.")
}
XCTAssertEqual(lastResultCode!, ResultCode.SQLITE_ERROR)
XCTAssertEqual(lastMessage!, "near \"That\": syntax error")
// Restore current log function
Database.logError = currentLogError
}
}
@@ -39,7 +39,7 @@ class ConcurrencyTests: GRDBTestCase {
}
func testDeferredTransactionConcurrency() throws {
let dbQueue1 = try makeDatabaseQueue()
let dbQueue1 = try makeDatabaseQueue(filename: "test.sqlite")
#if GRDBCIPHER_USE_ENCRYPTION
// Work around SQLCipher bug when two connections are open to the
// same empty database: make sure the database is not empty before
@@ -48,7 +48,7 @@ class ConcurrencyTests: GRDBTestCase {
try db.execute("CREATE TABLE SQLCipherWorkAround (foo INTEGER)")
}
#endif
let dbQueue2 = try makeDatabaseQueue()
let dbQueue2 = try makeDatabaseQueue(filename: "test.sqlite")
// Queue 1 Queue 2
// BEGIN DEFERRED TRANSACTION
@@ -118,8 +118,8 @@ class ConcurrencyTests: GRDBTestCase {
}
func testExclusiveTransactionConcurrency() throws {
let dbQueue1 = try makeDatabaseQueue()
let dbQueue2 = try makeDatabaseQueue()
let dbQueue1 = try makeDatabaseQueue(filename: "test.sqlite")
let dbQueue2 = try makeDatabaseQueue(filename: "test.sqlite")
// Queue 1 Queue 2
// BEGIN EXCLUSIVE TRANSACTION
@@ -174,8 +174,8 @@ class ConcurrencyTests: GRDBTestCase {
}
func testImmediateTransactionConcurrency() throws {
let dbQueue1 = try makeDatabaseQueue()
let dbQueue2 = try makeDatabaseQueue()
let dbQueue1 = try makeDatabaseQueue(filename: "test.sqlite")
let dbQueue2 = try makeDatabaseQueue(filename: "test.sqlite")
// Queue 1 Queue 2
// BEGIN IMMEDIATE TRANSACTION
@@ -230,7 +230,7 @@ class ConcurrencyTests: GRDBTestCase {
}
func testBusyCallback() throws {
let dbQueue1 = try makeDatabaseQueue()
let dbQueue1 = try makeDatabaseQueue(filename: "test.sqlite")
#if GRDBCIPHER_USE_ENCRYPTION
// Work around SQLCipher bug when two connections are open to the
// same empty database: make sure the database is not empty before
@@ -239,7 +239,7 @@ class ConcurrencyTests: GRDBTestCase {
try db.execute("CREATE TABLE SQLCipherWorkAround (foo INTEGER)")
}
#endif
let dbQueue2 = try makeDatabaseQueue()
let dbQueue2 = try makeDatabaseQueue(filename: "test.sqlite")
// Queue 1 Queue 2
// BEGIN EXCLUSIVE TRANSACTION
@@ -293,7 +293,7 @@ class ConcurrencyTests: GRDBTestCase {
}
func testReaderDuringDefaultTransaction() throws {
let dbQueue1 = try makeDatabaseQueue()
let dbQueue1 = try makeDatabaseQueue(filename: "test.sqlite")
#if GRDBCIPHER_USE_ENCRYPTION
// Work around SQLCipher bug when two connections are open to the
// same empty database: make sure the database is not empty before
@@ -302,7 +302,7 @@ class ConcurrencyTests: GRDBTestCase {
try db.execute("CREATE TABLE SQLCipherWorkAround (foo INTEGER)")
}
#endif
let dbQueue2 = try makeDatabaseQueue()
let dbQueue2 = try makeDatabaseQueue(filename: "test.sqlite")
// Here we test that a reader can read while a writer is writing.
@@ -359,7 +359,7 @@ class ConcurrencyTests: GRDBTestCase {
}
func testReaderInDeferredTransactionDuringDefaultTransaction() throws {
let dbQueue1 = try makeDatabaseQueue()
let dbQueue1 = try makeDatabaseQueue(filename: "test.sqlite")
#if GRDBCIPHER_USE_ENCRYPTION
// Work around SQLCipher bug when two connections are open to the
// same empty database: make sure the database is not empty before
@@ -368,7 +368,7 @@ class ConcurrencyTests: GRDBTestCase {
try db.execute("CREATE TABLE SQLCipherWorkAround (foo INTEGER)")
}
#endif
let dbQueue2 = try makeDatabaseQueue()
let dbQueue2 = try makeDatabaseQueue(filename: "test.sqlite")
// The `SELECT * FROM stuffs` statement of Queue 2 prevents Queue 1
// from committing with SQLITE_BUSY.
@@ -12,12 +12,12 @@ class DatabaseQueueReadOnlyTests : GRDBTestCase {
func testReadOnlyDatabaseCanNotBeModified() throws {
// Create database
do {
_ = try makeDatabaseQueue()
_ = try makeDatabaseQueue(filename: "test.sqlite")
}
// Open it again, readonly
dbConfiguration.readonly = true
let dbQueue = try makeDatabaseQueue()
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
let statement = try dbQueue.inDatabase { db in
try db.makeUpdateStatement("CREATE TABLE items (id INTEGER PRIMARY KEY)")
}
+31 -31
View File
@@ -7,7 +7,7 @@ class EncryptionTests: GRDBTestCase {
func testDatabaseQueueWithPassphraseToDatabaseQueueWithPassphrase() throws {
do {
dbConfiguration.passphrase = "secret"
let dbQueue = try makeDatabaseQueue()
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE data (value INTEGER)")
try db.execute("INSERT INTO data (value) VALUES (1)")
@@ -16,7 +16,7 @@ class EncryptionTests: GRDBTestCase {
do {
dbConfiguration.passphrase = "secret"
let dbQueue = try makeDatabaseQueue()
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
try dbQueue.inDatabase { db in
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM data")!, 1)
}
@@ -26,7 +26,7 @@ class EncryptionTests: GRDBTestCase {
func testDatabaseQueueWithPassphraseToDatabaseQueueWithoutPassphrase() throws {
do {
dbConfiguration.passphrase = "secret"
let dbQueue = try makeDatabaseQueue()
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE data (value INTEGER)")
try db.execute("INSERT INTO data (value) VALUES (1)")
@@ -36,7 +36,7 @@ class EncryptionTests: GRDBTestCase {
do {
dbConfiguration.passphrase = nil
do {
_ = try makeDatabaseQueue()
_ = try makeDatabaseQueue(filename: "test.sqlite")
} catch let error as DatabaseError {
XCTAssertEqual(error.resultCode, .SQLITE_NOTADB)
XCTAssertEqual(error.message!, "file is encrypted or is not a database")
@@ -49,7 +49,7 @@ class EncryptionTests: GRDBTestCase {
func testDatabaseQueueWithPassphraseToDatabaseQueueWithWrongPassphrase() throws {
do {
dbConfiguration.passphrase = "secret"
let dbQueue = try makeDatabaseQueue()
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE data (value INTEGER)")
try db.execute("INSERT INTO data (value) VALUES (1)")
@@ -59,7 +59,7 @@ class EncryptionTests: GRDBTestCase {
do {
dbConfiguration.passphrase = "wrong"
do {
_ = try makeDatabaseQueue()
_ = try makeDatabaseQueue(filename: "test.sqlite")
} catch let error as DatabaseError {
XCTAssertEqual(error.resultCode, .SQLITE_NOTADB)
XCTAssertEqual(error.message!, "file is encrypted or is not a database")
@@ -72,7 +72,7 @@ class EncryptionTests: GRDBTestCase {
func testDatabaseQueueWithPassphraseToDatabaseQueueWithNewPassphrase() throws {
do {
dbConfiguration.passphrase = "secret"
let dbQueue = try makeDatabaseQueue()
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE data (value INTEGER)")
try db.execute("INSERT INTO data (value) VALUES (1)")
@@ -81,7 +81,7 @@ class EncryptionTests: GRDBTestCase {
do {
dbConfiguration.passphrase = "secret"
let dbQueue = try makeDatabaseQueue()
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
try dbQueue.change(passphrase: "newSecret")
try dbQueue.inDatabase { db in
try db.execute("INSERT INTO data (value) VALUES (2)")
@@ -93,7 +93,7 @@ class EncryptionTests: GRDBTestCase {
do {
dbConfiguration.passphrase = "newSecret"
let dbQueue = try makeDatabaseQueue()
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
try dbQueue.inDatabase { db in
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM data")!, 2)
}
@@ -103,7 +103,7 @@ class EncryptionTests: GRDBTestCase {
func testDatabaseQueueWithPassphraseToDatabasePoolWithPassphrase() throws {
do {
dbConfiguration.passphrase = "secret"
let dbQueue = try makeDatabaseQueue()
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE data (value INTEGER)")
try db.execute("INSERT INTO data (value) VALUES (1)")
@@ -112,7 +112,7 @@ class EncryptionTests: GRDBTestCase {
do {
dbConfiguration.passphrase = "secret"
let dbPool = try makeDatabasePool()
let dbPool = try makeDatabasePool(filename: "test.sqlite")
try dbPool.read { db in
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM data")!, 1)
}
@@ -122,7 +122,7 @@ class EncryptionTests: GRDBTestCase {
func testDatabaseQueueWithPassphraseToDatabasePoolWithoutPassphrase() throws {
do {
dbConfiguration.passphrase = "secret"
let dbQueue = try makeDatabaseQueue()
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE data (value INTEGER)")
try db.execute("INSERT INTO data (value) VALUES (1)")
@@ -132,7 +132,7 @@ class EncryptionTests: GRDBTestCase {
do {
dbConfiguration.passphrase = nil
do {
_ = try makeDatabasePool()
_ = try makeDatabasePool(filename: "test.sqlite")
} catch let error as DatabaseError {
XCTAssertEqual(error.resultCode, .SQLITE_NOTADB)
XCTAssertEqual(error.message!, "file is encrypted or is not a database")
@@ -145,7 +145,7 @@ class EncryptionTests: GRDBTestCase {
func testDatabaseQueueWithPassphraseToDatabasePoolWithWrongPassphrase() throws {
do {
dbConfiguration.passphrase = "secret"
let dbQueue = try makeDatabaseQueue()
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE data (value INTEGER)")
try db.execute("INSERT INTO data (value) VALUES (1)")
@@ -155,7 +155,7 @@ class EncryptionTests: GRDBTestCase {
do {
dbConfiguration.passphrase = "wrong"
do {
_ = try makeDatabasePool()
_ = try makeDatabasePool(filename: "test.sqlite")
} catch let error as DatabaseError {
XCTAssertEqual(error.resultCode, .SQLITE_NOTADB)
XCTAssertEqual(error.message!, "file is encrypted or is not a database")
@@ -168,7 +168,7 @@ class EncryptionTests: GRDBTestCase {
func testDatabaseQueueWithPassphraseToDatabasePoolWithNewPassphrase() throws {
do {
dbConfiguration.passphrase = "secret"
let dbQueue = try makeDatabaseQueue()
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE data (value INTEGER)")
try db.execute("INSERT INTO data (value) VALUES (1)")
@@ -177,7 +177,7 @@ class EncryptionTests: GRDBTestCase {
do {
dbConfiguration.passphrase = "secret"
let dbPool = try makeDatabasePool()
let dbPool = try makeDatabasePool(filename: "test.sqlite")
try dbPool.change(passphrase: "newSecret")
try dbPool.write { db in
try db.execute("INSERT INTO data (value) VALUES (2)")
@@ -187,7 +187,7 @@ class EncryptionTests: GRDBTestCase {
do {
dbConfiguration.passphrase = "newSecret"
let dbPool = try makeDatabasePool()
let dbPool = try makeDatabasePool(filename: "test.sqlite")
try dbPool.read { db in
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM data")!, 2)
}
@@ -197,7 +197,7 @@ class EncryptionTests: GRDBTestCase {
func testDatabasePoolWithPassphraseToDatabasePoolWithPassphrase() throws {
do {
dbConfiguration.passphrase = "secret"
let dbPool = try makeDatabasePool()
let dbPool = try makeDatabasePool(filename: "test.sqlite")
try dbPool.write { db in
try db.execute("CREATE TABLE data (value INTEGER)")
try db.execute("INSERT INTO data (value) VALUES (1)")
@@ -206,7 +206,7 @@ class EncryptionTests: GRDBTestCase {
do {
dbConfiguration.passphrase = "secret"
let dbPool = try makeDatabasePool()
let dbPool = try makeDatabasePool(filename: "test.sqlite")
try dbPool.read { db in
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM data")!, 1)
}
@@ -216,7 +216,7 @@ class EncryptionTests: GRDBTestCase {
func testDatabasePoolWithPassphraseToDatabasePoolWithoutPassphrase() throws {
do {
dbConfiguration.passphrase = "secret"
let dbPool = try makeDatabasePool()
let dbPool = try makeDatabasePool(filename: "test.sqlite")
try dbPool.write { db in
try db.execute("CREATE TABLE data (value INTEGER)")
try db.execute("INSERT INTO data (value) VALUES (1)")
@@ -226,7 +226,7 @@ class EncryptionTests: GRDBTestCase {
do {
dbConfiguration.passphrase = nil
do {
_ = try makeDatabasePool()
_ = try makeDatabasePool(filename: "test.sqlite")
} catch let error as DatabaseError {
XCTAssertEqual(error.resultCode, .SQLITE_NOTADB)
XCTAssertEqual(error.message!, "file is encrypted or is not a database")
@@ -239,7 +239,7 @@ class EncryptionTests: GRDBTestCase {
func testDatabasePoolWithPassphraseToDatabasePoolWithWrongPassphrase() throws {
do {
dbConfiguration.passphrase = "secret"
let dbPool = try makeDatabasePool()
let dbPool = try makeDatabasePool(filename: "test.sqlite")
try dbPool.write { db in
try db.execute("CREATE TABLE data (value INTEGER)")
try db.execute("INSERT INTO data (value) VALUES (1)")
@@ -249,7 +249,7 @@ class EncryptionTests: GRDBTestCase {
do {
dbConfiguration.passphrase = "wrong"
do {
_ = try makeDatabasePool()
_ = try makeDatabasePool(filename: "test.sqlite")
} catch let error as DatabaseError {
XCTAssertEqual(error.resultCode, .SQLITE_NOTADB)
XCTAssertEqual(error.message!, "file is encrypted or is not a database")
@@ -263,7 +263,7 @@ class EncryptionTests: GRDBTestCase {
do {
dbConfiguration.passphrase = "secret"
let dbPool = try makeDatabasePool()
let dbPool = try makeDatabasePool(filename: "test.sqlite")
try dbPool.write { db in
try db.execute("CREATE TABLE data (value INTEGER)")
try db.execute("INSERT INTO data (value) VALUES (1)")
@@ -272,7 +272,7 @@ class EncryptionTests: GRDBTestCase {
do {
dbConfiguration.passphrase = "secret"
let dbPool = try makeDatabasePool()
let dbPool = try makeDatabasePool(filename: "test.sqlite")
try dbPool.change(passphrase: "newSecret")
try dbPool.write { db in
try db.execute("INSERT INTO data (value) VALUES (2)")
@@ -282,7 +282,7 @@ class EncryptionTests: GRDBTestCase {
do {
dbConfiguration.passphrase = "newSecret"
let dbPool = try makeDatabasePool()
let dbPool = try makeDatabasePool(filename: "test.sqlite")
try dbPool.read { db in
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM data")!, 2)
}
@@ -292,7 +292,7 @@ class EncryptionTests: GRDBTestCase {
func testDatabaseQueueWithPragmaPassphraseToDatabaseQueueWithPassphrase() throws {
do {
dbConfiguration.passphrase = nil
let dbQueue = try makeDatabaseQueue()
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
try dbQueue.inDatabase { db in
try db.execute("PRAGMA key = 'secret'")
try db.execute("CREATE TABLE data (value INTEGER)")
@@ -302,7 +302,7 @@ class EncryptionTests: GRDBTestCase {
do {
dbConfiguration.passphrase = "secret"
let dbQueue = try makeDatabaseQueue()
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
try dbQueue.inDatabase { db in
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM data")!, 1)
}
@@ -312,7 +312,7 @@ class EncryptionTests: GRDBTestCase {
func testDatabaseQueueWithPragmaPassphraseToDatabaseQueueWithoutPassphrase() throws {
do {
dbConfiguration.passphrase = nil
let dbQueue = try makeDatabaseQueue()
let dbQueue = try makeDatabaseQueue(filename: "test.sqlite")
try dbQueue.inDatabase { db in
try db.execute("PRAGMA key = 'secret'")
try db.execute("CREATE TABLE data (value INTEGER)")
@@ -323,7 +323,7 @@ class EncryptionTests: GRDBTestCase {
do {
dbConfiguration.passphrase = nil
do {
_ = try makeDatabaseQueue()
_ = try makeDatabaseQueue(filename: "test.sqlite")
} catch let error as DatabaseError {
XCTAssertEqual(error.resultCode, .SQLITE_NOTADB)
XCTAssertEqual(error.message!, "file is encrypted or is not a database")
@@ -229,4 +229,63 @@ class FTS4TableBuilderTests: GRDBTestCase {
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM ft_documents WHERE ft_documents MATCH ?", arguments: ["bar"])!, 1)
}
}
func testFTS4SynchronizationCleanup() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
try db.create(table: "documents") { t in
t.column("id", .integer).primaryKey()
t.column("content", .text)
}
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
try db.create(virtualTable: "ft_documents", using: FTS4()) { t in
t.synchronize(withTable: "documents")
t.column("content")
}
try db.drop(table: "ft_documents")
try db.dropFTS4SynchronizationTriggers(forTable: "ft_documents")
// It is possible to modify the content table
try db.execute("UPDATE documents SET content = ?", arguments: ["bar"])
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
try db.execute("DELETE FROM documents WHERE content = ?", arguments: ["foo"])
// It is possible to recreate the FT table
try db.create(virtualTable: "ft_documents", using: FTS4()) { t in
t.synchronize(withTable: "documents")
t.column("content")
}
}
}
func testFTS4SynchronizationCleanupWithLegacySupport() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
try db.create(table: "documents") { t in
t.column("id", .integer).primaryKey()
t.column("content", .text)
}
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
try db.create(virtualTable: "ft_documents", using: FTS4()) { t in
t.synchronize(withTable: "documents")
t.column("content")
}
try db.drop(table: "ft_documents")
try db.dropFTS4SynchronizationTriggers(forTable: "documents") // legacy GRDB <= 2.3.1
try db.dropFTS4SynchronizationTriggers(forTable: "ft_documents")
// It is possible to modify the content table
try db.execute("UPDATE documents SET content = ?", arguments: ["bar"])
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
try db.execute("DELETE FROM documents WHERE content = ?", arguments: ["foo"])
// It is possible to recreate the FT table
try db.create(virtualTable: "ft_documents", using: FTS4()) { t in
t.synchronize(withTable: "documents")
t.column("content")
}
}
}
}
+60 -1
View File
@@ -128,7 +128,7 @@ class FTS5TableBuilderTests: GRDBTestCase {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
try db.create(virtualTable: "documents", using: FTS5()) { t in
t.tokenizer = .unicode61(tokenCharacters: Set(".-".characters))
t.tokenizer = .unicode61(tokenCharacters: Set(".-"))
t.column("content")
}
assertDidExecute(sql: "CREATE VIRTUAL TABLE \"documents\" USING fts5(content, tokenize='unicode61 tokenchars ''-.''')")
@@ -219,5 +219,64 @@ class FTS5TableBuilderTests: GRDBTestCase {
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM ft_documents WHERE ft_documents MATCH ?", arguments: ["bar"])!, 1)
}
}
func testFTS5SynchronizationCleanup() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
try db.create(table: "documents") { t in
t.column("id", .integer).primaryKey()
t.column("content", .text)
}
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
try db.create(virtualTable: "ft_documents", using: FTS5()) { t in
t.synchronize(withTable: "documents")
t.column("content")
}
try db.drop(table: "ft_documents")
try db.dropFTS5SynchronizationTriggers(forTable: "ft_documents")
// It is possible to modify the content table
try db.execute("UPDATE documents SET content = ?", arguments: ["bar"])
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
try db.execute("DELETE FROM documents WHERE content = ?", arguments: ["foo"])
// It is possible to recreate the FT table
try db.create(virtualTable: "ft_documents", using: FTS5()) { t in
t.synchronize(withTable: "documents")
t.column("content")
}
}
}
func testFTS5SynchronizationCleanupWithLegacySupport() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
try db.create(table: "documents") { t in
t.column("id", .integer).primaryKey()
t.column("content", .text)
}
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
try db.create(virtualTable: "ft_documents", using: FTS5()) { t in
t.synchronize(withTable: "documents")
t.column("content")
}
try db.drop(table: "ft_documents")
try db.dropFTS5SynchronizationTriggers(forTable: "documents") // legacy GRDB <= 2.3.1
try db.dropFTS5SynchronizationTriggers(forTable: "ft_documents")
// It is possible to modify the content table
try db.execute("UPDATE documents SET content = ?", arguments: ["bar"])
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
try db.execute("DELETE FROM documents WHERE content = ?", arguments: ["foo"])
// It is possible to recreate the FT table
try db.create(virtualTable: "ft_documents", using: FTS5()) { t in
t.synchronize(withTable: "documents")
t.column("content")
}
}
}
}
#endif
+1 -1
View File
@@ -169,7 +169,7 @@ class FTS5TokenizerTests: GRDBTestCase {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
try db.create(virtualTable: "documents", using: FTS5()) { t in
t.tokenizer = .unicode61(tokenCharacters: Set(".-".characters))
t.tokenizer = .unicode61(tokenCharacters: Set(".-"))
t.column("content")
}
+14 -4
View File
@@ -12,23 +12,27 @@ import XCTest
@testable import GRDB // @testable so that we have access to SQLiteConnectionWillClose
#endif
// Support for Database.logError
var lastResultCode: ResultCode? = nil
var lastMessage: String? = nil
class GRDBTestCase: XCTestCase {
// The default configuration for tests
var dbConfiguration: Configuration!
// Builds a database queue based on dbConfiguration
func makeDatabaseQueue(filename: String = "db.sqlite") throws -> DatabaseQueue {
func makeDatabaseQueue(filename: String? = nil) throws -> DatabaseQueue {
try FileManager.default.createDirectory(atPath: dbDirectoryPath, withIntermediateDirectories: true, attributes: nil)
let dbPath = (dbDirectoryPath as NSString).appendingPathComponent(filename)
let dbPath = (dbDirectoryPath as NSString).appendingPathComponent(filename ?? ProcessInfo.processInfo.globallyUniqueString)
let dbQueue = try DatabaseQueue(path: dbPath, configuration: dbConfiguration)
try setup(dbQueue)
return dbQueue
}
// Builds a database pool based on dbConfiguration
func makeDatabasePool(filename: String = "db.sqlite") throws -> DatabasePool {
func makeDatabasePool(filename: String? = nil) throws -> DatabasePool {
try FileManager.default.createDirectory(atPath: dbDirectoryPath, withIntermediateDirectories: true, attributes: nil)
let dbPath = (dbDirectoryPath as NSString).appendingPathComponent(filename)
let dbPath = (dbDirectoryPath as NSString).appendingPathComponent(filename ?? ProcessInfo.processInfo.globallyUniqueString)
let dbPool = try DatabasePool(path: dbPath, configuration: dbConfiguration)
try setup(dbPool)
return dbPool
@@ -53,6 +57,12 @@ class GRDBTestCase: XCTestCase {
override func setUp() {
super.setUp()
// Must be set prior to any databaase connection
Database.logError = { (resultCode, message) in
lastResultCode = resultCode
lastMessage = message
}
let dbPoolDirectoryName = "GRDBTestCase-\(ProcessInfo.processInfo.globallyUniqueString)"
dbDirectoryPath = (NSTemporaryDirectory() as NSString).appendingPathComponent(dbPoolDirectoryName)
do { try FileManager.default.removeItem(atPath: dbDirectoryPath) } catch { }
+11 -11
View File
@@ -10,9 +10,9 @@ import XCTest
class SchedulingWatchdogTests: GRDBTestCase {
func testSchedulingWatchdog() throws {
let dbQueue1 = try makeDatabaseQueue(filename: "db1")
let dbQueue2 = try makeDatabaseQueue(filename: "db2")
let dbQueue3 = try makeDatabaseQueue(filename: "db3")
let dbQueue1 = try makeDatabaseQueue()
let dbQueue2 = try makeDatabaseQueue()
let dbQueue3 = try makeDatabaseQueue()
var db1: Database! = nil
var db2: Database! = nil
@@ -51,8 +51,8 @@ class SchedulingWatchdogTests: GRDBTestCase {
}
func testDatabaseQueueFromDatabaseQueue() throws {
let dbQueue1 = try makeDatabaseQueue(filename: "db1")
let dbQueue2 = try makeDatabaseQueue(filename: "db2")
let dbQueue1 = try makeDatabaseQueue()
let dbQueue2 = try makeDatabaseQueue()
try dbQueue1.inDatabase { db1 in
try db1.execute("CREATE TABLE items (id INTEGER PRIMARY KEY)")
try db1.execute("INSERT INTO items (id) VALUES (NULL)")
@@ -71,8 +71,8 @@ class SchedulingWatchdogTests: GRDBTestCase {
}
func testDatabaseQueueFromDatabasePool() throws {
let dbPool1 = try makeDatabasePool(filename: "db1")
let dbQueue2 = try makeDatabaseQueue(filename: "db2")
let dbPool1 = try makeDatabasePool()
let dbQueue2 = try makeDatabaseQueue()
try dbPool1.write { db1 in
try db1.execute("CREATE TABLE items (id INTEGER PRIMARY KEY)")
try db1.execute("INSERT INTO items (id) VALUES (NULL)")
@@ -91,8 +91,8 @@ class SchedulingWatchdogTests: GRDBTestCase {
}
func testDatabasePoolFromDatabaseQueue() throws {
let dbQueue1 = try makeDatabaseQueue(filename: "db1")
let dbPool2 = try makeDatabasePool(filename: "db2")
let dbQueue1 = try makeDatabaseQueue()
let dbPool2 = try makeDatabasePool()
try dbQueue1.inDatabase { db1 in
try db1.execute("CREATE TABLE items (id INTEGER PRIMARY KEY)")
try db1.execute("INSERT INTO items (id) VALUES (NULL)")
@@ -111,8 +111,8 @@ class SchedulingWatchdogTests: GRDBTestCase {
}
func testDatabasePoolFromDatabasePool() throws {
let dbPool1 = try makeDatabasePool(filename: "db1")
let dbPool2 = try makeDatabasePool(filename: "db2")
let dbPool1 = try makeDatabasePool()
let dbPool2 = try makeDatabasePool()
try dbPool1.write { db1 in
try db1.execute("CREATE TABLE items (id INTEGER PRIMARY KEY)")
try db1.execute("INSERT INTO items (id) VALUES (NULL)")
+6 -4
View File
@@ -462,14 +462,16 @@ class TableDefinitionTests: GRDBTestCase {
t.add(column: "b", .text)
t.add(column: "c", .integer).notNull().defaults(to: 1)
t.add(column: "d", .text).references("alt")
t.add(column: "e")
}
assertEqualSQL(sqlQueries[sqlQueries.count - 3], "ALTER TABLE \"test\" ADD COLUMN \"b\" TEXT")
assertEqualSQL(sqlQueries[sqlQueries.count - 2], "ALTER TABLE \"test\" ADD COLUMN \"c\" INTEGER NOT NULL DEFAULT 1")
assertEqualSQL(sqlQueries[sqlQueries.count - 1], "ALTER TABLE \"test\" ADD COLUMN \"d\" TEXT REFERENCES \"alt\"(\"rowid\")")
assertEqualSQL(sqlQueries[sqlQueries.count - 4], "ALTER TABLE \"test\" ADD COLUMN \"b\" TEXT")
assertEqualSQL(sqlQueries[sqlQueries.count - 3], "ALTER TABLE \"test\" ADD COLUMN \"c\" INTEGER NOT NULL DEFAULT 1")
assertEqualSQL(sqlQueries[sqlQueries.count - 2], "ALTER TABLE \"test\" ADD COLUMN \"d\" TEXT REFERENCES \"alt\"(\"rowid\")")
assertEqualSQL(sqlQueries[sqlQueries.count - 1], "ALTER TABLE \"test\" ADD COLUMN \"e\"")
}
}
func testDropTable() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
File diff suppressed because it is too large. Load diff
+32 -1
View File
@@ -28,7 +28,7 @@ class UpdateStatementTests : GRDBTestCase {
try dbQueue.inTransaction { db in
try db.makeUpdateStatement("INSERT INTO persons (name) VALUES ('Arthur');").execute()
try db.makeUpdateStatement("INSERT INTO persons (name) VALUES ('Barbara')\n \t").execute()
try db.makeUpdateStatement("INSERT INTO persons (name) VALUES ('Craig');").execute()
try db.makeUpdateStatement("INSERT INTO persons (name) VALUES ('Craig'); ; ;").execute()
try db.makeUpdateStatement("INSERT INTO persons (name) VALUES ('Daniel');\n \t").execute()
return .commit
}
@@ -182,6 +182,19 @@ class UpdateStatementTests : GRDBTestCase {
XCTAssertEqual(index, 3 + 3)
}
func testExecuteNothing() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("")
try db.execute(" ")
try db.execute(";")
try db.execute(";;")
try db.execute(" \n;\t; ")
try db.execute("-- comment")
try db.execute("-- comment\\n; -----ignored")
}
}
func testExecuteMultipleStatement() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
@@ -209,6 +222,24 @@ class UpdateStatementTests : GRDBTestCase {
}
}
func testExecuteMultipleStatementWithPlentyOfSemicolonsAndWhiteSpaceAndComments() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("""
;;
CREATE TABLE wines ( -- create a table
name TEXT, -- the name
color INT);
;\t;
-- create another table
CREATE TABLE books (name TEXT, age INT); \
\t; ;
""")
XCTAssertTrue(try db.tableExists("wines"))
XCTAssertTrue(try db.tableExists("books"))
}
}
func testExecuteMultipleStatementWithNamedArguments() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inTransaction { db in
+98
View File
@@ -0,0 +1,98 @@
#!/usr/bin/env ruby
gem 'json'
require 'json'
require 'date'
tests = JSON.parse(STDIN.read)
puts <<-REPORT
# Comparing the Performances of Swift SQLite libraries
*Last updated #{Date.today.strftime('%B %-d, %Y')}*
Below are performance benchmarks made on for [GRDB 2.4.1](https://github.com/groue/GRDB.swift), [FMDB 2.7.4](https://github.com/ccgus/fmdb), and [SQLite.swift 0.11.4](https://github.com/stephencelis/SQLite.swift). They are compared to Core Data, [Realm 3.0.2](https://realm.io) and the raw use of the SQLite C API from Swift.
This report was generated on a MacBook Pro (15-inch, Late 2016), with Xcode 9.2, by running the following command:
```sh
make test_performance | Tests/parsePerformanceTests.rb | Tests/generatePerformanceReport.rb
```
All tests use the default settings of each library. For each library, we:
- Build and consume database rows with raw SQL and column indexes (aiming at the best performance)
- Build and consume database rows with column names (sacrificing performance for maintainability)
- Build and consume records values to and from database rows (aiming at the shortest code from database to records)
- Build and consume records values to and from database rows, with [change tracking](https://github.com/groue/GRDB.swift#changes-tracking) (records know if they have unsaved changes)
As a bottom line, the raw SQLite C API is used as efficiently as possible, without any error checking.
| | Raw SQLite | FMDB | GRDB| SQLite.swift | Core Data | Realm |
|:------------------ | ----------:| --------:| --------:| ------------:| ----------:| -----:|
| **Column indexes** | | | | | | |
| Fetch | *#{tests['FetchPositionalValuesTests']['testSQLite']}* | **#{tests['FetchPositionalValuesTests']['testFMDB']}** | **#{tests['FetchPositionalValuesTests']['testGRDB']}** | #{tests['FetchPositionalValuesTests']['testSQLiteSwift']} | ¹ | ¹ |
| Insert | *#{tests['InsertPositionalValuesTests']['testSQLite']}* | #{tests['InsertPositionalValuesTests']['testFMDB']} | **#{tests['InsertPositionalValuesTests']['testGRDB']}** | #{tests['InsertPositionalValuesTests']['testSQLiteSwift']} | ¹ | ¹ |
| **Column names** | | | | | | |
| Fetch | ¹ | #{tests['FetchNamedValuesTests']['testFMDB']} | **#{tests['FetchNamedValuesTests']['testGRDB']}** | #{tests['FetchNamedValuesTests']['testSQLiteSwift']} | ¹ | ¹ |
| Insert | ¹ | #{tests['InsertNamedValuesTests']['testFMDB']} | **#{tests['InsertNamedValuesTests']['testGRDB']}** | #{tests['InsertNamedValuesTests']['testSQLiteSwift']} | ¹ | ¹ |
| **Records** | | | | | | |
| Fetch | *#{tests['FetchRecordStructTests']['testSQLite']}* | #{tests['FetchRecordStructTests']['testFMDB']} | **#{tests['FetchRecordStructTests']['testGRDB']}** | #{tests['FetchRecordStructTests']['testSQLiteSwift']} | ¹ | ¹ |
| Insert | ¹ | ¹ | **#{tests['InsertRecordStructTests']['testGRDB']}** | ¹ | ¹ | ¹ |
| **Records with change tracking** | | | | | | |
| Fetch | ¹ | ¹ | **#{tests['FetchRecordClassTests']['testGRDB']}** | ¹ | #{tests['FetchRecordClassTests']['testCoreData']} | #{tests['FetchRecordClassTests']['testRealm']} |
| Insert | ¹ | ¹ | **#{tests['InsertRecordClassTests']['testGRDB']}** | ¹ | #{tests['InsertRecordClassTests']['testCoreData']} | #{tests['InsertRecordClassTests']['testRealm']} |
¹ Not applicable
- **Column indexes**:
- **Fetch** ([source](https://github.com/groue/GRDB.swift/blob/master/Tests/Performance/FetchPositionalValuesTests.swift))
This test fetches 100000 rows of 10 ints and extracts each int given its position in the row.
It uses FMDB's `-[FMResultSet longForColumnIndex:]`, GRDB's `Row.value(atIndex:)`, and the low-level SQL API of SQLite.swift.
- **Insert** ([source](https://github.com/groue/GRDB.swift/blob/master/Tests/Performance/InsertPositionalValuesTests.swift))
This test inserts 20000 rows of 10 ints, by setting query arguments given their position.
It uses FMDB's `-[FMDatabase executeUpdate:withArgumentsInArray:]` with statement caching, GRDB's `UpdateStatement.execute(arguments:Array)`, and the low-level SQL API of SQLite.swift.
- **Column names**:
- **Fetch** ([source](https://github.com/groue/GRDB.swift/blob/master/Tests/Performance/FetchNamedValuesTests.swift))
This test fetches 100000 rows of 10 ints and extracts each int given its column name.
It uses FMDB's `-[FMResultSet longForColumn:]`, GRDB's `Row.value(named:)`, and the high-level query builder of SQLite.swift.
- **Insert** ([source](https://github.com/groue/GRDB.swift/blob/master/Tests/Performance/InsertNamedValuesTests.swift))
This test inserts 20000 rows of 10 ints, by setting query arguments given their argument name.
It uses FMDB's `-[FMDatabase executeUpdate:withParameterDictionary:]` with statement caching, GRDB's `UpdateStatement.execute(arguments:Dictionary)`, and the high-level query builder of SQLite.swift.
- **Records**:
- **Fetch** ([source](https://github.com/groue/GRDB.swift/blob/master/Tests/Performance/FetchRecordStructTests.swift))
This test fetches an array of 100000 record objects initiated from rows of 10 ints.
It builds records from FMDB's `-[FMResultSet resultDictionary]`, GRDB's built-in [RowConvertible](https://github.com/groue/GRDB.swift#rowconvertible-protocol) protocol, and the values returned by the high-level query builder of SQLite.swift.
- **Insert** ([source](https://github.com/groue/GRDB.swift/blob/master/Tests/Performance/InsertRecordStructTests.swift))
This tests inserts 20000 records with the persistence method provided by GRDB's [Persistable](https://github.com/groue/GRDB.swift#persistable-protocol) protocol.
- **Records with change tracking**:
- **Fetch** ([source](https://github.com/groue/GRDB.swift/blob/master/Tests/Performance/FetchRecordClassTests.swift))
This test fetches an array of 100000 record objects initiated from rows of 10 ints.
It builds records from FMDB's `-[FMResultSet resultDictionary]`, GRDB's built-in [Record](https://github.com/groue/GRDB.swift#record-class) class.
- **Insert** ([source](https://github.com/groue/GRDB.swift/blob/master/Tests/Performance/InsertRecordClassTests.swift))
This tests inserts 20000 records with the persistence method provided by GRDB's [Record](https://github.com/groue/GRDB.swift#record-class) class.
REPORT
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby
gem 'json'
require 'json'
tests = {}
STDIN.each do |line|
if line =~ /\.([^ ]*) ([^ ]*)\]' measured \[Time, seconds\] average: ([\d.]+)/
class_name = $1
test_name = $2
time = $3
tests[class_name] ||= {}
tests[class_name][test_name] = time.to_f
end
end
puts tests.to_json
-10
View File
@@ -1,10 +0,0 @@
#/bin/sh
#
# Outputs the compilation time of all methods.
# To get the 20 slowest methods, run ./slow_methods.sh | head -20
set -e
PROJECT=GRDB.xcodeproj
TARGET=GRDBiOS
OTHER_SWIFT_FLAGS='-Xfrontend -debug-time-function-bodies' xcodebuild -project $PROJECT -target $TARGET 2>&1 clean build | grep '^[0-9][0-9.]*.*\t' | sort -nr