Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
groue committed Aug 15, 2021
2 parents 3de6f51 + f0443a6 commit eda960d
Show file tree
Hide file tree
Showing 142 changed files with 7,397 additions and 2,300 deletions.
1 change: 0 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,3 @@ opt_in_rules:

vertical_whitespace:
max_empty_lines: 2

88 changes: 44 additions & 44 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,121 +41,121 @@ jobs:
script: make test_framework_GRDBiOS_minTarget

###########################################
## Test GRDB Xcode 12.2
## Test GRDB Xcode 12.5

- name: "Test GRDB Xcode 12.2 - GRDBOSX - Swift 5.3"
- name: "Test GRDB Xcode 12.5 - GRDBOSX - Swift 5.3"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_framework_GRDBOSX_maxSwift

- name: "Test GRDB Xcode 12.2 - GRDBOSX - Swift 5.2"
- name: "Test GRDB Xcode 12.5 - GRDBOSX - Swift 5.2"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_framework_GRDBOSX_minSwift

- name: "Test GRDB Xcode 12.2 - GRDBWatchOS"
- name: "Test GRDB Xcode 12.5 - GRDBWatchOS"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_framework_GRDBWatchOS

- name: "Test GRDB Xcode 12.2 - GRDBiOS iOS maxTarget"
- name: "Test GRDB Xcode 12.5 - GRDBiOS iOS maxTarget"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_framework_GRDBiOS_maxTarget_maxSwift

- name: "Test GRDB Xcode 12.2 - GRDBiOS iOS minTarget"
- name: "Test GRDB Xcode 12.5 - GRDBiOS iOS minTarget"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_framework_GRDBiOS_minTarget

- name: "Test GRDB Xcode 12.2 - GRDBtvOS maxTarget"
- name: "Test GRDB Xcode 12.5 - GRDBtvOS maxTarget"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_framework_GRDBtvOS_maxTarget_maxSwift

- name: "Test GRDB Xcode 12 - GRDBtvOS minTarget"
- name: "Test GRDB Xcode 12.5 - GRDBtvOS minTarget"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_framework_GRDBtvOS_minTarget

- name: "Test GRDB Xcode 12.2 - SPM"
- name: "Test GRDB Xcode 12.5 - SPM"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_SPM

###########################################
## Test GRDBCustom Xcode 12.2
## Test GRDBCustom Xcode 12.5

- name: "Test GRDBCustom Xcode 12.2 - GRDBOSX"
- name: "Test GRDBCustom Xcode 12.5 - GRDBOSX"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_framework_GRDBCustomSQLiteOSX

- name: "Test GRDBCustom Xcode 12.2 - GRDBiOS maxTarget"
- name: "Test GRDBCustom Xcode 12.5 - GRDBiOS maxTarget"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_framework_GRDBCustomSQLiteiOS_maxTarget_maxSwift

- name: "Test GRDBCustom Xcode 12.2 - GRDBiOS minTarget"
- name: "Test GRDBCustom Xcode 12.5 - GRDBiOS minTarget"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_framework_GRDBCustomSQLiteiOS_minTarget

###########################################
## Test SQLCipher Xcode 12.2
## Test SQLCipher Xcode 12.5

- name: "Test SQLCipher Xcode 12.2 - SQLCipher 3"
- name: "Test SQLCipher Xcode 12.5 - SQLCipher 3"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_framework_SQLCipher3

- name: "Test SQLCipher Xcode 12.2 - SQLCipher 4"
- name: "Test SQLCipher Xcode 12.5 - SQLCipher 4"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_framework_SQLCipher4

###########################################
## Test Installation Xcode 12.2
## Test Installation Xcode 12.5

# Manual Install
- name: "Test Installation Xcode 12.2 - Manual Install"
- name: "Test Installation Xcode 12.5 - Manual Install"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_install_manual

# Travis is much too slow, and always fail this job
# # CocoaPods Lint
# - name: "Test Installation Xcode 12.2 - CocoaPods Lint"
# - name: "Test Installation Xcode 12.5 - CocoaPods Lint"
# gemfile: .ci/gemfiles/Gemfile.travis
# osx_image: xcode12.2
# osx_image: xcode12.5
# script: make test_CocoaPodsLint_GRDB

# CocoaPods Install GRDB
- name: "Test Installation Xcode 12.2 - CocoaPods Framework"
- name: "Test Installation Xcode 12.5 - CocoaPods Framework"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_install_GRDB_CocoaPods_framework

