mirror of
https://github.com/groue/GRDB.swift
synced 2026-12-06 05:28:44 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19b067405f | ||
|
|
3b494b5737 | ||
|
|
5f11a19296 | ||
|
|
3ff7675eb7 | ||
|
|
3d06841eba |
No files matched your search
+41
-38
@@ -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
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
Release Notes
|
||||
=============
|
||||
|
||||
## 2.3.0
|
||||
|
||||
Released November 5, 2017 • [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 • [diff](https://github.com/groue/GRDB.swift/compare/v2.1.0...v2.2.0)
|
||||
|
||||
@@ -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.3.0
|
||||
git submodule update --init SQLiteCustom/src
|
||||
````
|
||||
|
||||
|
||||
@@ -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.3/Functions.html) and [count(distinct:)](http://groue.github.io/GRDB.swift/docs/2.3/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.3/Protocols/SQLExpression.html) protocol.
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'GRDB.swift'
|
||||
s.version = '2.2.0'
|
||||
s.version = '2.3.0'
|
||||
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.summary = 'A Swift application toolkit for SQLite databases.'
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'GRDBCipher'
|
||||
s.version = '2.2.0'
|
||||
s.version = '2.3.0'
|
||||
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.summary = 'A Swift application toolkit for SQLite databases.'
|
||||
|
||||
@@ -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
|
||||
@@ -292,10 +295,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.3.0 \
|
||||
--module-version 2.3 \
|
||||
--module GRDB \
|
||||
--root-url http://groue.github.io/GRDB.swift/docs/2.2/ \
|
||||
--root-url http://groue.github.io/GRDB.swift/docs/2.3/ \
|
||||
--output Documentation/Reference \
|
||||
--podspec GRDB.swift.podspec
|
||||
else
|
||||
|
||||
@@ -3,7 +3,7 @@ GRDB 2 [](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**: November 5, 2017 • version 2.3.0 • [CHANGELOG](CHANGELOG.md)
|
||||
|
||||
**Requirements**: iOS 8.0+ / OSX 10.9+ / watchOS 2.0+ • Swift 4.0 / Xcode 9+
|
||||
|
||||
@@ -14,7 +14,7 @@ GRDB 2 [](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.3.0** |
|
||||
|
||||
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.3/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.3.0")
|
||||
]
|
||||
)
|
||||
```
|
||||
@@ -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.3.0) a copy of GRDB, or clone its repository and make sure you use the latest tagged version with the `git checkout v2.3.0` 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.3/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.3/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.3/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.3/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.3/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.3/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.3/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.3/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.3/Structs/Configuration.html)
|
||||
- `sqlite3_changes`, `sqlite3_total_changes`: see [Database.changesCount and Database.totalChangesCount](http://groue.github.io/GRDB.swift/docs/2.3/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.3/Classes/Statement.html)
|
||||
- `sqlite3_trace`: see [Configuration.trace](http://groue.github.io/GRDB.swift/docs/2.3/Structs/Configuration.html)
|
||||
- `sqlite3_wal_checkpoint_v2`: see [DatabasePool.checkpoint](http://groue.github.io/GRDB.swift/docs/2.3/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.3/Structs/StatementArguments.html) for more information about the query arguments.
|
||||
|
||||
|
||||
## TableMapping Protocol
|
||||
@@ -3181,7 +3181,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.3/Structs/StatementArguments.html):
|
||||
|
||||
```swift
|
||||
// SELECT DATE(creationDate), COUNT(*) FROM players WHERE name = 'Arthur' GROUP BY date(creationDate)
|
||||
@@ -3650,9 +3650,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.3/Structs/SQLRequest.html): a Request built from raw SQL
|
||||
- [AnyRequest](http://groue.github.io/GRDB.swift/docs/2.3/Structs/AnyRequest.html): a type-erased Request
|
||||
- [AnyTypedRequest](http://groue.github.io/GRDB.swift/docs/2.3/Structs/AnyTypedRequest.html): a type-erased TypedRequest
|
||||
|
||||
Use the `asRequest(of:)` method to define the type fetched by the request:
|
||||
|
||||
@@ -4082,7 +4082,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.3/Structs/StatementArguments.html):
|
||||
|
||||
```swift
|
||||
let documents = try Document.fetchAll(db,
|
||||
@@ -4295,7 +4295,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.3/Structs/StatementArguments.html):
|
||||
|
||||
```swift
|
||||
let documents = try Document.fetchAll(db,
|
||||
@@ -5118,7 +5118,7 @@ Alternatively, perform a manual installation of GRDB and SQLCipher:
|
||||
|
||||
```sh
|
||||
cd [GRDB directory]
|
||||
git checkout v2.2.0
|
||||
git checkout v2.3.0
|
||||
git submodule update --init SQLCipher/src
|
||||
```
|
||||
|
||||
@@ -5225,7 +5225,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.3/Structs/StatementArguments.html) to your SQL queries:
|
||||
|
||||
```swift
|
||||
// Good
|
||||
@@ -5804,7 +5804,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.3/Protocols/DatabaseReader.html) and [DatabaseWriter](http://groue.github.io/GRDB.swift/docs/2.3/Protocols/DatabaseWriter.html) protocols.
|
||||
|
||||
These protocols provide a unified API that lets you write safe concurrent code that targets both classes.
|
||||
|
||||
@@ -5812,7 +5812,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.3/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 +5899,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.3/Structs/Configuration.html)
|
||||
- [Ask questions](https://github.com/groue/GRDB.swift/issues)
|
||||
|
||||
|
||||
|
||||
+1
-1
Submodule SQLiteCustom/src updated: 0c6c093316...73bb494220.
+1
-1
@@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.2.0</string>
|
||||
<string>2.3.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -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 ''-.''')")
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user