From e54410b608c6018586abaf0a5cdeed41c9f44e9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Wed, 20 Feb 2019 07:56:52 +0100 Subject: [PATCH 1/6] Swift 5: link to the GRDB-4.0 branch --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7d4e2bdef..307a41f00 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ GRDB 3 [![Swift](https://img.shields.io/badge/swift-4.1-orange.svg?style=flat)]( | Swift version | GRDB version | | ------------- | ----------------------------------------------------------- | +| Swift 5 | [v4.0.0](https://github.com/groue/GRDB.swift/tree/GRDB-4.0) :construction: in development | | **Swift 4.2** | **v3.6.2** | | **Swift 4.1** | **v3.6.2** | | Swift 4 | [v2.10.0](https://github.com/groue/GRDB.swift/tree/v2.10.0) | From ccf339d6efd8c87ebbe1b31fe73cfcc0ff4a3051 Mon Sep 17 00:00:00 2001 From: David Kraus Date: Wed, 6 Mar 2019 14:55:11 +0100 Subject: [PATCH 2/6] improve fts5 documentation --- README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 307a41f00..833de6be6 100644 --- a/README.md +++ b/README.md @@ -5074,13 +5074,23 @@ let documents = try Document.filter(Column("content").match(pattern)).fetchAll(d When the FTS3 and FTS4 full-text engines don't suit your needs, you may want to use FTS5. See [Choosing the Full-Text Engine](#choosing-the-full-text-engine) to help you make a decision. The version of SQLite that ships with iOS, macOS and watchOS does not always support the FTS5 engine. To enable FTS5 support, you'll need to install GRDB with one of those installation techniques: - -1. Use the GRDBPlus CocoaPod. It uses the system SQLite, and requires iOS 11.4+ / macOS 10.13+ / watchOS 4.3+: - + +1. Use a custom compilation option. It uses the system SQLite and requires iOS 11.4+ / macOS 10.13+ / watchOS 4.3+: + ```ruby - pod 'GRDBPlus' + platform :ios, '11.4' # or above + + post_install do |installer| + installer.pods_project.targets.select { |target| target.name == "GRDB.swift" }.each do |target| + target.build_configurations.each do |config| + config.build_settings['OTHER_SWIFT_FLAGS'] = "$(inherited) -D SQLITE_ENABLE_FTS5" + end + end + end ``` +> :point_up: **Note**: make sure you use the right platform version! GRDB can't protect you here and you will get runtime errors on devices with a lower version. + 2. Use the GRDBCipher CocoaPod. It uses SQLCipher (see [encryption](#encryption)), and requires iOS 8.0+ / macOS 10.9+ / watchOS 2.0+: ```ruby From 403c4a894fe091491cc1bf677de4f526371378b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Wed, 6 Mar 2019 18:18:15 +0100 Subject: [PATCH 3/6] Apply lovely advice from @glessard --- GRDB/Core/Support/Foundation/SQLiteDateParser.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/GRDB/Core/Support/Foundation/SQLiteDateParser.swift b/GRDB/Core/Support/Foundation/SQLiteDateParser.swift index ba2f83814..cd42663c0 100644 --- a/GRDB/Core/Support/Foundation/SQLiteDateParser.swift +++ b/GRDB/Core/Support/Foundation/SQLiteDateParser.swift @@ -23,16 +23,20 @@ class SQLiteDateParser { func components(cString: UnsafePointer, length: Int) -> DatabaseDateComponents? { assert(strlen(cString) == length) + // "HH:MM" is the shortest valid string guard length >= 5 else { return nil } - if cString.advanced(by: 4).pointee == 45 /* '-' */ { + // "YYYY-..." -> datetime + if cString[4] == UInt8(ascii: "-") { return datetimeComponents(cString: cString, length: length) } - if cString.advanced(by: 2).pointee == 58 /* ':' */ { + // "HH-:..." -> time + if cString[2] == UInt8(ascii: ":") { return timeComponents(cString: cString, length: length) } + // Invalid return nil } From 2f447cc2375a013cd98af931bc2631be1b34cd70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Wed, 6 Mar 2019 18:42:45 +0100 Subject: [PATCH 4/6] Wording and formatting --- README.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 833de6be6..1572e4362 100644 --- a/README.md +++ b/README.md @@ -5075,21 +5075,24 @@ When the FTS3 and FTS4 full-text engines don't suit your needs, you may want to The version of SQLite that ships with iOS, macOS and watchOS does not always support the FTS5 engine. To enable FTS5 support, you'll need to install GRDB with one of those installation techniques: -1. Use a custom compilation option. It uses the system SQLite and requires iOS 11.4+ / macOS 10.13+ / watchOS 4.3+: +1. Use the GRDB.swift CocoaPod with a custom compilation option, as below. It uses the system SQLite, which is compiled with FTS5 support, but only on iOS 11.4+ / macOS 10.13+ / watchOS 4.3+: ```ruby + pod 'GRDB.swift' platform :ios, '11.4' # or above - + post_install do |installer| installer.pods_project.targets.select { |target| target.name == "GRDB.swift" }.each do |target| - target.build_configurations.each do |config| - config.build_settings['OTHER_SWIFT_FLAGS'] = "$(inherited) -D SQLITE_ENABLE_FTS5" + target.build_configurations.each do |config| + config.build_settings['OTHER_SWIFT_FLAGS'] = "$(inherited) -D SQLITE_ENABLE_FTS5" end end end ``` - -> :point_up: **Note**: make sure you use the right platform version! GRDB can't protect you here and you will get runtime errors on devices with a lower version. + + > :warning: **Warning**: make sure you use the right platform version! You will get runtime errors on devices with a lower version. + + > :point_up: **Note**: there used to be a GRDBPlus CocoaPod with pre-enabled FTS5 support. This CocoaPod is deprecated: please switch to the above technique. 2. Use the GRDBCipher CocoaPod. It uses SQLCipher (see [encryption](#encryption)), and requires iOS 8.0+ / macOS 10.9+ / watchOS 2.0+: From 658c9d34cb54281e46b1b66a55d882908234e502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Wed, 6 Mar 2019 18:43:21 +0100 Subject: [PATCH 5/6] Remove GRDBPlus from ReleaseProcess.md --- Documentation/ReleaseProcess.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/Documentation/ReleaseProcess.md b/Documentation/ReleaseProcess.md index e721dbd7e..249d22130 100644 --- a/Documentation/ReleaseProcess.md +++ b/Documentation/ReleaseProcess.md @@ -18,14 +18,12 @@ To release a new GRDB version: - Documentation/CustomSQLiteBuilds.md - GRDB.swift.podspec - GRDBCipher.podspec - - GRDBPlus.podspec - README.md - Support/Info.plist - Commit and tag - Check tag authors: `git for-each-ref --format '%(refname) %(authorname)' refs/tags` - Push to the master branch - `pod trunk push --allow-warnings GRDB.swift.podspec` -- `pod trunk push --allow-warnings GRDBPlus.podspec` - `pod trunk push --allow-warnings GRDBCipher.podspec` - `make doc`, and update index.html in the `gh-pages` branch - Update http://github.com/groue/WWDCCompanion From 43fff321560117a1e57c0541bfc682764445e493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Wed, 6 Mar 2019 18:51:08 +0100 Subject: [PATCH 6/6] Thank you notice for davidkraus :-) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1572e4362..413d8786a 100644 --- a/README.md +++ b/README.md @@ -8569,7 +8569,7 @@ Sample Code **Thanks** - [Pierlis](http://pierlis.com), where we write great software. -- [@bellebethcooper](https://github.com/bellebethcooper), [@bfad](https://github.com/bfad), [@cfilipov](https://github.com/cfilipov), [@Chiliec](https://github.com/Chiliec), [@darrenclark](https://github.com/darrenclark), [@fpillet](http://github.com/fpillet), [@gusrota](https://github.com/gusrota), [@hartbit](https://github.com/hartbit), [@kdubb](https://github.com/kdubb), [@kluufger](https://github.com/kluufger), [@KyleLeneau](https://github.com/KyleLeneau), [@Marus](https://github.com/Marus), [@pakko972](https://github.com/pakko972), [@peter-ss](https://github.com/peter-ss), [@pierlo](https://github.com/pierlo), [@pocketpixels](https://github.com/pocketpixels), [@schveiguy](https://github.com/schveiguy), [@SD10](https://github.com/SD10), [@sobri909](https://github.com/sobri909), [@sroddy](https://github.com/sroddy), [@swiftlyfalling](https://github.com/swiftlyfalling), [@valexa](https://github.com/valexa), and [@zmeyc](https://github.com/zmeyc) for their contributions, help, and feedback on GRDB. +- [@bellebethcooper](https://github.com/bellebethcooper), [@bfad](https://github.com/bfad), [@cfilipov](https://github.com/cfilipov), [@Chiliec](https://github.com/Chiliec), [@darrenclark](https://github.com/darrenclark), [@davidkraus](https://github.com/davidkraus), [@fpillet](http://github.com/fpillet), [@gusrota](https://github.com/gusrota), [@hartbit](https://github.com/hartbit), [@kdubb](https://github.com/kdubb), [@kluufger](https://github.com/kluufger), [@KyleLeneau](https://github.com/KyleLeneau), [@Marus](https://github.com/Marus), [@pakko972](https://github.com/pakko972), [@peter-ss](https://github.com/peter-ss), [@pierlo](https://github.com/pierlo), [@pocketpixels](https://github.com/pocketpixels), [@schveiguy](https://github.com/schveiguy), [@SD10](https://github.com/SD10), [@sobri909](https://github.com/sobri909), [@sroddy](https://github.com/sroddy), [@swiftlyfalling](https://github.com/swiftlyfalling), [@valexa](https://github.com/valexa), and [@zmeyc](https://github.com/zmeyc) for their contributions, help, and feedback on GRDB. - [@aymerick](https://github.com/aymerick) and [@kali](https://github.com/kali) because SQL. - [ccgus/fmdb](https://github.com/ccgus/fmdb) for its excellency.