# CocoaPods Install GRDB
- name: "Test Installation Xcode 12.2 - CocoaPods Static"
- name: "Test Installation Xcode 12.5 - CocoaPods Static"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_install_GRDB_CocoaPods_static

# SPM Install
- name: "Test Installation Xcode 12.2 - SPM Package"
- name: "Test Installation Xcode 12.5 - SPM Package"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_install_SPM_Package

# SPM Install
- name: "Test Installation Xcode 12.2 - SPM Package in Xcode Project"
- name: "Test Installation Xcode 12.5 - SPM Package in Xcode Project"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_install_SPM_Project

# Custom SQLite Install
- name: "Test Installation Xcode 12.2 - Custom SQLite"
- name: "Test Installation Xcode 12.5 - Custom SQLite"
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode12.2
osx_image: xcode12.5
script: make test_install_customSQLite
27 changes: 25 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception:

#### 5.x Releases

- [Development Branch](#development-branch)
- `5.9.x` Releases - [5.9.0](#590)
- `5.8.x` Releases - [5.8.0](#580)
- `5.7.x` Releases - [5.7.0](#570) | [5.7.1](#571) | [5.7.2](#572) | [5.7.3](#573) | [5.7.4](#574)
- `5.6.x` Releases - [5.6.0](#560)
Expand Down Expand Up @@ -76,9 +76,32 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception:

---

## Development Branch
## 5.9.0

Released August 15, 2021 • [diff](https://github.com/groue/GRDB.swift/compare/v5.8.0...v5.9.0)

- **Fixed**: [#980](https://github.com/groue/GRDB.swift/pull/980) by [@jroselightricks](https://github.com/jroselightricks): Fix spelling
- **Fixed**: [#989](https://github.com/groue/GRDB.swift/pull/989) by [@pp5x](https://github.com/pp5x): FTS: add support of ifNotExists in synchronize()
- **Fixed**: [#999](https://github.com/groue/GRDB.swift/issues/999): `request(for: association)` no longer crashes when the foreign key contains a NULL value.
- **Fixed**: [#1025](https://github.com/groue/GRDB.swift/issues/1025) by [@mattgallagher](https://github.com/mattgallagher): Fix ValueObservation crash
- **Fixed**: Fix thread unsafety in `ValueObservation.print()`
- **New**: The `selectID()` method is now available for [Identifiable Records](README.md#identifiable-records)
- **New**: Cached prepared statements can profit from [SQL Interpolation](Documentation/SQLInterpolation.md):

```swift
let updateStatement = try db.cachedStatement(literal: "INSERT ...")
// ~~~~~~~
```

- **New**: [#993](https://github.com/groue/GRDB.swift/pull/993) by [@groue](https://github.com/groue): QueryInterfaceRequest builder with dynamic table/view name
- **New**: Types that adopt both `DatabaseValueConvertible` and `Codable` now profit from automatic JSON encoding and decoding.
- **New**: [#1010](https://github.com/groue/GRDB.swift/pull/1010) by [@tternes](https://github.com/tternes): Add VACUUM INTO Support
- **New**: [#1012](https://github.com/groue/GRDB.swift/pull/1012) by [@ZevEisenberg](https://github.com/ZevEisenberg): Add brackets to urls in doc comments to make them clickable
- **New**: [#1019](https://github.com/groue/GRDB.swift/pull/1019) by [@groue](https://github.com/groue): Merge prepared statement types, and introduce statement cursor
- **Documentation Update**: The [Requests](README.md#requests) chapter was updated for the new `Table` type that can build requests without any record type.
- **Documentation Update**: The [Custom Value Types](README.md#custom-value-types) chapter was extended about the new support for codable value types encoded as JSON arrays or objects.
- **Documentation Update**: The [Fetching Methods](README.md#fetching-methods) and [Prepared Statements](README.md#prepared-statements) chapters have been updated for the unique `Statement` class, and the new `Database.allStatements()` method.


## 5.8.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import GRDB
/// AppDatabase lets the application access the database.
///
/// It applies the pratices recommended at
/// https://github.com/groue/GRDB.swift/blob/master/Documentation/GoodPracticesForDesigningRecordTypes.md
/// <https://github.com/groue/GRDB.swift/blob/master/Documentation/GoodPracticesForDesigningRecordTypes.md>
struct AppDatabase {
/// Creates an `AppDatabase`, and make sure the database schema is ready.
init(_ dbWriter: DatabaseWriter) throws {
Expand All @@ -17,12 +17,12 @@ struct AppDatabase {
/// Application can use a `DatabasePool`, while SwiftUI previews and tests
/// can use a fast in-memory `DatabaseQueue`.
///
/// See https://github.com/groue/GRDB.swift/blob/master/README.md#database-connections
/// See <https://github.com/groue/GRDB.swift/blob/master/README.md#database-connections>
private let dbWriter: DatabaseWriter

/// The DatabaseMigrator that defines the database schema.
///
/// See https://github.com/groue/GRDB.swift/blob/master/Documentation/Migrations.md
/// See <https://github.com/groue/GRDB.swift/blob/master/Documentation/Migrations.md>
private var migrator: DatabaseMigrator {
var migrator = DatabaseMigrator()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ extension Player {

/// Make Player a Codable Record.
///
/// See https://github.com/groue/GRDB.swift/blob/master/README.md#records
/// See <https://github.com/groue/GRDB.swift/blob/master/README.md#records>
extension Player: Codable, FetchableRecord, MutablePersistableRecord {
// Define database columns from CodingKeys
fileprivate enum Columns {
Expand All @@ -69,8 +69,8 @@ extension Player: Codable, FetchableRecord, MutablePersistableRecord {

/// Define some player requests used by the application.
///
/// See https://github.com/groue/GRDB.swift/blob/master/README.md#requests
/// See https://github.com/groue/GRDB.swift/blob/master/Documentation/GoodPracticesForDesigningRecordTypes.md
/// See <https://github.com/groue/GRDB.swift/blob/master/README.md#requests>
/// See <https://github.com/groue/GRDB.swift/blob/master/Documentation/GoodPracticesForDesigningRecordTypes.md>
extension DerivableRequest where RowDecoder == Player {
/// A request of players ordered by name.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import GRDB
/// AppDatabase lets the application access the database.
///
/// It applies the pratices recommended at
/// https://github.com/groue/GRDB.swift/blob/master/Documentation/GoodPracticesForDesigningRecordTypes.md
/// <https://github.com/groue/GRDB.swift/blob/master/Documentation/GoodPracticesForDesigningRecordTypes.md>
final class AppDatabase {
/// Creates an `AppDatabase`, and make sure the database schema is ready.
init(_ dbWriter: DatabaseWriter) throws {
Expand All @@ -16,12 +16,12 @@ final class AppDatabase {
/// Application can use a `DatabasePool`, and tests can use a fast
/// in-memory `DatabaseQueue`.
///
/// See https://github.com/groue/GRDB.swift/blob/master/README.md#database-connections
/// See <https://github.com/groue/GRDB.swift/blob/master/README.md#database-connections>
private let dbWriter: DatabaseWriter

/// The DatabaseMigrator that defines the database schema.
///
/// See https://github.com/groue/GRDB.swift/blob/master/Documentation/Migrations.md
/// See <https://github.com/groue/GRDB.swift/blob/master/Documentation/Migrations.md>
private var migrator: DatabaseMigrator {
var migrator = DatabaseMigrator()

Expand Down
6 changes: 3 additions & 3 deletions Documentation/DemoApps/GRDBDemoiOS/GRDBDemoiOS/Player.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extension Player {

/// Make Player a Codable Record.
///
/// See https://github.com/groue/GRDB.swift/blob/master/README.md#records
/// See <https://github.com/groue/GRDB.swift/blob/master/README.md#records>
extension Player: Codable, FetchableRecord, MutablePersistableRecord {
// Define database columns from CodingKeys
fileprivate enum Columns {
Expand All @@ -68,8 +68,8 @@ extension Player: Codable, FetchableRecord, MutablePersistableRecord {

/// Define some player requests used by the application.
///
/// See https://github.com/groue/GRDB.swift/blob/master/README.md#requests
/// See https://github.com/groue/GRDB.swift/blob/master/Documentation/GoodPracticesForDesigningRecordTypes.md
/// See <https://github.com/groue/GRDB.swift/blob/master/README.md#requests>
/// See <https://github.com/groue/GRDB.swift/blob/master/Documentation/GoodPracticesForDesigningRecordTypes.md>
extension DerivableRequest where RowDecoder == Player {
/// A request of players ordered by name.
///
Expand Down
4 changes: 2 additions & 2 deletions Documentation/FullTextSearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ let pattern = FTS3Pattern(matchingAnyTokenIn: "") // nil
let pattern = FTS3Pattern(matchingAnyTokenIn: "*") // nil
```

FTS3Pattern are regular [values](../README.md#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/5.8/Structs/StatementArguments.html):
FTS3Pattern are regular [values](../README.md#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/5.9/Structs/StatementArguments.html):

```swift
let documents = try Document.fetchAll(db,
Expand Down Expand Up @@ -529,7 +529,7 @@ let pattern = FTS5Pattern(matchingAnyTokenIn: "") // nil
let pattern = FTS5Pattern(matchingAnyTokenIn: "*") // nil
```

FTS5Pattern are regular [values](../README.md#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/5.8/Structs/StatementArguments.html):
FTS5Pattern are regular [values](../README.md#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/5.9/Structs/StatementArguments.html):

```swift
let documents = try Document.fetchAll(db,
Expand Down
2 changes: 1 addition & 1 deletion Documentation/Migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ try dbQueue.read { db in
}
```

See the [DatabaseMigrator reference](http://groue.github.io/GRDB.swift/docs/5.8/Structs/DatabaseMigrator.html) for more migrator methods.
See the [DatabaseMigrator reference](http://groue.github.io/GRDB.swift/docs/5.9/Structs/DatabaseMigrator.html) for more migrator methods.


## The `eraseDatabaseOnSchemaChange` Option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,38 +212,38 @@ extension Base: MyDatabaseDecoder {
//: **prepared statement**:
//:
//: try dbQueue.read { db in
//: let statement = try db.makeSelectStatement(sql: "SELECT ...")
//: let statement = try db.makeStatement(sql: "SELECT ...")
//: try Base.fetchCursor(statement) // Cursor of Base
//: try Base.fetchAll(statement) // [Base]
//: try Base.fetchOne(statement) // Base?
//: }

extension MyDatabaseDecoder {
// MARK: - Fetch from SelectStatement
// MARK: - Fetch from Prepared Statement

// SelectStatement, StatementArguments, and RowAdapter are the fundamental
// Statement, StatementArguments, and RowAdapter are the fundamental
// fetching parameters of GRDB. Make sure to accept them all:
static func fetchCursor(_ statement: SelectStatement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws -> MapCursor<RowCursor, DecodedType> {
static func fetchCursor(_ statement: Statement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws -> MapCursor<RowCursor, DecodedType> {
// Turn the cursor of raw rows into a cursor of decoded rows
return try Row.fetchCursor(statement, arguments: arguments, adapter: adapter).map {
self.decode(row: $0)
}
}

static func fetchAll(_ statement: SelectStatement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws -> [DecodedType] {
static func fetchAll(_ statement: Statement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws -> [DecodedType] {
// Turn the cursor into an Array
return try Array(fetchCursor(statement, arguments: arguments, adapter: adapter))
}

static func fetchOne(_ statement: SelectStatement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws -> DecodedType? {
static func fetchOne(_ statement: Statement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws -> DecodedType? {
// Consume the first value of the cursor
return try fetchCursor(statement, arguments: arguments, adapter: adapter).next()
}
}

try dbQueue.read { db in
print("> Fetch from prepared statement")
let statement = try db.makeSelectStatement(sql: "SELECT * FROM base")
let statement = try db.makeStatement(sql: "SELECT * FROM base")
let bases = try Base.fetchAll(statement)
for base in bases {
print(base.description)
Expand Down Expand Up @@ -422,7 +422,7 @@ protocol ContextFetchableRecord {

extension ContextFetchableRecord {
static func fetchCursor(
_ statement: SelectStatement,
_ statement: Statement,
arguments: StatementArguments? = nil,
adapter: RowAdapter? = nil,
context: Context)
Expand Down Expand Up @@ -454,7 +454,7 @@ protocol FailableFetchableRecord {

extension FailableFetchableRecord {
static func fetchCursor(
_ statement: SelectStatement,
_ statement: Statement,
arguments: StatementArguments? = nil,
adapter: RowAdapter? = nil)
throws -> MapCursor<RowCursor, Self>
Expand Down
Loading

0 comments on commit eda960d

Please sign in to comment.