diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1c05fd109..a9a667d0b 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -10,4 +10,3 @@ Please verify that your pull request checks those boxes: - [ ] Inline documentation has been updated. - [ ] README.md or another dedicated guide has been updated. - [ ] Changes are tested, for all flavors of GRDB, GRDBCipher, and GRDBCustomSQLite. -- [ ] CHANGELOG.md has been updated. diff --git a/.travis.yml b/.travis.yml index 31a1f7b0f..6ffd109be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -194,16 +194,7 @@ jobs: install: - gem install cocoapods # >= 1.6.0 for cocoapods lint env: - - TID=CocoaPods Lint GRDBPlus - script: make test_CocoaPodsLint_GRDBPlus - - # CocoaPods Lint - - stage: Test Installation Xcode 10.1 - osx_image: xcode10.1 - install: - - gem install cocoapods # >= 1.6.0 for cocoapods lint - env: - - TID=CocoaPods Lint GRDBCipher + - TID=CocoaPods Lint GRDBCipher (Xcode 10) script: make test_CocoaPodsLint_GRDBCipher # CocoaPods Install @@ -215,23 +206,17 @@ jobs: - TID=CocoaPods GRDB script: make test_install_GRDB_CocoaPods - # CocoaPods Install - - stage: Test Installation Xcode 10.1 - osx_image: xcode10.1 - install: - - gem install cocoapods # >= 1.6.0 for cocoapods lint - env: - - TID=CocoaPods GRDB+FTS5 - script: make test_install_GRDBFTS5_CocoaPods - - # CocoaPods Install - - stage: Test Installation Xcode 10.1 - osx_image: xcode10.1 - install: - - gem install cocoapods # >= 1.6.0 for cocoapods lint - env: - - TID=CocoaPods GRDBCipher - script: make test_install_GRDBCipher_CocoaPods + # Disabled until we understand the reason for this failure: + # https://travis-ci.org/groue/GRDB.swift/jobs/503214543 + # + # # CocoaPods Install (Xcode 10) + # - stage: Test Installation + # osx_image: xcode10 + # install: + # - gem install cocoapods --pre # >= 1.6.0.beta.1 for cocoapods lint + # env: + # - TID=CocoaPods GRDBCipher (Xcode 10) + # script: make test_install_GRDBCipher_CocoaPods # SPM Install - stage: Test Installation Xcode 10.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index fcac546fe..ac9281d08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one expection: #### 3.x Releases +- `3.7.x` Releases - [3.7.0](#370) - `3.6.x` Releases - [3.6.0](#360) | [3.6.1](#361) | [3.6.2](#362) - `3.5.x` Releases - [3.5.0](#350) - `3.4.x` Releases - [3.4.0](#340) @@ -68,6 +69,25 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one expection: - [SQL Interpolation](Documentation/SQLInterpolation.md): this new document describes the new SQL interpolation feature. +## 3.7.0 + +Released March 9, 2019 • [diff](https://github.com/groue/GRDB.swift/compare/v3.6.2...v3.7.20) + +### Fixed + +- [#496](https://github.com/groue/GRDB.swift/pull/496): Fix crash when trying to perform fetchCount or ValueObservation.trackCount on joined query + +### New + +- [#494](https://github.com/groue/GRDB.swift/pull/494) by [@davidkraus](https://github.com/davidkraus): Document how to enable FTS5 with GRDB.swift CocoaPod +- [#497](https://github.com/groue/GRDB.swift/pull/497) by [@Marus](https://github.com/Marus): Add additional SQLCipher configuration options + +### Documentation Diff + +- [Advanced configuration options for SQLCipher](README.md#advanced-configuration-options-for-sqlcipher): this new chapter documents the new database encryption APIs. +- [Enabling FTS5 Support](README.md#enabling-fts5-support) has been updated with a new technique for enabling FTS5 with the GRDB.swift CocoaPod. + + ## 3.6.2 Released January 5, 2019 • [diff](https://github.com/groue/GRDB.swift/compare/v3.6.1...v3.6.2) diff --git a/Documentation/CustomSQLiteBuilds.md b/Documentation/CustomSQLiteBuilds.md index 29b08440e..933453afa 100644 --- a/Documentation/CustomSQLiteBuilds.md +++ b/Documentation/CustomSQLiteBuilds.md @@ -15,7 +15,7 @@ GRDB builds SQLite with [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfal ```sh cd [GRDB directory] - git checkout v3.6.2 + git checkout v3.7.0 git submodule update --init SQLiteCustom/src ```` diff --git a/GRDB.swift.podspec b/GRDB.swift.podspec index dce643bdd..6bf05d161 100644 --- a/GRDB.swift.podspec +++ b/GRDB.swift.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'GRDB.swift' - s.version = '3.6.2' + s.version = '3.7.0' s.license = { :type => 'MIT', :file => 'LICENSE' } s.summary = 'A toolkit for SQLite databases, with a focus on application development.' diff --git a/GRDB/Core/Configuration.swift b/GRDB/Core/Configuration.swift index fac576893..18934e3ff 100644 --- a/GRDB/Core/Configuration.swift +++ b/GRDB/Core/Configuration.swift @@ -77,10 +77,24 @@ public struct Configuration { // MARK: - Encryption #if SQLITE_HAS_CODEC - /// The passphrase for encrypted database. + /// The passphrase for the encrypted database. /// /// Default: nil public var passphrase: String? + + /// The cipher_page_size setting for the encrypted database. + /// + /// See https://www.zetetic.net/sqlcipher/sqlcipher-api/#cipher_page_size + /// + /// Default: 1024 - this corresponds to the default used by SQLCipher 3 + public var cipherPageSize: Int = 1024 + + /// The kdf_iter setting for the encrypted database. + /// + /// See https://www.zetetic.net/sqlcipher/sqlcipher-api/#kdf_iter + /// + /// Default: 64000 - this corresponds to the default used by SQLCipher 3 + public var kdfIterations: Int = 64000 #endif diff --git a/GRDB/Core/Database.swift b/GRDB/Core/Database.swift index 28afc6f2c..cee17ca88 100644 --- a/GRDB/Core/Database.swift +++ b/GRDB/Core/Database.swift @@ -173,6 +173,8 @@ public final class Database { try Database.validateSQLCipher(sqliteConnection) if let passphrase = configuration.passphrase { try Database.set(passphrase: passphrase, forConnection: sqliteConnection) + try Database.set(cipherPageSize: configuration.cipherPageSize, forConnection: sqliteConnection) + try Database.set(kdfIterations: configuration.kdfIterations, forConnection: sqliteConnection) } #endif try Database.validateDatabaseFormat(sqliteConnection) @@ -267,6 +269,36 @@ extension Database { throw DatabaseError(resultCode: code, message: String(cString: sqlite3_errmsg(sqliteConnection))) } } + + private static func set(cipherPageSize: Int, forConnection sqliteConnection: SQLiteConnection) throws { + var sqliteStatement: SQLiteStatement? = nil + var code = sqlite3_prepare_v2(sqliteConnection, "PRAGMA cipher_page_size = \(cipherPageSize)", -1, &sqliteStatement, nil) + guard code == SQLITE_OK else { + throw DatabaseError(resultCode: code, message: String(cString: sqlite3_errmsg(sqliteConnection))) + } + defer { + sqlite3_finalize(sqliteStatement) + } + code = sqlite3_step(sqliteStatement) + if code != SQLITE_DONE { + throw DatabaseError(resultCode: code, message: String(cString: sqlite3_errmsg(sqliteConnection))) + } + } + + private static func set(kdfIterations: Int, forConnection sqliteConnection: SQLiteConnection) throws { + var sqliteStatement: SQLiteStatement? = nil + var code = sqlite3_prepare_v2(sqliteConnection, "PRAGMA kdf_iter = \(kdfIterations)", -1, &sqliteStatement, nil) + guard code == SQLITE_OK else { + throw DatabaseError(resultCode: code, message: String(cString: sqlite3_errmsg(sqliteConnection))) + } + defer { + sqlite3_finalize(sqliteStatement) + } + code = sqlite3_step(sqliteStatement) + if code != SQLITE_DONE { + throw DatabaseError(resultCode: code, message: String(cString: sqlite3_errmsg(sqliteConnection))) + } + } #endif private static func validateDatabaseFormat(_ sqliteConnection: SQLiteConnection) throws { @@ -935,6 +967,7 @@ extension Database { /// /// To set the busy mode of a database, use Configuration: /// + /// // Wait 1 second before failing with SQLITE_BUSY /// let configuration = Configuration(busyMode: .timeout(1)) /// let dbQueue = DatabaseQueue(path: "...", configuration: configuration) /// @@ -950,7 +983,7 @@ extension Database { case immediateError /// The SQLITE_BUSY error will be returned only if the database remains - /// locked for more than the specified duration. + /// locked for more than the specified duration (in seconds). case timeout(TimeInterval) /// A custom callback that is called when a database is locked. diff --git a/GRDB/Utils/OrderedDictionary.swift b/GRDB/Utils/OrderedDictionary.swift index 63df05cbd..ab8600abd 100644 --- a/GRDB/Utils/OrderedDictionary.swift +++ b/GRDB/Utils/OrderedDictionary.swift @@ -10,8 +10,8 @@ /// dict.map { $0.key } // ["foo", "bar"], in this order. @usableFromInline struct OrderedDictionary { - @usableFromInline var keys: [Key] - @usableFromInline var dictionary: [Key: Value] + @usableFromInline private(set) var keys: [Key] + @usableFromInline private(set) var dictionary: [Key: Value] var values: [Value] { return keys.map { dictionary[$0]! } diff --git a/GRDBCipher.podspec b/GRDBCipher.podspec index 3a1f61b67..1ea212225 100644 --- a/GRDBCipher.podspec +++ b/GRDBCipher.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'GRDBCipher' - s.version = '3.6.2' + s.version = '3.7.0' s.license = { :type => 'MIT', :file => 'LICENSE' } s.summary = 'A toolkit for SQLite databases, with a focus on application development.' diff --git a/GRDBPlus.podspec b/GRDBPlus.podspec index 560f0fcb6..4642ffa29 100644 --- a/GRDBPlus.podspec +++ b/GRDBPlus.podspec @@ -1,6 +1,8 @@ Pod::Spec.new do |s| s.name = 'GRDBPlus' - s.version = '3.6.2' + s.version = '3.7.0' + s.deprecated = true + s.deprecated_in_favor_of = 'GRDB.swift' s.license = { :type => 'MIT', :file => 'LICENSE' } s.summary = 'A toolkit for SQLite databases, with a focus on application development.' diff --git a/Makefile b/Makefile index 15c2bbd48..580ddfeac 100644 --- a/Makefile +++ b/Makefile @@ -100,8 +100,8 @@ test_framework_darwin: test_framework_GRDB test_framework_GRDBCustom test_framew test_framework_GRDB: test_framework_GRDBOSX test_framework_GRDBWatchOS test_framework_GRDBiOS test_framework_GRDBCustom: test_framework_GRDBCustomSQLiteOSX test_framework_GRDBCustomSQLiteiOS test_framework_GRDBCipher: test_framework_GRDBCipherOSX test_framework_GRDBCipheriOS -test_install: test_install_manual test_install_GRDBCipher test_install_SPM test_install_GRDB_CocoaPods test_install_GRDBFTS5_CocoaPods test_install_GRDBCipher_CocoaPods test_CocoaPodsLint -test_CocoaPodsLint: test_CocoaPodsLint_GRDB test_CocoaPodsLint_GRDBPlus test_CocoaPodsLint_GRDBCipher +test_install: test_install_manual test_install_GRDBCipher test_install_SPM test_install_GRDB_CocoaPods test_install_GRDBCipher_CocoaPods test_CocoaPodsLint +test_CocoaPodsLint: test_CocoaPodsLint_GRDB test_CocoaPodsLint_GRDBCipher test_framework_GRDBOSX: test_framework_GRDBOSX_maxSwift test_framework_GRDBOSX_minSwift @@ -295,24 +295,6 @@ else @exit 1 endif -test_install_GRDBFTS5_CocoaPods: -ifdef POD - cd Tests/CocoaPods/GRDBFTS5MacOS && \ - rm -rf GRDBFTS5MacOS.xcworkspace && \ - rm -rf Pods && \ - rm -rf Podfile.lock && \ - $(POD) install && \ - $(XCODEBUILD) \ - -workspace GRDBFTS5MacOS.xcworkspace \ - -scheme GRDBFTS5MacOS \ - -configuration Release \ - clean build \ - $(XCPRETTY) -else - @echo CocoaPods must be installed for test_install_GRDBFTS5_CocoaPods - @exit 1 -endif - test_install_GRDBCipher_CocoaPods: ifdef POD cd Tests/CocoaPods/GRDBCipherMacOS && \ @@ -339,14 +321,6 @@ else @exit 1 endif -test_CocoaPodsLint_GRDBPlus: -ifdef POD - $(POD) lib lint GRDBPlus.podspec --allow-warnings $(COCOAPODS_EXTRA_TIME) -else - @echo CocoaPods must be installed for test_CocoaPodsLint_GRDBPlus - @exit 1 -endif - test_CocoaPodsLint_GRDBCipher: ifdef POD $(POD) lib lint GRDBCipher.podspec --allow-warnings $(COCOAPODS_EXTRA_TIME) @@ -429,10 +403,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/v3.6.2 \ - --module-version 3.6 \ + --github-file-prefix https://github.com/groue/GRDB.swift/tree/v3.7.0 \ + --module-version 3.7 \ --module GRDB \ - --root-url http://groue.github.io/GRDB.swift/docs/3.6/ \ + --root-url http://groue.github.io/GRDB.swift/docs/3.7/ \ --output Documentation/Reference \ --xcodebuild-arguments -project,GRDB.xcodeproj,-scheme,GRDBiOS else diff --git a/README.md b/README.md index fc3e43641..f2762e899 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,12 @@ GRDB 4 [![Swift](https://img.shields.io/badge/swift-4.2-orange.svg?style=flat)]( GRDB 4 will not be following semantic versioning during the development process. There may be breaking changes until 4.0.0 is released. There is not ETA (estimated time of arrival) for version 4.0.0. Your [help and support](https://github.com/groue/GRDB.swift/blob/master/CONTRIBUTING.md) are welcome. -The latest stable release [GRDB 3.6.2](https://github.com/groue/GRDB.swift/tree/v3.6.2) does not support Xcode 10.2. There is currently no plan to make it happen. Instead, you are encouraged to migrate to GRDB 4. See [issue #482](https://github.com/groue/GRDB.swift/issues/482) for more information. +The latest stable release [GRDB 3.7.0](https://github.com/groue/GRDB.swift/tree/v3.7.0) does not support Xcode 10.2. There is currently no plan to make it happen. Instead, you are encouraged to migrate to GRDB 4. See [issue #482](https://github.com/groue/GRDB.swift/issues/482) for more information. --- **Requirements**: iOS 9.0+ / macOS 10.9+ / watchOS 2.0+ • Swift 4.2+ / Xcode 10.0+ @@ -23,7 +23,7 @@ The latest stable release [GRDB 3.6.2](https://github.com/groue/GRDB.swift/tree/ | ------------- | ----------------------------------------------------------- | | **Swift 5** | **v4.0.0** | | **Swift 4.2** | **v4.0.0** | -| Swift 4.1 | [v3.6.2](https://github.com/groue/GRDB.swift/tree/v3.6.2) | +| Swift 4.1 | [v3.7.0](https://github.com/groue/GRDB.swift/tree/v3.7.0) | | Swift 4 | [v2.10.0](https://github.com/groue/GRDB.swift/tree/v2.10.0) | | Swift 3.2 | [v1.3.0](https://github.com/groue/GRDB.swift/tree/v1.3.0) | | Swift 3.1 | [v1.3.0](https://github.com/groue/GRDB.swift/tree/v1.3.0) | @@ -260,7 +260,7 @@ Documentation #### Reference -- [GRDB Reference](http://groue.github.io/GRDB.swift/docs/3.6/index.html) (generated by [Jazzy](https://github.com/realm/jazzy)) +- [GRDB Reference](http://groue.github.io/GRDB.swift/docs/3.7/index.html) (generated by [Jazzy](https://github.com/realm/jazzy)) #### Getting Started @@ -342,7 +342,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: "3.6.2") + .package(url: "https://github.com/groue/GRDB.swift.git", from: "3.7.0") ] ) ``` @@ -359,7 +359,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/v3.6.2) a copy of GRDB, or clone its repository and make sure you use the latest tagged version with the `git checkout v3.6.2` command. +1. [Download](https://github.com/groue/GRDB.swift/releases/tag/v3.7.0) a copy of GRDB, or clone its repository and make sure you use the latest tagged version with the `git checkout v3.7.0` command. 2. Embed the `GRDB.xcodeproj` project in your own project. @@ -474,7 +474,7 @@ let dbQueue = try DatabaseQueue( configuration: config) ``` -See [Configuration](http://groue.github.io/GRDB.swift/docs/3.6/Structs/Configuration.html) for more details. +See [Configuration](http://groue.github.io/GRDB.swift/docs/3.7/Structs/Configuration.html) for more details. ## Database Pools @@ -555,7 +555,7 @@ let dbPool = try DatabasePool( configuration: config) ``` -See [Configuration](http://groue.github.io/GRDB.swift/docs/3.6/Structs/Configuration.html) for more details. +See [Configuration](http://groue.github.io/GRDB.swift/docs/3.7/Structs/Configuration.html) for more details. Database pools are more memory-hungry than database queues. See [Memory Management](#memory-management) for more information. @@ -615,7 +615,7 @@ try dbQueue.write { db in } ``` -The `?` and colon-prefixed keys like `:score` in the SQL query are the **statements arguments**. You pass arguments with arrays or dictionaries, as in the example above. See [Values](#values) for more information on supported arguments types (Bool, Int, String, Date, Swift enums, etc.), and [StatementArguments](http://groue.github.io/GRDB.swift/docs/3.6/Structs/StatementArguments.html) for a detailed documentation of SQLite arguments. +The `?` and colon-prefixed keys like `:score` in the SQL query are the **statements arguments**. You pass arguments with arrays or dictionaries, as in the example above. See [Values](#values) for more information on supported arguments types (Bool, Int, String, Date, Swift enums, etc.), and [StatementArguments](http://groue.github.io/GRDB.swift/docs/3.7/Structs/StatementArguments.html) for a detailed documentation of SQLite arguments. In Swift 5, you can embed query arguments right into your SQL queries, with the `literal` argument label, as in the example below. See [SQL Interpolation] for more details. @@ -816,7 +816,7 @@ Both arrays and cursors can iterate over database results. How do you choose one - **Cursors are granted with direct access to SQLite,** unlike arrays that have to take the time to copy database values. If you look after extra performance, you may prefer cursors over arrays. -- **Cursors adopt the [Cursor](http://groue.github.io/GRDB.swift/docs/3.6/Protocols/Cursor.html) protocol, which looks a lot like standard [lazy sequences](https://developer.apple.com/reference/swift/lazysequenceprotocol) of Swift.** As such, cursors come with many convenience methods: `compactMap`, `contains`, `dropFirst`, `dropLast`, `drop(while:)`, `enumerated`, `filter`, `first`, `flatMap`, `forEach`, `joined`, `joined(separator:)`, `max`, `max(by:)`, `min`, `min(by:)`, `map`, `prefix`, `prefix(while:)`, `reduce`, `reduce(into:)`, `suffix`: +- **Cursors adopt the [Cursor](http://groue.github.io/GRDB.swift/docs/3.7/Protocols/Cursor.html) protocol, which looks a lot like standard [lazy sequences](https://developer.apple.com/reference/swift/lazysequenceprotocol) of Swift.** As such, cursors come with many convenience methods: `compactMap`, `contains`, `dropFirst`, `dropLast`, `drop(while:)`, `enumerated`, `filter`, `first`, `flatMap`, `forEach`, `joined`, `joined(separator:)`, `max`, `max(by:)`, `min`, `min(by:)`, `map`, `prefix`, `prefix(while:)`, `reduce`, `reduce(into:)`, `suffix`: ```swift // Prints all Github links @@ -898,7 +898,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/3.6/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/3.7/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: @@ -1181,7 +1181,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/3.6/Structs/StatementArguments.html): +Values can be used as [statement arguments](http://groue.github.io/GRDB.swift/docs/3.7/Structs/StatementArguments.html): ```swift let url: URL = ... @@ -1588,7 +1588,7 @@ try dbQueue.inDatabase { db in // or dbPool.writeWithoutTransaction } ``` -Transactions can't be left opened unless you set the [allowsUnsafeTransactions](http://groue.github.io/GRDB.swift/docs/3.6/Structs/Configuration.html) configuration flag: +Transactions can't be left opened unless you set the [allowsUnsafeTransactions](http://groue.github.io/GRDB.swift/docs/3.7/Structs/Configuration.html) configuration flag: ```swift // fatal error: A transaction has been left opened at the end of a database access @@ -1702,7 +1702,7 @@ try dbQueue.write { db in } ``` -The `?` and colon-prefixed keys like `:name` in the SQL query are the statement arguments. You set them with arrays or dictionaries (arguments are actually of type [StatementArguments](http://groue.github.io/GRDB.swift/docs/3.6/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/3.7/Structs/StatementArguments.html), which happens to adopt the ExpressibleByArrayLiteral and ExpressibleByDictionaryLiteral protocols). ```swift updateStatement.arguments = ["name": "Arthur", "score": 1000] @@ -1961,7 +1961,7 @@ row["consumed"] // "Hello" row["produced"] // nil ``` -Row adapters are values that adopt the [RowAdapter](http://groue.github.io/GRDB.swift/docs/3.6/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, described below. +Row adapters are values that adopt the [RowAdapter](http://groue.github.io/GRDB.swift/docs/3.7/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, described below. To see how row adapters can be used, see [Joined Queries Support](#joined-queries-support). @@ -2104,8 +2104,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/3.6/Structs/Configuration.html) -- `sqlite3_changes`, `sqlite3_total_changes`: see [Database.changesCount and Database.totalChangesCount](http://groue.github.io/GRDB.swift/docs/3.6/Classes/Database.html) +- `sqlite3_busy_handler`, `sqlite3_busy_timeout`: see [Configuration.busyMode](http://groue.github.io/GRDB.swift/docs/3.7/Structs/Configuration.html) +- `sqlite3_changes`, `sqlite3_total_changes`: see [Database.changesCount and Database.totalChangesCount](http://groue.github.io/GRDB.swift/docs/3.7/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), [DatabaseRegionObservation], [ValueObservation], [FetchedRecordsController] - `sqlite3_config`: see [Error Log](#error-log) @@ -2116,9 +2116,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/3.6/Classes/Statement.html) -- `sqlite3_trace`: see [Configuration.trace](http://groue.github.io/GRDB.swift/docs/3.6/Structs/Configuration.html) -- `sqlite3_wal_checkpoint_v2`: see [DatabasePool.checkpoint](http://groue.github.io/GRDB.swift/docs/3.6/Classes/DatabasePool.html) +- `sqlite3_sql`: see [Statement.sql](http://groue.github.io/GRDB.swift/docs/3.7/Classes/Statement.html) +- `sqlite3_trace`: see [Configuration.trace](http://groue.github.io/GRDB.swift/docs/3.7/Structs/Configuration.html) +- `sqlite3_wal_checkpoint_v2`: see [DatabasePool.checkpoint](http://groue.github.io/GRDB.swift/docs/3.7/Classes/DatabasePool.html) Records @@ -2437,7 +2437,7 @@ try Place.fetchAll(db, sql: "SELECT ...", arguments:...) // [Place] try Place.fetchOne(db, sql: "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/3.6/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/3.7/Structs/StatementArguments.html) for more information about the query arguments. > :point_up: **Note**: for performance reasons, the same row argument to `init(row:)` is reused during the iteration of a fetch query. If you want to keep the row for later use, make sure to store a copy: `self.row = row.copy()`. @@ -2809,7 +2809,7 @@ protocol MutablePersistableRecord { } ``` -See [DatabaseDateDecodingStrategy](https://groue.github.io/GRDB.swift/docs/3.6/Enums/DatabaseDateDecodingStrategy.html), [DatabaseDateEncodingStrategy](https://groue.github.io/GRDB.swift/docs/3.6/Enums/DatabaseDateEncodingStrategy.html), and [DatabaseUUIDEncodingStrategy](https://groue.github.io/GRDB.swift/docs/3.6/Enums/DatabaseUUIDEncodingStrategy.html) to learn about all available strategies. +See [DatabaseDateDecodingStrategy](https://groue.github.io/GRDB.swift/docs/3.7/Enums/DatabaseDateDecodingStrategy.html), [DatabaseDateEncodingStrategy](https://groue.github.io/GRDB.swift/docs/3.7/Enums/DatabaseDateEncodingStrategy.html), and [DatabaseUUIDEncodingStrategy](https://groue.github.io/GRDB.swift/docs/3.7/Enums/DatabaseUUIDEncodingStrategy.html) to learn about all available strategies. > :point_up: **Note**: there is no customization of uuid decoding, because UUID can already decode all its encoded variants (16-bytes blobs, and uuid strings). @@ -4066,7 +4066,7 @@ Player // SELECT * FROM player ``` -Raw SQL snippets are also accepted, with eventual [arguments](http://groue.github.io/GRDB.swift/docs/3.6/Structs/StatementArguments.html): +Raw SQL snippets are also accepted, with eventual [arguments](http://groue.github.io/GRDB.swift/docs/3.7/Structs/StatementArguments.html): ```swift // SELECT DATE(creationDate), COUNT(*) FROM player WHERE name = 'Arthur' GROUP BY date(creationDate) @@ -4634,7 +4634,7 @@ let request = Player.all() **To build custom requests**, you can use one of the built-in requests, derive requests from other requests, or create your own request type that adopts the [FetchRequest](#fetchrequest-protocol) protocol. -- [SQLRequest](http://groue.github.io/GRDB.swift/docs/3.6/Structs/SQLRequest.html) is a fetch request built from raw SQL. For example: +- [SQLRequest](http://groue.github.io/GRDB.swift/docs/3.7/Structs/SQLRequest.html) is a fetch request built from raw SQL. For example: ```swift extension Player { @@ -4678,7 +4678,7 @@ let request = Player.all() - The `adapted(_:)` method eases the consumption of complex rows with [row adapters](#row-adapters). See [Joined Queries Support](#joined-queries-support) for some sample code that uses this method. -- [AnyFetchRequest](http://groue.github.io/GRDB.swift/docs/3.6/Structs/AnyFetchRequest.html): a [type-erased](http://chris.eidhof.nl/post/type-erasers-in-swift/) request. +- [AnyFetchRequest](http://groue.github.io/GRDB.swift/docs/3.7/Structs/AnyFetchRequest.html): a [type-erased](http://chris.eidhof.nl/post/type-erasers-in-swift/) request. ### Fetching From Custom Requests @@ -5108,7 +5108,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/3.6/Structs/StatementArguments.html): +FTS3Pattern are regular [values](#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/3.7/Structs/StatementArguments.html): ```swift let documents = try Document.fetchAll(db, @@ -5357,7 +5357,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/3.6/Structs/StatementArguments.html): +FTS5Pattern are regular [values](#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/3.7/Structs/StatementArguments.html): ```swift let documents = try Document.fetchAll(db, @@ -7256,7 +7256,7 @@ After `stopObservingDatabaseChangesUntilNextTransaction()`, the `databaseDidChan ### DatabaseRegion -**[DatabaseRegion](https://groue.github.io/GRDB.swift/docs/3.6/Structs/DatabaseRegion.html) is a type that helps observing changes in the results of a database [request](#requests)**. +**[DatabaseRegion](https://groue.github.io/GRDB.swift/docs/3.7/Structs/DatabaseRegion.html) is a type that helps observing changes in the results of a database [request](#requests)**. A request knows which database modifications can impact its results. It can communicate this information to [transaction observers](#transactionobserver-protocol) by the way of a DatabaseRegion. @@ -7268,7 +7268,7 @@ For example, if you observe the region of `Player.select(max(Column("score")))`, Similarly, observing the region of `Country.filter(key: "FR")` will notify all changes that happen to the whole `country` table. That is because SQLite only notifies the numerical [rowid](https://www.sqlite.org/rowidtable.html) of changed rows, and we can't check if it is the row "FR" that has been changed, or another. This limitation does not apply to tables whose primary key is the rowid: `Player.filter(key: 42)` will only notify of changes performed on the row with id 42. -For more details, see the [reference](http://groue.github.io/GRDB.swift/docs/3.6/Structs/DatabaseRegion.html#/s:4GRDB14DatabaseRegionV10isModified2bySbAA0B5EventV_tF). +For more details, see the [reference](http://groue.github.io/GRDB.swift/docs/3.7/Structs/DatabaseRegion.html#/s:4GRDB14DatabaseRegionV10isModified2bySbAA0B5EventV_tF). #### The DatabaseRegionConvertible Protocol @@ -7323,7 +7323,7 @@ Alternatively, perform a manual installation of GRDB and SQLCipher: ```sh cd [GRDB directory] - git checkout v3.6.2 + git checkout v3.7.0 git submodule update --init SQLCipher/src ``` @@ -7372,6 +7372,34 @@ try clearDBQueue.inDatabase { db in // Now the copy is done, and the clear-text database can be deleted. ``` +## Advanced configuration options for SQLCipher + +There are two advanced configuration options that you can set for configuring SQLCipher that control aspects of the encryption and key generation process. + +```swift +var configuration = Configuration() +configuration.passphrase = "secret" +configuration.cipherPageSize = .pageSize4K +configuration.kdfIterations = 128000 +let dbQueue = try DatabaseQueue(path: "...", configuration: configuration) +``` + +### cipherPageSize + +The `cipherPageSize` is used to adjust the page size for the encrypted database (this corresponds to the [SQLCipher `PRAGMA cipher_page_size`](https://www.zetetic.net/sqlcipher/sqlcipher-api/#cipher_page_size) configuration option). Increasing the page size can noticeably improve performance for certain queries that access large numbers of pages. + +The default `cipherPageSize` in the current version of SQLCipher used in GRDB.swift is `1024`. + +> :point_up: **Note**: the same `cipherPageSize` must be supplied every time that the database file is open; attempting to access the database without setting the proper `cipherPageSize` will result in the `SQLite error 26: file is encrypted or is not a database` error being thrown. + +### kdfIterations + +The `kdfIterations` value is used to adjust the number of iterations that the PBKDF2 key derivation is run to derive the key from the `passphrase` supplied (this corresponds to the [SQLCipher `PRAGMA kdf_iter`](https://www.zetetic.net/sqlcipher/sqlcipher-api/#kdf_iter) configuration option). + +The default `kdfIterations` in the current version of SQLCipher used in GRDB.swift is `64000`. It is not recommend to reduce the number of iterations used from the default. + +> :point_up: **Note**: the same `kdfIterations` must be supplied every time that the database file is open; attempting to access the database without setting the proper `kdfIterations` will result in the `SQLite error 26: file is encrypted or is not a database` error being thrown. + ## Backup @@ -8114,7 +8142,7 @@ try snapshot2.read { db in ### DatabaseWriter and DatabaseReader Protocols -Both DatabaseQueue and DatabasePool adopt the [DatabaseReader](http://groue.github.io/GRDB.swift/docs/3.6/Protocols/DatabaseReader.html) and [DatabaseWriter](http://groue.github.io/GRDB.swift/docs/3.6/Protocols/DatabaseWriter.html) protocols. DatabaseSnapshot adopts DatabaseReader only. +Both DatabaseQueue and DatabasePool adopt the [DatabaseReader](http://groue.github.io/GRDB.swift/docs/3.7/Protocols/DatabaseReader.html) and [DatabaseWriter](http://groue.github.io/GRDB.swift/docs/3.7/Protocols/DatabaseWriter.html) protocols. DatabaseSnapshot adopts DatabaseReader only. These protocols provide a unified API that let you write generic code that targets all concurrency modes. They fuel, for example: @@ -8229,7 +8257,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/3.6/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/3.7/Structs/Configuration.html) - [Ask questions](https://github.com/groue/GRDB.swift/issues) diff --git a/Support/Info.plist b/Support/Info.plist index 02e4bb299..767108022 100644 --- a/Support/Info.plist +++ b/Support/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 3.6.2 + 3.7.0 CFBundleSignature ???? CFBundleVersion diff --git a/Tests/CocoaPods/GRDBCipherMacOS/GRDBCipherMacOS.xcodeproj/project.pbxproj b/Tests/CocoaPods/GRDBCipherMacOS/GRDBCipherMacOS.xcodeproj/project.pbxproj index b85379444..2c37b257b 100644 --- a/Tests/CocoaPods/GRDBCipherMacOS/GRDBCipherMacOS.xcodeproj/project.pbxproj +++ b/Tests/CocoaPods/GRDBCipherMacOS/GRDBCipherMacOS.xcodeproj/project.pbxproj @@ -118,6 +118,11 @@ TargetAttributes = { 56269771211036C10066800A = { CreatedOnToolsVersion = 9.4.1; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 0; + }; + }; }; }; }; @@ -333,10 +338,9 @@ baseConfigurationReference = A3F8791E6F512575865AC37C /* Pods-GRDBCipherMacOS.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_ENTITLEMENTS = GRDBCipherMacOS/GRDBCipherMacOS.entitlements; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = AMD8W895CT; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = GRDBCipherMacOS/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -344,6 +348,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCipherMacOS; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 4.2; }; name = Debug; @@ -353,10 +358,9 @@ baseConfigurationReference = 2AB57EA4305B77469C9A4267 /* Pods-GRDBCipherMacOS.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_ENTITLEMENTS = GRDBCipherMacOS/GRDBCipherMacOS.entitlements; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = AMD8W895CT; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = GRDBCipherMacOS/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -364,6 +368,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCipherMacOS; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 4.2; }; name = Release; diff --git a/Tests/CocoaPods/GRDBCipherMacOS/GRDBCipherMacOS/GRDBCipherMacOS.entitlements b/Tests/CocoaPods/GRDBCipherMacOS/GRDBCipherMacOS/GRDBCipherMacOS.entitlements index f2ef3ae02..0c67376eb 100644 --- a/Tests/CocoaPods/GRDBCipherMacOS/GRDBCipherMacOS/GRDBCipherMacOS.entitlements +++ b/Tests/CocoaPods/GRDBCipherMacOS/GRDBCipherMacOS/GRDBCipherMacOS.entitlements @@ -1,10 +1,5 @@ - - com.apple.security.app-sandbox - - com.apple.security.files.user-selected.read-only - - + diff --git a/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS.xcodeproj/project.pbxproj b/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS.xcodeproj/project.pbxproj deleted file mode 100644 index 3e841b4df..000000000 --- a/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS.xcodeproj/project.pbxproj +++ /dev/null @@ -1,393 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 50; - objects = { - -/* Begin PBXBuildFile section */ - 562697B521107C130066800A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562697B421107C130066800A /* AppDelegate.swift */; }; - 562697B721107C140066800A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 562697B621107C140066800A /* Assets.xcassets */; }; - 562697BA21107C140066800A /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 562697B821107C140066800A /* MainMenu.xib */; }; - CFA022B8C32840D0B6DEE0F0 /* Pods_GRDBFTS5MacOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CD0FDB86C1C7C5D392EEDC0 /* Pods_GRDBFTS5MacOS.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 562697B121107C130066800A /* GRDBFTS5MacOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GRDBFTS5MacOS.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 562697B421107C130066800A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 562697B621107C140066800A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 562697B921107C140066800A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; - 562697BB21107C140066800A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 562697BC21107C140066800A /* GRDBFTS5MacOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = GRDBFTS5MacOS.entitlements; sourceTree = ""; }; - 6CD0FDB86C1C7C5D392EEDC0 /* Pods_GRDBFTS5MacOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GRDBFTS5MacOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 966036335047A35A92E51A77 /* Pods-GRDBFTS5MacOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GRDBFTS5MacOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-GRDBFTS5MacOS/Pods-GRDBFTS5MacOS.release.xcconfig"; sourceTree = ""; }; - EC2C210DD2F8C1485D2B51F8 /* Pods-GRDBFTS5MacOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GRDBFTS5MacOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-GRDBFTS5MacOS/Pods-GRDBFTS5MacOS.debug.xcconfig"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 562697AE21107C130066800A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - CFA022B8C32840D0B6DEE0F0 /* Pods_GRDBFTS5MacOS.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 562697A821107C130066800A = { - isa = PBXGroup; - children = ( - 562697B321107C130066800A /* GRDBFTS5MacOS */, - 562697B221107C130066800A /* Products */, - BC88EA1E9BA0651EB954E368 /* Pods */, - A3A77F69118F72CFF483B37C /* Frameworks */, - ); - sourceTree = ""; - }; - 562697B221107C130066800A /* Products */ = { - isa = PBXGroup; - children = ( - 562697B121107C130066800A /* GRDBFTS5MacOS.app */, - ); - name = Products; - sourceTree = ""; - }; - 562697B321107C130066800A /* GRDBFTS5MacOS */ = { - isa = PBXGroup; - children = ( - 562697B421107C130066800A /* AppDelegate.swift */, - 562697B621107C140066800A /* Assets.xcassets */, - 562697B821107C140066800A /* MainMenu.xib */, - 562697BB21107C140066800A /* Info.plist */, - 562697BC21107C140066800A /* GRDBFTS5MacOS.entitlements */, - ); - path = GRDBFTS5MacOS; - sourceTree = ""; - }; - A3A77F69118F72CFF483B37C /* Frameworks */ = { - isa = PBXGroup; - children = ( - 6CD0FDB86C1C7C5D392EEDC0 /* Pods_GRDBFTS5MacOS.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - BC88EA1E9BA0651EB954E368 /* Pods */ = { - isa = PBXGroup; - children = ( - EC2C210DD2F8C1485D2B51F8 /* Pods-GRDBFTS5MacOS.debug.xcconfig */, - 966036335047A35A92E51A77 /* Pods-GRDBFTS5MacOS.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 562697B021107C130066800A /* GRDBFTS5MacOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 562697BF21107C140066800A /* Build configuration list for PBXNativeTarget "GRDBFTS5MacOS" */; - buildPhases = ( - 686592AFA9220CAC4B74492A /* [CP] Check Pods Manifest.lock */, - 562697AD21107C130066800A /* Sources */, - 562697AE21107C130066800A /* Frameworks */, - 562697AF21107C130066800A /* Resources */, - D7E14FB39185BF47C54C6643 /* [CP] Embed Pods Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = GRDBFTS5MacOS; - productName = GRDBFTS5MacOS; - productReference = 562697B121107C130066800A /* GRDBFTS5MacOS.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 562697A921107C130066800A /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0940; - LastUpgradeCheck = 0940; - ORGANIZATIONNAME = "Gwendal Roué"; - TargetAttributes = { - 562697B021107C130066800A = { - CreatedOnToolsVersion = 9.4.1; - }; - }; - }; - buildConfigurationList = 562697AC21107C130066800A /* Build configuration list for PBXProject "GRDBFTS5MacOS" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 562697A821107C130066800A; - productRefGroup = 562697B221107C130066800A /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 562697B021107C130066800A /* GRDBFTS5MacOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 562697AF21107C130066800A /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 562697B721107C140066800A /* Assets.xcassets in Resources */, - 562697BA21107C140066800A /* MainMenu.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 686592AFA9220CAC4B74492A /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-GRDBFTS5MacOS-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - D7E14FB39185BF47C54C6643 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-GRDBFTS5MacOS/Pods-GRDBFTS5MacOS-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/GRDBPlus/GRDB.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GRDB.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-GRDBFTS5MacOS/Pods-GRDBFTS5MacOS-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 562697AD21107C130066800A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 562697B521107C130066800A /* AppDelegate.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 562697B821107C140066800A /* MainMenu.xib */ = { - isa = PBXVariantGroup; - children = ( - 562697B921107C140066800A /* Base */, - ); - name = MainMenu.xib; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 562697BD21107C140066800A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - 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_IMPLICIT_RETAIN_SELF = 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_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "Mac Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 562697BE21107C140066800A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - 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_IMPLICIT_RETAIN_SELF = 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_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "Mac Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - }; - name = Release; - }; - 562697C021107C140066800A /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = EC2C210DD2F8C1485D2B51F8 /* Pods-GRDBFTS5MacOS.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_ENTITLEMENTS = GRDBFTS5MacOS/GRDBFTS5MacOS.entitlements; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = AMD8W895CT; - INFOPLIST_FILE = GRDBFTS5MacOS/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBFTS5MacOS; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; - }; - name = Debug; - }; - 562697C121107C140066800A /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 966036335047A35A92E51A77 /* Pods-GRDBFTS5MacOS.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_ENTITLEMENTS = GRDBFTS5MacOS/GRDBFTS5MacOS.entitlements; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = AMD8W895CT; - INFOPLIST_FILE = GRDBFTS5MacOS/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBFTS5MacOS; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 562697AC21107C130066800A /* Build configuration list for PBXProject "GRDBFTS5MacOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 562697BD21107C140066800A /* Debug */, - 562697BE21107C140066800A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 562697BF21107C140066800A /* Build configuration list for PBXNativeTarget "GRDBFTS5MacOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 562697C021107C140066800A /* Debug */, - 562697C121107C140066800A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 562697A921107C130066800A /* Project object */; -} diff --git a/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index fd8686896..000000000 --- a/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003..000000000 --- a/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS/AppDelegate.swift b/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS/AppDelegate.swift deleted file mode 100644 index d010e0e4b..000000000 --- a/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS/AppDelegate.swift +++ /dev/null @@ -1,21 +0,0 @@ -import Cocoa -import GRDB - -@NSApplicationMain -class AppDelegate: NSObject, NSApplicationDelegate { - @IBOutlet weak var window: NSWindow! - - func applicationDidFinishLaunching(_ aNotification: Notification) { - let dbQueue = DatabaseQueue() - try! dbQueue.write { db in - // Test access to FTS5 C API - _ = try db.makeTokenizer(.unicode61()) - - // Test creation of FTS5 table - try db.create(virtualTable: "document", using: FTS5()) { t in - t.column("content") - } - } - } -} - diff --git a/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 2db2b1c7c..000000000 --- a/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "images" : [ - { - "idiom" : "mac", - "size" : "16x16", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "16x16", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "32x32", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "32x32", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "128x128", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "128x128", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "256x256", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "256x256", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "512x512", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "512x512", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS/Assets.xcassets/Contents.json b/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164c9..000000000 --- a/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS/Base.lproj/MainMenu.xib b/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS/Base.lproj/MainMenu.xib deleted file mode 100644 index 623f91d00..000000000 --- a/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS/Base.lproj/MainMenu.xib +++ /dev/null @@ -1,692 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Default - - - - - - - Left to Right - - - - - - - Right to Left - - - - - - - - - - - Default - - - - - - - Left to Right - - - - - - - Right to Left - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS/GRDBFTS5MacOS.entitlements b/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS/GRDBFTS5MacOS.entitlements deleted file mode 100644 index f2ef3ae02..000000000 --- a/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS/GRDBFTS5MacOS.entitlements +++ /dev/null @@ -1,10 +0,0 @@ - - - - - com.apple.security.app-sandbox - - com.apple.security.files.user-selected.read-only - - - diff --git a/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS/Info.plist b/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS/Info.plist deleted file mode 100644 index cfde06cd5..000000000 --- a/Tests/CocoaPods/GRDBFTS5MacOS/GRDBFTS5MacOS/Info.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIconFile - - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSMinimumSystemVersion - $(MACOSX_DEPLOYMENT_TARGET) - NSHumanReadableCopyright - Copyright © 2018 Gwendal Roué. All rights reserved. - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - diff --git a/Tests/CocoaPods/GRDBFTS5MacOS/Podfile b/Tests/CocoaPods/GRDBFTS5MacOS/Podfile deleted file mode 100644 index 1ad4d78b6..000000000 --- a/Tests/CocoaPods/GRDBFTS5MacOS/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -use_frameworks! - -target 'GRDBFTS5MacOS' -platform :macos, '10.13' -pod 'GRDBPlus', :path => '../../..' diff --git a/Tests/GRDBTests/AssociationBelongsToSQLTests.swift b/Tests/GRDBTests/AssociationBelongsToSQLTests.swift index 3f619c67b..97af38506 100644 --- a/Tests/GRDBTests/AssociationBelongsToSQLTests.swift +++ b/Tests/GRDBTests/AssociationBelongsToSQLTests.swift @@ -873,4 +873,22 @@ class AssociationBelongsToSQLTests: GRDBTestCase { static let parent2 = belongsTo(Parent.self, using: ForeignKeys.parent2) } } + + // Regression test for https://github.com/groue/GRDB.swift/issues/495 + func testFetchCount() throws { + let dbQueue = try makeDatabaseQueue() + try dbQueue.write { db in + try db.create(table: "a") { t in + t.autoIncrementedPrimaryKey("id") + } + try db.create(table: "b") { t in + t.autoIncrementedPrimaryKey("id") + t.column("aId", .integer).references("a") + } + struct A: TableRecord { } + struct B: TableRecord { } + let request = B.joining(required: B.belongsTo(A.self)) + let _ = try request.fetchCount(db) + } + } } diff --git a/Tests/GRDBTests/EncryptionTests.swift b/Tests/GRDBTests/EncryptionTests.swift index 39182c799..d96d4b16f 100644 --- a/Tests/GRDBTests/EncryptionTests.swift +++ b/Tests/GRDBTests/EncryptionTests.swift @@ -37,6 +37,7 @@ class EncryptionTests: GRDBTestCase { dbConfiguration.passphrase = nil do { _ = try makeDatabaseQueue(filename: "test.sqlite") + XCTFail("Expected error") } catch let error as DatabaseError { XCTAssertEqual(error.resultCode, .SQLITE_NOTADB) XCTAssertEqual(error.message!, "file is not a database") @@ -60,6 +61,7 @@ class EncryptionTests: GRDBTestCase { dbConfiguration.passphrase = "wrong" do { _ = try makeDatabaseQueue(filename: "test.sqlite") + XCTFail("Expected error") } catch let error as DatabaseError { XCTAssertEqual(error.resultCode, .SQLITE_NOTADB) XCTAssertEqual(error.message!, "file is not a database") @@ -133,6 +135,7 @@ class EncryptionTests: GRDBTestCase { dbConfiguration.passphrase = nil do { _ = try makeDatabasePool(filename: "test.sqlite") + XCTFail("Expected error") } catch let error as DatabaseError { XCTAssertEqual(error.resultCode, .SQLITE_NOTADB) XCTAssertEqual(error.message!, "file is not a database") @@ -156,6 +159,7 @@ class EncryptionTests: GRDBTestCase { dbConfiguration.passphrase = "wrong" do { _ = try makeDatabasePool(filename: "test.sqlite") + XCTFail("Expected error") } catch let error as DatabaseError { XCTAssertEqual(error.resultCode, .SQLITE_NOTADB) XCTAssertEqual(error.message!, "file is not a database") @@ -227,6 +231,7 @@ class EncryptionTests: GRDBTestCase { dbConfiguration.passphrase = nil do { _ = try makeDatabasePool(filename: "test.sqlite") + XCTFail("Expected error") } catch let error as DatabaseError { XCTAssertEqual(error.resultCode, .SQLITE_NOTADB) XCTAssertEqual(error.message!, "file is not a database") @@ -250,6 +255,7 @@ class EncryptionTests: GRDBTestCase { dbConfiguration.passphrase = "wrong" do { _ = try makeDatabasePool(filename: "test.sqlite") + XCTFail("Expected error") } catch let error as DatabaseError { XCTAssertEqual(error.resultCode, .SQLITE_NOTADB) XCTAssertEqual(error.message!, "file is not a database") @@ -324,6 +330,7 @@ class EncryptionTests: GRDBTestCase { dbConfiguration.passphrase = nil do { _ = try makeDatabaseQueue(filename: "test.sqlite") + XCTFail("Expected error") } catch let error as DatabaseError { XCTAssertEqual(error.resultCode, .SQLITE_NOTADB) XCTAssertEqual(error.message!, "file is not a database") @@ -333,6 +340,62 @@ class EncryptionTests: GRDBTestCase { } } + func testCipherPageSize() throws { + do { + dbConfiguration.passphrase = "secret" + dbConfiguration.cipherPageSize = 8192 + + let dbQueue = try makeDatabaseQueue(filename: "test.sqlite") + try dbQueue.inDatabase({ db in + XCTAssertEqual(try Int.fetchOne(db, sql: "PRAGMA cipher_page_size")!, 8192) + }) + } + + do { + dbConfiguration.cipherPageSize = 4096 + + let dbPool = try makeDatabasePool(filename: "testpool.sqlite") + try dbPool.write({ db in + XCTAssertEqual(try Int.fetchOne(db, sql: "PRAGMA cipher_page_size")!, 4096) + try db.execute(sql: "CREATE TABLE data(value INTEGER)") + try db.execute(sql: "INSERT INTO data(value) VALUES(1)") + }) + try dbPool.read({ db in + XCTAssertEqual(try Int.fetchOne(db, sql: "PRAGMA cipher_page_size")!, 4096) + XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT value FROM data"), 1) + }) + + } + } + + func testCipherKDFIterations() throws { + do { + dbConfiguration.passphrase = "secret" + dbConfiguration.kdfIterations = 128000 + + let dbQueue = try makeDatabaseQueue(filename: "test.sqlite") + try dbQueue.inDatabase { db in + XCTAssertEqual(try Int.fetchOne(db, sql: "PRAGMA kdf_iter"), 128000) + } + } + + do { + dbConfiguration.kdfIterations = 128000 + + let dbPool = try makeDatabasePool(filename: "testpool.sqlite") + try dbPool.write { db in + XCTAssertEqual(try Int.fetchOne(db, sql: "PRAGMA kdf_iter"), 128000) + try db.execute(sql: "CREATE TABLE data(value INTEGER)") + try db.execute(sql: "INSERT INTO data(value) VALUES(1)") + } + + try dbPool.read { db in + XCTAssertEqual(try Int.fetchOne(db, sql: "PRAGMA kdf_iter"), 128000) + XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT value FROM data"), 1) + } + } + } + func testExportPlainTextDatabaseToEncryptedDatabase() throws { // See https://discuss.zetetic.net/t/how-to-encrypt-a-plaintext-sqlite-database-to-use-sqlcipher-and-avoid-file-is-encrypted-or-is-not-a-database-errors/868?source_topic_id=939 do { @@ -352,6 +415,7 @@ class EncryptionTests: GRDBTestCase { dbConfiguration.passphrase = "secret" do { _ = try makeDatabaseQueue(filename: "plaintext.sqlite") + XCTFail("Expected error") } catch let error as DatabaseError { XCTAssertEqual(error.resultCode, .SQLITE_NOTADB) XCTAssertEqual(error.message!, "file is not a database")