Compare commits

...
330 Commits
Author SHA1 Message Date
Gwendal Roué c71d4903a0 Merge branch 'release/v3.3.0' 2018-09-16 18:55:43 +02:00
Gwendal Roué d118a775ac Bump SQLCipher/src 2018-09-16 18:52:37 +02:00
Gwendal Roué e92c0c9aed Hide SQLSpecificExpressible from jazzy documentation 2018-09-16 13:39:11 +02:00
Gwendal Roué b826789349 Workaround https://github.com/realm/jazzy/issues/970 2018-09-16 13:35:56 +02:00
Gwendal Roué a09099bb02 v3.3.0 2018-09-16 12:58:36 +02:00
Gwendal Roué 914781cd7f Thank you @KyleLeneau 2018-09-16 12:16:52 +02:00
Gwendal Roué de84b084ec Merge pull request #408 from KyleLeneau/fix-carthage-tests
Getting carthage tests to pass
2018-09-16 12:11:39 +02:00
Gwendal Roué 2b6e69404e FetchedRecordsController in usage section 2018-09-16 12:09:47 +02:00
Kyle LeNeau aaca651a2e Getting Carthage tests to pass 2018-09-14 01:34:38 +09:00
Gwendal Roué 138289b646 Documentation improvement 2018-09-13 09:07:12 +02:00
Gwendal Roué d4157db4b1 CHANGELOG 2018-09-13 09:02:14 +02:00
Gwendal Roué 3bf32564a4 Merge pull request #409 from groue/feature/concurrentRead
DatabaseWriter.concurrentRead
2018-09-13 08:56:38 +02:00
Gwendal Roué 7186cd98c8 (more diff algorithms) 2018-09-13 07:31:35 +02:00
Gwendal Roué b9a878bb20 Cleanup 2018-09-11 08:56:29 +02:00
Gwendal Roué 8c479a863a Documentation 2018-09-09 20:00:03 +02:00
Gwendal Roué 58a48b73ae concurrentRead documentation 2018-09-09 19:55:07 +02:00
Gwendal Roué 2e6ed9d8f9 TODO 2018-09-09 16:03:00 +02:00
Gwendal Roué df406341c1 CHANGELOG.md 2018-09-09 16:00:53 +02:00
Gwendal Roué 41629ec9aa Future.wait() must be called only once 2018-09-09 16:00:01 +02:00
Gwendal Roué 47b42f38e3 CHANGELOG.md 2018-09-09 15:46:36 +02:00
Gwendal Roué 21209fb107 CHANGELOG.md 2018-09-09 13:46:13 +02:00
Gwendal Roué 106812c02c Fix SPM 2018-09-09 13:42:35 +02:00
Gwendal Roué da58e228c0 Document Future 2018-09-09 13:18:15 +02:00
Gwendal Roué 9bfe893908 DatabaseWriter.concurrentRead replaces readFromCurrentState 2018-09-09 13:12:35 +02:00
Gwendal Roué 03a781075e Cleanup 2018-09-06 08:50:56 +02:00
Gwendal Roué 60afc9ee06 Tweak existence checks for tables, views and triggers 2018-09-06 08:31:27 +02:00
Gwendal Roué 22165984c3 Cursor.isEmpty() 2018-09-06 08:29:57 +02:00
Gwendal Roué eebb013d06 Merge branch 'master' into development 2018-09-05 14:16:39 +02:00
Gwendal Roué 0e0ebdb2d6 Fix podspec 2018-09-05 14:09:01 +02:00
Gwendal Roué be15f89e28 Merge tag 'v3.3.0-beta1' into development
v3.3.0-beta1
2018-09-05 13:55:48 +02:00
Gwendal Roué 5d2f063c93 Merge branch 'release/v3.3.0-beta1' 2018-09-05 13:55:47 +02:00
Gwendal Roué e49c190288 Fix release date 2018-09-05 13:52:00 +02:00
Gwendal Roué d3ddf1c1bc Prepare merge on master 2018-09-05 13:36:31 +02:00
Gwendal Roué 04fc14d557 Compatibility: restore SWIFT_VERSION to 4.0 for embeddable projects 2018-09-05 13:09:27 +02:00
Gwendal Roué 603115c9a4 Tests/CocoaPods: use Swift 4.2 2018-09-05 13:04:47 +02:00
Gwendal Roué 6b60fbe50e Tests/CocoaPods/GRDBiOS: use Swift 4.2 2018-09-05 13:04:47 +02:00
Gwendal Roué 2a43869e45 Prepare v3.3.0-beta1 2018-09-05 13:04:47 +02:00
Gwendal Roué bd52dbcec0 Migrate projects to SWIFT_VERSION = 4.2 2018-09-05 13:04:47 +02:00
Gwendal Roué c9dace3089 Spot a flacky test 2018-09-05 13:04:47 +02:00
Gwendal Roué 9184cbe324 Welcome @SD10 in the thank you notice 2018-09-04 13:16:14 +02:00
Gwendal Roué 2216573acb Prefer pseudonyms 2018-09-04 13:15:20 +02:00
Gwendal Roué 2b331e3c03 Merge pull request #407 from SD10/development
Add Code of Conduct
2018-09-04 13:10:05 +02:00
Gwendal Roué 875e7779c3 More CloudKit 2018-09-04 08:54:20 +02:00
Gwendal Roué 743a56e0e4 More CloudKit 2018-09-04 08:47:20 +02:00
Gwendal Roué 6e1ef92a38 More CloudKit 2018-09-04 08:43:49 +02:00
Gwendal Roué e3ca4e42a3 CloudKit context 2018-09-04 08:24:39 +02:00
Steven Deutsch 6db4c38c74 Fix develop -> development branch name 2018-09-01 11:12:20 -05:00
Steven Deutsch 8a16f0ba42 Add CODE_OF_CONDUCT 2018-09-01 11:03:34 -05:00
Gwendal Roué 81cd30bb38 CONTRIBUTING.md 2018-09-01 16:38:35 +02:00
Gwendal Roué d26145e59e CONTRIBUTING.md 2018-09-01 16:37:37 +02:00
Gwendal Roué 2b664d5485 CONTRIBUTING.md 2018-09-01 16:06:50 +02:00
Gwendal Roué 27f8103e79 CONTRIBUTING.md 2018-09-01 15:55:44 +02:00
Gwendal Roué a5c2c618e4 CONTRIBUTING.md 2018-09-01 15:55:26 +02:00
Gwendal Roué 9d4a083193 CONTRIBUTING.md 2018-09-01 15:52:04 +02:00
Gwendal Roué 9d00f63358 CONTRIBUTING.md 2018-09-01 15:47:16 +02:00
Gwendal Roué 0ae85eed24 CONTRIBUTING.md 2018-09-01 15:43:25 +02:00
Gwendal Roué 41050094af CONTRIBUTING.md 2018-09-01 15:41:06 +02:00
Gwendal Roué 7d339edd6e CONTRIBUTING.md 2018-09-01 15:26:43 +02:00
Gwendal Roué 23d7d3f8ed CONTRIBUTING.md 2018-09-01 15:17:34 +02:00
Gwendal Roué 7bd9703540 CONTRIBUTING.md 2018-09-01 15:16:37 +02:00
Gwendal Roué 8a6e7b70ef CONTRIBUTING.md 2018-09-01 15:12:55 +02:00
Gwendal Roué 5a8c3cdafc CONTRIBUTING.md 2018-09-01 15:09:15 +02:00
Gwendal Roué 16a1cecc57 CONTRIBUTING.md 2018-09-01 15:02:05 +02:00
Gwendal Roué e367d55940 CONTRIBUTING.md 2018-09-01 14:46:07 +02:00
Gwendal Roué b45b6cd0cf CONTRIBUTING.md 2018-09-01 14:40:28 +02:00
Gwendal Roué c2535d19e9 CONTRIBUTING.md 2018-09-01 14:37:30 +02:00
Gwendal Roué fa4ca12903 CONTRIBUTING.md 2018-09-01 14:17:27 +02:00
Gwendal Roué c5444fa99d Merge pull request #396 from groue/swift4.2
Support for Xcode 10 and Swift 4.2
2018-08-31 08:24:53 +02:00
Gwendal Roué 468eaf8642 CHANGELOG 2018-08-31 08:17:50 +02:00
Gwendal Roué d9d0f62f71 Travis: please test Swift 4.0, 4.2, and Xcode 9.3, 9.4, and 10. 2018-08-30 16:34:30 +02:00
Gwendal Roué 8b4eb55568 Use Cocoapods pre-release (1.6.0 beta) 2018-08-30 16:34:30 +02:00
Gwendal Roué 132ba89427 Adapt SQLCipher to the new build system 2018-08-30 16:34:30 +02:00
Gwendal Roué 1c26b7748e SQLCipher: Define ARCHS to $ARCHS_STANDARD for all sdks
This prevents Xcode 10 beta from outputting errors when it meets the i386 architecture.
2018-08-30 16:34:30 +02:00
Gwendal Roué 3354b22cd0 Travis: run tests with Xcode 10 2018-08-30 16:34:30 +02:00
Gwendal Roué e5cd3a8994 SE-0206 2018-08-30 16:34:30 +02:00
Gwendal Roué 1c09a3d31f New MIN_SWIFT_VERSION and MAX_SWIFT_VERSION makefile variables
This allows us to test GRDB with Swift 4.2, but also with the Swift 4.2 compiler in 4.0 compatibility mode.
2018-08-30 16:34:30 +02:00
Gwendal Roué 83c257822b FTS5: Swift / OS version checks extravaganza
With a big thank you to @hartbit for providing a ready-made solution
2018-08-30 16:34:30 +02:00
Gwendal Roué e82c92a002 Allow experiments with OTHER_SWIFT_FLAGS 2018-08-30 16:34:30 +02:00
Gwendal Roué d58586a18e Enable FTS5 on iOS 12
Thanks to @jrose-apple for the nice tip that avoids code duplication
2018-08-30 16:34:30 +02:00
Gwendal Roué 066889e0d7 Upgrade swiftlyfalling/SQLiteLib 2018-08-30 16:34:30 +02:00
Gwendal Roué ff595eeaef Compile with both Swift 4.1 and Swift 4.2 2018-08-30 16:34:30 +02:00
Gwendal Roué 80956ee2c7 Makefile: support for Xcode 10.0 2018-08-30 16:34:30 +02:00
Gwendal Roué 95ef76e839 More DatabaseRegion documentation 2018-08-30 13:32:53 +02:00
Gwendal Roué bcdf9d8c58 Internal documentation link 2018-08-30 13:03:13 +02:00
Gwendal Roué c44a1518cc Improve DatabaseRegion documentation 2018-08-30 13:02:17 +02:00
Gwendal Roué 8056a0e3c9 Vocabulary 2018-08-30 10:37:51 +02:00
Gwendal Roué 47275d0bf0 Internal documentation link 2018-08-30 10:35:12 +02:00
Gwendal Roué af8e17c753 Document that observation works well with SQL triggers 2018-08-30 10:33:31 +02:00
Gwendal Roué 6b6f80b818 Internal documentation link 2018-08-30 10:27:26 +02:00
Gwendal Roué eaf25161a5 Fic typo 2018-08-30 10:22:15 +02:00
Gwendal Roué 870d6e6966 More DatabaseRegion documentation 2018-08-30 10:21:25 +02:00
Gwendal Roué cd2697e34b CHANGELOG 2018-08-30 10:16:04 +02:00
Gwendal Roué 2083c3b41c Fix typo 2018-08-30 10:14:19 +02:00
Gwendal Roué d65d547b23 DatabaseRegion documentation 2018-08-30 10:13:01 +02:00
Gwendal Roué 0593832d10 Document interaction between DatabaseRegion and transaction observers (2) 2018-08-30 09:00:21 +02:00
Gwendal Roué 056db7ff6f Document interaction between DatabaseRegion and transaction observers 2018-08-30 08:46:58 +02:00
Gwendal Roué 3c01f0f1c0 TODO 2018-08-27 17:30:44 +02:00
Gwendal Roué 05dc1a5bea Fix typo 2018-08-27 15:53:33 +02:00
Gwendal Roué 2174beb396 Review DatabaseValueConversionErrorTests 2018-08-26 15:14:43 +02:00
Gwendal Roué d9989fc442 FetchableRecord+Decodable: fix a few corner cases 2018-08-26 15:14:20 +02:00
Gwendal Roué 566f42e8d0 Remove useless conversion contexts 2018-08-26 14:07:36 +02:00
Gwendal Roué f159927724 SE-0075 2018-08-26 12:07:19 +02:00
Gwendal Roué 21b8690e07 TODO 2018-08-26 10:42:01 +02:00
Gwendal Roué bb91a7ca0b Fix typo 2018-08-26 10:41:36 +02:00
Gwendal Roué 5819419f3b Minor documentation update 2018-08-25 17:30:40 +02:00
Gwendal Roué 2c59f838aa Fix typo 2018-08-25 17:00:56 +02:00
Gwendal Roué cbbc12adc0 Enhance introduction to records 2018-08-25 17:00:10 +02:00
Gwendal Roué d4d0aed3ae Simplify jazzy documentation 2018-08-25 16:04:50 +02:00
Gwendal Roué 588d7ac4ca Enhance Transactions documentation 2018-08-25 15:43:22 +02:00
Gwendal Roué ab98081e7b Don't initialize PersistenceContainer inside RecordEncoder 2018-08-25 15:32:57 +02:00
Gwendal Roué a8a3ec8259 Enhance Swift Enums documentation 2018-08-25 15:31:59 +02:00
Gwendal Roué 4fcc1f81d5 Update "Differences between Database Queues and Pools" chapter 2018-08-25 14:17:46 +02:00
Gwendal Roué 4572e493e6 Update "Differences between Database Queues and Pools" chapter 2018-08-25 13:43:58 +02:00
Gwendal Roué 1928c84b80 Update "Differences between Database Queues and Pools" chapter 2018-08-25 13:17:01 +02:00
Gwendal Roué b4d99dc738 Update "Differences between Database Queues and Pools" chapter 2018-08-25 13:07:33 +02:00
Gwendal Roué 8abf815045 Enhance readFromCurrentState and snapshots documentation 2018-08-25 12:22:40 +02:00
Gwendal Roué 7610eebb3f Enhance Codable Record documentatoin 2018-08-25 12:19:16 +02:00
Gwendal Roué c43800f40d Enhance Date documentation 2018-08-25 12:16:16 +02:00
Gwendal Roué a511772562 Enhance Values documentation 2018-08-25 12:11:39 +02:00
Gwendal Roué e916f577f1 Enhance Row documentation 2018-08-25 12:10:07 +02:00
Gwendal Roué da14fd2f87 Enhance DatabaseValue documentation 2018-08-25 11:50:07 +02:00
Gwendal Roué 052e615de0 Enhance Row documentation 2018-08-25 11:48:08 +02:00
Gwendal Roué 5a2f713775 Enhance Cursor documentation 2018-08-25 11:46:41 +02:00
Gwendal Roué ae66563654 Documentation + test for mixed arguments 2018-08-23 14:52:59 +02:00
Gwendal Roué 26df5aa516 Documentation 2018-08-23 14:32:30 +02:00
Gwendal Roué d3a9667f10 Cleanup 2018-08-22 13:04:24 +02:00
Gwendal Roué adf5695c20 Move StatementCache to Database+Statements.swift 2018-08-22 12:56:12 +02:00
Gwendal Roué aa8cb60fad SQLCipher has learned SQLITE_PREPARE_PERSISTENT 2018-08-22 12:52:13 +02:00
Gwendal Roué 65d99879a8 SQLCipher has learned SQLITE_PREPARE_PERSISTENT 2018-08-22 12:50:07 +02:00
Gwendal Roué b14f1b9fdc SQLCipher has learned sqlite3_prepare_v3 2018-08-22 08:53:01 +02:00
Gwendal Roué 46511e507e Avoid code duplication in Database.setupTrace
Also, use sqlite3_trace_v2 with SQLCipher
2018-08-22 08:35:54 +02:00
Gwendal Roué 8f5eee0130 Avoid code duplication in Database.closeConnection 2018-08-22 08:01:26 +02:00
Gwendal Roué 7f8d59b7b1 Merge pull request #403 from groue/feature/decoding-strategies
Codable records: customize date and uuid format
2018-08-21 19:40:20 +02:00
Gwendal Roué 0932e92fb4 Documentation 2018-08-21 19:39:34 +02:00
Gwendal Roué 5a8381b282 Add missing attribution 2018-08-21 14:39:46 +02:00
Gwendal Roué 8493984949 Fix Typo 2018-08-21 14:32:43 +02:00
Gwendal Roué a386fb6580 Documentation 2018-08-21 08:17:57 +02:00
Gwendal Roué baee699591 CHANGELOG 2018-08-21 06:58:18 +02:00
Gwendal Roué ad11affd21 ISO8601: don't let user customize the formatter 2018-08-20 23:43:04 +02:00
Gwendal Roué 209b3d0d37 Fix SPM and -O builds 2018-08-20 23:32:38 +02:00
Gwendal Roué edca38470e Documentation 2018-08-20 22:24:26 +02:00
Gwendal Roué e9b76bb196 Tests for DatabaseUUIDEncodingStrategy 2018-08-20 22:16:29 +02:00
Gwendal Roué f70e9b3e39 Introduce DatabaseUUIDEncodingStrategy 2018-08-20 21:14:51 +02:00
Gwendal Roué 13f3e5ec0d Remove useless conversions from Int to Int32 2018-08-20 21:14:32 +02:00
Gwendal Roué fb209d8805 Decode UUID and NSUUID from both blobs and strings 2018-08-20 21:13:58 +02:00
Gwendal Roué c6b1872291 Documentation 2018-08-20 19:40:23 +02:00
Gwendal Roué 8fa405452d Documentation 2018-08-20 19:38:11 +02:00
Gwendal Roué 34c7b0b40c Documentation 2018-08-20 19:32:59 +02:00
Gwendal Roué f583ef0d2a Documentation 2018-08-20 19:30:59 +02:00
Gwendal Roué e438d580b4 Don't close doors 2018-08-20 09:02:15 +02:00
Gwendal Roué 2c9a4b6968 Enhance "Record Customization Options" chapter 2018-08-20 09:00:35 +02:00
Gwendal Roué ba984427a4 Sort "Record Customization Options" by expected popularity 2018-08-20 08:58:17 +02:00
Gwendal Roué 1e34128213 Sort "Record Customization Options" by expected popularity 2018-08-20 08:57:35 +02:00
Gwendal Roué 319ac27b15 Extend "Record Customization Options" chapter 2018-08-20 08:56:02 +02:00
Gwendal Roué 8ea13dc5fd Quiet 2018-08-20 08:52:51 +02:00
Gwendal Roué ad6f1f4a37 Fix inner link 2018-08-20 08:51:48 +02:00
Gwendal Roué 063fe70766 More fostering of Codable records 2018-08-20 08:50:13 +02:00
Gwendal Roué 1c9ce6781b Enhance "JSON Columns" chapter 2018-08-20 08:30:57 +02:00
Gwendal Roué 81e777a323 Enhance "Use CodingKeys as Columns" chapter 2018-08-20 08:14:51 +02:00
Gwendal Roué b7273e0a7e Documentation 2018-08-20 08:05:20 +02:00
Gwendal Roué bb90ea0259 Improve explanation why the sortedKeys JSON option is recommended 2018-08-19 22:40:51 +02:00
Gwendal Roué f925d7e3d4 Fix SPM 2018-08-19 22:21:03 +02:00
Gwendal Roué bbf7eb0b73 Make tests platform-independent 2018-08-19 22:15:19 +02:00
Gwendal Roué 140c590c49 DatabaseDateEncodingStrategy tests 2018-08-19 21:54:50 +02:00
Gwendal Roué ff306c21e2 DatabaseDateEncodingStrategy 2018-08-19 21:54:41 +02:00
Gwendal Roué d1892c649c Documentation 2018-08-19 21:41:47 +02:00
Gwendal Roué f5d0e4db12 Cleanup & documentation 2018-08-19 20:28:47 +02:00
Gwendal Roué fc914470f5 DatabaseDateDecodingStrategy tests 2018-08-19 19:51:09 +02:00
Gwendal Roué d03b76b7e7 DatabaseDateDecodingStrategy 2018-08-19 19:50:35 +02:00
Gwendal Roué d45afb921a Merge pull request #401 from groue/feature/selectAs
Query Interface: set the selection and the fetched type in a single method call
2018-08-19 15:54:42 +02:00
Gwendal Roué e1f80494a8 CHANGELOG.md 2018-08-19 13:52:42 +02:00
Gwendal Roué 982dee5b77 Documentation improvements 2018-08-19 13:31:48 +02:00
Gwendal Roué 9815b310b6 TODO.md 2018-08-19 13:03:00 +02:00
Gwendal Roué 7bb0718bae Documentation for select(..., as:) 2018-08-19 13:02:45 +02:00
Gwendal Roué da60a5004e Tests for select(..., as:) 2018-08-19 12:30:02 +02:00
Gwendal Roué 8af33c4fc9 Introduce select(..., as:)
Record.select(..., as: Value.self) is equivalent to Record.select(...).asRequest(of: Value.self).

It somewhat improves the readability of some requests:

Player.select(max(Column("score")), as: Int.self)
2018-08-19 12:25:27 +02:00
Gwendal Roué 1fba575c18 Merge pull request #399 from groue/feature/codableUserInfo
Codable support: customize the `userInfo` context dictionary, and the format of JSON columns
2018-08-19 07:31:44 +02:00
Gwendal Roué 1e25debefc Done 2018-08-19 07:31:09 +02:00
Gwendal Roué 97d77e871b internal documentation 2018-08-18 20:54:40 +02:00
Gwendal Roué 7cb58cfffc Major cleanup of FetchableRecord+Decodable 2018-08-18 20:27:07 +02:00
Gwendal Roué 950940dedf Major cleanup of MutablePersistableRecord+Encodable 2018-08-18 19:02:16 +02:00
Gwendal Roué c32af15fdd Fix sample code 2018-08-18 16:10:47 +02:00
Gwendal Roué 3d285dfc81 Fix sample code 2018-08-18 16:09:44 +02:00
Gwendal Roué 76d3ac42ff More taste of DAO 2018-08-18 16:07:52 +02:00
Gwendal Roué e9b7a67c73 Fix JSON column tests so that they don't run when .sortedKeys option is not available 2018-08-18 15:54:01 +02:00
Gwendal Roué ba7cd4f61d Cleanup 2018-08-18 15:54:01 +02:00
Gwendal Roué 7a3321a5ed Add missing Foundation import 2018-08-18 15:54:01 +02:00
Gwendal Roué 5cb9d19b1e Cleanup README 2018-08-18 15:54:01 +02:00
Gwendal Roué 9e3da1a1a9 CHANGELOG 2018-08-18 15:54:01 +02:00
Gwendal Roué 35e202eb13 Documentation 2018-08-18 15:54:01 +02:00
Gwendal Roué 812975ee7d Cleanup 2018-08-18 15:54:01 +02:00
Gwendal Roué 934ee8e5f4 Remove a few obsolete debugging print statements 2018-08-18 15:54:01 +02:00
Gwendal Roué 47c424cb69 PersistableRecord: customize JSON encoding per column 2018-08-18 15:54:01 +02:00
Gwendal Roué b35fb6e315 FetchableRecord: customize JSON decoding per column 2018-08-18 15:54:01 +02:00
Gwendal Roué fdc191bbb4 Inline documentation 2018-08-18 15:54:01 +02:00
Gwendal Roué a8ec0530b1 Fix tests for iOS 2018-08-18 15:54:01 +02:00
Gwendal Roué b7b8594176 Pass tests for MutablePersistableRecord userInfo customization 2018-08-18 15:54:01 +02:00
Gwendal Roué eee433fefe Failing tests for MutablePersistableRecord userInfo customization 2018-08-18 15:54:01 +02:00
Gwendal Roué 513a5a3fb7 More FetchableRecord userInfo customization tests 2018-08-18 15:54:01 +02:00
Gwendal Roué 1a3638c0ef FetchableRecord can customize Decoder userInfo 2018-08-18 15:54:01 +02:00
Gwendal Roué ef123824c3 Failing tetsts for Decodable user infos 2018-08-18 15:54:01 +02:00
Gwendal Roué 2bc56255b2 TODO 2018-08-17 09:50:20 +02:00
Gwendal Roué a94711ad77 Fix a compiler warning introduced by 7be63866 2018-08-16 14:34:30 +02:00
Gwendal Roué 0ab84aff52 Enhance Codable Records documentation chapter 2018-08-16 14:24:07 +02:00
Gwendal Roué e415db248a Minor documentation tweak 2018-08-16 13:45:05 +02:00
Gwendal Roué c3a15bc2fc The benefits of having CodingKeys adopt ColumnExpression 2018-08-16 13:23:47 +02:00
Gwendal Roué 7a18b7c948 Test for CodingKey as ColumnExpression 2018-08-16 12:31:26 +02:00
Gwendal Roué df1f9b92a1 TODO.md 2018-08-16 11:00:35 +02:00
Gwendal Roué 4110f890da Minor documentation tweak 2018-08-16 09:02:05 +02:00
Gwendal Roué 44061f0d31 Improve Codable support visibility 2018-08-16 08:59:18 +02:00
Gwendal Roué 7be6386689 Fix DatabaseQueue.write and unsafeReentrantRead throws/rethrows qualifier. 2018-08-16 08:27:05 +02:00
Gwendal Roué 4d7d5e8429 Minor documentation tweak 2018-08-16 08:14:32 +02:00
Gwendal Roué b933917f34 Minor documentation tweak 2018-08-16 08:12:41 +02:00
Gwendal Roué d7f7a57129 Hide implementation details 2018-08-16 06:42:31 +02:00
Gwendal Roué d5008283d4 Minor documentation tweak 2018-08-15 23:18:36 +02:00
Gwendal Roué e51f27403d Minor documentation tweak 2018-08-15 23:05:09 +02:00
Gwendal Roué e5b2710151 Minor documentation tweaks 2018-08-15 22:58:49 +02:00
Gwendal Roué bdca768900 Improve Cursor documentation 2018-08-15 22:31:43 +02:00
Gwendal Roué b9b7ab2902 Rewrite Database queue and pool introducttions 2018-08-15 21:57:46 +02:00
Gwendal Roué 30bc15afb6 Merge pull request #397 from rotacloud/rotacloud
JSON encoding and decoding of codable record properties
2018-08-15 21:07:44 +02:00
Gwendal Roué 7ea15dcce2 Welcome @valexa and @gusrota to the thank you notice 2018-08-15 19:44:47 +02:00
Gwendal Roué 44b998c08f CHANGELOG.md 2018-08-15 19:38:03 +02:00
Gwendal Roué 2b8c8389fe Fix typo 2018-08-15 19:01:11 +02:00
Gwendal Roué dfb9421bd7 Documentation for JSON support 2018-08-15 18:53:10 +02:00
Gwendal Roué 02db2a8dc6 Tests for JSON data strategy 2018-08-15 18:40:24 +02:00
Gwendal Roué 9bb4ff86f1 Tests for JSON date strategy 2018-08-15 18:35:06 +02:00
Gwendal Roué 2eb0955420 JSON encoding: choose strategies
Data: .base64
Date: .millisecondsSince1970
NonConformingFloat: .throw
2018-08-15 18:34:47 +02:00
Gwendal Roué 659db4fdd9 Safer default implementation for RowImpl.copiedRow(_:) 2018-08-15 17:33:05 +02:00
Gwendal Roué d00421abe0 Restore SPM: add missing Foundation import 2018-08-15 17:17:08 +02:00
Gwendal Roué 4d343e893e More tests for Data -> String conversion: play with JPEG :-) 2018-08-15 17:09:15 +02:00
Gwendal Roué eba21d3371 Oh men of little faith! 2018-08-15 16:55:12 +02:00
Gwendal Roué b47f5864ac Even better feedback for conversion errors from StatementColumnConvertible 2018-08-15 16:49:07 +02:00
Gwendal Roué e8dacb31cc Tests for failed value conversions 2018-08-15 16:22:27 +02:00
Gwendal Roué 0b77d0d745 Better feedback for conversion errors from StatementColumnConvertible 2018-08-15 16:10:51 +02:00
Gwendal Roué de4f57c2aa Test decoding of non-UTF8 data 2018-08-15 16:09:45 +02:00
Gwendal Roué 2d6140a805 Refactor value conversion tests 2018-08-15 15:17:54 +02:00
Vlad Alexa b2234b46a2 5f41c57c addition 2018-08-15 14:04:14 +01:00
Gwendal Roué 358225b462 Cleanup, documentation, and preserve coding paths 2018-08-15 13:41:53 +02:00
Gwendal Roué 820673b78b PersistableRecord+Encodable: make it as robust as FetchableRecord+Decodable 2018-08-15 13:23:58 +02:00
Gwendal Roué 1c66ad4aad Restore GRDB/Core/Support/Foundation/Data.swift
because Data belongs to Foundation, not to the Standard Library.

Remove `import Foundation` from StandardLibrary.swift
2018-08-15 12:05:16 +02:00
Vlad Alexa 5f41c57c45 amended the documentation and tests to include Dictionary support to Codable types 2018-08-15 10:21:55 +01:00
Gwendal Roué 0cdc7d81d4 Just some cleanup, nothing new 2018-08-15 11:10:11 +02:00
Gwendal Roué 942b32e5d5 RowSingleValueDecodingContainer performance improvements
We switch from column indexing to integer indexing, which is far more efficient. And we can use the improved value decoding methods from #384.
2018-08-15 10:40:14 +02:00
Gwendal Roué aa8bc0fae3 Don't let JSONDecodingRequiredError go
JSON decoding: when row doesn't contain any Data, we don't want to expose a JSONDecodingRequiredError error to the user. We switch to a detailed conversion error instead (see #384).
2018-08-15 10:24:28 +02:00
Gwendal Roué 275098084d Introduce JSONDecodingRequiredError
We used to check for a standard DecodingError.typeMismatch error with specific message before switching to JSON decoding.

There was a small risk that such an error would not be generated by GRDB. In this case, we'd erroneously switch to JSON decoding instead of throwing the error.

So let's recognize the specific need for JSON decoding with a specific error instead: JSONDecodingRequiredError.
2018-08-15 10:12:28 +02:00
Gwendal Roué 05fda18a56 Introduce RowSingleValueDecoder
This allows complex decodable types to fail decoding from a row column, so that we switch to JSON decoding.
2018-08-15 09:55:45 +02:00
Gwendal Roué 4b7f17dbfa Merge remote-tracking branch 'origin/development' into rotacloud 2018-08-15 05:12:28 +02:00
Angus Muller c52b59f1bc Switching to JSON encoding for nested containers. 2018-08-14 16:01:05 +01:00
Vlad Alexa 76f5adf944 moved the extension to Swift.Data to follow the extension to Swift.String in the StandardLibrary.swift,
added case .blob(let data): return String(data: data, encoding: .utf8) to String.fromDatabaseValue
fixed tests
2018-08-14 15:04:07 +01:00
Vlad Alexa d81475adc4 6262d10 continued 2018-08-14 13:06:26 +01:00
Angus Muller a08974ffa4 Added tests for arrays 2018-08-14 11:20:02 +01:00
Angus Muller 8c06e7bff5 Detached rows string to data and tests 2018-08-14 11:16:47 +01:00
Vlad Alexa 7f16e357d0 extended Codable documentation and added test for the example used in the documentation 2018-08-14 10:39:31 +01:00
Vlad Alexa 6262d10794 added catch 2018-08-14 09:25:44 +01:00
Gwendal Roué d9dd293d7f A really difficult cleanup process 2018-08-14 08:33:06 +02:00
Gwendal Roué e49e2db571 Optimize decoding of StatementColumnConvertible values in Decodable records
This is the real final touch for #384, after all
2018-08-13 21:17:52 +02:00
Gwendal Roué 7da5ff95a0 Makefile: fix rule for Realm 2018-08-13 07:51:13 +02:00
Gwendal Roué 8eee52dad5 Merge pull request #384 from groue/conversionDebugInfo
Improve database value decoding diagnostics
2018-08-13 07:45:32 +02:00
Gwendal Roué 9bc68cd10e The final touch 2018-08-12 15:12:46 +02:00
Gwendal Roué e415a93d7e Performance tests for Codable records 2018-08-12 14:10:38 +02:00
Gwendal Roué 46bba98f0f Fix versions in performance report 2018-08-12 13:43:39 +02:00
Gwendal Roué 6a21e97a12 Profile struct decoding 2018-08-12 13:43:16 +02:00
Gwendal Roué 1ae8e39dab Perform performance tests against SQLite.swift 0.11.5 2018-08-12 12:46:51 +02:00
Gwendal Roué b99b14eb4d Perform performance tests against FMDB 2.7 2018-08-12 12:45:02 +02:00
Gwendal Roué 5579dd651a Perform performance tests against Realm 3.7.6 2018-08-12 12:42:58 +02:00
Gwendal Roué 66541922a4 More cleanup 2018-08-12 12:27:47 +02:00
Gwendal Roué 80fe7f87b1 More cleanup 2018-08-12 11:39:48 +02:00
Gwendal Roué bf5420de26 More cleanup 2018-08-12 10:20:10 +02:00
Gwendal Roué ef10e2e8ed General cleanup:
- rename ValueConversionDebuggingInfo to ValueConversionContext
- allow missing value conversion context (when decoding a raw DatabaseValue)
- rename ColumnCursor to FastDatabaseValueCursor
- rename NullableColumnCursor to FastNullableDatabaseValueCursor
2018-08-11 19:45:58 +02:00
Gwendal Roué 1dcb42c540 wip: debug info for no such column errors 2018-08-11 13:03:11 +02:00
Gwendal Roué 897fd32725 Cleanup 2018-08-11 12:58:04 +02:00
Gwendal Roué e46902c845 wip: debug info for no such column errors 2018-08-11 07:16:55 +02:00
Gwendal Roué d836fffd08 wpi: debug info for no such column errors 2018-08-10 08:52:32 +02:00
Gwendal Roué c480e07f08 Increase single-value containers testing 2018-08-10 05:21:33 +02:00
Gwendal Roué 9f2058f6d9 Fix DatabaseValueConvertible implementation for Decodable types that need a single-value container 2018-08-10 05:01:30 +02:00
Gwendal Roué 7d4ebce70a TODO conversion error message for adapted rows 2018-08-10 04:52:59 +02:00
Gwendal Roué cbda1f9211 Fix DatabaseValueConvertible implementation for Decodable types that need a single-value container
They used to crash on decoding errors
2018-08-10 04:52:23 +02:00
Gwendal Roué cef5d25228 Test conversion error messages 2018-08-09 19:19:22 +02:00
Gwendal Roué 220ce379e1 Test conversion error messages 2018-08-09 14:00:33 +02:00
Vlad Alexa 2826472c19 sorted encoder outputFormatting for ios11+ etcl 2018-08-09 09:46:45 +01:00
Gwendal Roué bcc45dc076 no more throwing conversion methods, and refactor ValueConversionDebuggingInfo 2018-08-09 08:51:50 +02:00
Vlad Alexa 7def60c3c0 fixed checking for nested codable 2018-08-08 14:35:05 +01:00
Vlad Alexa 74aae3dd59 implemented requested changes 2018-08-08 11:41:26 +01:00
Gwendal Roué 89d5bd7945 Restore SQLCipher/src to v3.4.2 2018-08-07 19:44:38 +02:00
Vlad Alexa feeedcb92d Added nested Codable support by flattening into/from JSON 2018-08-07 15:29:16 +01:00
Gwendal Roué 78a6f7251b Spot a few Demeter law violations 2018-08-06 13:40:37 +02:00
Gwendal Roué b307e907cb CHANGELOG 2018-08-06 13:40:37 +02:00
Gwendal Roué 9f2ba7245b fix SPM build 2018-08-06 13:40:05 +02:00
Gwendal Roué e9e1fa85c6 Cleanup 2018-08-06 13:40:05 +02:00
Gwendal Roué f8de01779c Cleanup 2018-08-06 13:40:05 +02:00
Gwendal Roué 84c53ef6b9 improve value conversion diagnostics more 2018-08-06 13:40:05 +02:00
Gwendal Roué a8f6ed6d61 improve value conversion diagnostics more 2018-08-06 13:40:05 +02:00
Gwendal Roué 1c811a61ca improve value conversion diagnostics 2018-08-06 13:40:05 +02:00
Gwendal Roué 566dae0574 Merge pull request #393 from groue/SQLCipher-3.4.2
Upgrade SQLCipher to 3.4.2, enable FTS5 on GRDBCipher and new pod GRDBPlus
2018-08-06 13:32:57 +02:00
Gwendal Roué f0ec9925d2 Add @Marus to the thank you notice 2018-08-06 08:40:37 +02:00
Gwendal Roué 481dc79c85 CHANGELOG: documentation diff 2018-08-06 08:32:16 +02:00
Gwendal Roué 0b1a24184b Upgrade release process for GRDBPlus pod 2018-08-06 08:19:58 +02:00
Gwendal Roué b473d07b3c Fix typo 2018-08-06 08:19:37 +02:00
Gwendal Roué 5538977911 Improve doc about FTS5 support 2018-08-06 08:07:31 +02:00
Gwendal Roué 9815b0b480 CHANGELOG 2018-08-05 14:47:26 +02:00
Gwendal Roué 9ed01719b7 Update SQLCipher version in README.md 2018-08-05 14:41:52 +02:00
Gwendal Roué 0e40b6bda2 Document how to activate FTS5
and address #373
2018-08-05 14:37:02 +02:00
Gwendal Roué dd18323a36 New pod: GRDBPlus
This is a workaround for https://github.com/CocoaPods/CocoaPods/issues/7333
2018-08-05 14:25:58 +02:00
Gwendal Roué 06e5dc5dfd Further split CocoaPods lint tasks
(still hoping that this fixes Travis timeout)
2018-08-04 13:24:03 +02:00
Gwendal Roué b916bca1f6 Split test_CocoaPodsLint Makefile target
... in order to avoid Travis CI timeouts
2018-08-04 07:19:06 +02:00
Gwendal Roué 4186d2e5c4 Fix test_install_GRDBFTS5_CocoaPods 2018-08-03 13:28:10 +02:00
Gwendal Roué 33a5decfdc Fix GRDB.swift podspec 2018-08-03 13:27:15 +02:00
Gwendal Roué 2c35ca5ac7 Rename GRDB/FTS5 podspec to GRDB/3.19.3, and comment out target requirements that CocoaPods does not support; 2018-08-03 08:24:25 +02:00
Gwendal Roué 4d2e230633 Makefile: test FTS5 support on iOS 11.4+ and macOS 10.13+ 2018-08-03 08:24:25 +02:00
Gwendal Roué 66d7f37643 https://github.com/CocoaPods/CocoaPods/issues/7333 😭 2018-08-03 08:24:25 +02:00
Gwendal Roué fd00cd613e New Makefile target test_install_GRDBFTS5_CocoaPods that tests GRDB/FTS5 subspec 2018-08-03 08:24:25 +02:00
Gwendal Roué c5c4508bfe New GRDB.swift/FTS5 subspec 2018-08-03 08:24:25 +02:00
Gwendal Roué d21a9b90b2 Enable FTS5 for SQLite < 3.20.0 (sqlite3_prepare_v3 and sqlite3_bind_pointer) 2018-08-03 08:24:25 +02:00
Gwendal Roué 0eeb72a89b Ignore CocoaPods tests workspaces 2018-08-03 08:24:25 +02:00
Gwendal Roué 1cd211bd89 New Makefile target test_install_GRDBCipher_CocoaPods 2018-08-03 08:24:25 +02:00
Gwendal Roué 1d04376493 New Tests/CocoaPods/GRDBCipherMacOS app that checks GRDBCipher integration + FTS5 2018-08-03 08:24:25 +02:00
Gwendal Roué fa396a2d86 New Makefile target test_install_GRDB_CocoaPods 2018-08-03 08:24:25 +02:00
Gwendal Roué 06150b5e58 Make Tests/CocoaPods/GRDBiOS buildable again 2018-08-03 08:24:25 +02:00
Marcel Ball 4f0b5eb7b9 Enable FTS5 extension for GRDBCipher builds
- Enable
- Add -DSQLITE_ENABLE_FTS5 to the CFLAGS for SQLCipher (SQLCipher/src/sqlcipher.xcconfig) (via submodule update)
- Add -D SQLITE_ENABLE_FTS5 to swift flags for GRDBCipher (SQLCipher/GRDBCipher.xcconfig)
- Add -D SQLITE_ENABLE_FTS5 to the GRDBCipher Testing Projects
- Updated message in EncryptionTests - SQLCipher changed the message “file is encrypted or is not a database” back to just “file is not a database” in 3.4.2 - seems like an odd choice on their part but is behaving as expected.
2018-08-03 08:24:25 +02:00
Gwendal Roué 79fd17faec Upgrade SQLCipher to 3.4.2 + FTS5 2018-08-03 08:24:25 +02:00
Gwendal Roué 59da551b66 Merge branch 'master' into development 2018-08-02 16:46:10 +02:00
Gwendal Roué 89d95f6a7c Merge pull request #390 from kluufger/patch-2
fix small typo in readme
2018-07-19 14:30:42 +02:00
kluufger 1db18b818a player -> country 2018-07-19 11:39:01 +00:00
kluufger 37be51ec37 player -> country x2 2018-07-19 11:22:33 +00:00
kluufger 6fb5bb8ffd player -> country 2018-07-19 10:57:14 +00:00
Gwendal Roué d82b539942 Merge pull request #387 from kluufger/patch-1
Fix some typos in AssociationsBasics guide
2018-07-19 12:56:41 +02:00
kluufger dc8406d732 fix small type in readme 2018-07-19 10:08:59 +00:00
kluufger 328d1fcd30 Fix some typos in AssociationsBasics guide
Not sure about some of them, though.
2018-07-19 08:09:10 +00:00
Gwendal Roué d4590ff91f Fix DatabaseWriter.readFromCurrentState documentation 2018-07-13 09:45:59 +02:00
Gwendal Roué 5bcc95ce87 Update TODO.md 2018-07-11 18:11:42 +02:00
150 changed files with 11303 additions and 2998 deletions

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@ Write documentation and tests if you can, because if nobody else has the time to
Ask for help and guidance when needed.
-->
- [ ] This pull request is submitted against the `develop` branch.
- [ ] This pull request is submitted against the `development` branch.
- [ ] 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.
+1
View File
@@ -103,6 +103,7 @@ SQLiteCustom/GRDBCustomSQLite-USER.xcconfig
# CocoaPods test
Podfile.lock
Pods
Tests/CocoaPods/*/*.xcworkspace
# SPM
.build
+125 -42
View File
@@ -1,5 +1,5 @@
# The OS X Build Environment
# https://docs.travis-ci.com/user/reference/osx/#Xcode-version
# https://docs.travis-ci.com/user/reference/osx/#xcode-version
language: objective-c
xcode_project: GRDB.xcodeproj
@@ -15,29 +15,45 @@ jobs:
###########################################
## Test GRDB
# Test GRDBOSX (Xcode 9.4)
# Test GRDBOSX (Xcode 10)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9.4
osx_image: xcode10
env:
- TID=GRDBOSX (Xcode 9.4, macOS)
script: make test_framework_GRDBOSX
- TID=GRDBOSX (Xcode 10, Swift 4.2, macOS)
script: make test_framework_GRDBOSX_maxSwift
# Test GRDBWatchOS (Xcode 9.4)
# Test GRDBOSX (Xcode 10)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9.4
osx_image: xcode10
env:
- TID=GRDBWatchOS (Xcode 9.4, watchOS)
- TID=GRDBOSX (Xcode 10, Swift 4.0, macOS)
script: make test_framework_GRDBOSX_minSwift
# Test GRDBWatchOS (Xcode 10)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=GRDBWatchOS (Xcode 10, watchOS)
script: make test_framework_GRDBWatchOS
# Test GRDBiOS (Xcode 10, iOS <MAXIMUM VERSION>)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=GRDBiOS (Xcode 10, Swift 4.2, iOS <MAX>)
script: make test_framework_GRDBiOS_maxTarget_maxSwift
# Test GRDBiOS (Xcode 9.4, iOS <MAXIMUM VERSION>)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9.4
env:
- TID=GRDBiOS (Xcode 9.4, iOS <MAX>)
script: make test_framework_GRDBiOS_maxTarget
script: make test_framework_GRDBiOS_maxTarget_maxSwift
# Test GRDBiOS (Xcode 9.3, iOS <MINIMUM VERSION>))
- stage: Test GRDB
@@ -47,25 +63,41 @@ jobs:
- TID=GRDBiOS (Xcode 9.3, iOS <MIN>)
script: make test_framework_GRDBiOS_minTarget
# Test GRDB [SPM] (Xcode 9.4, macOS)
# Test GRDB [SPM] (Xcode 10, macOS)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9.4
osx_image: xcode10
env:
- TID=GRDB [SPM] (Xcode 9.4, macOS)
- TID=GRDB [SPM] (Xcode 10, macOS)
script: make test_SPM
###########################################
## Test GRDB (Custom SQLite)
# Test GRDBCustomSQLiteOSX (Xcode 9.4)
# Test GRDBCustomSQLiteOSX (Xcode 10)
- stage: Test GRDB + Custom SQLite
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9.4
osx_image: xcode10
env:
- TID=GRDBCustomSQLiteOSX (Xcode 9.4, macOS)
- TID=GRDBCustomSQLiteOSX (Xcode 10, macOS)
script: make test_framework_GRDBCustomSQLiteOSX
# Test GRDBCustomSQLiteiOS (Xcode 10, iOS <MAXIMUM VERSION>)
- stage: Test GRDB + Custom SQLite
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=GRDBCustomSQLiteiOS (Xcode 10, Swift 4.2, iOS <MAX>)
script: make test_framework_GRDBCustomSQLiteiOS_maxTarget_maxSwift
# Test GRDBCustomSQLiteiOS (Xcode 10, iOS <MAXIMUM VERSION>)
- stage: Test GRDB + Custom SQLite
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=GRDBCustomSQLiteiOS (Xcode 10, Swift 4.0, iOS <MAX>)
script: make test_framework_GRDBCustomSQLiteiOS_maxTarget_minSwift
# Test GRDBCustomSQLiteiOS (Xcode 9.4, iOS <MAXIMUM VERSION>)
- stage: Test GRDB + Custom SQLite
gemfile: .ci/gemfiles/Gemfile.travis
@@ -85,14 +117,22 @@ jobs:
###########################################
## Test GRDB (SQLCipher)
# Test GRDBCipherOSX (Xcode 9.4)
# Test GRDBCipherOSX (Xcode 10)
- stage: Test GRDB + SQLCipher
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9.4
osx_image: xcode10
env:
- TID=GRDBCipherOSX (Xcode 9.4, macOS)
- TID=GRDBCipherOSX (Xcode 10, macOS)
script: make test_framework_GRDBCipherOSX
# Test GRDBCipheriOS (Xcode 10, iOS <MAXIMUM VERSION>)
- stage: Test GRDB + SQLCipher
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=GRDBCipheriOS (Xcode 10, iOS <MAX>)
script: make test_framework_GRDBCipheriOS_maxTarget
# Test GRDBCipheriOS (Xcode 9.4, iOS <MAXIMUM VERSION>)
- stage: Test GRDB + SQLCipher
gemfile: .ci/gemfiles/Gemfile.travis
@@ -112,46 +152,89 @@ jobs:
###########################################
## Test Installation Methods
# Manual Install (Xcode 9.4)
# Manual Install (Xcode 10)
- stage: Test Installation
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9.4
osx_image: xcode10
env:
- TID=Manual Install (Xcode 9.4)
- TID=Manual Install (Xcode 10)
script: make test_install_manual
# Manual Install (GRDBCipher, Xcode 9.4)
# Manual Install (GRDBCipher, Xcode 10)
- stage: Test Installation
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9.4
osx_image: xcode10
env:
- TID=Manual Install (GRDBCipher, Xcode 9.4)
- TID=Manual Install (GRDBCipher, Xcode 10)
script: make test_install_GRDBCipher
# Cocoapods Lint (Xcode 9.4)
# CocoaPods Lint (Xcode 10)
- stage: Test Installation
osx_image: xcode9.4
osx_image: xcode10
install:
- gem install cocoapods # Since Travis is not always on latest version
- gem install cocoapods --pre # >= 1.6.0.beta.1 for cocoapods lint
env:
- TID=Cocoapods (Xcode 9.4)
script: make test_CocoaPodsLint
- TID=CocoaPods Lint GRDB.swift (Xcode 10)
script: make test_CocoaPodsLint_GRDB
# SPM Install (Xcode 9.4)
# CocoaPods Lint (Xcode 10)
- stage: Test Installation
osx_image: xcode9.4
osx_image: xcode10
install:
- gem install cocoapods --pre # >= 1.6.0.beta.1 for cocoapods lint
env:
- TID=SPM (Xcode 9.4)
- TID=CocoaPods Lint GRDBPlus (Xcode 10)
script: make test_CocoaPodsLint_GRDBPlus
# CocoaPods Lint (Xcode 10)
- stage: Test Installation
osx_image: xcode10
install:
- gem install cocoapods --pre # >= 1.6.0.beta.1 for cocoapods lint
env:
- TID=CocoaPods Lint GRDBCipher (Xcode 10)
script: make test_CocoaPodsLint_GRDBCipher
# 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 GRDB (Xcode 10)
script: make test_install_GRDB_CocoaPods
# 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 GRDB+FTS5 (Xcode 10)
script: make test_install_GRDBFTS5_CocoaPods
# 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 (Xcode 10)
- stage: Test Installation
osx_image: xcode10
env:
- TID=SPM (Xcode 10)
script: make test_install_SPM
## Carthage Build
## Commented out until `make test_CarthageBuild` performs *reliably*.
## See https://github.com/groue/GRDB.swift/pull/262
# - stage: Test Installation
# osx_image: xcode9.4
# before_install:
# - brew update
# - brew outdated carthage || brew upgrade carthage
# env:
# - TID=Carthages
# script: make test_CarthageBuild
- stage: Test Installation
osx_image: xcode10
before_install:
- brew update
- brew outdated carthage || brew upgrade carthage
env:
- TID=Carthages
script: make test_CarthageBuild
+130
View File
@@ -1,6 +1,136 @@
Release Notes
=============
## 3.3.0
Released September 16, 2018 &bull; [diff](https://github.com/groue/GRDB.swift/compare/v3.3.0-beta1...v3.3.0)
### New
- [#409](https://github.com/groue/GRDB.swift/pull/409): DatabaseWriter.concurrentRead
### Documentation Diff
- [Advanced DatabasePool](README.md#advanced-databasepool): the chapter has been updated for the new DatabasePool.concurrentRead method.
### API diff
```diff
protocol DatabaseWriter : DatabaseReader {
+ func concurrentRead<T>(_ block: @escaping (Database) throws -> T) -> Future<T>
+ @available(*, deprecated)
func readFromCurrentState(_ block: @escaping (Database) -> Void) throws
}
+class Future<Value> {
+ func wait() throws -> Value
+}
extension Cursor {
+ func isEmpty() throws -> Bool
}
```
## 3.3.0-beta1
Released September 5, 2018 &bull; [diff](https://github.com/groue/GRDB.swift/compare/v3.2.0...v3.3.0-beta1)
This release focuses on enhancing the relationships between [Codable records](README.md#codable-records) and the database, with JSON columns, customized date formats, and better diagnostics when things go wrong.
Other notable enhancements are:
- Support for Swift 4.2 and Xcode 10 (Xcode 9.3 is still supported).
- Support for the FTS5 full-text engine when available in the operating system (iOS 11.4+ / macOS 10.13+ / watchOS 4.3+).
### Fixed
- The `write` and `unsafeReentrantRead` DatabaseQueue methods used to have an incorrect `throws/rethrows` qualifier.
### New
- [#397](https://github.com/groue/GRDB.swift/pull/397) by [@gusrota](https://github.com/gusrota) and [@valexa](https://github.com/valexa): Codable records: JSON encoding and decoding of codable record properties
- [#399](https://github.com/groue/GRDB.swift/pull/399): Codable records: customize the `userInfo` context dictionary, and the format of JSON columns
- [#403](https://github.com/groue/GRDB.swift/pull/403): Codable records: customize date and uuid format
- [#401](https://github.com/groue/GRDB.swift/pull/401): Query Interface: set the selection and the fetched type in a single method call
- [#393](https://github.com/groue/GRDB.swift/pull/393) by [@Marus](https://github.com/Marus): Upgrade SQLCipher to 3.4.2, enable FTS5 on GRDBCipher and new pod GRDBPlus.
- [#384](https://github.com/groue/GRDB.swift/pull/384): Improve database value decoding diagnostics
- [#396](https://github.com/groue/GRDB.swift/pull/396): Support for Xcode 10 and Swift 4.2
- Cursors of optimized values (Strint, Int, Date, etc.) have been renamed: FastDatabaseValueCursor and FastNullableDatabaseValueCursor replace the deprecated ColumnCursor and NullableColumnCursor.
### Documentation Diff
- [Enabling FTS5 Support](README.md#enabling-fts5-support): Procedure for enabling FTS5 support in GRDB.
- [Codable Records](README.md#codable-records): Updated documentation for JSON columns, customized date and uuid formats, and other customization options.
- [Record Customization Options](README.md#record-customization-options): A new chapter that gathers all your customization options.
- [Fetching from Requests](README.md#fetching-from-requests): Enhanced documentation about requests that don't fetch their origin record (such as aggregates, or associated records).
- [DatabaseRegion](README.md#databaseregion): Database regions help you observe the database.
### API diff
Fixes:
```diff
class DatabaseQueue {
- func write<T>(_ block: (Database) throws -> T) rethrows -> T {
+ func write<T>(_ block: (Database) throws -> T) throws -> T {
- func unsafeReentrantRead<T>(_ block: (Database) throws -> T) throws -> T {
+ func unsafeReentrantRead<T>(_ block: (Database) throws -> T) rethrows -> T {
}
```
Enhancements to Codable support:
```diff
protocol FetchableRecord {
+ static var databaseDecodingUserInfo: [CodingUserInfoKey: Any] { get }
+ static var databaseDateDecodingStrategy: DatabaseDateDecodingStrategy { get }
+ static func databaseJSONDecoder(for column: String) -> JSONDecoder
}
protocol MutablePersistableRecord: TableRecord {
+ static var databaseEncodingUserInfo: [CodingUserInfoKey: Any] { get }
+ static var databaseDateEncodingStrategy: DatabaseDateEncodingStrategy { get }
+ static var databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy { get }
+ static func databaseJSONEncoder(for column: String) -> JSONEncoder
}
```
Query Interface: set the selection and the fetched type in a single method call:
```diff
extension QueryInterfaceRequest {
+ func select<RowDecoder>(_ selection: [SQLSelectable], as type: RowDecoder.Type) -> QueryInterfaceRequest<RowDecoder>
+ func select<RowDecoder>(_ selection: SQLSelectable..., as type: RowDecoder.Type) -> QueryInterfaceRequest<RowDecoder>
+ func select<RowDecoder>(sql: String, arguments: StatementArguments? = nil, as type: RowDecoder.Type) -> QueryInterfaceRequest<RowDecoder>
}
extension TableRecord {
+ static func select<RowDecoder>(_ selection: [SQLSelectable], as type: RowDecoder.Type) -> QueryInterfaceRequest<RowDecoder>
+ static func select<RowDecoder>(_ selection: SQLSelectable..., as type: RowDecoder.Type) -> QueryInterfaceRequest<RowDecoder>
+ static func select<RowDecoder>(sql: String, arguments: StatementArguments? = nil, as type: RowDecoder.Type) -> QueryInterfaceRequest<RowDecoder>
}
```
Deprecations:
```diff
+final class FastDatabaseValueCursor<Value: DatabaseValueConvertible & StatementColumnConvertible> : Cursor { }
+@available(*, deprecated, renamed: "FastDatabaseValueCursor")
+typealias ColumnCursor<Value: DatabaseValueConvertible & StatementColumnConvertible> = FastDatabaseValueCursor<Value>
+final class FastNullableDatabaseValueCursor<Value: DatabaseValueConvertible & StatementColumnConvertible> : Cursor { }
+@available(*, deprecated, renamed: "FastNullableDatabaseValueCursor")
+typealias NullableColumnCursor<Value: DatabaseValueConvertible & StatementColumnConvertible> = FastNullableDatabaseValueCursor<Value>
```
## 3.2.0
Released July 8, 2018 &bull; [diff](https://github.com/groue/GRDB.swift/compare/v3.1.0...v3.2.0)
+50
View File
@@ -0,0 +1,50 @@
# Contributor Code of Conduct
As contributors and maintainers of this project, and in the interest of
fostering an open and welcoming community, we pledge to respect all people who
contribute through reporting issues, posting feature requests, updating
documentation, submitting pull requests or patches, and other activities.
We are committed to making participation in this project a harassment-free
experience for everyone, regardless of level of experience, gender, gender
identity and expression, sexual orientation, disability, personal appearance,
body size, race, ethnicity, age, religion, or nationality.
Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery
- Personal attacks
- Trolling or insulting/derogatory comments
- Public or private harassment
- Publishing other's private information, such as physical or electronic
addresses, without explicit permission
- Other unethical or unprofessional conduct
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
By adopting this Code of Conduct, project maintainers commit themselves to
fairly and consistently applying these principles to every aspect of managing
this project. Project maintainers who do not follow or enforce the Code of
Conduct may be permanently removed from the project team.
This code of conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting a project maintainer at [gr@pierlis.com](mailto:gr@pierlis.com).
All complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. Maintainers are
obligated to maintain confidentiality with regard to the reporter of an
incident.
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.3.0, available at
[http://contributor-covenant.org/version/1/3/0/][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/3/0/
+393
View File
@@ -0,0 +1,393 @@
Contributing to GRDB
====================
**Thank you for coming!**
This guide is a set of tips and guidelines for contributing to the GitHub repository [groue/GRDB.swift](https://github.com/groue/GRDB.swift).
- [Report Bugs]
- [Ask Questions]
- [Suggest an Enhancement]
- [Submit a Pull Request]
- [Sponsoring and Professional Support]
- [Suggested Contributions]
- [Non-Goals]
### Report Bugs
Please make sure the bug is not already reported by searching existing [issues](https://github.com/groue/GRDB.swift/issues).
If you're unable to find an existing issue addressing the problem, [open a new one](https://github.com/groue/GRDB.swift/issues/new). Be sure to include a title and clear description, as much relevant information as possible, and a code sample or an executable test case demonstrating the expected behavior that is not occurring.
### Ask Questions
The information you are looking for is maybe already available. Check out:
- the [FAQ](README.md#faq)
- the [general documentation](README.md#documentation)
- the [answered questions](https://github.com/groue/GRDB.swift/issues?utf8=✓&q=label%3Aquestion+)
If not, your questions are welcome in the [GRDB forums](https://forums.swift.org/c/related-projects/grdb), or in a new [GitHub issue](https://github.com/groue/GRDB.swift/issues/new).
### Suggest an Enhancement
Your idea may already be listed in [Suggested Contributions], waiting for someone to pick it up.
If not, contact [@groue](http://twitter.com/groue) on Twitter, or [open a new issue](https://github.com/groue/GRDB.swift/issues/new).
### Submit a Pull Request
Discuss your idea first, so that your changes have a good chance of being merged in.
Submit your pull request against the `development` branch.
Pull requests that include tests for modified and new functionalities, inline documentation, and relevant updates to the main README.md are merged faster, because you won't have to wait for somebody else to complete your contribution.
### Sponsoring and Professional Support
GRDB is free. It is openly developed by its contributors, on their free time, according to their will, needs, and availability. It is not controlled by any company.
When you have specific development or support needs, and are willing to financially contribute to GRDB, please send an email to [Gwendal Roué](mailto:gr@pierlis.com) so that we can enter a regular business relationship through the [Pierlis](http://pierlis.com/) company, based in Paris, France.
## Suggested Contributions
You'll find below various ideas for enhancing and extending GRDB, in various areas. Your ideas can be added to this list: [Suggest an Enhancement].
Legend:
- :baby: **Starter Task**: get familiar with GRDB internals
- :muscle: **Hard**: there are implementation challenges
- :pencil: **Documentation**
- :fire: **Experimental**: let's invent the future!
- :bowtie: **Public API Challenge**: we'll need a very good public API
- :hammer: **Tooling**: GRDB and its environment
- :question: **Unknown Difficulty**
The ideas, in alphabetical order:
- [Associations]
- [Carthage]
- [CloudKit]
- [Concurrency]
- [Database Observation]
- [Date and Time Functions]
- [Decode NSDecimalNumber from Text Columns]
- [Documentation]
- [FetchedRecordsController Diffing Algorithm]
- [FetchedRecordsController Support for Any Request]
- [FetchedRecordsController Support for Sections]
- [Full Text Search Demo Application]
- [JSON]
- [Linux]
- [More SQL Generation]
- [SQL Console in the Debugger]
- [SQLCipher in a Shared App Container]
- [Static Library]
- [Typed Expressions]
### Associations
:bowtie: Public API Challenge :muscle: Hard :fire: Experimental
Associations can be enhanced in several ways. See the "Known Issues" and "Future Directions" chapter of the [Associations Guide](Documentation/AssociationsBasics.md)
### Carthage
:question: Unknown Difficulty
[Carthage](https://github.com/Carthage/Carthage) can build GRDB frameworks, but it can also inexplicably fail. This installation method is thus currently **unsupported**, which means that support has to be found directly in the [Carthage repo](https://github.com/Carthage/Carthage/issues), or on [Stack Overflow](http://stackoverflow.com). See [#262](https://github.com/groue/GRDB.swift/pull/262) for more information.
I would be a nice improvement if GRDB Carthage builds were made robust.
### CloudKit
:bowtie: Public API Challenge :question: Unknown Difficulty :fire: Experimental
Integration with [CloudKit](https://developer.apple.com/icloud/cloudkit/) is a rich, interesting, and useful topic.
It is likely that CloudKit support would exist in a separate companion library.
Starting points:
- [caiyue1993/IceCream](https://github.com/caiyue1993/IceCream)
- [mentrena/SyncKit](https://github.com/mentrena/SyncKit)
- [nofelmahmood/Seam](https://github.com/nofelmahmood/Seam)
- [Sorix/CloudCore](https://github.com/Sorix/CloudCore)
- [Synchronizing data with CloudKit](https://medium.com/@guilhermerambo/synchronizing-data-with-cloudkit-94c6246a3fda)
- WWDC CloudKit sessions, including [CloudKit Best Practices](https://developer.apple.com/videos/play/wwdc2016/231/)
### Concurrency
:bowtie: Public API Challenge :muscle: Hard :pencil: Documentation
GRDB has a strong focus on safe concurrency. Not only safe as "does not crash", but safe as "actively protects your application data". The topic is discussed in (too) many places:
- [Concurrency Guide](README.md#concurrency)
- [Why Adopt GRDB?](https://github.com/groue/GRDB.swift/blob/master/Documentation/WhyAdoptGRDB.md#strong-and-clear-multi-threading-guarantees)
- [Four different ways to handle SQLite concurrency](https://medium.com/@gwendal.roue/four-different-ways-to-handle-sqlite-concurrency-db3bcc74d00e)
- [Good Practices for Designing Record Types](https://github.com/groue/GRDB.swift/blob/master/Documentation/GoodPracticesForDesigningRecordTypes.md#fetch-in-time)
- [Comparison between GRDB and Core Data concurrency](https://github.com/groue/GRDB.swift/issues/405)
Despite this abundant documention, I regularly meet developers who don't think about eventual multi-threading gotchas, and don't design their application against them.
This can be explained:
- Some developers disregard potential multi-threading bugs such as data races, even if the fix is "easy". Such bugs may never happen during the development of an application. They may only impact a few users in production. It is always easier not to think about them.
- Databases are often seen as plain CRUD tools, and some developers are not familiar with topics like isolation or transactions. This is especially true for developers who have experience in a managed ORM such as Core Data or Realm, or web frameworks like Rails or Django: switching to an unmanaged relational database is not an easy task.
- Not all applications need to be multi-threaded.
And this creates improvement opportunities:
- Better documentation of GRDB concurrency
- The introduction of an "ultra-safe" concurrency mode. Maybe something that restricts all database accesses to the main thread, like [FCModel](https://github.com/marcoarment/FCModel). Maybe in a separate companion library.
### Database Observation
:muscle: Hard
[Database Observation](README#database-changes-observation) is currently available in three flavors:
- The [TransactionObserver](README.md#transactionobserver-protocol) protocol: versatile, but low-level and challenging in terms of concurrency, especially when used in conjunction with database pools.
- [FetchedRecordsController]: high-level and easier to use.
- [RxGRDB]: high-level and easier to use, depends on [RxSwift](https://github.com/ReactiveX/RxSwift).
Suggested contributions are:
- Enhancements to FetchedRecordsController (see below).
- More choices of reactive engines.
### Date and Time Functions
:baby: Starter Task
Believe it or not, no one has ever asked support for SQLite [Date And Time Functions](https://www.sqlite.org/lang_datefunc.html). There is surely room for a nice Swift API that makes them available.
For more ideas, see:
- [SQLite Core Functions](https://www.sqlite.org/lang_corefunc.html)
- [SQLite Aggregate Functions](https://www.sqlite.org/lang_aggfunc.html)
- [SQLite JSON functions](https://www.sqlite.org/json1.html) and [JSON], below.
Functions are defined in [GRDB/QueryInterface/Support/SQLFunctions.swift](https://github.com/groue/GRDB.swift/blob/master/GRDB/QueryInterface/Support/SQLFunctions.swift).
### Decode NSDecimalNumber from Text Columns
:baby: Starter Task
NSDecimalNumber currently only decodes integer and float decimal values. It would be nice if NSDecimalNumber would decode text values as well:
```swift
let number = try NSDecimalNumber.fetchOne(db, "SELECT '12.3'")!
print(number) // prints 12.3
```
NSNumber and NSDecimalNumber support is found in [GRDB/Core/Support/Foundation/NSNumber.swift](https://github.com/groue/GRDB.swift/blob/master/GRDB/Core/Support/Foundation/NSNumber.swift)
### Documentation
:baby: Starter Task :pencil: Documentation
General documentation can always be improved so that it reaches its goal: helping developers building applications.
- English: the documentation has mostly been written by [@groue](http://github.com/groue) who is not a native English speaker.
- Clarity: any chapter that is not crystal clear should be enhanced.
- Audience: documentation should talk to several populations of developers, from beginners who need positive guidance, to SQLite experts who need to build trust.
- Typos
- Inaccuracies
- etc.
Inline documentation, the one which is embedded right into the source code and is displayed by Xcode when one alt-clicks an identifier, deserves the same care.
If you are a good writer, your help will be very warmly welcomed.
### FetchedRecordsController Diffing Algorithm
:muscle: Hard
[FetchedRecordsController] uses a Levenshtein-based diffing algorithm which has a terrible algorithmic complexity. This makes this very useful class unable to deal with more than hundreds of elements.
There exists much more efficient O(n) diffing algorithms that would lift this limitation.
Starting points:
- [RxSwiftCommunity/RxDataSources](https://github.com/RxSwiftCommunity/RxDataSources)
- [ra1028/DifferenceKit](https://github.com/ra1028/DifferenceKit)
- [tonyarnold/Differ](https://github.com/tonyarnold/Differ)
- [onmyway133/DeepDiff](https://github.com/onmyway133/DeepDiff)
- [mcudich/HeckelDiff](https://github.com/mcudich/HeckelDiff)
### FetchedRecordsController Support for Any Request
:muscle: Hard
[FetchedRecordsController] is able to deal with records, but not with raw rows or values:
```swift
// Supported by FetchedRecordsController
let recordRequest = Player.all()
// Not supported by FetchedRecordsController
let stringRequest = Player.select(Column("name"), as: String.self)
let rowRequest = SQLRequest<Row>("SELECT ...")
```
This limitation does not apply to [RxGRDB], the reactive sibling of FetchedRecordsController. It would be nice if FetchedRecordsController would become just as versatile.
### FetchedRecordsController Support for Sections
:muscle: Hard
[FetchedRecordsController] mimics the API of Core Data's [NSFetchedResultsController](https://developer.apple.com/documentation/coredata/nsfetchedresultscontroller), but does not yet support table and collection view sections.
This improvement most certainly depends on a refreshing of the [FetchedRecordsController Diffing Algorithm].
### Full Text Search Demo Application
:baby: Starter Task :pencil: Documentation
There exists a GRDB demo app for the FTS5 full-text engine: [WWDCCompanion](https://github.com/groue/WWDCCompanion).
This application downloads the transcripts of WWDC sessions, and lets its user type keywords and find matching sessions, sorted by relevance.
The problem is that this demo app breaks every year :sweat_smile:
We'd need instead to index a stable corpus, in order to ease the maintenance of this demo app.
### JSON
:bowtie: Public API Challenge :baby: Starter Task
[Codable Records] are granted with automatic JSON encoding and decoding of their complex properties. But there is still room for improvements. For example, could we put the [SQLite JSON1 extension](https://www.sqlite.org/json1.html) to some good use?
### Linux
:muscle: Hard :hammer: Tooling
Swift on Linux is currently focused on the server (Vapor, Perfect, Kitura). While general server support is a [non-goal](#non-goals) of GRDB, there exists read-only servers, and Linux GUI applications, too. Linux is thus a desired platform.
### More SQL Generation
:bowtie: Public API Challenge :question: Unknown Difficulty
There are several SQLite features that GRDB could natively support:
- [ATTACH DATABASE](https://www.sqlite.org/lang_attach.html)
- [UPSERT](https://www.sqlite.org/lang_UPSERT.html)
- [INSERT INTO ... SELECT ...](https://www.sqlite.org/lang_insert.html)
- [WITH RECURSIVE ...](https://www.sqlite.org/lang_with.html)
- [RTree](https://sqlite.org/rtree.html)
- [More ideas](https://www.sqlite.org/lang.html)
### SQL Console in the Debugger
:question: Unknown Difficulty :hammer: Tooling
Sometimes one needs, in lldb, a console similar to the [Command Line Shell For SQLite](https://www.sqlite.org/cli.html).
### SQLCipher in a Shared App Container
:question: Unknown Difficulty
See issue [#302](https://github.com/groue/GRDB.swift/issues/302).
### Static Library
:question: Unknown Difficulty :hammer: Tooling
It would be nice to be able to integrate GRDB as a static library.
### Typed Expressions
:bowtie: Public API Challenge :muscle: Hard :fire: Experimental
The compiler currently does not spot type mistakes in query interface requests:
```swift
Player.filter(Column("name") == "Arthur") // OK
Player.filter(Column("name") == 1) // Sure
Player.filter(Column("name") == Date()) // Legit
```
This weak typing also prevents natural-looking Swift code from producing the expected results:
```swift
// Performs arithmetic additions instead of string concatenation
Player.select(Column("firstName") + " " + Column("lastName"))
```
It would be interesting to see what typed expressions could bring to GRDB.
## Non-Goals
GRDB is a "toolkit for SQLite databases, with a focus on application development".
This definition is the reason why GRDB can provide key features such as sharp multi-threading, database observation, and first-class support for raw SQL.
Features that blur this focus are non-goals:
- Support for MySQL, PostgreSQL, or other database engines
- Support for Servers
[Ask Questions]: #ask-questions
[Associations]: #associations
[Carthage]: #carthage
[CloudKit]: #cloudkit
[Codable Records]: README.md#codable-records
[Database Observation]: #database-observation
[Date and Time Functions]: #date-and-time-functions
[Decode NSDecimalNumber from Text Columns]: #decode-nsdecimalnumber-from-text-columns
[Documentation]: #documentation
[FetchedRecordsController]: README.md#fetchedrecordscontroller
[FetchedRecordsController Diffing Algorithm]: #fetchedrecordscontroller-diffing-algorithm
[FetchedRecordsController Support for Any Request]: #fetchedrecordscontroller-support-for-any-request
[FetchedRecordsController Support for Sections]: #fetchedrecordscontroller-support-for-sections
[Full Text Search Demo Application]: #full-text-search-demo-application
[How is the Library Organized?]: Documentation/LibraryOrganization.md
[How is the Repository Organized?]: Documentation/RepositoryOrganization.md
[JSON]: #json
[Linux]: #linux
[More SQL Generation]: #more-sql-generation
[Non-Goals]: #non-goals
[Report Bugs]: #report-bugs
[RxGRDB]: http://github.com/RxSwiftCommunity/RxGRDB
[Concurrency]: #concurrency
[Static Library]: #static-library
[Sponsoring and Professional Support]: #sponsoring-and-professional-support
[SQL Console in the Debugger]: #sql-console-in-the-debugger
[SQLCipher in a Shared App Container]: #sqlcipher-in-a-shared-app-container
[Submit a Pull Request]: #submit-a-pull-request
[Suggest an Enhancement]: #suggest-an-enhancement
[Suggested Contributions]: #suggested-contributions
[Typed Expressions]: #typed-expressions
@@ -705,7 +705,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
@@ -755,7 +755,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
VALIDATE_PRODUCT = YES;
};
name = Release;
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
</Workspace>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -8,7 +8,7 @@ var dbQueue: DatabaseQueue!
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
try! setupDatabase(application)
return true
}
@@ -59,8 +59,8 @@ extension PlayerEditionViewController {
}
}
override func willMove(toParentViewController parent: UIViewController?) {
super.willMove(toParentViewController: parent)
override func willMove(toParent parent: UIViewController?) {
super.willMove(toParent: parent)
if parent == nil {
// Self is popping from its navigation controller
@@ -140,7 +140,7 @@ extension PlayersViewController {
return cell
}
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
// Delete the player
let player = playersController.record(at: indexPath)
try! dbQueue.write { db in
+7 -7
View File
@@ -69,7 +69,7 @@ struct BookInfo {
let books = try Book.fetchAll(db)
let bookInfos = books.map { book -> BookInfo in
let author = try Author.fetchOne(key: book.authorId)
let author = try Author.fetchOne(db, key: book.authorId)
return BookInfo(book: book, author: author)
}
```
@@ -647,7 +647,7 @@ struct Author: PersistableRecord {
static let books = hasMany(Book.self)
/// The request for an author's books
var books: QueryInterfaceRequest<Author> {
var books: QueryInterfaceRequest<Book> {
return request(for: Author.books)
}
}
@@ -1060,7 +1060,7 @@ let bookInfos = try BookInfo.fetchAll(db, request) // [BookInfo]
## The Structure of a Joined Request
**Joined request define a tree of associated records identified by "association keys".**
**Joined request defines a tree of associated records identified by "association keys".**
Below, author and cover image are both associated to book, and country is associated to author:
@@ -1338,8 +1338,8 @@ This code compiles, but you'll get a runtime fatal error "Not implemented: chain
```swift
// NOT IMPLEMENTED
let request = Book
.including(Book.author) // key "author"
.including(Book.author) // key "author"
.including(required: Book.author) // key "author"
.including(required: Book.author) // key "author"
```
This code compiles, but you'll get a runtime fatal error "The association key `author` is ambiguous. Use the Association.forKey(_:) method is order to disambiguate.". Future versions of GRDB may allow such requests.
@@ -1349,8 +1349,8 @@ To join the same table twice, and make sure GRDB does not modify the fetched res
```swift
// OK
let request = Book
.including(Book.author.forKey("firstAuthor"))
.including(Book.author.forKey("secondAuthor"))
.including(required: Book.author.forKey("firstAuthor"))
.including(required: Book.author.forKey("secondAuthor"))
```
+1 -1
View File
@@ -15,7 +15,7 @@ GRDB builds SQLite with [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfal
```sh
cd [GRDB directory]
git checkout v3.2.0
git checkout v3.3.0
git submodule update --init SQLiteCustom/src
````
+37 -1
View File
@@ -160,9 +160,45 @@ struct Player: FetchableRecord, TableRecord {
score = row[Columns.score]
}
}
extension Player {
static func filter(name: String) -> QueryInterfaceRequest<Player> {
return filter(Columns.name == name)
}
static var maximumScore: QueryInterfaceRequest<Int> {
return select(max(Columns.score), as: Int.self)
}
}
```
GRDB can apply additional optimizations on expressions that adopt ColumnExpression, so conform to this protocol when you define a custom column type:
When your record adopts the Codable protocol, you can use its [coding keys](https://developer.apple.com/documentation/foundation/archives_and_serialization/encoding_and_decoding_custom_types) as columns:
```swift
// GRDB 3
struct Player: Codable, FetchableRecord, PersistableRecord {
var id: Int64
var name: String
var score: Int
// Add ColumnExpression conformance
private enum CodingKeys: String, CodingKey, ColumnExpression {
case id, name, score
}
}
extension Player {
static func filter(name: String) -> QueryInterfaceRequest<Player> {
return filter(CodingKeys.name == name)
}
static var maximumScore: QueryInterfaceRequest<Int> {
return select(max(CodingKeys.score), as: Int.self)
}
}
```
GRDB can apply additional optimizations on expressions that adopt ColumnExpression, so conform to this protocol whenever you define a custom column type:
```swift
struct TypedColumn: ColumnExpression {
Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

@@ -0,0 +1,173 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="489px" height="362px" viewBox="0 0 489 362" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 51.2 (57519) - http://www.bohemiancoding.com/sketch -->
<title>DatabasePoolScheduling</title>
<desc>Created with Sketch.</desc>
<defs>
<linearGradient x1="50%" y1="100%" x2="50%" y2="1.41638472e-14%" id="linearGradient-1">
<stop stop-color="#FFFFFF" stop-opacity="0.9" offset="0%"></stop>
<stop stop-color="#FFFFFF" offset="100%"></stop>
</linearGradient>
<rect id="path-2" x="0" y="0" width="120" height="88" rx="10"></rect>
<filter x="-12.1%" y="-13.1%" width="124.2%" height="133.0%" filterUnits="objectBoundingBox" id="filter-4">
<feMorphology radius="1" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology>
<feOffset dx="0" dy="3" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur stdDeviation="4" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
<feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
</filter>
<rect id="path-5" x="0" y="0" width="120" height="250" rx="10"></rect>
<filter x="-12.1%" y="-4.6%" width="124.2%" height="111.6%" filterUnits="objectBoundingBox" id="filter-7">
<feMorphology radius="1" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology>
<feOffset dx="0" dy="3" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur stdDeviation="4" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
<feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
</filter>
<rect id="path-8" x="0" y="0" width="120" height="94" rx="10"></rect>
<filter x="-12.1%" y="-12.2%" width="124.2%" height="130.9%" filterUnits="objectBoundingBox" id="filter-10">
<feMorphology radius="1" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology>
<feOffset dx="0" dy="3" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur stdDeviation="4" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
<feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
</filter>
<rect id="path-11" x="0" y="0" width="120" height="44" rx="10"></rect>
<filter x="-12.1%" y="-26.1%" width="124.2%" height="165.9%" filterUnits="objectBoundingBox" id="filter-13">
<feMorphology radius="1" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology>
<feOffset dx="0" dy="3" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur stdDeviation="4" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
<feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
</filter>
<rect id="path-14" x="0" y="0" width="120" height="44" rx="10"></rect>
<filter x="-12.1%" y="-26.1%" width="124.2%" height="165.9%" filterUnits="objectBoundingBox" id="filter-16">
<feMorphology radius="1" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology>
<feOffset dx="0" dy="3" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur stdDeviation="4" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
<feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
</filter>
<rect id="path-17" x="0" y="0" width="120" height="44" rx="10"></rect>
<filter x="-12.1%" y="-26.1%" width="124.2%" height="165.9%" filterUnits="objectBoundingBox" id="filter-19">
<feMorphology radius="1" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology>
<feOffset dx="0" dy="3" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur stdDeviation="4" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
<feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
</filter>
</defs>
<g id="Page-3" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="DatabasePoolScheduling">
<g id="Group-2" transform="translate(44.000000, 0.000000)" stroke="#D7D7D7">
<rect id="Rectangle-2" x="0.5" y="0.5" width="444" height="361" rx="6"></rect>
<rect id="Rectangle-2-Copy" fill-opacity="0.02" fill="#000000" x="148.5" y="0.5" width="148" height="361"></rect>
</g>
<text id="Thread-1" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal" fill="#000000">
<tspan x="89.9428711" y="26">Thread 1</tspan>
</text>
<text id="Thread-2" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal" fill="#000000">
<tspan x="236.979004" y="26">Thread 2</tspan>
</text>
<text id="Thread-3" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal" fill="#000000">
<tspan x="384.818359" y="26">Thread 3</tspan>
</text>
<g id="BlueBox" transform="translate(58.000000, 44.000000)">
<g id="Group">
<mask id="mask-3" fill="white">
<use xlink:href="#path-2"></use>
</mask>
<g id="Rectangle">
<use fill="black" fill-opacity="1" filter="url(#filter-4)" xlink:href="#path-2"></use>
<use fill="#005CC5" fill-rule="evenodd" xlink:href="#path-2"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" fill="url(#linearGradient-1)" fill-rule="evenodd" x="-0.5" y="-0.5" width="121" height="89" rx="10"></rect>
</g>
<text id="Label" mask="url(#mask-3)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="15.7509766" y="49">Read State A</tspan>
</text>
</g>
</g>
<g id="BlueBox" transform="translate(355.000000, 94.000000)">
<g id="Group">
<mask id="mask-6" fill="white">
<use xlink:href="#path-5"></use>
</mask>
<g id="Rectangle">
<use fill="black" fill-opacity="1" filter="url(#filter-7)" xlink:href="#path-5"></use>
<use fill="#005CC5" fill-rule="evenodd" xlink:href="#path-5"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" fill="url(#linearGradient-1)" fill-rule="evenodd" x="-0.5" y="-0.5" width="121" height="251" rx="10"></rect>
</g>
<text id="Label" mask="url(#mask-6)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="15.7509766" y="130">Read State A</tspan>
</text>
</g>
</g>
<g id="GreenBox" transform="translate(207.000000, 60.000000)">
<g id="Group">
<mask id="mask-9" fill="white">
<use xlink:href="#path-8"></use>
</mask>
<g id="Rectangle">
<use fill="black" fill-opacity="1" filter="url(#filter-10)" xlink:href="#path-8"></use>
<use fill="#366500" fill-rule="evenodd" xlink:href="#path-8"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" fill="url(#linearGradient-1)" fill-rule="evenodd" x="-0.5" y="-0.5" width="121" height="95" rx="10"></rect>
</g>
<text id="Label" mask="url(#mask-9)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="14.7802734" y="52">Write State B</tspan>
</text>
</g>
</g>
<g id="GreenBox" transform="translate(58.000000, 172.000000)">
<g id="Group">
<mask id="mask-12" fill="white">
<use xlink:href="#path-11"></use>
</mask>
<g id="Rectangle">
<use fill="black" fill-opacity="1" filter="url(#filter-13)" xlink:href="#path-11"></use>
<use fill="#366500" fill-rule="evenodd" xlink:href="#path-11"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" fill="url(#linearGradient-1)" fill-rule="evenodd" x="-0.5" y="-0.5" width="121" height="45" rx="10"></rect>
</g>
<text id="Label" mask="url(#mask-12)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="15.9663086" y="27">Read State B</tspan>
</text>
</g>
</g>
<g id="OrangeBox" transform="translate(58.000000, 231.000000)">
<g id="Group">
<mask id="mask-15" fill="white">
<use xlink:href="#path-14"></use>
</mask>
<g id="Rectangle">
<use fill="black" fill-opacity="1" filter="url(#filter-16)" xlink:href="#path-14"></use>
<use fill="#CD7F00" fill-rule="evenodd" xlink:href="#path-14"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" fill="url(#linearGradient-1)" fill-rule="evenodd" x="-0.5" y="-0.5" width="121" height="45" rx="10"></rect>
</g>
<text id="Label" mask="url(#mask-15)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="14.4179688" y="27">Write State C</tspan>
</text>
</g>
</g>
<g id="OrangeBox" transform="translate(207.000000, 300.000000)">
<g id="Group">
<mask id="mask-18" fill="white">
<use xlink:href="#path-17"></use>
</mask>
<g id="Rectangle">
<use fill="black" fill-opacity="1" filter="url(#filter-19)" xlink:href="#path-17"></use>
<use fill="#CD7F00" fill-rule="evenodd" xlink:href="#path-17"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" fill="url(#linearGradient-1)" fill-rule="evenodd" x="-0.5" y="-0.5" width="121" height="45" rx="10"></rect>
</g>
<text id="Label" mask="url(#mask-18)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="15.6040039" y="27">Read State C</tspan>
</text>
</g>
</g>
<g id="Group-4" transform="translate(0.000000, 13.000000)" fill="#000000">
<text id="Time" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="0.501953125" y="13">Time</tspan>
</text>
<path id="Line" d="M16.5,340 L21,331 L12,331 L16.5,340 Z M16,22.5 L16,331.5 L16,332 L17,332 L17,331.5 L17,22.5 L17,22 L16,22 L16,22.5 Z" fill-rule="nonzero"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

@@ -0,0 +1,150 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="489px" height="362px" viewBox="0 0 489 362" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 51.2 (57519) - http://www.bohemiancoding.com/sketch -->
<title>DatabaseQueueScheduling</title>
<desc>Created with Sketch.</desc>
<defs>
<linearGradient x1="50%" y1="100%" x2="50%" y2="1.41638472e-14%" id="linearGradient-1">
<stop stop-color="#FFFFFF" stop-opacity="0.9" offset="0%"></stop>
<stop stop-color="#FFFFFF" offset="100%"></stop>
</linearGradient>
<rect id="path-2" x="0" y="0" width="120" height="44" rx="10"></rect>
<filter x="-12.1%" y="-26.1%" width="124.2%" height="165.9%" filterUnits="objectBoundingBox" id="filter-4">
<feMorphology radius="1" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology>
<feOffset dx="0" dy="3" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur stdDeviation="4" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
<feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
</filter>
<rect id="path-5" x="0" y="0" width="120" height="44" rx="10"></rect>
<filter x="-12.1%" y="-26.1%" width="124.2%" height="165.9%" filterUnits="objectBoundingBox" id="filter-7">
<feMorphology radius="1" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology>
<feOffset dx="0" dy="3" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur stdDeviation="4" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
<feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
</filter>
<rect id="path-8" x="0" y="0" width="120" height="44" rx="10"></rect>
<filter x="-12.1%" y="-26.1%" width="124.2%" height="165.9%" filterUnits="objectBoundingBox" id="filter-10">
<feMorphology radius="1" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology>
<feOffset dx="0" dy="3" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur stdDeviation="4" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
<feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
</filter>
<rect id="path-11" x="0" y="0" width="120" height="44" rx="10"></rect>
<filter x="-12.1%" y="-26.1%" width="124.2%" height="165.9%" filterUnits="objectBoundingBox" id="filter-13">
<feMorphology radius="1" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology>
<feOffset dx="0" dy="3" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur stdDeviation="4" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
<feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
</filter>
<rect id="path-14" x="0" y="0" width="120" height="44" rx="10"></rect>
<filter x="-12.1%" y="-26.1%" width="124.2%" height="165.9%" filterUnits="objectBoundingBox" id="filter-16">
<feMorphology radius="1" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology>
<feOffset dx="0" dy="3" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur stdDeviation="4" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
<feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
</filter>
</defs>
<g id="Page-3" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="DatabaseQueueScheduling">
<g id="Group-2" transform="translate(44.000000, 0.000000)" stroke="#D7D7D7">
<rect id="Rectangle-2" x="0.5" y="0.5" width="444" height="361" rx="6"></rect>
<rect id="Rectangle-2-Copy" fill-opacity="0.02" fill="#000000" x="148.5" y="0.5" width="148" height="361"></rect>
</g>
<text id="Thread-1" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal" fill="#000000">
<tspan x="89.9428711" y="26">Thread 1</tspan>
</text>
<text id="Thread-2" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal" fill="#000000">
<tspan x="236.979004" y="26">Thread 2</tspan>
</text>
<text id="Thread-3" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal" fill="#000000">
<tspan x="384.818359" y="26">Thread 3</tspan>
</text>
<g id="Group-4" transform="translate(0.000000, 13.000000)" fill="#000000">
<text id="Time" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="0.501953125" y="13">Time</tspan>
</text>
<path id="Line" d="M16.5,340 L21,331 L12,331 L16.5,340 Z M16,22.5 L16,331.5 L16,332 L17,332 L17,331.5 L17,22.5 L17,22 L16,22 L16,22.5 Z" fill-rule="nonzero"></path>
</g>
<g id="BlueBox" transform="translate(58.000000, 44.000000)">
<g id="Group">
<mask id="mask-3" fill="white">
<use xlink:href="#path-2"></use>
</mask>
<g id="Rectangle">
<use fill="black" fill-opacity="1" filter="url(#filter-4)" xlink:href="#path-2"></use>
<use fill="#005CC5" fill-rule="evenodd" xlink:href="#path-2"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" fill="url(#linearGradient-1)" fill-rule="evenodd" x="-0.5" y="-0.5" width="121" height="45" rx="10"></rect>
</g>
<text id="Label" mask="url(#mask-3)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="15.7509766" y="27">Read State A</tspan>
</text>
</g>
</g>
<g id="GreenBox" transform="translate(207.000000, 110.000000)">
<g id="Group">
<mask id="mask-6" fill="white">
<use xlink:href="#path-5"></use>
</mask>
<g id="Rectangle">
<use fill="black" fill-opacity="1" filter="url(#filter-7)" xlink:href="#path-5"></use>
<use fill="#366500" fill-rule="evenodd" xlink:href="#path-5"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" fill="url(#linearGradient-1)" fill-rule="evenodd" x="-0.5" y="-0.5" width="121" height="45" rx="10"></rect>
</g>
<text id="Label" mask="url(#mask-6)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="14.7802734" y="27">Write State B</tspan>
</text>
</g>
</g>
<g id="GreenBox" transform="translate(355.000000, 159.000000)">
<g id="Group">
<mask id="mask-9" fill="white">
<use xlink:href="#path-8"></use>
</mask>
<g id="Rectangle">
<use fill="black" fill-opacity="1" filter="url(#filter-10)" xlink:href="#path-8"></use>
<use fill="#366500" fill-rule="evenodd" xlink:href="#path-8"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" fill="url(#linearGradient-1)" fill-rule="evenodd" x="-0.5" y="-0.5" width="121" height="45" rx="10"></rect>
</g>
<text id="Label" mask="url(#mask-9)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="15.9663086" y="27">Read State B</tspan>
</text>
</g>
</g>
<g id="OrangeBox" transform="translate(355.000000, 297.000000)">
<g id="Group">
<mask id="mask-12" fill="white">
<use xlink:href="#path-11"></use>
</mask>
<g id="Rectangle">
<use fill="black" fill-opacity="1" filter="url(#filter-13)" xlink:href="#path-11"></use>
<use fill="#CD7F00" fill-rule="evenodd" xlink:href="#path-11"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" fill="url(#linearGradient-1)" fill-rule="evenodd" x="-0.5" y="-0.5" width="121" height="45" rx="10"></rect>
</g>
<text id="Label" mask="url(#mask-12)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="15.6040039" y="27">Read State C</tspan>
</text>
</g>
</g>
<g id="OrangeBox" transform="translate(58.000000, 231.000000)">
<g id="Group">
<mask id="mask-15" fill="white">
<use xlink:href="#path-14"></use>
</mask>
<g id="Rectangle">
<use fill="black" fill-opacity="1" filter="url(#filter-16)" xlink:href="#path-14"></use>
<use fill="#CD7F00" fill-rule="evenodd" xlink:href="#path-14"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" fill="url(#linearGradient-1)" fill-rule="evenodd" x="-0.5" y="-0.5" width="121" height="45" rx="10"></rect>
</g>
<text id="Label" mask="url(#mask-15)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="14.4179688" y="27">Write State C</tspan>
</text>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 11 KiB

+3
View File
@@ -0,0 +1,3 @@
fixfonts:
sed -i '' -- 's/SFUIText-Regular, SF UI Text/-apple-system,sans-serif/g' *.svg
sed -i '' -- 's/SFUIText-Semibold, SF UI Text/-apple-system,sans-serif/g' *.svg
+2
View File
@@ -18,12 +18,14 @@ 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/GRDBDemo
+18 -18
View File
@@ -1,20 +1,20 @@
Pod::Spec.new do |s|
s.name = 'GRDB.swift'
s.version = '3.2.0'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'A toolkit for SQLite databases, with a focus on application development.'
s.homepage = 'https://github.com/groue/GRDB.swift'
s.author = { 'Gwendal Roué' => 'gr@pierlis.com' }
s.source = { :git => 'https://github.com/groue/GRDB.swift.git', :tag => "v#{s.version}" }
s.module_name = 'GRDB'
s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.9'
s.watchos.deployment_target = '2.0'
s.source_files = 'GRDB/**/*.swift', 'Support/*.h'
s.module_map = 'Support/module.modulemap'
s.framework = 'Foundation'
s.library = 'sqlite3'
s.name = 'GRDB.swift'
s.version = '3.3.0'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'A toolkit for SQLite databases, with a focus on application development.'
s.homepage = 'https://github.com/groue/GRDB.swift'
s.author = { 'Gwendal Roué' => 'gr@pierlis.com' }
s.source = { :git => 'https://github.com/groue/GRDB.swift.git', :tag => "v#{s.version}" }
s.module_name = 'GRDB'
s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.9'
s.watchos.deployment_target = '2.0'
s.source_files = 'GRDB/**/*.swift', 'Support/*.h'
s.module_map = 'Support/module.modulemap'
s.framework = 'Foundation'
s.library = 'sqlite3'
end
+57 -27
View File
@@ -140,6 +140,9 @@
56439B581F4CA5AE0066043F /* PerformanceTests.sqlite in Resources */ = {isa = PBXBuildFile; fileRef = 56BB86111BA9886D001F9168 /* PerformanceTests.sqlite */; };
564448831EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564448821EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift */; };
564448871EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564448821EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift */; };
5644DE6D20F8C32E001FFDDE /* DatabaseValueConversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5644DE6C20F8C32E001FFDDE /* DatabaseValueConversion.swift */; };
5644DE6E20F8C32E001FFDDE /* DatabaseValueConversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5644DE6C20F8C32E001FFDDE /* DatabaseValueConversion.swift */; };
5644DE6F20F8C32E001FFDDE /* DatabaseValueConversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5644DE6C20F8C32E001FFDDE /* DatabaseValueConversion.swift */; };
564A50C81BFF4B7F00B3A3A2 /* DatabaseCollationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564A50C61BFF4B7F00B3A3A2 /* DatabaseCollationTests.swift */; };
564E73DF203D50B9000C443C /* JoinSupportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564E73DE203D50B9000C443C /* JoinSupportTests.swift */; };
564E73E0203D50B9000C443C /* JoinSupportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564E73DE203D50B9000C443C /* JoinSupportTests.swift */; };
@@ -148,6 +151,8 @@
564F9C2D1F075DD200877A00 /* DatabaseFunction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564F9C2C1F075DD200877A00 /* DatabaseFunction.swift */; };
564F9C311F07611600877A00 /* DatabaseFunction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564F9C2C1F075DD200877A00 /* DatabaseFunction.swift */; };
564F9C341F07611900877A00 /* DatabaseFunction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564F9C2C1F075DD200877A00 /* DatabaseFunction.swift */; };
564FCE5E20F7E11B00202B90 /* DatabaseValueConversionErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564FCE5D20F7E11A00202B90 /* DatabaseValueConversionErrorTests.swift */; };
564FCE5F20F7E11B00202B90 /* DatabaseValueConversionErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564FCE5D20F7E11A00202B90 /* DatabaseValueConversionErrorTests.swift */; };
5653EAD620944B4F00F46237 /* AssociationChainRowScopesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EAC620944B4C00F46237 /* AssociationChainRowScopesTests.swift */; };
5653EAD720944B4F00F46237 /* AssociationChainRowScopesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EAC620944B4C00F46237 /* AssociationChainRowScopesTests.swift */; };
5653EAD820944B4F00F46237 /* AssociationBelongsToRowScopeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5653EAC720944B4C00F46237 /* AssociationBelongsToRowScopeTests.swift */; };
@@ -296,6 +301,10 @@
566475D91D981D5E00FF74B8 /* SQLOperators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566475CB1D981D5E00FF74B8 /* SQLOperators.swift */; };
5665F85D203EE6030084C6C0 /* ColumnInfoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665F85C203EE6030084C6C0 /* ColumnInfoTests.swift */; };
5665F85E203EE6030084C6C0 /* ColumnInfoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665F85C203EE6030084C6C0 /* ColumnInfoTests.swift */; };
5665FA142129C9D6004D8612 /* DatabaseDateDecodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665FA132129C9D6004D8612 /* DatabaseDateDecodingStrategyTests.swift */; };
5665FA152129C9D6004D8612 /* DatabaseDateDecodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665FA132129C9D6004D8612 /* DatabaseDateDecodingStrategyTests.swift */; };
5665FA332129EEA0004D8612 /* DatabaseDateEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665FA322129EEA0004D8612 /* DatabaseDateEncodingStrategyTests.swift */; };
5665FA342129EEA0004D8612 /* DatabaseDateEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665FA322129EEA0004D8612 /* DatabaseDateEncodingStrategyTests.swift */; };
566A841A2041146100E50BFD /* DatabaseSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566A84192041146100E50BFD /* DatabaseSnapshot.swift */; };
566A841B2041146100E50BFD /* DatabaseSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566A84192041146100E50BFD /* DatabaseSnapshot.swift */; };
566A841C2041146100E50BFD /* DatabaseSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566A84192041146100E50BFD /* DatabaseSnapshot.swift */; };
@@ -321,6 +330,8 @@
566B91331FA4D3810012D5B0 /* TransactionObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566B91321FA4D3810012D5B0 /* TransactionObserver.swift */; };
566B91361FA4D3810012D5B0 /* TransactionObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566B91321FA4D3810012D5B0 /* TransactionObserver.swift */; };
566B91391FA4D3810012D5B0 /* TransactionObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566B91321FA4D3810012D5B0 /* TransactionObserver.swift */; };
56703297212B5450007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56703290212B544F007D270F /* DatabaseUUIDEncodingStrategyTests.swift */; };
56703298212B5450007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56703290212B544F007D270F /* DatabaseUUIDEncodingStrategyTests.swift */; };
56707201208A509C006AD95A /* DateParsingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567071FA208A509C006AD95A /* DateParsingTests.swift */; };
567156181CB142AA007DC145 /* DatabaseQueueReadOnlyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567156151CB142AA007DC145 /* DatabaseQueueReadOnlyTests.swift */; };
5671FC201DA3CAC9003BF4FF /* FTS3TokenizerDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5671FC1F1DA3CAC9003BF4FF /* FTS3TokenizerDescriptor.swift */; };
@@ -369,6 +380,10 @@
56873BEC1F2CB400004D24B4 /* Fixits-1.2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56873BEB1F2CB400004D24B4 /* Fixits-1.2.swift */; };
56873BEF1F2CB400004D24B4 /* Fixits-1.2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56873BEB1F2CB400004D24B4 /* Fixits-1.2.swift */; };
56873BF21F2CB400004D24B4 /* Fixits-1.2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56873BEB1F2CB400004D24B4 /* Fixits-1.2.swift */; };
5690AFD82120589A001530EA /* InsertRecordCodableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5690AFD72120589A001530EA /* InsertRecordCodableTests.swift */; };
5690AFD92120589A001530EA /* InsertRecordCodableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5690AFD72120589A001530EA /* InsertRecordCodableTests.swift */; };
5690AFDB212058CB001530EA /* FetchRecordCodableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5690AFDA212058CB001530EA /* FetchRecordCodableTests.swift */; };
5690AFDC212058CB001530EA /* FetchRecordCodableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5690AFDA212058CB001530EA /* FetchRecordCodableTests.swift */; };
5690C32A1D23E6D800E59934 /* FoundationDateComponentsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5690C3251D23E6D800E59934 /* FoundationDateComponentsTests.swift */; };
5690C33B1D23E7D200E59934 /* FoundationDateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5690C3361D23E7D200E59934 /* FoundationDateTests.swift */; };
5690C3401D23E82A00E59934 /* Data.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5690C33F1D23E82A00E59934 /* Data.swift */; };
@@ -589,7 +604,6 @@
56D496781D81309E008276D7 /* RecordSubClassTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238331B9C74A90082EB20 /* RecordSubClassTests.swift */; };
56D496791D81309E008276D7 /* RecordWithColumnNameManglingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A5E4081BA2BCF900707640 /* RecordWithColumnNameManglingTests.swift */; };
56D4967C1D8130DB008276D7 /* CGFloatTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B7F4291BE14A1900E39BBF /* CGFloatTests.swift */; };
56D4967F1D813131008276D7 /* StatementColumnConvertibleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56EE573C1BB317B7007A6A95 /* StatementColumnConvertibleTests.swift */; };
56D496801D813131008276D7 /* StatementColumnConvertibleFetchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56E8CE0F1BB4FE5B00828BEC /* StatementColumnConvertibleFetchTests.swift */; };
56D496811D813131008276D7 /* TransactionObserverSavepointsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5634B1061CF9B970005360B9 /* TransactionObserverSavepointsTests.swift */; };
56D496821D813131008276D7 /* TransactionObserverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5607EFD21BB8254800605DE3 /* TransactionObserverTests.swift */; };
@@ -665,7 +679,6 @@
56EA86951C91DFE7002BB4DF /* DatabaseReaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56EA86931C91DFE7002BB4DF /* DatabaseReaderTests.swift */; };
56EA869F1C932597002BB4DF /* DatabasePoolReadOnlyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56EA869D1C932597002BB4DF /* DatabasePoolReadOnlyTests.swift */; };
56EB0AB31BCD787300A3DC55 /* DataMemoryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56EB0AB11BCD787300A3DC55 /* DataMemoryTests.swift */; };
56EE573E1BB317B7007A6A95 /* StatementColumnConvertibleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56EE573C1BB317B7007A6A95 /* StatementColumnConvertibleTests.swift */; };
56F0B9921B6001C600A2F135 /* FoundationNSDateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56F0B98E1B6001C600A2F135 /* FoundationNSDateTests.swift */; };
56F26C1C1CEE3F32007969C4 /* RowAdapterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 565F03C11CE5D3AA00DE108F /* RowAdapterTests.swift */; };
56F3E7491E66F83A00BF0F01 /* ResultCodeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56F3E7481E66F83A00BF0F01 /* ResultCodeTests.swift */; };
@@ -865,10 +878,12 @@
5636E9BB1D22574100B9B05F /* FetchRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchRequest.swift; sourceTree = "<group>"; };
56439B501F4CA1DC0066043F /* GRDBOSXPerformanceComparisonTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GRDBOSXPerformanceComparisonTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
564448821EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseAfterNextTransactionCommitTests.swift; sourceTree = "<group>"; };
5644DE6C20F8C32E001FFDDE /* DatabaseValueConversion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseValueConversion.swift; sourceTree = "<group>"; };
564A50C61BFF4B7F00B3A3A2 /* DatabaseCollationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseCollationTests.swift; sourceTree = "<group>"; };
564E73DE203D50B9000C443C /* JoinSupportTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinSupportTests.swift; sourceTree = "<group>"; };
564F9C1D1F069B4E00877A00 /* DatabaseAggregateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseAggregateTests.swift; sourceTree = "<group>"; };
564F9C2C1F075DD200877A00 /* DatabaseFunction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseFunction.swift; sourceTree = "<group>"; };
564FCE5D20F7E11A00202B90 /* DatabaseValueConversionErrorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseValueConversionErrorTests.swift; sourceTree = "<group>"; };
5653EAC620944B4C00F46237 /* AssociationChainRowScopesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationChainRowScopesTests.swift; sourceTree = "<group>"; };
5653EAC720944B4C00F46237 /* AssociationBelongsToRowScopeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationBelongsToRowScopeTests.swift; sourceTree = "<group>"; };
5653EAC820944B4D00F46237 /* AssociationRowScopeSearchTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociationRowScopeSearchTests.swift; sourceTree = "<group>"; };
@@ -920,6 +935,8 @@
566475CA1D981D5E00FF74B8 /* SQLFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLFunctions.swift; sourceTree = "<group>"; };
566475CB1D981D5E00FF74B8 /* SQLOperators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLOperators.swift; sourceTree = "<group>"; };
5665F85C203EE6030084C6C0 /* ColumnInfoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColumnInfoTests.swift; sourceTree = "<group>"; };
5665FA132129C9D6004D8612 /* DatabaseDateDecodingStrategyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseDateDecodingStrategyTests.swift; sourceTree = "<group>"; };
5665FA322129EEA0004D8612 /* DatabaseDateEncodingStrategyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseDateEncodingStrategyTests.swift; sourceTree = "<group>"; };
566A84192041146100E50BFD /* DatabaseSnapshot.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseSnapshot.swift; sourceTree = "<group>"; };
566A8424204120B700E50BFD /* DatabaseSnapshotTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseSnapshotTests.swift; sourceTree = "<group>"; };
566A843F2041914000E50BFD /* MutablePersistableRecordChangesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutablePersistableRecordChangesTests.swift; sourceTree = "<group>"; };
@@ -930,6 +947,7 @@
566B91221FA4CF810012D5B0 /* Database+Schema.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Database+Schema.swift"; sourceTree = "<group>"; };
566B912A1FA4D0CC0012D5B0 /* StatementAuthorizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatementAuthorizer.swift; sourceTree = "<group>"; };
566B91321FA4D3810012D5B0 /* TransactionObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionObserver.swift; sourceTree = "<group>"; };
56703290212B544F007D270F /* DatabaseUUIDEncodingStrategyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseUUIDEncodingStrategyTests.swift; sourceTree = "<group>"; };
567071FA208A509C006AD95A /* DateParsingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DateParsingTests.swift; sourceTree = "<group>"; };
567156151CB142AA007DC145 /* DatabaseQueueReadOnlyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseQueueReadOnlyTests.swift; sourceTree = "<group>"; };
567156701CB18050007DC145 /* EncryptionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EncryptionTests.swift; sourceTree = "<group>"; };
@@ -954,6 +972,8 @@
568068301EBBA26100EFB8AA /* SQLRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLRequestTests.swift; sourceTree = "<group>"; };
5687359E1CEDE16C009B9116 /* Betty.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Betty.jpeg; sourceTree = "<group>"; };
56873BEB1F2CB400004D24B4 /* Fixits-1.2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Fixits-1.2.swift"; sourceTree = "<group>"; };
5690AFD72120589A001530EA /* InsertRecordCodableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InsertRecordCodableTests.swift; sourceTree = "<group>"; };
5690AFDA212058CB001530EA /* FetchRecordCodableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchRecordCodableTests.swift; sourceTree = "<group>"; };
5690C3251D23E6D800E59934 /* FoundationDateComponentsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FoundationDateComponentsTests.swift; sourceTree = "<group>"; };
5690C3361D23E7D200E59934 /* FoundationDateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FoundationDateTests.swift; sourceTree = "<group>"; };
5690C33F1D23E82A00E59934 /* Data.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Data.swift; sourceTree = "<group>"; };
@@ -1036,8 +1056,8 @@
56B6EF55208CB4E3002F0ACB /* ColumnExpressionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColumnExpressionTests.swift; sourceTree = "<group>"; };
56B7F4291BE14A1900E39BBF /* CGFloatTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGFloatTests.swift; sourceTree = "<group>"; };
56B7F4391BEB42D500E39BBF /* Migration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Migration.swift; sourceTree = "<group>"; };
56B8C2401CA1758F00510325 /* Realm.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Realm.framework; path = "Realm/build/osx/swift-4.1/Realm.framework"; sourceTree = "<group>"; };
56B8C2411CA1758F00510325 /* RealmSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RealmSwift.framework; path = "Realm/build/osx/swift-4.1/RealmSwift.framework"; sourceTree = "<group>"; };
56B8C2401CA1758F00510325 /* Realm.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Realm.framework; path = "Realm/build/osx/swift-4.1.2/Realm.framework"; sourceTree = "<group>"; };
56B8C2411CA1758F00510325 /* RealmSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RealmSwift.framework; path = "Realm/build/osx/swift-4.1.2/RealmSwift.framework"; sourceTree = "<group>"; };
56B8F49A1B4E2F3600C24296 /* GRDB.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = GRDB.xcconfig; sourceTree = "<group>"; };
56B9649C1DA51B4C0002DA19 /* FTS5.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5.swift; sourceTree = "<group>"; };
56B964B01DA51D010002DA19 /* FTS5TokenizerDescriptor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5TokenizerDescriptor.swift; sourceTree = "<group>"; };
@@ -1109,7 +1129,6 @@
56EA869D1C932597002BB4DF /* DatabasePoolReadOnlyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabasePoolReadOnlyTests.swift; sourceTree = "<group>"; };
56EB0AB11BCD787300A3DC55 /* DataMemoryTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataMemoryTests.swift; sourceTree = "<group>"; };
56ED8A7E1DAB8D6800BD0ABC /* FTS5WrapperTokenizerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5WrapperTokenizerTests.swift; sourceTree = "<group>"; };
56EE573C1BB317B7007A6A95 /* StatementColumnConvertibleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatementColumnConvertibleTests.swift; sourceTree = "<group>"; };
56F0B98E1B6001C600A2F135 /* FoundationNSDateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FoundationNSDateTests.swift; sourceTree = "<group>"; };
56F3E7481E66F83A00BF0F01 /* ResultCodeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultCodeTests.swift; sourceTree = "<group>"; };
56F3E7621E67F8C100BF0F01 /* Fixits-0.101.1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Fixits-0.101.1.swift"; sourceTree = "<group>"; };
@@ -1268,6 +1287,8 @@
560B3FA41C19DFF800C58EC7 /* PersistableRecord */ = {
isa = PBXGroup;
children = (
5665FA322129EEA0004D8612 /* DatabaseDateEncodingStrategyTests.swift */,
56703290212B544F007D270F /* DatabaseUUIDEncodingStrategyTests.swift */,
566A843F2041914000E50BFD /* MutablePersistableRecordChangesTests.swift */,
56FF453F1D2C23BA00F21EF9 /* MutablePersistableRecordDeleteTests.swift */,
5674A71C1F30A8DF0095F066 /* MutablePersistableRecordEncodableTests.swift */,
@@ -1281,11 +1302,11 @@
56176C581EACC2D8000F3F2B /* GRDBTests */ = {
isa = PBXGroup;
children = (
5623E0901B4AFACC00B20B7F /* GRDBTestCase.swift */,
562EA81E1F17B26F00FA528C /* Compilation */,
56A238111B9C74A90082EB20 /* Core */,
5698AC3E1DA2BEBB0056AF8C /* FTS */,
56176CA01EACEE2A000F3F2B /* GRDBCipher */,
5623E0901B4AFACC00B20B7F /* GRDBTestCase.swift */,
56A238231B9C74A90082EB20 /* Migrations */,
569978D31B539038005EBEED /* Private */,
56300B5C1C53C38F005A543B /* QueryInterface */,
@@ -1469,6 +1490,7 @@
5674A7251F30A8EF0095F066 /* FetchableRecord */ = {
isa = PBXGroup;
children = (
5665FA132129C9D6004D8612 /* DatabaseDateDecodingStrategyTests.swift */,
5674A7261F30A9090095F066 /* FetchableRecordDecodableTests.swift */,
565B0FEE1BBC7D980098DE03 /* FetchableRecordTests.swift */,
);
@@ -1559,6 +1581,7 @@
56C3F7521CF9F12400F6A361 /* DatabaseSavepointTests.swift */,
566A8424204120B700E50BFD /* DatabaseSnapshotTests.swift */,
56A238131B9C74A90082EB20 /* DatabaseTests.swift */,
564FCE5D20F7E11A00202B90 /* DatabaseValueConversionErrorTests.swift */,
56A2381B1B9C74A90082EB20 /* DatabaseValueConversionTests.swift */,
56A238191B9C74A90082EB20 /* DatabaseValueConvertible */,
56A238181B9C74A90082EB20 /* DatabaseValueTests.swift */,
@@ -1573,7 +1596,7 @@
569C1EB11CF07DDD0042627B /* SchedulingWatchdogTests.swift */,
568068301EBBA26100EFB8AA /* SQLRequestTests.swift */,
56A238201B9C74A90082EB20 /* Statement */,
56EE573B1BB317B7007A6A95 /* StatementColumnConvertible */,
56E8CE0F1BB4FE5B00828BEC /* StatementColumnConvertibleFetchTests.swift */,
5607EFD11BB8253300605DE3 /* TransactionObserver */,
);
name = Core;
@@ -1655,6 +1678,7 @@
5695311E1C907A8C00CF1A2B /* DatabaseSchemaCache.swift */,
566A84192041146100E50BFD /* DatabaseSnapshot.swift */,
56A238751B9C75030082EB20 /* DatabaseValue.swift */,
5644DE6C20F8C32E001FFDDE /* DatabaseValueConversion.swift */,
560D923E1C672C3E00F4F92B /* DatabaseValueConvertible.swift */,
563363C31C942C37000BE133 /* DatabaseWriter.swift */,
5636E9BB1D22574100B9B05F /* FetchRequest.swift */,
@@ -1665,8 +1689,8 @@
56A238781B9C75030082EB20 /* Statement.swift */,
566B912A1FA4D0CC0012D5B0 /* StatementAuthorizer.swift */,
560D923F1C672C3E00F4F92B /* StatementColumnConvertible.swift */,
566B91321FA4D3810012D5B0 /* TransactionObserver.swift */,
5605F1471C672E4000235C62 /* Support */,
566B91321FA4D3810012D5B0 /* TransactionObserver.swift */,
);
path = Core;
sourceTree = "<group>";
@@ -1708,10 +1732,12 @@
56DE7B271C41302500861EB8 /* FetchNamedValuesTests.swift */,
56DE7B291C4130AF00861EB8 /* FetchPositionalValuesTests.swift */,
56DE7B2B1C41311900861EB8 /* FetchRecordClassTests.swift */,
5690AFDA212058CB001530EA /* FetchRecordCodableTests.swift */,
56D3BE701F4EB1900034C6D2 /* FetchRecordStructTests.swift */,
56DE7B251C412FDA00861EB8 /* InsertNamedValuesTests.swift */,
56DE7B231C412F7E00861EB8 /* InsertPositionalValuesTests.swift */,
56BB86121BA9886D001F9168 /* InsertRecordClassTests.swift */,
5690AFD72120589A001530EA /* InsertRecordCodableTests.swift */,
56D507821F6D7A4500AE1C5B /* InsertRecordStructTests.swift */,
56CA22211BB41565009A04C5 /* PerformanceTests.swift */,
56B8C2401CA1758F00510325 /* Realm.framework */,
@@ -1789,15 +1815,6 @@
name = Cursor;
sourceTree = "<group>";
};
56EE573B1BB317B7007A6A95 /* StatementColumnConvertible */ = {
isa = PBXGroup;
children = (
56E8CE0F1BB4FE5B00828BEC /* StatementColumnConvertibleFetchTests.swift */,
56EE573C1BB317B7007A6A95 /* StatementColumnConvertibleTests.swift */,
);
name = StatementColumnConvertible;
sourceTree = "<group>";
};
56F0B98C1B6001C600A2F135 /* Foundation */ = {
isa = PBXGroup;
children = (
@@ -2269,6 +2286,8 @@
56707201208A509C006AD95A /* DateParsingTests.swift in Sources */,
56DE7B2C1C41311900861EB8 /* FetchRecordClassTests.swift in Sources */,
56DE7B281C41302500861EB8 /* FetchNamedValuesTests.swift in Sources */,
5690AFD82120589A001530EA /* InsertRecordCodableTests.swift in Sources */,
5690AFDB212058CB001530EA /* FetchRecordCodableTests.swift in Sources */,
56D507831F6D7B2E00AE1C5B /* InsertRecordStructTests.swift in Sources */,
56DE7B241C412F7E00861EB8 /* InsertPositionalValuesTests.swift in Sources */,
560C98241C0E23BB00BF8471 /* PerformanceTests.swift in Sources */,
@@ -2291,10 +2310,12 @@
56D507841F6D7B2F00AE1C5B /* InsertRecordStructTests.swift in Sources */,
56439B3A1F4CA1DC0066043F /* FMDatabaseQueue.m in Sources */,
56439B3B1F4CA1DC0066043F /* FMDatabasePool.m in Sources */,
5690AFD92120589A001530EA /* InsertRecordCodableTests.swift in Sources */,
56439B3C1F4CA1DC0066043F /* PerformanceTests.swift in Sources */,
56D3BE721F4EB1A00034C6D2 /* FetchRecordStructTests.swift in Sources */,
56439B3D1F4CA1DC0066043F /* InsertNamedValuesTests.swift in Sources */,
56439B3E1F4CA1DC0066043F /* PerformanceModel.xcdatamodeld in Sources */,
5690AFDC212058CB001530EA /* FetchRecordCodableTests.swift in Sources */,
56439B3F1F4CA1DC0066043F /* FetchPositionalValuesTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -2406,6 +2427,7 @@
56BF6D3C1DEF47DA006039A3 /* Fixits-0-90-1.swift in Sources */,
56DAA2E11DE9C827006E10C8 /* Cursor.swift in Sources */,
5653EB0520944C7C00F46237 /* BelongsToAssociation.swift in Sources */,
5644DE6F20F8C32E001FFDDE /* DatabaseValueConversion.swift in Sources */,
565490BC1D5AE236005622CB /* DatabaseSchemaCache.swift in Sources */,
565490BA1D5AE236005622CB /* DatabaseQueue.swift in Sources */,
565490CD1D5AE252005622CB /* Date.swift in Sources */,
@@ -2517,6 +2539,7 @@
5653EB0D20944C7C00F46237 /* HasManyAssociation.swift in Sources */,
566AD8B51D5318F4002EC1A8 /* TableDefinition.swift in Sources */,
5698AD241DABAEFA0056AF8C /* FTS5WrapperTokenizer.swift in Sources */,
5644DE6E20F8C32E001FFDDE /* DatabaseValueConversion.swift in Sources */,
C96C0F2C2084A459006B2981 /* SQLiteDateParser.swift in Sources */,
5605F1681C672E4000235C62 /* NSNumber.swift in Sources */,
56CEB5041EAA2F4D00BFAF62 /* FTS4.swift in Sources */,
@@ -2568,7 +2591,6 @@
5657AB4A1D108BA9006283EF /* FoundationNSNullTests.swift in Sources */,
569531351C919DF200CF1A2B /* DatabasePoolCollationTests.swift in Sources */,
56A2385A1B9C74A90082EB20 /* RecordPrimaryKeySingleTests.swift in Sources */,
56EE573E1BB317B7007A6A95 /* StatementColumnConvertibleTests.swift in Sources */,
562756471E963AAC0035B653 /* DatabaseWriterTests.swift in Sources */,
569531381C919DF700CF1A2B /* DatabasePoolFunctionTests.swift in Sources */,
56A238481B9C74A90082EB20 /* RowCopiedFromStatementTests.swift in Sources */,
@@ -2593,6 +2615,7 @@
56A238681B9C74A90082EB20 /* RecordInitializersTests.swift in Sources */,
56CC9252201E093F00CB597E /* PrefixCursorTests.swift in Sources */,
563363B01C933FF8000BE133 /* MutablePersistableRecordTests.swift in Sources */,
5665FA152129C9D6004D8612 /* DatabaseDateDecodingStrategyTests.swift in Sources */,
5657AB421D108BA9006283EF /* FoundationNSDataTests.swift in Sources */,
56CC922D201DFFB900CB597E /* DropWhileCursorTests.swift in Sources */,
56D507621F6BAE8600AE1C5B /* PrimaryKeyInfoTests.swift in Sources */,
@@ -2603,6 +2626,7 @@
567F45AC1F888B2600030B59 /* TruncateOptimizationTests.swift in Sources */,
5657AB621D108BA9006283EF /* FoundationNSURLTests.swift in Sources */,
5657AB6A1D108BA9006283EF /* FoundationURLTests.swift in Sources */,
564FCE5F20F7E11B00202B90 /* DatabaseValueConversionErrorTests.swift in Sources */,
5653EADF20944B4F00F46237 /* AssociationHasOneSQLDerivationTests.swift in Sources */,
56F3E74D1E66F83A00BF0F01 /* ResultCodeTests.swift in Sources */,
56EB0AB31BCD787300A3DC55 /* DataMemoryTests.swift in Sources */,
@@ -2646,6 +2670,7 @@
56A4CDB41D4234B200B1A9B9 /* SQLExpressionLiteralTests.swift in Sources */,
56CC9247201E058100CB597E /* DropFirstCursorTests.swift in Sources */,
56E8CE0E1BB4FA5600828BEC /* DatabaseValueConvertibleFetchTests.swift in Sources */,
5665FA342129EEA0004D8612 /* DatabaseDateEncodingStrategyTests.swift in Sources */,
56A238581B9C74A90082EB20 /* RecordPrimaryKeyRowIDTests.swift in Sources */,
56A5EF131EF7F20B00F03071 /* ForeignKeyInfoTests.swift in Sources */,
5653EAE920944B4F00F46237 /* AssociationChainSQLTests.swift in Sources */,
@@ -2675,6 +2700,7 @@
56A238B71B9CA2590082EB20 /* DatabaseTimestampTests.swift in Sources */,
568068351EBBA26100EFB8AA /* SQLRequestTests.swift in Sources */,
565D5D751BBC70AE00DC9BD4 /* StatementArguments+FoundationTests.swift in Sources */,
56703298212B5450007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */,
5623931C1DECC02000A6B01F /* RowFetchTests.swift in Sources */,
5653EAD720944B4F00F46237 /* AssociationChainRowScopesTests.swift in Sources */,
562393641DEE06D300A6B01F /* CursorTests.swift in Sources */,
@@ -2754,6 +2780,7 @@
56D496781D81309E008276D7 /* RecordSubClassTests.swift in Sources */,
56D4965F1D81304E008276D7 /* FoundationNSURLTests.swift in Sources */,
562393301DEDFC5700A6B01F /* AnyCursorTests.swift in Sources */,
5665FA142129C9D6004D8612 /* DatabaseDateDecodingStrategyTests.swift in Sources */,
56CC9251201E093F00CB597E /* PrefixCursorTests.swift in Sources */,
56D4965E1D81304E008276D7 /* FoundationNSStringTests.swift in Sources */,
5698AC891DA389380056AF8C /* FTS3TableBuilderTests.swift in Sources */,
@@ -2765,6 +2792,7 @@
56D496601D81304E008276D7 /* FoundationNSUUIDTests.swift in Sources */,
567F45A81F888B2600030B59 /* TruncateOptimizationTests.swift in Sources */,
56D4968D1D81316E008276D7 /* DatabaseFunctionTests.swift in Sources */,
564FCE5E20F7E11B00202B90 /* DatabaseValueConversionErrorTests.swift in Sources */,
5653EADE20944B4F00F46237 /* AssociationHasOneSQLDerivationTests.swift in Sources */,
56D496661D813086008276D7 /* QueryInterfaceRequestTests.swift in Sources */,
56F3E7491E66F83A00BF0F01 /* ResultCodeTests.swift in Sources */,
@@ -2807,6 +2835,7 @@
5653EAE420944B4F00F46237 /* AssociationParallelRowScopesTests.swift in Sources */,
56D4968F1D81316E008276D7 /* RowFromDictionaryTests.swift in Sources */,
56D4968E1D81316E008276D7 /* RowCopiedFromStatementTests.swift in Sources */,
5665FA332129EEA0004D8612 /* DatabaseDateEncodingStrategyTests.swift in Sources */,
56CC9246201E058100CB597E /* DropFirstCursorTests.swift in Sources */,
5698AC401DA2BED90056AF8C /* FTS3PatternTests.swift in Sources */,
562393571DEE013C00A6B01F /* FilterCursorTests.swift in Sources */,
@@ -2836,6 +2865,7 @@
56D496681D813086008276D7 /* FetchableRecord+QueryInterfaceRequestTests.swift in Sources */,
5623934E1DEDFEFB00A6B01F /* EnumeratedCursorTests.swift in Sources */,
568068311EBBA26100EFB8AA /* SQLRequestTests.swift in Sources */,
56703297212B5450007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */,
56D496B41D8133F8008276D7 /* DatabaseTests.swift in Sources */,
56D496951D81317B008276D7 /* MutablePersistableRecordTests.swift in Sources */,
5653EAD620944B4F00F46237 /* AssociationChainRowScopesTests.swift in Sources */,
@@ -2851,7 +2881,6 @@
56D4965C1D81304E008276D7 /* FoundationNSNullTests.swift in Sources */,
5653EAD820944B4F00F46237 /* AssociationBelongsToRowScopeTests.swift in Sources */,
562205F11E420E47005860AC /* DatabasePoolReleaseMemoryTests.swift in Sources */,
56D4967F1D813131008276D7 /* StatementColumnConvertibleTests.swift in Sources */,
5653EAF420944B4F00F46237 /* AssociationParallelSQLTests.swift in Sources */,
56D496971D81317B008276D7 /* DatabaseReaderTests.swift in Sources */,
56D496911D81316E008276D7 /* RowFromStatementTests.swift in Sources */,
@@ -2968,6 +2997,7 @@
566475A21D9810A400FF74B8 /* SQLSelectable+QueryInterface.swift in Sources */,
5674A6E41F307F0E0095F066 /* DatabaseValueConvertible+Decodable.swift in Sources */,
5653EB0C20944C7C00F46237 /* HasManyAssociation.swift in Sources */,
5644DE6D20F8C32E001FFDDE /* DatabaseValueConversion.swift in Sources */,
5657AAB91D107001006283EF /* NSData.swift in Sources */,
560D92421C672C3E00F4F92B /* StatementColumnConvertible.swift in Sources */,
56CEB5531EAA359A00BFAF62 /* SQLExpression.swift in Sources */,
@@ -3060,13 +3090,13 @@
DEBUG_INFORMATION_FORMAT = dwarf;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Tests/Performance/Realm/build/osx/swift-4.1",
"$(PROJECT_DIR)/Tests/Performance/Realm/build/osx/swift-4.1.2",
);
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
OTHER_SWIFT_FLAGS = "-D GRDB_COMPARE";
OTHER_SWIFT_FLAGS = "$(inherited) -D GRDB_COMPARE";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBOSXTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
@@ -3083,13 +3113,13 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Tests/Performance/Realm/build/osx/swift-4.1",
"$(PROJECT_DIR)/Tests/Performance/Realm/build/osx/swift-4.1.2",
);
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
OTHER_SWIFT_FLAGS = "-D GRDB_COMPARE";
OTHER_SWIFT_FLAGS = "$(inherited) -D GRDB_COMPARE";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBOSXTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
@@ -3245,7 +3275,7 @@
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-D SQLITE_MODULE";
OTHER_SWIFT_FLAGS = "$(inherited) -D SQLITE_MODULE";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBiOSTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
@@ -3263,7 +3293,7 @@
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-D SQLITE_MODULE";
OTHER_SWIFT_FLAGS = "$(inherited) -D SQLITE_MODULE";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBiOSTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
@@ -3281,7 +3311,7 @@
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
OTHER_SWIFT_FLAGS = "-D SQLITE_MODULE";
OTHER_SWIFT_FLAGS = "$(inherited) -D SQLITE_MODULE";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBOSXTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
@@ -3299,7 +3329,7 @@
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
OTHER_SWIFT_FLAGS = "-D SQLITE_MODULE";
OTHER_SWIFT_FLAGS = "$(inherited) -D SQLITE_MODULE";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBOSXTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
+6
View File
@@ -85,6 +85,12 @@ public protocol Cursor : class {
}
extension Cursor {
/// Returns a Boolean value indicating whether the cursor contains
/// an element.
public func isEmpty() throws -> Bool {
return try next() == nil
}
/// Returns a Boolean value indicating whether the cursor contains an
/// element that satisfies the given predicate.
///
+44 -21
View File
@@ -25,9 +25,8 @@ extension Database {
}
/// Returns whether a table exists.
public func tableExists(_ tableName: String) throws -> Bool {
// SQlite identifiers are case-insensitive, case-preserving (http://www.alberton.info/dbms_identifiers_and_case_sensitivity.html)
return try Row.fetchOne(self, "SELECT 1 FROM (SELECT sql, type, name FROM sqlite_master UNION SELECT sql, type, name FROM sqlite_temp_master) WHERE type = 'table' AND LOWER(name) = ?", arguments: [tableName.lowercased()]) != nil
public func tableExists(_ name: String) throws -> Bool {
return try exists(type: "table", name: name)
}
/// Returns whether a table is an internal SQLite table.
@@ -53,15 +52,31 @@ extension Database {
}
/// Returns whether a view exists.
public func viewExists(_ viewName: String) throws -> Bool {
// SQlite identifiers are case-insensitive, case-preserving (http://www.alberton.info/dbms_identifiers_and_case_sensitivity.html)
return try Row.fetchOne(self, "SELECT 1 FROM (SELECT sql, type, name FROM sqlite_master UNION SELECT sql, type, name FROM sqlite_temp_master) WHERE type = 'view' AND LOWER(name) = ?", arguments: [viewName.lowercased()]) != nil
public func viewExists(_ name: String) throws -> Bool {
return try exists(type: "view", name: name)
}
/// Returns whether a trigger exists.
public func triggerExists(_ triggerName: String) throws -> Bool {
// SQlite identifiers are case-insensitive, case-preserving (http://www.alberton.info/dbms_identifiers_and_case_sensitivity.html)
return try Row.fetchOne(self, "SELECT 1 FROM (SELECT sql, type, name FROM sqlite_master UNION SELECT sql, type, name FROM sqlite_temp_master) WHERE type = 'trigger' AND LOWER(name) = ?", arguments: [triggerName.lowercased()]) != nil
public func triggerExists(_ name: String) throws -> Bool {
return try exists(type: "trigger", name: name)
}
private func exists(type: String, name: String) throws -> Bool {
// SQlite identifiers are case-insensitive, case-preserving:
// http://www.alberton.info/dbms_identifiers_and_case_sensitivity.html
let name = name.lowercased()
if try makeSelectStatement("SELECT 1 FROM sqlite_master WHERE type = ? AND LOWER(name) = ?")
.makeCursor(arguments: [type, name])
.isEmpty() == false
{ return true }
if try makeSelectStatement("SELECT 1 FROM sqlite_temp_master WHERE type = ? AND LOWER(name) = ?")
.makeCursor(arguments: [type, name])
.isEmpty() == false
{ return true }
return false
}
/// The primary key for table named `tableName`.
@@ -164,14 +179,21 @@ extension Database {
return indexes
}
let indexes = try Row.fetchAll(self, "PRAGMA index_list(\(tableName.quotedDatabaseIdentifier))").map { row -> IndexInfo in
let indexName: String = row[1]
let unique: Bool = row[2]
let columns = try Row.fetchAll(self, "PRAGMA index_info(\(indexName.quotedDatabaseIdentifier))")
.map { ($0[0] as Int, $0[2] as String) }
.sorted { $0.0 < $1.0 }
.map { $0.1 }
return IndexInfo(name: indexName, columns: columns, unique: unique)
let indexes = try Row
.fetchAll(self, "PRAGMA index_list(\(tableName.quotedDatabaseIdentifier))")
.map { row -> IndexInfo in
// [seq:0 name:"index" unique:0 origin:"c" partial:0]
let indexName: String = row[1]
let unique: Bool = row[2]
let columns = try Row
.fetchAll(self, "PRAGMA index_info(\(indexName.quotedDatabaseIdentifier))")
.map { row -> (Int, String) in
// [seqno:0 cid:2 name:"column"]
(row[0] as Int, row[2] as String)
}
.sorted { $0.0 < $1.0 }
.map { $0.1 }
return IndexInfo(name: indexName, columns: columns, unique: unique)
}
if indexes.isEmpty {
@@ -577,9 +599,10 @@ struct SchemaInfo: Equatable {
var name: String
var tbl_name: String?
// TODO: remove when Hashable conformance is synthesized
var hashValue: Int {
return type.hashValue ^ name.hashValue ^ (tbl_name?.hashValue ?? 0)
}
#if !swift(>=4.2)
var hashValue: Int {
return type.hashValue ^ name.hashValue ^ (tbl_name?.hashValue ?? 0)
}
#endif
}
}
+78
View File
@@ -223,3 +223,81 @@ extension Database {
publicStatementCache.remove(statement)
}
}
/// A thread-unsafe statement cache
struct StatementCache {
unowned let db: Database
private var selectStatements: [String: SelectStatement] = [:]
private var updateStatements: [String: UpdateStatement] = [:]
init(database: Database) {
self.db = database
}
mutating func selectStatement(_ sql: String) throws -> SelectStatement {
if let statement = selectStatements[sql] {
return statement
}
// http://www.sqlite.org/c3ref/c_prepare_persistent.html#sqlitepreparepersistent
// > The SQLITE_PREPARE_PERSISTENT flag is a hint to the query
// > planner that the prepared statement will be retained for a long
// > time and probably reused many times.
//
// This looks like a perfect match for cached statements.
//
// However SQLITE_PREPARE_PERSISTENT was only introduced in
// SQLite 3.20.0 http://www.sqlite.org/changes.html#version_3_20
//
// TODO: use SQLITE_PREPARE_PERSISTENT if #available(iOS 12.0, OSX 10.14, watchOS 5.0, *)
#if GRDBCUSTOMSQLITE || GRDBCIPHER
let statement = try db.makeSelectStatement(sql, prepFlags: SQLITE_PREPARE_PERSISTENT)
#else
let statement = try db.makeSelectStatement(sql)
#endif
selectStatements[sql] = statement
return statement
}
mutating func updateStatement(_ sql: String) throws -> UpdateStatement {
if let statement = updateStatements[sql] {
return statement
}
// http://www.sqlite.org/c3ref/c_prepare_persistent.html#sqlitepreparepersistent
// > The SQLITE_PREPARE_PERSISTENT flag is a hint to the query
// > planner that the prepared statement will be retained for a long
// > time and probably reused many times.
//
// This looks like a perfect match for cached statements.
//
// However SQLITE_PREPARE_PERSISTENT was only introduced in
// SQLite 3.20.0 http://www.sqlite.org/changes.html#version_3_20
//
// TODO: use SQLITE_PREPARE_PERSISTENT if #available(iOS 12.0, OSX 10.14, watchOS 5.0, *)
#if GRDBCUSTOMSQLITE || GRDBCIPHER
let statement = try db.makeUpdateStatement(sql, prepFlags: SQLITE_PREPARE_PERSISTENT)
#else
let statement = try db.makeUpdateStatement(sql)
#endif
updateStatements[sql] = statement
return statement
}
mutating func clear() {
updateStatements = [:]
selectStatements = [:]
}
mutating func remove(_ statement: SelectStatement) {
if let index = selectStatements.index(where: { $0.1 === statement }) {
selectStatements.remove(at: index)
}
}
mutating func remove(_ statement: UpdateStatement) {
if let index = updateStatements.index(where: { $0.1 === statement }) {
updateStatements.remove(at: index)
}
}
}
+70 -79
View File
@@ -285,52 +285,55 @@ extension Database {
guard configuration.trace != nil else {
return
}
let dbPointer = Unmanaged.passUnretained(self).toOpaque()
// sqlite3_trace_v2 and sqlite3_expanded_sql were introduced in SQLite 3.14.0 http://www.sqlite.org/changes.html#version_3_14
// It is available from iOS 10.0 and OS X 10.12 https://github.com/yapstudios/YapDatabase/wiki/SQLite-version-(bundled-with-OS)
#if GRDBCUSTOMSQLITE
#if GRDBCUSTOMSQLITE || GRDBCIPHER
let dbPointer = Unmanaged.passUnretained(self).toOpaque()
sqlite3_trace_v2(sqliteConnection, UInt32(SQLITE_TRACE_STMT), { (mask, dbPointer, stmt, unexpandedSQL) -> Int32 in
guard let stmt = stmt else { return SQLITE_OK }
guard let expandedSQLCString = sqlite3_expanded_sql(OpaquePointer(stmt)) else { return SQLITE_OK }
let sql = String(cString: expandedSQLCString)
sqlite3_free(expandedSQLCString)
let db = Unmanaged<Database>.fromOpaque(dbPointer!).takeUnretainedValue()
db.configuration.trace!(sql)
return SQLITE_OK
return Database.trace_v2(mask, dbPointer, stmt, unexpandedSQL, sqlite3_expanded_sql)
}, dbPointer)
#elseif GRDBCIPHER
sqlite3_trace(sqliteConnection, { (dbPointer, sql) in
guard let sql = sql.map({ String(cString: $0) }) else { return }
let db = Unmanaged<Database>.fromOpaque(dbPointer!).takeUnretainedValue()
db.configuration.trace!(sql)
}, dbPointer)
#elseif !os(Linux)
#elseif os(Linux)
setupTrace_v1()
#else
if #available(iOS 10.0, OSX 10.12, watchOS 3.0, *) {
let dbPointer = Unmanaged.passUnretained(self).toOpaque()
sqlite3_trace_v2(sqliteConnection, UInt32(SQLITE_TRACE_STMT), { (mask, dbPointer, stmt, unexpandedSQL) -> Int32 in
guard let stmt = stmt else { return SQLITE_OK }
guard let expandedSQLCString = sqlite3_expanded_sql(OpaquePointer(stmt)) else { return SQLITE_OK }
let sql = String(cString: expandedSQLCString)
sqlite3_free(expandedSQLCString)
let db = Unmanaged<Database>.fromOpaque(dbPointer!).takeUnretainedValue()
db.configuration.trace!(sql)
return SQLITE_OK
return Database.trace_v2(mask, dbPointer, stmt, unexpandedSQL, sqlite3_expanded_sql)
}, dbPointer)
} else {
sqlite3_trace(sqliteConnection, { (dbPointer, sql) in
guard let sql = sql.map({ String(cString: $0) }) else { return }
let db = Unmanaged<Database>.fromOpaque(dbPointer!).takeUnretainedValue()
db.configuration.trace!(sql)
}, dbPointer)
setupTrace_v1()
}
#else
sqlite3_trace(sqliteConnection, { (dbPointer, sql) in
guard let sql = sql.map({ String(cString: $0) }) else { return }
let db = Unmanaged<Database>.fromOpaque(dbPointer!).takeUnretainedValue()
db.configuration.trace!(sql)
}, dbPointer)
#endif
}
// Precondition: configuration.trace != nil
private func setupTrace_v1() {
let dbPointer = Unmanaged.passUnretained(self).toOpaque()
sqlite3_trace(sqliteConnection, { (dbPointer, sql) in
guard let sql = sql.map({ String(cString: $0) }) else { return }
let db = Unmanaged<Database>.fromOpaque(dbPointer!).takeUnretainedValue()
db.configuration.trace!(sql)
}, dbPointer)
}
// Precondition: configuration.trace != nil
private static func trace_v2(
_ mask: UInt32,
_ dbPointer: UnsafeMutableRawPointer?,
_ stmt: UnsafeMutableRawPointer?,
_ unexpandedSQL: UnsafeMutableRawPointer?,
_ sqlite3_expanded_sql: @convention(c) (OpaquePointer?) -> UnsafeMutablePointer<Int8>?)
-> Int32
{
guard let stmt = stmt else { return SQLITE_OK }
guard let expandedSQLCString = sqlite3_expanded_sql(OpaquePointer(stmt)) else { return SQLITE_OK }
let sql = String(cString: expandedSQLCString)
sqlite3_free(expandedSQLCString)
let db = Unmanaged<Database>.fromOpaque(dbPointer!).takeUnretainedValue()
db.configuration.trace!(sql)
return SQLITE_OK
}
private func setupForeignKeys() throws {
// Foreign keys are disabled by default with SQLite3
if configuration.foreignKeysEnabled {
@@ -400,41 +403,47 @@ extension Database {
}
private static func closeConnection(_ sqliteConnection: SQLiteConnection) {
// sqlite3_close_v2 was added in SQLite 3.7.14 http://www.sqlite.org/changes.html#version_3_7_14
// It is available from iOS 8.2 and OS X 10.10 https://github.com/yapstudios/YapDatabase/wiki/SQLite-version-(bundled-with-OS)
#if GRDBCUSTOMSQLITE || GRDBCIPHER
close_v2(connection: sqliteConnection)
closeConnection_v2(sqliteConnection, sqlite3_close_v2)
#else
if #available(iOS 8.2, OSX 10.10, OSXApplicationExtension 10.10, *) {
close_v2(connection: sqliteConnection)
closeConnection_v2(sqliteConnection, sqlite3_close_v2)
} else {
// https://www.sqlite.org/c3ref/close.html
// > If the database connection is associated with unfinalized prepared
// > statements or unfinished sqlite3_backup objects then
// > sqlite3_close() will leave the database connection open and
// > return SQLITE_BUSY.
let code = sqlite3_close(sqliteConnection)
if code != SQLITE_OK, let log = logError {
// A rare situation where GRDB doesn't fatalError on
// unprocessed errors.
let message = String(cString: sqlite3_errmsg(sqliteConnection))
log(ResultCode(rawValue: code), "could not close database: \(message)")
if code == SQLITE_BUSY {
// Let the user know about unfinalized statements that did
// prevent the connection from closing properly.
var stmt: SQLiteStatement? = sqlite3_next_stmt(sqliteConnection, nil)
while stmt != nil {
log(ResultCode(rawValue: code), "unfinalized statement: \(String(cString: sqlite3_sql(stmt)))")
stmt = sqlite3_next_stmt(sqliteConnection, stmt)
}
}
}
closeConnection_v1(sqliteConnection)
}
#endif
}
private static func closeConnection_v1(_ sqliteConnection: SQLiteConnection) {
// https://www.sqlite.org/c3ref/close.html
// > If the database connection is associated with unfinalized prepared
// > statements or unfinished sqlite3_backup objects then
// > sqlite3_close() will leave the database connection open and
// > return SQLITE_BUSY.
let code = sqlite3_close(sqliteConnection)
if code != SQLITE_OK, let log = logError {
// A rare situation where GRDB doesn't fatalError on
// unprocessed errors.
let message = String(cString: sqlite3_errmsg(sqliteConnection))
log(ResultCode(rawValue: code), "could not close database: \(message)")
if code == SQLITE_BUSY {
// Let the user know about unfinalized statements that did
// prevent the connection from closing properly.
var stmt: SQLiteStatement? = sqlite3_next_stmt(sqliteConnection, nil)
while stmt != nil {
log(ResultCode(rawValue: code), "unfinalized statement: \(String(cString: sqlite3_sql(stmt)))")
stmt = sqlite3_next_stmt(sqliteConnection, stmt)
}
}
}
}
// sqlite3_close_v2 was added in SQLite 3.7.14 http://www.sqlite.org/changes.html#version_3_7_14
// It is available from iOS 8.2 and OS X 10.10 https://github.com/yapstudios/YapDatabase/wiki/SQLite-version-(bundled-with-OS)
#if GRDBCUSTOMSQLITE || GRDBCIPHER
private static func close_v2(connection sqliteConnection: SQLiteConnection) {
private static func closeConnection_v2(
_ sqliteConnection: SQLiteConnection,
_ sqlite3_close_v2: @convention(c) (OpaquePointer?) -> Int32)
{
// https://www.sqlite.org/c3ref/close.html
// > If sqlite3_close_v2() is called with unfinalized prepared
// > statements and/or unfinished sqlite3_backups, then the database
@@ -449,24 +458,6 @@ extension Database {
log(ResultCode(rawValue: code), "could not close database: \(message)")
}
}
#else
@available(iOS 8.2, OSX 10.10, OSXApplicationExtension 10.10, *)
private static func close_v2(connection sqliteConnection: SQLiteConnection) {
// https://www.sqlite.org/c3ref/close.html
// > If sqlite3_close_v2() is called with unfinalized prepared
// > statements and/or unfinished sqlite3_backups, then the database
// > connection becomes an unusable "zombie" which will automatically
// > be deallocated when the last prepared statement is finalized or the
// > last sqlite3_backup is finished.
let code = sqlite3_close_v2(sqliteConnection)
if code != SQLITE_OK, let log = logError {
// A rare situation where GRDB doesn't fatalError on
// unprocessed errors.
let message = String(cString: sqlite3_errmsg(sqliteConnection))
log(ResultCode(rawValue: code), "could not close database: \(message)")
}
}
#endif
}
extension Database {
+14 -7
View File
@@ -32,17 +32,24 @@ public final class DatabaseCollation {
}
}
extension DatabaseCollation : Hashable {
extension DatabaseCollation: Hashable {
// Collation equality is based on the sqlite3_strnicmp SQLite function.
// (see https://www.sqlite.org/c3ref/create_collation.html). Computing
// a hash value that honors the Swift Hashable contract (value equality
// implies hash equality) is thus non trivial. But it's not that
// important, since this hashValue is only used when one adds
// or removes a collation from a database connection.
#if swift(>=4.2)
/// :nodoc:
public func hash(into hasher: inout Hasher) {
hasher.combine(0)
}
#else
/// :nodoc:
public var hashValue: Int {
// Collation equality is based on the sqlite3_strnicmp SQLite function.
// (see https://www.sqlite.org/c3ref/create_collation.html). Computing
// a hash value that honors the Swift Hashable contract (value equality
// implies hash equality) is thus non trivial. But it's not that
// important, since this hashValue is only used when one adds
// or removes a collation from a database connection.
return 0
}
#endif
/// Two collations are equal if they share the same name (case insensitive)
/// :nodoc:
+7 -1
View File
@@ -313,11 +313,17 @@ public final class DatabaseFunction: Hashable {
}
extension DatabaseFunction {
/// The hash value
#if swift(>=4.2)
/// :nodoc:
public func hash(into hasher: inout Hasher) {
hasher.combine(identity)
}
#else
/// :nodoc:
public var hashValue: Int {
return identity.hashValue
}
#endif
/// Two functions are equal if they share the same name and arity.
/// :nodoc:
+136 -7
View File
@@ -1,4 +1,5 @@
import Foundation
import Dispatch
#if SWIFT_PACKAGE
import CSQLite
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
@@ -167,8 +168,13 @@ extension DatabasePool {
public func setupMemoryManagement(in application: UIApplication) {
self.application = application
let center = NotificationCenter.default
#if swift(>=4.2)
center.addObserver(self, selector: #selector(DatabasePool.applicationDidReceiveMemoryWarning(_:)), name: UIApplication.didReceiveMemoryWarningNotification, object: nil)
center.addObserver(self, selector: #selector(DatabasePool.applicationDidEnterBackground(_:)), name: UIApplication.didReceiveMemoryWarningNotification, object: nil)
#else
center.addObserver(self, selector: #selector(DatabasePool.applicationDidReceiveMemoryWarning(_:)), name: .UIApplicationDidReceiveMemoryWarning, object: nil)
center.addObserver(self, selector: #selector(DatabasePool.applicationDidEnterBackground(_:)), name: .UIApplicationDidEnterBackground, object: nil)
#endif
}
@objc private func applicationDidEnterBackground(_ notification: NSNotification) {
@@ -176,10 +182,13 @@ extension DatabasePool {
return
}
var task: UIBackgroundTaskIdentifier! = nil
task = application.beginBackgroundTask(expirationHandler: nil)
if task == UIBackgroundTaskInvalid {
let task: UIBackgroundTaskIdentifier = application.beginBackgroundTask(expirationHandler: nil)
#if swift(>=4.2)
let taskIsInvalid = task == UIBackgroundTaskIdentifier.invalid
#else
let taskIsInvalid = task == UIBackgroundTaskInvalid
#endif
if taskIsInvalid {
// Perform releaseMemory() synchronously.
releaseMemory()
} else {
@@ -341,6 +350,8 @@ extension DatabasePool : DatabaseReader {
}
}
/// This method is deprecated. Use concurrentRead instead.
///
/// Asynchronously executes a read-only block in a protected dispatch queue,
/// wrapped in a deferred transaction.
///
@@ -366,6 +377,7 @@ extension DatabasePool : DatabaseReader {
/// - parameter block: A block that accesses the database.
/// - throws: The error thrown by the block, or any DatabaseError that would
/// happen while establishing the read access to the database.
@available(*, deprecated, message: "Use concurrentRead instead")
public func readFromCurrentState(_ block: @escaping (Database) -> Void) throws {
// https://www.sqlite.org/isolation.html
//
@@ -414,7 +426,12 @@ extension DatabasePool : DatabaseReader {
// Check that we're on the writer queue...
writer.execute { db in
// ... and that no transaction is opened.
GRDBPrecondition(!db.isInsideTransaction, "readFromCurrentState must not be called from inside a transaction. If this error is raised from a DatabasePool.write block, use DatabasePool.writeWithoutTransaction instead (and use transactions when needed).")
GRDBPrecondition(!db.isInsideTransaction, """
readFromCurrentState must not be called from inside a transaction. \
If this error is raised from a DatabasePool.write block, use \
DatabasePool.writeWithoutTransaction instead (and use \
transactions when needed).
""")
}
// The semaphore that blocks the writing dispatch queue until snapshot
@@ -427,7 +444,7 @@ extension DatabasePool : DatabaseReader {
do {
try db.beginTransaction(.deferred)
assert(db.isInsideTransaction)
try db.makeSelectStatement("SELECT rootpage FROM sqlite_master").cursor().next()
try db.makeSelectStatement("SELECT rootpage FROM sqlite_master").makeCursor().next()
} catch {
readError = error
semaphore.signal() // Release the writer queue and rethrow error
@@ -448,7 +465,119 @@ extension DatabasePool : DatabaseReader {
throw readError
}
}
public func concurrentRead<T>(_ block: @escaping (Database) throws -> T) -> Future<T> {
// https://www.sqlite.org/isolation.html
//
// > In WAL mode, SQLite exhibits "snapshot isolation". When a read
// > transaction starts, that reader continues to see an unchanging
// > "snapshot" of the database file as it existed at the moment in time
// > when the read transaction started. Any write transactions that
// > commit while the read transaction is active are still invisible to
// > the read transaction, because the reader is seeing a snapshot of
// > database file from a prior moment in time.
//
// That's exactly what we need. But what does "when read transaction
// starts" mean?
//
// http://www.sqlite.org/lang_transaction.html
//
// > Deferred [transaction] means that no locks are acquired on the
// > database until the database is first accessed. [...] Locks are not
// > acquired until the first read or write operation. [...] Because the
// > acquisition of locks is deferred until they are needed, it is
// > possible that another thread or process could create a separate
// > transaction and write to the database after the BEGIN on the
// > current thread has executed.
//
// Now that's precise enough: SQLite defers "snapshot isolation" until
// the first SELECT:
//
// Reader Writer
// BEGIN DEFERRED TRANSACTION
// UPDATE ... (1)
// Here the change (1) is visible
// SELECT ...
// UPDATE ... (2)
// Here the change (2) is not visible
//
// The readFromCurrentState method says that no change should be visible
// at all. We thus have to perform a select that establishes the
// snapshot isolation before we release the writer queue:
//
// Reader Writer
// BEGIN DEFERRED TRANSACTION
// SELECT anything
// UPDATE ...
// Here the change is not visible by GRDB user
// Check that we're on the writer queue...
writer.execute { db in
// ... and that no transaction is opened.
GRDBPrecondition(!db.isInsideTransaction, """
concurrentRead must not be called from inside a transaction. \
If this error is raised from a DatabasePool.write block, use \
DatabasePool.writeWithoutTransaction instead (and use \
transactions when needed).
""")
}
// The semaphore that blocks the writing dispatch queue until snapshot
// isolation has been established:
let isolationSemaphore = DispatchSemaphore(value: 0)
// The semaphore that blocks until futureResult is defined:
let futureSemaphore = DispatchSemaphore(value: 0)
var futureResult: Result<T>? = nil
do {
try readerPool.get { reader in
reader.async { db in
// Open a deferred transaction and access the database in
// order to establish snapshot isolation.
defer { _ = try? db.commit() }
do {
try db.beginTransaction(.deferred)
try db.makeSelectStatement("SELECT rootpage FROM sqlite_master").makeCursor().next()
} catch {
// Snapshot isolation failure
futureResult = .failure(error)
isolationSemaphore.signal()
futureSemaphore.signal()
return
}
// Release the writer queue
isolationSemaphore.signal()
// Reset the schema cache before running user code in snapshot isolation
db.schemaCache = SimpleDatabaseSchemaCache()
// Fetch and release the future
futureResult = Result { try block(db) }
futureSemaphore.signal()
}
}
} catch {
return Future { throw error }
}
// Block the writer queue until snapshot isolation success or error
_ = isolationSemaphore.wait(timeout: .distantFuture)
return Future {
// Block the future until results are fetched
_ = futureSemaphore.wait(timeout: .distantFuture)
switch futureResult! {
case .failure(let error):
throw error
case .success(let result):
return result
}
}
}
/// Returns a reader that can be used from the current dispatch queue,
/// if any.
private var currentReader: SerializedDatabase? {
+34 -10
View File
@@ -94,8 +94,13 @@ extension DatabaseQueue {
public func setupMemoryManagement(in application: UIApplication) {
self.application = application
let center = NotificationCenter.default
#if swift(>=4.2)
center.addObserver(self, selector: #selector(DatabaseQueue.applicationDidReceiveMemoryWarning(_:)), name: UIApplication.didReceiveMemoryWarningNotification, object: nil)
center.addObserver(self, selector: #selector(DatabaseQueue.applicationDidEnterBackground(_:)), name: UIApplication.didEnterBackgroundNotification, object: nil)
#else
center.addObserver(self, selector: #selector(DatabaseQueue.applicationDidReceiveMemoryWarning(_:)), name: .UIApplicationDidReceiveMemoryWarning, object: nil)
center.addObserver(self, selector: #selector(DatabaseQueue.applicationDidEnterBackground(_:)), name: .UIApplicationDidEnterBackground, object: nil)
#endif
}
@objc private func applicationDidEnterBackground(_ notification: NSNotification) {
@@ -103,10 +108,13 @@ extension DatabaseQueue {
return
}
var task: UIBackgroundTaskIdentifier! = nil
task = application.beginBackgroundTask(expirationHandler: nil)
if task == UIBackgroundTaskInvalid {
let task: UIBackgroundTaskIdentifier = application.beginBackgroundTask(expirationHandler: nil)
#if swift(>=4.2)
let taskIsInvalid = task == UIBackgroundTaskIdentifier.invalid
#else
let taskIsInvalid = task == UIBackgroundTaskInvalid
#endif
if taskIsInvalid {
// Perform releaseMemory() synchronously.
releaseMemory()
} else {
@@ -191,10 +199,12 @@ extension DatabaseQueue {
/// concurrency practices.
///
/// :nodoc:
public func unsafeReentrantRead<T>(_ block: (Database) throws -> T) throws -> T {
public func unsafeReentrantRead<T>(_ block: (Database) throws -> T) rethrows -> T {
return try writer.reentrantSync(block)
}
/// This method is deprecated. Use concurrentRead instead.
///
/// Synchronously executes *block*.
///
/// This method must be called from the protected database dispatch queue,
@@ -203,10 +213,7 @@ extension DatabaseQueue {
/// Starting SQLite 3.8.0 (iOS 8.2+, OSX 10.10+, custom SQLite builds and
/// SQLCipher), attempts to write in the database from this meethod throw a
/// DatabaseError of resultCode `SQLITE_READONLY`.
///
/// See `DatabaseWriter.readFromCurrentState`.
///
/// :nodoc:
@available(*, deprecated, message: "Use concurrentRead instead")
public func readFromCurrentState(_ block: @escaping (Database) -> Void) {
// Check that we're on the correct queue...
writer.execute { db in
@@ -216,6 +223,23 @@ extension DatabaseQueue {
}
}
public func concurrentRead<T>(_ block: @escaping (Database) throws -> T) -> Future<T> {
// DatabaseQueue can't perform parallel reads.
let result = Result<T> {
// Check that we're on the writer queue...
try writer.execute { db in
// ... and that no transaction is opened.
GRDBPrecondition(!db.isInsideTransaction, "concurrentRead must not be called from inside a transaction.")
return try db.readOnly {
try block(db)
}
}
}
return Future {
try result.unwrap()
}
}
// MARK: - Writing in Database
/// Synchronously executes a block in a protected dispatch queue, wrapped
@@ -232,7 +256,7 @@ extension DatabaseQueue {
///
/// - parameter block: A block that executes SQL statements.
/// - throws: An eventual database error, or the error thrown by the block.
public func write<T>(_ block: (Database) throws -> T) rethrows -> T {
public func write<T>(_ block: (Database) throws -> T) throws -> T {
return try writer.sync { db in
var result: T? = nil
try db.inTransaction {
+2 -2
View File
@@ -34,8 +34,8 @@ public class DatabaseSnapshot : DatabaseReader {
try db.beginTransaction(.deferred)
// Take snapshot
// See DatabasePool.readFromCurrentState for a complete discussion
try db.makeSelectStatement("SELECT rootpage FROM sqlite_master").cursor().next()
// See DatabasePool.concurrentRead for a complete discussion
try db.makeSelectStatement("SELECT rootpage FROM sqlite_master").makeCursor().next()
}
}
+29 -38
View File
@@ -121,18 +121,18 @@ public struct DatabaseValue: Hashable, CustomStringConvertible, DatabaseValueCon
/// Returns a DatabaseValue initialized from a raw SQLite statement pointer.
init(sqliteStatement: SQLiteStatement, index: Int32) {
switch sqlite3_column_type(sqliteStatement, Int32(index)) {
switch sqlite3_column_type(sqliteStatement, index) {
case SQLITE_NULL:
storage = .null
case SQLITE_INTEGER:
storage = .int64(sqlite3_column_int64(sqliteStatement, Int32(index)))
storage = .int64(sqlite3_column_int64(sqliteStatement, index))
case SQLITE_FLOAT:
storage = .double(sqlite3_column_double(sqliteStatement, Int32(index)))
storage = .double(sqlite3_column_double(sqliteStatement, index))
case SQLITE_TEXT:
storage = .string(String(cString: sqlite3_column_text(sqliteStatement, Int32(index))))
storage = .string(String(cString: sqlite3_column_text(sqliteStatement, index)))
case SQLITE_BLOB:
if let bytes = sqlite3_column_blob(sqliteStatement, Int32(index)) {
let count = Int(sqlite3_column_bytes(sqliteStatement, Int32(index)))
if let bytes = sqlite3_column_blob(sqliteStatement, index) {
let count = Int(sqlite3_column_bytes(sqliteStatement, index))
storage = .blob(Data(bytes: bytes, count: count)) // copy bytes
} else {
storage = .blob(Data())
@@ -149,7 +149,24 @@ public struct DatabaseValue: Hashable, CustomStringConvertible, DatabaseValueCon
// Hashable
extension DatabaseValue {
/// The hash value
#if swift(>=4.2)
/// :nodoc:
public func hash(into hasher: inout Hasher) {
switch storage {
case .null:
hasher.combine(0)
case .int64(let int64):
// 1 == 1.0, hence 1 and 1.0 must have the same hash:
hasher.combine(Double(int64))
case .double(let double):
hasher.combine(double)
case .string(let string):
hasher.combine(string)
case .blob(let data):
hasher.combine(data)
}
}
#else
/// :nodoc:
public var hashValue: Int {
switch storage {
@@ -166,6 +183,7 @@ extension DatabaseValue {
return data.hashValue
}
}
#endif
/// Returns whether two DatabaseValues are equal.
///
@@ -207,6 +225,7 @@ extension DatabaseValue {
// MARK: - Lossless conversions
extension DatabaseValue {
// TODO: deprecate and rename to DatabaseValue.decode(_:sql:arguments:)
/// Converts the database value to the type T.
///
/// let dbValue = "foo".databaseValue
@@ -226,20 +245,10 @@ extension DatabaseValue {
/// - arguments: Optional statement arguments that enhances the eventual
/// conversion error
public func losslessConvert<T>(sql: String? = nil, arguments: StatementArguments? = nil) -> T where T : DatabaseValueConvertible {
if let value = T.fromDatabaseValue(self) {
return value
}
// Failed conversion: this is data loss, a programmer error.
var error = "could not convert database value \(self) to \(T.self)"
if let sql = sql {
error += " with statement `\(sql)`"
}
if let arguments = arguments, !arguments.isEmpty {
error += " arguments \(arguments)"
}
fatalError(error)
return T.decode(from: self, conversionContext: sql.map { ValueConversionContext(sql: $0, arguments: arguments) })
}
// TODO: deprecate and rename to DatabaseValue.decodeIfPresent(_:sql:arguments:)
/// Converts the database value to the type Optional<T>.
///
/// let dbValue = "foo".databaseValue
@@ -260,25 +269,7 @@ extension DatabaseValue {
/// - arguments: Optional statement arguments that enhances the eventual
/// conversion error
public func losslessConvert<T>(sql: String? = nil, arguments: StatementArguments? = nil) -> T? where T : DatabaseValueConvertible {
// Use fromDatabaseValue first: this allows DatabaseValue to convert NULL to .null.
if let value = T.fromDatabaseValue(self) {
return value
}
if isNull {
// Failed conversion from null: ok
return nil
} else {
// Failed conversion from a non-null database value: this is data
// loss, a programmer error.
var error = "could not convert database value \(self) to \(T.self)"
if let sql = sql {
error += " with statement `\(sql)`"
}
if let arguments = arguments, !arguments.isEmpty {
error += " arguments \(arguments)"
}
fatalError(error)
}
return T.decodeIfPresent(from: self, conversionContext: sql.map { ValueConversionContext(sql: $0, arguments: arguments) })
}
}
+227
View File
@@ -0,0 +1,227 @@
#if SWIFT_PACKAGE
import CSQLite
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
import SQLite3
#endif
// MARK: - Conversion Context and Errors
/// A type that helps the user understanding value conversion errors
struct ValueConversionContext {
private enum Column {
case columnIndex(Int)
case columnName(String)
}
var row: Row?
var sql: String?
var arguments: StatementArguments?
private var column: Column?
func atColumn(_ columnIndex: Int) -> ValueConversionContext {
var result = self
result.column = .columnIndex(columnIndex)
return result
}
func atColumn(_ columnName: String) -> ValueConversionContext {
var result = self
result.column = .columnName(columnName)
return result
}
var columnIndex: Int? {
guard let column = column else { return nil }
switch column {
case .columnIndex(let index):
return index
case .columnName(let name):
return row?.index(ofColumn: name)
}
}
var columnName: String? {
guard let column = column else { return nil }
switch column {
case .columnIndex(let index):
guard let row = row else { return nil }
return Array(row.columnNames)[index]
case .columnName(let name):
return name
}
}
}
extension ValueConversionContext {
init(_ statement: SelectStatement) {
self.init(
row: Row(statement: statement).copy(),
sql: statement.sql,
arguments: statement.arguments,
column: nil)
}
init(_ row: Row) {
if let statement = row.statement {
self.init(
row: row.copy(),
sql: statement.sql,
arguments: statement.arguments,
column: nil)
} else if let sqliteStatement = row.sqliteStatement {
let sql = String(cString: sqlite3_sql(sqliteStatement)).trimmingCharacters(in: statementSeparatorCharacterSet)
self.init(
row: row.copy(),
sql: sql,
arguments: nil,
column: nil)
} else {
self.init(
row: row.copy(),
sql: nil,
arguments: nil,
column: nil)
}
}
init(sql: String, arguments: StatementArguments?) {
self.init(
row: nil,
sql: sql,
arguments: arguments,
column: nil)
}
}
/// The canonical conversion error message
///
/// - parameter dbValue: nil means "missing column"
func conversionErrorMessage<T>(to: T.Type, from dbValue: DatabaseValue?, conversionContext: ValueConversionContext?) -> String {
var message: String
var extras: [String] = []
if let dbValue = dbValue {
message = "could not convert database value \(dbValue) to \(T.self)"
if let columnName = conversionContext?.columnName {
extras.append("column: `\(columnName)`")
}
if let columnIndex = conversionContext?.columnIndex {
extras.append("column index: \(columnIndex)")
}
} else {
message = "could not read \(T.self) from missing column"
if let columnName = conversionContext?.columnName {
message += " `\(columnName)`"
}
}
if let row = conversionContext?.row {
extras.append("row: \(row)")
}
if let sql = conversionContext?.sql {
extras.append("sql: `\(sql)`")
if let arguments = conversionContext?.arguments, arguments.isEmpty == false {
extras.append("arguments: \(arguments)")
}
}
if extras.isEmpty == false {
message += " (" + extras.joined(separator: ", ") + ")"
}
return message
}
/// The canonical conversion fatal error
///
/// - parameter dbValue: nil means "missing column", for consistency with (row["missing"] as DatabaseValue? == nil)
func fatalConversionError<T>(to: T.Type, from dbValue: DatabaseValue?, conversionContext: ValueConversionContext?, file: StaticString = #file, line: UInt = #line) -> Never {
fatalError(conversionErrorMessage(to: T.self, from: dbValue, conversionContext: conversionContext), file: file, line: line)
}
func fatalConversionError<T>(to: T.Type, sqliteStatement: SQLiteStatement, index: Int32) -> Never {
let row = Row(sqliteStatement: sqliteStatement)
fatalConversionError(
to: T.self,
from: DatabaseValue(sqliteStatement: sqliteStatement, index: index),
conversionContext: ValueConversionContext(row).atColumn(Int(index)))
}
// MARK: - DatabaseValueConvertible
/// Lossless conversions from database values and rows
extension DatabaseValueConvertible {
@inline(__always)
static func decode(from dbValue: DatabaseValue, conversionContext: @autoclosure () -> ValueConversionContext?) -> Self {
if let value = fromDatabaseValue(dbValue) {
return value
} else {
fatalConversionError(to: Self.self, from: dbValue, conversionContext: conversionContext())
}
}
@inline(__always)
static func decode(from row: Row, atUncheckedIndex index: Int) -> Self {
return decode(
from: row.impl.databaseValue(atUncheckedIndex: index),
conversionContext: ValueConversionContext(row).atColumn(index))
}
@inline(__always)
static func decodeIfPresent(from dbValue: DatabaseValue, conversionContext: @autoclosure () -> ValueConversionContext?) -> Self? {
// Use fromDatabaseValue before checking for null: this allows DatabaseValue to convert NULL to .null.
if let value = fromDatabaseValue(dbValue) {
return value
} else if dbValue.isNull {
return nil
} else {
fatalConversionError(to: Self.self, from: dbValue, conversionContext: conversionContext())
}
}
@inline(__always)
static func decodeIfPresent(from row: Row, atUncheckedIndex index: Int) -> Self? {
return decodeIfPresent(
from: row.impl.databaseValue(atUncheckedIndex: index),
conversionContext: ValueConversionContext(row).atColumn(index))
}
}
// MARK: - DatabaseValueConvertible & StatementColumnConvertible
/// Lossless conversions from database values and rows
extension DatabaseValueConvertible where Self: StatementColumnConvertible {
@inline(__always)
static func fastDecode(from sqliteStatement: SQLiteStatement, index: Int32) -> Self {
if sqlite3_column_type(sqliteStatement, index) == SQLITE_NULL {
fatalConversionError(
to: Self.self,
from: .null,
conversionContext: ValueConversionContext(Row(sqliteStatement: sqliteStatement)).atColumn(Int(index)))
}
return self.init(sqliteStatement: sqliteStatement, index: index)
}
@inline(__always)
static func fastDecode(from row: Row, atUncheckedIndex index: Int) -> Self {
if let sqliteStatement = row.sqliteStatement {
return fastDecode(from: sqliteStatement, index: Int32(index))
}
return row.impl.fastDecode(Self.self, atUncheckedIndex: index)
}
@inline(__always)
static func fastDecodeIfPresent(from sqliteStatement: SQLiteStatement, atUncheckedIndex index: Int32) -> Self? {
if sqlite3_column_type(sqliteStatement, index) == SQLITE_NULL {
return nil
}
return self.init(sqliteStatement: sqliteStatement, index: index)
}
@inline(__always)
static func fastDecodeIfPresent(from row: Row, atUncheckedIndex index: Int) -> Self? {
if let sqliteStatement = row.sqliteStatement {
return fastDecodeIfPresent(from: sqliteStatement, atUncheckedIndex: Int32(index))
}
return row.impl.fastDecodeIfPresent(Self.self, atUncheckedIndex: index)
}
}
+40 -12
View File
@@ -55,25 +55,39 @@ public final class DatabaseValueCursor<Value: DatabaseValueConvertible> : Cursor
init(statement: SelectStatement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws {
self.statement = statement
// We'll read from leftmost column at index 0, unless adapter mangles columns
self.columnIndex = try Int32(adapter?.baseColumnIndex(atIndex: 0, layout: statement) ?? 0)
self.sqliteStatement = statement.sqliteStatement
statement.cursorReset(arguments: arguments)
if let adapter = adapter {
// adapter may redefine the index of the leftmost column
self.columnIndex = try Int32(adapter.baseColumnIndex(atIndex: 0, layout: statement))
} else {
self.columnIndex = 0
}
statement.reset(withArguments: arguments)
}
/// :nodoc:
public func next() throws -> Value? {
if done { return nil }
if done {
// make sure this instance never yields a value again, even if the
// statement is reset by another cursor.
return nil
}
switch sqlite3_step(sqliteStatement) {
case SQLITE_DONE:
done = true
return nil
case SQLITE_ROW:
let dbValue = DatabaseValue(sqliteStatement: sqliteStatement, index: columnIndex)
return dbValue.losslessConvert() as Value
return Value.decode(
from: dbValue,
conversionContext: ValueConversionContext(statement).atColumn(Int(columnIndex)))
case let code:
statement.database.selectStatementDidFail(statement)
throw DatabaseError(resultCode: code, message: statement.database.lastErrorMessage, sql: statement.sql, arguments: statement.arguments)
throw DatabaseError(
resultCode: code,
message: statement.database.lastErrorMessage,
sql: statement.sql,
arguments: statement.arguments)
}
}
}
@@ -95,25 +109,39 @@ public final class NullableDatabaseValueCursor<Value: DatabaseValueConvertible>
init(statement: SelectStatement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws {
self.statement = statement
// We'll read from leftmost column at index 0, unless adapter mangles columns
self.columnIndex = try Int32(adapter?.baseColumnIndex(atIndex: 0, layout: statement) ?? 0)
self.sqliteStatement = statement.sqliteStatement
statement.cursorReset(arguments: arguments)
if let adapter = adapter {
// adapter may redefine the index of the leftmost column
self.columnIndex = try Int32(adapter.baseColumnIndex(atIndex: 0, layout: statement))
} else {
self.columnIndex = 0
}
statement.reset(withArguments: arguments)
}
/// :nodoc:
public func next() throws -> Value?? {
if done { return nil }
if done {
// make sure this instance never yields a value again, even if the
// statement is reset by another cursor.
return nil
}
switch sqlite3_step(sqliteStatement) {
case SQLITE_DONE:
done = true
return nil
case SQLITE_ROW:
let dbValue = DatabaseValue(sqliteStatement: sqliteStatement, index: columnIndex)
return dbValue.losslessConvert() as Value?
return Value.decodeIfPresent(
from: dbValue,
conversionContext: ValueConversionContext(statement).atColumn(Int(columnIndex)))
case let code:
statement.database.selectStatementDidFail(statement)
throw DatabaseError(resultCode: code, message: statement.database.lastErrorMessage, sql: statement.sql, arguments: statement.arguments)
throw DatabaseError(
resultCode: code,
message: statement.database.lastErrorMessage,
sql: statement.sql,
arguments: statement.arguments)
}
}
}
+100 -1
View File
@@ -1,3 +1,5 @@
import Dispatch
/// The protocol for all types that can update a database.
///
/// It is adopted by DatabaseQueue and DatabasePool.
@@ -60,6 +62,8 @@ public protocol DatabaseWriter : DatabaseReader {
// MARK: - Reading from Database
/// This method is deprecated. Use concurrentRead instead.
///
/// Synchronously or asynchronously executes a read-only block that takes a
/// database connection.
///
@@ -72,7 +76,7 @@ public protocol DatabaseWriter : DatabaseReader {
///
/// For example:
///
/// try writer.write { db in
/// try writer.writeWithoutTransaction { db in
/// try db.execute("DELETE FROM player")
/// try writer.readFromCurrentState { db in
/// // Guaranteed to be zero
@@ -80,7 +84,42 @@ public protocol DatabaseWriter : DatabaseReader {
/// }
/// try db.execute("INSERT INTO player ...")
/// }
@available(*, deprecated, message: "Use concurrentRead instead")
func readFromCurrentState(_ block: @escaping (Database) -> Void) throws
/// Concurrently executes a read-only block that takes a
/// database connection.
///
/// This method must be called from a writing dispatch queue, outside of any
/// transaction. You'll get a fatal error otherwise.
///
/// The *block* argument is guaranteed to see the database in the last
/// committed state at the moment this method is called. Eventual concurrent
/// database updates are *not visible* inside the block.
///
/// This method returns as soon as the isolation guarantees described above
/// are established. To access the fetched results, you call the wait()
/// method of the returned future, on any dispatch queue.
///
/// In the example below, the number of players is fetched concurrently with
/// the player insertion. Yet the future is guaranteed to return zero:
///
/// try writer.writeWithoutTransaction { db in
/// // Delete all players
/// try Player.deleteAll()
///
/// // Count players concurrently
/// let future = writer.concurrentRead { db in
/// return try Player.fetchCount()
/// }
///
/// // Insert a player
/// try Player(...).insert(db)
///
/// // Guaranteed to be zero
/// let count = try future.wait()
/// }
func concurrentRead<T>(_ block: @escaping (Database) throws -> T) -> Future<T>
}
extension DatabaseWriter {
@@ -148,6 +187,37 @@ extension DatabaseWriter {
#endif
}
// MARK: - Reading from Database
/// Default implementation, based on the deprecated readFromCurrentState.
///
/// :nodoc:
public func concurrentRead<T>(_ block: @escaping (Database) throws -> T) -> Future<T> {
let semaphore = DispatchSemaphore(value: 0)
var result: Result<T>? = nil
do {
try readFromCurrentState { db in
result = Result { try block(db) }
semaphore.signal()
}
} catch {
result = .failure(error)
semaphore.signal()
}
return Future {
_ = semaphore.wait(timeout: .distantFuture)
switch result! {
case .failure(let error):
throw error
case .success(let result):
return result
}
}
}
// MARK: - Claiming Disk Space
/// Rebuilds the database file, repacking it into a minimal amount of
@@ -159,6 +229,29 @@ extension DatabaseWriter {
}
}
/// A future value.
public class Future<Value> {
private var consumed = false
private let _wait: () throws -> Value
init(_ wait: @escaping () throws -> Value) {
_wait = wait
}
/// Blocks the current thread until the value is available, and returns it.
///
/// It is a programmer error to call this method several times.
///
/// - throws: Any error that prevented the value from becoming available.
public func wait() throws -> Value {
// Not thread-safe and quick and dirty.
// Goal is that users learn not to call this method twice.
GRDBPrecondition(consumed == false, "Future.wait() must be called only once")
consumed = true
return try _wait()
}
}
/// A type-erased DatabaseWriter
///
/// Instances of AnyDatabaseWriter forward their methods to an arbitrary
@@ -189,9 +282,15 @@ public final class AnyDatabaseWriter : DatabaseWriter {
}
/// :nodoc:
@available(*, deprecated, message: "Use concurrentRead instead")
public func readFromCurrentState(_ block: @escaping (Database) -> Void) throws {
try base.readFromCurrentState(block)
}
/// :nodoc:
public func concurrentRead<T>(_ block: @escaping (Database) throws -> T) -> Future<T> {
return base.concurrentRead(block)
}
// MARK: - Writing in Database
+159 -87
View File
@@ -7,6 +7,8 @@ import Foundation
/// A database row.
public final class Row : Equatable, Hashable, RandomAccessCollection, ExpressibleByDictionaryLiteral, CustomStringConvertible, CustomDebugStringConvertible {
// It is not a violation of the Demeter law when another type uses this
// property, which is exposed for optimizations.
let impl: RowImpl
/// Unless we are producing a row array, we use a single row when iterating
@@ -21,6 +23,9 @@ public final class Row : Equatable, Hashable, RandomAccessCollection, Expressibl
/// The statementRef is released in deinit.
let statementRef: Unmanaged<SelectStatement>?
let sqliteStatement: SQLiteStatement?
var statement: SelectStatement? {
return statementRef?.takeUnretainedValue()
}
/// The number of columns in the row.
public let count: Int
@@ -89,6 +94,15 @@ public final class Row : Equatable, Hashable, RandomAccessCollection, Expressibl
self.count = Int(sqlite3_column_count(sqliteStatement))
}
/// Creates a row that maps an SQLite statement. Further calls to
/// sqlite3_step() modify the row.
init(sqliteStatement: SQLiteStatement) {
self.sqliteStatement = sqliteStatement
self.statementRef = nil
self.impl = SQLiteStatementRowImpl(sqliteStatement: sqliteStatement)
self.count = Int(sqlite3_column_count(sqliteStatement))
}
/// Creates a row that contain a copy of the current state of the
/// SQLite statement. Further calls to sqlite3_step() do not modify the row.
///
@@ -123,7 +137,12 @@ extension Row {
///
/// This method is case-insensitive.
public func hasColumn(_ columnName: String) -> Bool {
return impl.index(ofColumn: columnName) != nil
return index(ofColumn: columnName) != nil
}
@inline(__always)
func index(ofColumn name: String) -> Int? {
return impl.index(ofColumn: name)
}
}
@@ -131,6 +150,12 @@ extension Row {
// MARK: - Extracting Values
/// Fatal errors if index is out of bounds
@inline(__always)
private func checkIndex(_ index: Int, file: StaticString = #file, line: UInt = #line) {
GRDBPrecondition(index >= 0 && index < count, "row index out of range", file: file, line: line)
}
/// Returns true if and only if one column contains a non-null value, or if
/// the row was fetched with a row adapter that defines a scoped row that
/// contains a non-null value.
@@ -143,7 +168,7 @@ extension Row {
/// let row = try Row.fetchOne(db, "SELECT NULL, NULL")!
/// row.containsNonNullValue // false
public var containsNonNullValue: Bool {
for i in (0..<count) where !hasNull(atIndex: i) {
for i in (0..<count) where !impl.hasNull(atUncheckedIndex: i) {
return true
}
@@ -163,7 +188,7 @@ extension Row {
/// in performance-critical code because it can avoid decoding database
/// values.
public func hasNull(atIndex index: Int) -> Bool {
GRDBPrecondition(index >= 0 && index < count, "row index out of range")
checkIndex(index)
return impl.hasNull(atUncheckedIndex: index)
}
@@ -173,7 +198,7 @@ extension Row {
/// Indexes span from 0 for the leftmost column to (row.count - 1) for the
/// righmost column.
public subscript(_ index: Int) -> DatabaseValueConvertible? {
GRDBPrecondition(index >= 0 && index < count, "row index out of range")
checkIndex(index)
return impl.databaseValue(atUncheckedIndex: index).storage.value
}
@@ -186,8 +211,8 @@ extension Row {
/// value is converted to the requested type `Value`. Should this conversion
/// fail, a fatal error is raised.
public subscript<Value: DatabaseValueConvertible>(_ index: Int) -> Value? {
GRDBPrecondition(index >= 0 && index < count, "row index out of range")
return impl.value(atUncheckedIndex: index)
checkIndex(index)
return Value.decodeIfPresent(from: self, atUncheckedIndex: index)
}
/// Returns the value at given index, converted to the requested type.
@@ -203,11 +228,8 @@ extension Row {
/// StatementColumnConvertible. It *may* trigger SQLite built-in conversions
/// (see https://www.sqlite.org/datatype3.html).
public subscript<Value: DatabaseValueConvertible & StatementColumnConvertible>(_ index: Int) -> Value? {
GRDBPrecondition(index >= 0 && index < count, "row index out of range")
if let sqliteStatement = sqliteStatement { // fast path
return Value.losslessConvert(sqliteStatement: sqliteStatement, index: Int32(index))
}
return impl.fastValue(atUncheckedIndex: index)
checkIndex(index)
return Value.fastDecodeIfPresent(from: self, atUncheckedIndex: index)
}
/// Returns the value at given index, converted to the requested type.
@@ -218,8 +240,8 @@ extension Row {
/// This method crashes if the fetched SQLite value is NULL, or if the
/// SQLite value can not be converted to `Value`.
public subscript<Value: DatabaseValueConvertible>(_ index: Int) -> Value {
GRDBPrecondition(index >= 0 && index < count, "row index out of range")
return impl.value(atUncheckedIndex: index)
checkIndex(index)
return Value.decode(from: self, atUncheckedIndex: index)
}
/// Returns the value at given index, converted to the requested type.
@@ -234,11 +256,8 @@ extension Row {
/// StatementColumnConvertible. It *may* trigger SQLite built-in conversions
/// (see https://www.sqlite.org/datatype3.html).
public subscript<Value: DatabaseValueConvertible & StatementColumnConvertible>(_ index: Int) -> Value {
GRDBPrecondition(index >= 0 && index < count, "row index out of range")
if let sqliteStatement = sqliteStatement { // fast path
return Value.losslessConvert(sqliteStatement: sqliteStatement, index: Int32(index))
}
return impl.fastValue(atUncheckedIndex: index)
checkIndex(index)
return Value.fastDecode(from: self, atUncheckedIndex: index)
}
/// Returns Int64, Double, String, Data or nil, depending on the value
@@ -256,7 +275,7 @@ extension Row {
// if row["foo"] != nil { ... }
//
// Without this method, the code above would not compile.
guard let index = impl.index(ofColumn: columnName) else {
guard let index = index(ofColumn: columnName) else {
return nil
}
return impl.databaseValue(atUncheckedIndex: index).storage.value
@@ -271,10 +290,10 @@ extension Row {
/// nil. Otherwise the SQLite value is converted to the requested type
/// `Value`. Should this conversion fail, a fatal error is raised.
public subscript<Value: DatabaseValueConvertible>(_ columnName: String) -> Value? {
guard let index = impl.index(ofColumn: columnName) else {
guard let index = index(ofColumn: columnName) else {
return nil
}
return impl.value(atUncheckedIndex: index)
return Value.decodeIfPresent(from: self, atUncheckedIndex: index)
}
/// Returns the value at given column, converted to the requested type.
@@ -290,13 +309,10 @@ extension Row {
/// StatementColumnConvertible. It *may* trigger SQLite built-in conversions
/// (see https://www.sqlite.org/datatype3.html).
public subscript<Value: DatabaseValueConvertible & StatementColumnConvertible>(_ columnName: String) -> Value? {
guard let index = impl.index(ofColumn: columnName) else {
guard let index = index(ofColumn: columnName) else {
return nil
}
if let sqliteStatement = sqliteStatement { // fast path
return Value.losslessConvert(sqliteStatement: sqliteStatement, index: Int32(index))
}
return impl.fastValue(atUncheckedIndex: index)
return Value.fastDecodeIfPresent(from: self, atUncheckedIndex: index)
}
/// Returns the value at given column, converted to the requested type.
@@ -309,11 +325,14 @@ extension Row {
/// This method crashes if the fetched SQLite value is NULL, or if the
/// SQLite value can not be converted to `Value`.
public subscript<Value: DatabaseValueConvertible>(_ columnName: String) -> Value {
guard let index = impl.index(ofColumn: columnName) else {
// Programmer error
fatalError("no such column: \(columnName)")
guard let index = index(ofColumn: columnName) else {
// No such column
fatalConversionError(
to: Value.self,
from: nil,
conversionContext: ValueConversionContext(self).atColumn(columnName))
}
return impl.value(atUncheckedIndex: index)
return Value.decode(from: self, atUncheckedIndex: index)
}
/// Returns the value at given column, converted to the requested type.
@@ -330,14 +349,14 @@ extension Row {
/// StatementColumnConvertible. It *may* trigger SQLite built-in conversions
/// (see https://www.sqlite.org/datatype3.html).
public subscript<Value: DatabaseValueConvertible & StatementColumnConvertible>(_ columnName: String) -> Value {
guard let index = impl.index(ofColumn: columnName) else {
// Programmer error
fatalError("no such column: \(columnName)")
guard let index = index(ofColumn: columnName) else {
// No such column
fatalConversionError(
to: Value.self,
from: nil,
conversionContext: ValueConversionContext(self).atColumn(columnName))
}
if let sqliteStatement = sqliteStatement { // fast path
return Value.losslessConvert(sqliteStatement: sqliteStatement, index: Int32(index))
}
return impl.fastValue(atUncheckedIndex: index)
return Value.fastDecode(from: self, atUncheckedIndex: index)
}
/// Returns Int64, Double, String, NSData or nil, depending on the value
@@ -420,7 +439,7 @@ extension Row {
/// The returned data does not owns its bytes: it must not be used longer
/// than the row's lifetime.
public func dataNoCopy(atIndex index: Int) -> Data? {
GRDBPrecondition(index >= 0 && index < count, "row index out of range")
checkIndex(index)
return impl.dataNoCopy(atUncheckedIndex: index)
}
@@ -436,7 +455,7 @@ extension Row {
/// The returned data does not owns its bytes: it must not be used longer
/// than the row's lifetime.
public func dataNoCopy(named columnName: String) -> Data? {
guard let index = impl.index(ofColumn: columnName) else {
guard let index = index(ofColumn: columnName) else {
return nil
}
return impl.dataNoCopy(atUncheckedIndex: index)
@@ -595,12 +614,16 @@ public final class RowCursor : Cursor {
self.statement = statement
self.row = try Row(statement: statement).adapted(with: adapter, layout: statement)
self.sqliteStatement = statement.sqliteStatement
statement.cursorReset(arguments: arguments)
statement.reset(withArguments: arguments)
}
/// :nodoc:
public func next() throws -> Row? {
if done { return nil }
if done {
// make sure this instance never yields a value again, even if the
// statement is reset by another cursor.
return nil
}
switch sqlite3_step(sqliteStatement) {
case SQLITE_DONE:
done = true
@@ -911,7 +934,7 @@ extension Row {
/// Accesses the (ColumnName, DatabaseValue) pair at given index.
public subscript(position: RowIndex) -> (String, DatabaseValue) {
let index = position.index
GRDBPrecondition(index >= 0 && index < count, "row index out of range")
checkIndex(index)
return (
impl.columnName(atUncheckedIndex: index),
impl.databaseValue(atUncheckedIndex: index))
@@ -962,12 +985,22 @@ extension Row {
// Hashable
extension Row {
/// The hash value
#if swift(>=4.2)
/// :nodoc:
public func hash(into hasher: inout Hasher) {
hasher.combine(count)
for (column, dbValue) in self {
hasher.combine(column)
hasher.combine(dbValue)
}
}
#else
/// :nodoc:
public var hashValue: Int {
return columnNames.reduce(0) { (acc, column) in acc ^ column.hashValue } ^
databaseValues.reduce(0) { (acc, dbValue) in acc ^ dbValue.hashValue }
}
#endif
}
// CustomStringConvertible & CustomDebugStringConvertible
@@ -1178,15 +1211,14 @@ protocol RowImpl {
var count: Int { get }
var isFetched: Bool { get }
var scopes: Row.ScopesView { get }
func databaseValue(atUncheckedIndex index: Int) -> DatabaseValue
func fastValue<Value: DatabaseValueConvertible & StatementColumnConvertible>(atUncheckedIndex index: Int) -> Value
func fastValue<Value: DatabaseValueConvertible & StatementColumnConvertible>(atUncheckedIndex index: Int) -> Value?
func hasNull(atUncheckedIndex index:Int) -> Bool
func dataNoCopy(atUncheckedIndex index:Int) -> Data?
func columnName(atUncheckedIndex index: Int) -> String
func hasNull(atUncheckedIndex index:Int) -> Bool
func databaseValue(atUncheckedIndex index: Int) -> DatabaseValue
func fastDecode<Value: DatabaseValueConvertible & StatementColumnConvertible>(_ type: Value.Type, atUncheckedIndex index: Int) -> Value
func fastDecodeIfPresent<Value: DatabaseValueConvertible & StatementColumnConvertible>(_ type: Value.Type, atUncheckedIndex index: Int) -> Value?
func dataNoCopy(atUncheckedIndex index:Int) -> Data?
// This method MUST be case-insensitive, and returns the index of the
// leftmost column that matches *name*.
/// Returns the index of the leftmost column that matches *name* (case-insensitive)
func index(ofColumn name: String) -> Int?
// row.impl is guaranteed to be self.
@@ -1197,42 +1229,59 @@ protocol RowImpl {
extension RowImpl {
func copiedRow(_ row: Row) -> Row {
return row
// unless customized, assume unsafe and unadapted row
return Row(impl: ArrayRowImpl(columns: row.map { $0 }))
}
func unscopedRow(_ row: Row) -> Row {
// unless customized, assume unadapted row (see AdaptedRowImpl for customization)
return row
}
func unadaptedRow(_ row: Row) -> Row {
// unless customized, assume unadapted row (see AdaptedRowImpl for customization)
return row
}
var scopes: Row.ScopesView {
// unless customized, assume unuscoped row (see AdaptedRowImpl for customization)
return Row.ScopesView()
}
func hasNull(atUncheckedIndex index:Int) -> Bool {
// unless customized, use slow check (see StatementRowImpl and AdaptedRowImpl for customization)
return databaseValue(atUncheckedIndex: index).isNull
}
func value<Value: DatabaseValueConvertible>(atUncheckedIndex index: Int) -> Value {
return databaseValue(atUncheckedIndex: index).losslessConvert()
func fastDecode<Value: DatabaseValueConvertible & StatementColumnConvertible>(
_ type: Value.Type,
atUncheckedIndex index: Int) -> Value
{
// unless customized, use slow decoding (see StatementRowImpl and AdaptedRowImpl for customization)
return Value.decode(
from: databaseValue(atUncheckedIndex: index),
conversionContext: ValueConversionContext(Row(impl: self)).atColumn(index))
}
func value<Value: DatabaseValueConvertible>(atUncheckedIndex index: Int) -> Value? {
return databaseValue(atUncheckedIndex: index).losslessConvert()
func fastDecodeIfPresent<Value: DatabaseValueConvertible & StatementColumnConvertible>(
_ type: Value.Type,
atUncheckedIndex index: Int) -> Value?
{
// unless customized, use slow decoding (see StatementRowImpl and AdaptedRowImpl for customization)
return Value.decodeIfPresent(
from: databaseValue(atUncheckedIndex: index),
conversionContext: ValueConversionContext(Row(impl: self)).atColumn(index))
}
func fastValue<Value: DatabaseValueConvertible & StatementColumnConvertible>(atUncheckedIndex index: Int) -> Value {
return databaseValue(atUncheckedIndex: index).losslessConvert()
}
func fastValue<Value: DatabaseValueConvertible & StatementColumnConvertible>(atUncheckedIndex index: Int) -> Value? {
return databaseValue(atUncheckedIndex: index).losslessConvert()
func dataNoCopy(atUncheckedIndex index:Int) -> Data? {
// unless customized, copy data (see StatementRowImpl and AdaptedRowImpl for customization)
return Data.decodeIfPresent(
from: databaseValue(atUncheckedIndex: index),
conversionContext: ValueConversionContext(Row(impl: self)).atColumn(index))
}
}
// TODO: merge with StatementCopyRowImpl eventually?
/// See Row.init(dictionary:)
private struct ArrayRowImpl : RowImpl {
let columns: [(String, DatabaseValue)]
@@ -1249,10 +1298,6 @@ private struct ArrayRowImpl : RowImpl {
return false
}
func dataNoCopy(atUncheckedIndex index:Int) -> Data? {
return databaseValue(atUncheckedIndex: index).losslessConvert()
}
func databaseValue(atUncheckedIndex index: Int) -> DatabaseValue {
return columns[index].1
}
@@ -1261,15 +1306,18 @@ private struct ArrayRowImpl : RowImpl {
return columns[index].0
}
// This method MUST be case-insensitive, and returns the index of the
// leftmost column that matches *name*.
func index(ofColumn name: String) -> Int? {
let lowercaseName = name.lowercased()
return columns.index { (column, _) in column.lowercased() == lowercaseName }
}
func copiedRow(_ row: Row) -> Row {
return row
}
}
// TODO: merge with ArrayRowImpl eventually?
/// See Row.init(copiedFromStatementRef:sqliteStatement:)
private struct StatementCopyRowImpl : RowImpl {
let dbValues: ContiguousArray<DatabaseValue>
@@ -1289,10 +1337,6 @@ private struct StatementCopyRowImpl : RowImpl {
return true
}
func dataNoCopy(atUncheckedIndex index:Int) -> Data? {
return databaseValue(atUncheckedIndex: index).losslessConvert()
}
func databaseValue(atUncheckedIndex index: Int) -> DatabaseValue {
return dbValues[index]
}
@@ -1301,12 +1345,14 @@ private struct StatementCopyRowImpl : RowImpl {
return columnNames[index]
}
// This method MUST be case-insensitive, and returns the index of the
// leftmost column that matches *name*.
func index(ofColumn name: String) -> Int? {
let lowercaseName = name.lowercased()
return columnNames.index { $0.lowercased() == lowercaseName }
}
func copiedRow(_ row: Row) -> Row {
return row
}
}
@@ -1319,7 +1365,7 @@ private struct StatementRowImpl : RowImpl {
init(sqliteStatement: SQLiteStatement, statementRef: Unmanaged<SelectStatement>) {
self.statementRef = statementRef
self.sqliteStatement = sqliteStatement
// Optimize row["..."]
// Optimize row[columnName]
let lowercaseColumnNames = (0..<sqlite3_column_count(sqliteStatement)).map { String(cString: sqlite3_column_name(sqliteStatement, Int32($0))).lowercased() }
self.lowercaseColumnIndexes = Dictionary(
lowercaseColumnNames
@@ -1337,7 +1383,7 @@ private struct StatementRowImpl : RowImpl {
}
func hasNull(atUncheckedIndex index:Int) -> Bool {
// Avoid extracting values, because this modifies the statement.
// Avoid extracting values, because this modifies the SQLite statement.
return sqlite3_column_type(sqliteStatement, Int32(index)) == SQLITE_NULL
}
@@ -1356,20 +1402,24 @@ private struct StatementRowImpl : RowImpl {
return DatabaseValue(sqliteStatement: sqliteStatement, index: Int32(index))
}
func fastValue<Value: DatabaseValueConvertible & StatementColumnConvertible>(atUncheckedIndex index: Int) -> Value {
return Value.losslessConvert(sqliteStatement: sqliteStatement, index: Int32(index))
func fastDecode<Value: DatabaseValueConvertible & StatementColumnConvertible>(
_ type: Value.Type,
atUncheckedIndex index: Int) -> Value
{
return Value.fastDecode(from: sqliteStatement, index: Int32(index))
}
func fastValue<Value: DatabaseValueConvertible & StatementColumnConvertible>(atUncheckedIndex index: Int) -> Value? {
return Value.losslessConvert(sqliteStatement: sqliteStatement, index: Int32(index))
func fastDecodeIfPresent<Value: DatabaseValueConvertible & StatementColumnConvertible>(
_ type: Value.Type,
atUncheckedIndex index: Int) -> Value?
{
return Value.fastDecodeIfPresent(from: sqliteStatement, atUncheckedIndex: Int32(index))
}
func columnName(atUncheckedIndex index: Int) -> String {
return statementRef.takeUnretainedValue().columnNames[index]
}
// This method MUST be case-insensitive, and returns the index of the
// leftmost column that matches *name*.
func index(ofColumn name: String) -> Int? {
if let index = lowercaseColumnIndexes[name] {
return index
@@ -1382,6 +1432,29 @@ private struct StatementRowImpl : RowImpl {
}
}
// This one is not optimized at all, since it is only used in fatal conversion errors, so far
private struct SQLiteStatementRowImpl : RowImpl {
let sqliteStatement: SQLiteStatement
var count: Int { return Int(sqlite3_column_count(sqliteStatement)) }
var isFetched: Bool { return true }
func columnName(atUncheckedIndex index: Int) -> String {
return String(cString: sqlite3_column_name(sqliteStatement, Int32(index)))
}
func databaseValue(atUncheckedIndex index: Int) -> DatabaseValue {
return DatabaseValue(sqliteStatement: sqliteStatement, index: Int32(index))
}
func index(ofColumn name: String) -> Int? {
let name = name.lowercased()
for index in 0..<count where columnName(atUncheckedIndex: index).lowercased() == name {
return index
}
return nil
}
}
/// See Row.init()
private struct EmptyRowImpl : RowImpl {
var count: Int {
@@ -1397,11 +1470,6 @@ private struct EmptyRowImpl : RowImpl {
fatalError("row index out of range")
}
func dataNoCopy(atUncheckedIndex index:Int) -> Data? {
// Programmer error
fatalError("row index out of range")
}
func columnName(atUncheckedIndex index: Int) -> String {
// Programmer error
fatalError("row index out of range")
@@ -1410,4 +1478,8 @@ private struct EmptyRowImpl : RowImpl {
func index(ofColumn name: String) -> Int? {
return nil
}
func copiedRow(_ row: Row) -> Row {
return row
}
}
+11 -5
View File
@@ -501,16 +501,22 @@ struct AdaptedRowImpl : RowImpl {
return base.impl.databaseValue(atUncheckedIndex: mappedIndex)
}
func fastValue<Value: DatabaseValueConvertible & StatementColumnConvertible>(atUncheckedIndex index: Int) -> Value {
func fastDecode<Value: DatabaseValueConvertible & StatementColumnConvertible>(
_ type: Value.Type,
atUncheckedIndex index: Int) -> Value
{
let mappedIndex = mapping.baseColumnIndex(atMappingIndex: index)
return base.impl.fastValue(atUncheckedIndex: mappedIndex)
return Value.fastDecode(from: base, atUncheckedIndex: mappedIndex)
}
func fastValue<Value: DatabaseValueConvertible & StatementColumnConvertible>(atUncheckedIndex index: Int) -> Value? {
func fastDecodeIfPresent<Value: DatabaseValueConvertible & StatementColumnConvertible>(
_ type: Value.Type,
atUncheckedIndex index: Int) -> Value?
{
let mappedIndex = mapping.baseColumnIndex(atMappingIndex: index)
return base.impl.fastValue(atUncheckedIndex: mappedIndex)
return Value.fastDecodeIfPresent(from: base, atUncheckedIndex: mappedIndex)
}
func dataNoCopy(atUncheckedIndex index:Int) -> Data? {
let mappedIndex = mapping.baseColumnIndex(atMappingIndex: index)
return base.impl.dataNoCopy(atUncheckedIndex: mappedIndex)
+23 -83
View File
@@ -54,9 +54,10 @@ public class Statement {
var sqliteStatement: SQLiteStatement? = nil
// sqlite3_prepare_v3 was introduced in SQLite 3.20.0 http://www.sqlite.org/changes.html#version_3_20
#if GRDBCUSTOMSQLITE
#if GRDBCUSTOMSQLITE || GRDBCIPHER
let code = sqlite3_prepare_v3(database.sqliteConnection, statementStart, -1, UInt32(bitPattern: prepFlags), &sqliteStatement, statementEnd)
#else
// TODO: use sqlite3_prepare_v3 if #available(iOS 12.0, OSX 10.14, watchOS 5.0, *)
let code = sqlite3_prepare_v2(database.sqliteConnection, statementStart, -1, &sqliteStatement, statementEnd)
#endif
@@ -356,12 +357,12 @@ public final class SelectStatement : Statement {
/// Creates a cursor over the statement. This cursor does not produce any
/// value, and is only intended to give access to the sqlite3_step()
/// low-level function.
func cursor(arguments: StatementArguments? = nil) -> StatementCursor {
func makeCursor(arguments: StatementArguments? = nil) -> StatementCursor {
return StatementCursor(statement: self, arguments: arguments)
}
/// Utility function for cursors
func cursorReset(arguments: StatementArguments? = nil) {
func reset(withArguments arguments: StatementArguments? = nil) {
SchedulingWatchdog.preconditionValidQueue(database)
prepare(withArguments: arguments)
reset()
@@ -371,12 +372,13 @@ public final class SelectStatement : Statement {
// Hide AuthorizedStatement from Jazzy
extension SelectStatement: AuthorizedStatement { }
// TODO: remove public qualifier, or expose SelectStatement.makeCursor()
/// A cursor that iterates a database statement without producing any value.
/// For example:
///
/// try dbQueue.read { db in
/// let statement = db.makeSelectStatement("SELECT * FROM player")
/// let cursor: StatementCursor = statement.cursor()
/// let cursor: StatementCursor = statement.makeCursor()
/// }
public final class StatementCursor: Cursor {
public let statement: SelectStatement
@@ -387,12 +389,16 @@ public final class StatementCursor: Cursor {
fileprivate init(statement: SelectStatement, arguments: StatementArguments? = nil) {
self.statement = statement
self.sqliteStatement = statement.sqliteStatement
statement.cursorReset(arguments: arguments)
statement.reset(withArguments: arguments)
}
/// :nodoc:
public func next() throws -> Void? {
if done { return nil }
if done {
// make sure this instance never yields a value again, even if the
// statement is reset by another cursor.
return nil
}
switch sqlite3_step(sqliteStatement) {
case SQLITE_DONE:
done = true
@@ -580,13 +586,21 @@ extension UpdateStatement: AuthorizedStatement { }
///
/// ## Mixed Arguments
///
/// When a statement consumes a mix of named and positional arguments, it
/// prefers named arguments over positional ones. For example:
/// It is possible to mix named and positional arguments. Yet this is usually
/// confusing, and it is best to avoid this practice:
///
/// let sql = "SELECT ?2 AS two, :foo AS foo, ?1 AS one, :foo AS foo2, :bar AS bar"
/// let row = try Row.fetchOne(db, sql, arguments: [1, 2, "bar"] + ["foo": "foo"])!
/// var arguments: StatementArguments = [1, 2, "bar"] + ["foo": "foo"]
/// let row = try Row.fetchOne(db, sql, arguments: arguments)!
/// print(row)
/// // Prints [two:2 foo:"foo" one:1 foo2:"foo" bar:"bar"]
///
/// Mixed arguments exist as a support for requests like the following:
///
/// let players = try Player
/// .filter(sql: "team = :team", arguments: ["team": "Blue"])
/// .filter(sql: "score > ?", arguments: [1000])
/// .fetchAll(db)
public struct StatementArguments: CustomStringConvertible, Equatable, ExpressibleByArrayLiteral, ExpressibleByDictionaryLiteral {
private(set) var values: [DatabaseValue] = []
private(set) var namedValues: [String: DatabaseValue] = [:]
@@ -904,77 +918,3 @@ extension StatementArguments {
return "[" + (namedValuesDescriptions + valuesDescriptions).joined(separator: ", ") + "]"
}
}
/// A thread-unsafe statement cache
struct StatementCache {
unowned let db: Database
private var selectStatements: [String: SelectStatement] = [:]
private var updateStatements: [String: UpdateStatement] = [:]
init(database: Database) {
self.db = database
}
mutating func selectStatement(_ sql: String) throws -> SelectStatement {
if let statement = selectStatements[sql] {
return statement
}
#if GRDBCUSTOMSQLITE
// http://www.sqlite.org/c3ref/c_prepare_persistent.html#sqlitepreparepersistent
// > The SQLITE_PREPARE_PERSISTENT flag is a hint to the query
// > planner that the prepared statement will be retained for a long
// > time and probably reused many times.
//
// This looks like a perfect match for cached statements.
//
// However SQLITE_PREPARE_PERSISTENT was only introduced in
// SQLite 3.20.0 http://www.sqlite.org/changes.html#version_3_20
let statement = try db.makeSelectStatement(sql, prepFlags: SQLITE_PREPARE_PERSISTENT)
#else
let statement = try db.makeSelectStatement(sql)
#endif
selectStatements[sql] = statement
return statement
}
mutating func updateStatement(_ sql: String) throws -> UpdateStatement {
if let statement = updateStatements[sql] {
return statement
}
#if GRDBCUSTOMSQLITE
// http://www.sqlite.org/c3ref/c_prepare_persistent.html#sqlitepreparepersistent
// > The SQLITE_PREPARE_PERSISTENT flag is a hint to the query
// > planner that the prepared statement will be retained for a long
// > time and probably reused many times.
//
// This looks like a perfect match for cached statements.
//
// However SQLITE_PREPARE_PERSISTENT was only introduced in
// SQLite 3.20.0 http://www.sqlite.org/changes.html#version_3_20
let statement = try db.makeUpdateStatement(sql, prepFlags: SQLITE_PREPARE_PERSISTENT)
#else
let statement = try db.makeUpdateStatement(sql)
#endif
updateStatements[sql] = statement
return statement
}
mutating func clear() {
updateStatements = [:]
selectStatements = [:]
}
mutating func remove(_ statement: SelectStatement) {
if let index = selectStatements.index(where: { $0.1 === statement }) {
selectStatements.remove(at: index)
}
}
mutating func remove(_ statement: UpdateStatement) {
if let index = updateStatements.index(where: { $0.1 === statement }) {
updateStatements.remove(at: index)
}
}
}
+45 -54
View File
@@ -50,27 +50,6 @@ public protocol StatementColumnConvertible {
init(sqliteStatement: SQLiteStatement, index: Int32)
}
extension StatementColumnConvertible {
@inline(__always)
static func losslessConvert(sqliteStatement: SQLiteStatement, index: Int32) -> Self? {
guard sqlite3_column_type(sqliteStatement, index) != SQLITE_NULL else {
return nil
}
return self.init(sqliteStatement: sqliteStatement, index: index)
}
@inline(__always)
static func losslessConvert(sqliteStatement: SQLiteStatement, index: Int32) -> Self {
guard sqlite3_column_type(sqliteStatement, index) != SQLITE_NULL else {
// Programmer error
fatalError("could not convert database value NULL to \(Self.self)")
}
return self.init(sqliteStatement: sqliteStatement, index: index)
}
}
/// A cursor of database values extracted from a single column.
/// For example:
///
@@ -80,7 +59,7 @@ extension StatementColumnConvertible {
/// print(name)
/// }
/// }
public final class ColumnCursor<Value: DatabaseValueConvertible & StatementColumnConvertible> : Cursor {
public final class FastDatabaseValueCursor<Value: DatabaseValueConvertible & StatementColumnConvertible> : Cursor {
private let statement: SelectStatement
private let sqliteStatement: SQLiteStatement
private let columnIndex: Int32
@@ -88,28 +67,29 @@ public final class ColumnCursor<Value: DatabaseValueConvertible & StatementColum
init(statement: SelectStatement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws {
self.statement = statement
// We'll read from leftmost column at index 0, unless adapter mangles columns
self.columnIndex = try Int32(adapter?.baseColumnIndex(atIndex: 0, layout: statement) ?? 0)
self.sqliteStatement = statement.sqliteStatement
statement.cursorReset(arguments: arguments)
if let adapter = adapter {
// adapter may redefine the index of the leftmost column
self.columnIndex = try Int32(adapter.baseColumnIndex(atIndex: 0, layout: statement))
} else {
self.columnIndex = 0
}
statement.reset(withArguments: arguments)
}
/// :nodoc:
public func next() throws -> Value? {
if done { return nil }
if done {
// make sure this instance never yields a value again, even if the
// statement is reset by another cursor.
return nil
}
switch sqlite3_step(sqliteStatement) {
case SQLITE_DONE:
done = true
return nil
case SQLITE_ROW:
if sqlite3_column_type(sqliteStatement, columnIndex) == SQLITE_NULL {
var error = "could not convert database value NULL to \(Value.self) with statement `\(statement.sql)`"
if !statement.arguments.isEmpty {
error += " arguments \(statement.arguments)"
}
fatalError(error)
}
return Value(sqliteStatement: sqliteStatement, index: columnIndex)
return Value.fastDecode(from: sqliteStatement, index: columnIndex)
case let code:
statement.database.selectStatementDidFail(statement)
throw DatabaseError(resultCode: code, message: statement.database.lastErrorMessage, sql: statement.sql, arguments: statement.arguments)
@@ -117,6 +97,9 @@ public final class ColumnCursor<Value: DatabaseValueConvertible & StatementColum
}
}
@available(*, deprecated, renamed: "FastDatabaseValueCursor")
public typealias ColumnCursor<Value: DatabaseValueConvertible & StatementColumnConvertible> = FastDatabaseValueCursor<Value>
/// A cursor of optional database values extracted from a single column.
/// For example:
///
@@ -126,7 +109,7 @@ public final class ColumnCursor<Value: DatabaseValueConvertible & StatementColum
/// print(email ?? "<NULL>")
/// }
/// }
public final class NullableColumnCursor<Value: DatabaseValueConvertible & StatementColumnConvertible> : Cursor {
public final class FastNullableDatabaseValueCursor<Value: DatabaseValueConvertible & StatementColumnConvertible> : Cursor {
private let statement: SelectStatement
private let sqliteStatement: SQLiteStatement
private let columnIndex: Int32
@@ -134,24 +117,29 @@ public final class NullableColumnCursor<Value: DatabaseValueConvertible & Statem
init(statement: SelectStatement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws {
self.statement = statement
// We'll read from leftmost column at index 0, unless adapter mangles columns
self.columnIndex = try Int32(adapter?.baseColumnIndex(atIndex: 0, layout: statement) ?? 0)
self.sqliteStatement = statement.sqliteStatement
statement.cursorReset(arguments: arguments)
if let adapter = adapter {
// adapter may redefine the index of the leftmost column
self.columnIndex = try Int32(adapter.baseColumnIndex(atIndex: 0, layout: statement))
} else {
self.columnIndex = 0
}
statement.reset(withArguments: arguments)
}
/// :nodoc:
public func next() throws -> Value?? {
if done { return nil }
if done {
// make sure this instance never yields a value again, even if the
// statement is reset by another cursor.
return nil
}
switch sqlite3_step(sqliteStatement) {
case SQLITE_DONE:
done = true
return nil
case SQLITE_ROW:
if sqlite3_column_type(sqliteStatement, columnIndex) == SQLITE_NULL {
return .some(nil)
}
return Value(sqliteStatement: sqliteStatement, index: columnIndex)
return Value.fastDecodeIfPresent(from: sqliteStatement, atUncheckedIndex: columnIndex)
case let code:
statement.database.selectStatementDidFail(statement)
throw DatabaseError(resultCode: code, message: statement.database.lastErrorMessage, sql: statement.sql, arguments: statement.arguments)
@@ -159,6 +147,9 @@ public final class NullableColumnCursor<Value: DatabaseValueConvertible & Statem
}
}
@available(*, deprecated, renamed: "FastNullableDatabaseValueCursor")
public typealias NullableColumnCursor<Value: DatabaseValueConvertible & StatementColumnConvertible> = FastNullableDatabaseValueCursor<Value>
/// Types that adopt both DatabaseValueConvertible and
/// StatementColumnConvertible can be efficiently initialized from
/// database values.
@@ -188,8 +179,8 @@ extension DatabaseValueConvertible where Self: StatementColumnConvertible {
/// - adapter: Optional RowAdapter
/// - returns: A cursor over fetched values.
/// - throws: A DatabaseError is thrown whenever an SQLite error occurs.
public static func fetchCursor(_ statement: SelectStatement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws -> ColumnCursor<Self> {
return try ColumnCursor(statement: statement, arguments: arguments, adapter: adapter)
public static func fetchCursor(_ statement: SelectStatement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws -> FastDatabaseValueCursor<Self> {
return try FastDatabaseValueCursor(statement: statement, arguments: arguments, adapter: adapter)
}
/// Returns an array of values fetched from a prepared statement.
@@ -220,7 +211,7 @@ extension DatabaseValueConvertible where Self: StatementColumnConvertible {
/// - throws: A DatabaseError is thrown whenever an SQLite error occurs.
public static func fetchOne(_ statement: SelectStatement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws -> Self? {
// fetchOne returns nil if there is no row, or if there is a row with a null value
let cursor = try NullableColumnCursor<Self>(statement: statement, arguments: arguments, adapter: adapter)
let cursor = try FastNullableDatabaseValueCursor<Self>(statement: statement, arguments: arguments, adapter: adapter)
return try cursor.next() ?? nil
}
}
@@ -248,7 +239,7 @@ extension DatabaseValueConvertible where Self: StatementColumnConvertible {
/// - adapter: Optional RowAdapter
/// - returns: A cursor over fetched values.
/// - throws: A DatabaseError is thrown whenever an SQLite error occurs.
public static func fetchCursor(_ db: Database, _ sql: String, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws -> ColumnCursor<Self> {
public static func fetchCursor(_ db: Database, _ sql: String, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws -> FastDatabaseValueCursor<Self> {
return try fetchCursor(db, SQLRequest<Void>(sql, arguments: arguments, adapter: adapter))
}
@@ -305,7 +296,7 @@ extension DatabaseValueConvertible where Self: StatementColumnConvertible {
/// - request: A FetchRequest.
/// - returns: A cursor over fetched values.
/// - throws: A DatabaseError is thrown whenever an SQLite error occurs.
public static func fetchCursor<R: FetchRequest>(_ db: Database, _ request: R) throws -> ColumnCursor<Self> {
public static func fetchCursor<R: FetchRequest>(_ db: Database, _ request: R) throws -> FastDatabaseValueCursor<Self> {
let (statement, adapter) = try request.prepare(db)
return try fetchCursor(statement, adapter: adapter)
}
@@ -361,7 +352,7 @@ extension FetchRequest where RowDecoder: DatabaseValueConvertible & StatementCol
/// - parameter db: A database connection.
/// - returns: A cursor over fetched values.
/// - throws: A DatabaseError is thrown whenever an SQLite error occurs.
public func fetchCursor(_ db: Database) throws -> ColumnCursor<RowDecoder> {
public func fetchCursor(_ db: Database) throws -> FastDatabaseValueCursor<RowDecoder> {
return try RowDecoder.fetchCursor(db, self)
}
@@ -427,8 +418,8 @@ extension Optional where Wrapped: DatabaseValueConvertible & StatementColumnConv
/// - adapter: Optional RowAdapter
/// - returns: A cursor over fetched optional values.
/// - throws: A DatabaseError is thrown whenever an SQLite error occurs.
public static func fetchCursor(_ statement: SelectStatement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws -> NullableColumnCursor<Wrapped> {
return try NullableColumnCursor(statement: statement, arguments: arguments, adapter: adapter)
public static func fetchCursor(_ statement: SelectStatement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws -> FastNullableDatabaseValueCursor<Wrapped> {
return try FastNullableDatabaseValueCursor(statement: statement, arguments: arguments, adapter: adapter)
}
/// Returns an array of optional values fetched from a prepared statement.
@@ -470,7 +461,7 @@ extension Optional where Wrapped: DatabaseValueConvertible & StatementColumnConv
/// - adapter: Optional RowAdapter
/// - returns: A cursor over fetched optional values.
/// - throws: A DatabaseError is thrown whenever an SQLite error occurs.
public static func fetchCursor(_ db: Database, _ sql: String, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws -> NullableColumnCursor<Wrapped> {
public static func fetchCursor(_ db: Database, _ sql: String, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws -> FastNullableDatabaseValueCursor<Wrapped> {
return try fetchCursor(db, SQLRequest<Void>(sql, arguments: arguments, adapter: adapter))
}
@@ -512,7 +503,7 @@ extension Optional where Wrapped: DatabaseValueConvertible & StatementColumnConv
/// - request: A FetchRequest.
/// - returns: A cursor over fetched optional values.
/// - throws: A DatabaseError is thrown whenever an SQLite error occurs.
public static func fetchCursor<R: FetchRequest>(_ db: Database, _ request: R) throws -> NullableColumnCursor<Wrapped> {
public static func fetchCursor<R: FetchRequest>(_ db: Database, _ request: R) throws -> FastNullableDatabaseValueCursor<Wrapped> {
let (statement, adapter) = try request.prepare(db)
return try fetchCursor(statement, adapter: adapter)
}
@@ -553,7 +544,7 @@ extension FetchRequest where RowDecoder: _OptionalProtocol, RowDecoder._Wrapped:
/// - parameter db: A database connection.
/// - returns: A cursor over fetched values.
/// - throws: A DatabaseError is thrown whenever an SQLite error occurs.
public func fetchCursor(_ db: Database) throws -> NullableColumnCursor<RowDecoder._Wrapped> {
public func fetchCursor(_ db: Database) throws -> FastNullableDatabaseValueCursor<RowDecoder._Wrapped> {
return try Optional<RowDecoder._Wrapped>.fetchCursor(db, self)
}
+1 -1
View File
@@ -1,4 +1,4 @@
#if !os(Linux)
#if canImport(CoreGraphics)
import CoreGraphics
/// CGFloat adopts DatabaseValueConvertible
+10 -4
View File
@@ -8,8 +8,8 @@ import Foundation
/// Data is convertible to and from DatabaseValue.
extension Data : DatabaseValueConvertible, StatementColumnConvertible {
public init(sqliteStatement: SQLiteStatement, index: Int32) {
if let bytes = sqlite3_column_blob(sqliteStatement, Int32(index)) {
let count = Int(sqlite3_column_bytes(sqliteStatement, Int32(index)))
if let bytes = sqlite3_column_blob(sqliteStatement, index) {
let count = Int(sqlite3_column_bytes(sqliteStatement, index))
self.init(bytes: bytes, count: count) // copy bytes
} else {
self.init()
@@ -24,9 +24,15 @@ extension Data : DatabaseValueConvertible, StatementColumnConvertible {
/// Returns a Data initialized from *dbValue*, if it contains
/// a Blob.
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> Data? {
guard case .blob(let data) = dbValue.storage else {
switch dbValue.storage {
case .blob(let data):
return data
case .string(let string):
// Implicit conversion from string to blob, just as SQLite does
// See https://www.sqlite.org/c3ref/column_blob.html
return string.data(using: .utf8)
default:
return nil
}
return data
}
}
@@ -76,14 +76,14 @@ public struct DatabaseDateComponents : DatabaseValueConvertible, StatementColumn
/// - index: The column index.
public init(sqliteStatement: SQLiteStatement, index: Int32) {
guard let cString = sqlite3_column_text(sqliteStatement, index) else {
fatalError("could not convert database value \(DatabaseValue(sqliteStatement: sqliteStatement, index: index)) to DatabaseDateComponents")
fatalConversionError(to: DatabaseDateComponents.self, sqliteStatement: sqliteStatement, index: index)
}
let length = Int(sqlite3_column_bytes(sqliteStatement, index)) // avoid an strlen
let optionalComponents = cString.withMemoryRebound(to: Int8.self, capacity: length + 1 /* trailing \0 */) { cString in
SQLiteDateParser().components(cString: cString, length: length)
}
guard let components = optionalComponents else {
fatalError("could not convert database value \(String(cString: cString)) to DatabaseDateComponents")
fatalConversionError(to: DatabaseDateComponents.self, sqliteStatement: sqliteStatement, index: index)
}
self.dateComponents = components.dateComponents
self.format = components.format
+3 -5
View File
@@ -125,17 +125,15 @@ extension Date: StatementColumnConvertible {
public init(sqliteStatement: SQLiteStatement, index: Int32) {
switch sqlite3_column_type(sqliteStatement, index) {
case SQLITE_INTEGER, SQLITE_FLOAT:
self.init(timeIntervalSince1970: sqlite3_column_double(sqliteStatement, Int32(index)))
self.init(timeIntervalSince1970: sqlite3_column_double(sqliteStatement, index))
case SQLITE_TEXT:
let databaseDateComponents = DatabaseDateComponents(sqliteStatement: sqliteStatement, index: index)
guard let date = Date(databaseDateComponents: databaseDateComponents) else {
let dbValue = DatabaseValue(sqliteStatement: sqliteStatement, index: index)
fatalError("could not convert database value \(dbValue) to Date")
fatalConversionError(to: Date.self, sqliteStatement: sqliteStatement, index: index)
}
self.init(timeIntervalSinceReferenceDate: date.timeIntervalSinceReferenceDate)
default:
let dbValue = DatabaseValue(sqliteStatement: sqliteStatement, index: index)
fatalError("could not convert database value \(dbValue) to Date")
fatalConversionError(to: Date.self, sqliteStatement: sqliteStatement, index: index)
}
}
}
+68 -8
View File
@@ -1,10 +1,13 @@
import Foundation
#if SWIFT_PACKAGE
import CSQLite
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
import SQLite3
#endif
#if !os(Linux)
/// NSUUID adopts DatabaseValueConvertible
extension NSUUID : DatabaseValueConvertible {
/// Returns a value that can be stored in the database.
extension NSUUID: DatabaseValueConvertible {
public var databaseValue: DatabaseValue {
var uuidBytes = ContiguousArray(repeating: UInt8(0), count: 16)
return uuidBytes.withUnsafeMutableBufferPointer { buffer in
@@ -13,15 +16,72 @@ extension NSUUID : DatabaseValueConvertible {
}
}
/// Returns an NSUUID initialized from *dbValue*, if possible.
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> Self? {
guard let data = NSData.fromDatabaseValue(dbValue), data.length == 16 else {
switch dbValue.storage {
case .blob(let data) where data.count == 16:
// The code below works in debug configuration, but crashes in
// release configuration (Xcode 9.4.1)
// return data.withUnsafeBytes {
// self.init(uuidBytes: $0)
// }
// Workaround (involves a useless copy)
let buffer = UnsafeMutableBufferPointer<UInt8>.allocate(capacity: 16)
_ = data.copyBytes(to: buffer)
let uuid = self.init(uuidBytes: UnsafePointer(buffer.baseAddress!))
buffer.deallocate()
return uuid
case .string(let string):
return self.init(uuidString: string)
default:
return nil
}
return self.init(uuidBytes: data.bytes.assumingMemoryBound(to: UInt8.self))
}
}
}
#endif
/// UUID adopts DatabaseValueConvertible
extension UUID : DatabaseValueConvertible { }
extension UUID: DatabaseValueConvertible {
public var databaseValue: DatabaseValue {
var uuid_t = uuid
return withUnsafeBytes(of: &uuid_t) {
Data(bytes: $0.baseAddress!, count: $0.count).databaseValue
}
}
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> UUID? {
switch dbValue.storage {
case .blob(let data) where data.count == 16:
return data.withUnsafeBytes {
UUID(uuid: $0.pointee)
}
case .string(let string):
return UUID(uuidString: string)
default:
return nil
}
}
}
extension UUID: StatementColumnConvertible {
public init(sqliteStatement: SQLiteStatement, index: Int32) {
switch sqlite3_column_type(sqliteStatement, index) {
case SQLITE_TEXT:
let string = String(cString: sqlite3_column_text(sqliteStatement, index)!)
guard let uuid = UUID(uuidString: string) else {
fatalConversionError(to: UUID.self, sqliteStatement: sqliteStatement, index: index)
}
self.init(uuid: uuid.uuid)
case SQLITE_BLOB:
guard sqlite3_column_bytes(sqliteStatement, index) == 16,
let blob = sqlite3_column_blob(sqliteStatement, index) else
{
fatalConversionError(to: UUID.self, sqliteStatement: sqliteStatement, index: index)
}
self.init(uuid: blob.assumingMemoryBound(to: uuid_t.self).pointee)
default:
fatalConversionError(to: UUID.self, sqliteStatement: sqliteStatement, index: index)
}
}
}
@@ -15,20 +15,117 @@ private struct DatabaseValueDecodingContainer: SingleValueDecodingContainer {
/// - returns: A value of the requested type.
/// - throws: `DecodingError.typeMismatch` if the encountered encoded value cannot be converted to the requested type.
/// - throws: `DecodingError.valueNotFound` if the encountered encoded value is null.
func decode(_ type: Bool.Type) throws -> Bool { return dbValue.losslessConvert() }
func decode(_ type: Int.Type) throws -> Int { return dbValue.losslessConvert() }
func decode(_ type: Int8.Type) throws -> Int8 { return dbValue.losslessConvert() }
func decode(_ type: Int16.Type) throws -> Int16 { return dbValue.losslessConvert() }
func decode(_ type: Int32.Type) throws -> Int32 { return dbValue.losslessConvert() }
func decode(_ type: Int64.Type) throws -> Int64 { return dbValue.losslessConvert() }
func decode(_ type: UInt.Type) throws -> UInt { return dbValue.losslessConvert() }
func decode(_ type: UInt8.Type) throws -> UInt8 { return dbValue.losslessConvert() }
func decode(_ type: UInt16.Type) throws -> UInt16 { return dbValue.losslessConvert() }
func decode(_ type: UInt32.Type) throws -> UInt32 { return dbValue.losslessConvert() }
func decode(_ type: UInt64.Type) throws -> UInt64 { return dbValue.losslessConvert() }
func decode(_ type: Float.Type) throws -> Float { return dbValue.losslessConvert() }
func decode(_ type: Double.Type) throws -> Double { return dbValue.losslessConvert() }
func decode(_ type: String.Type) throws -> String { return dbValue.losslessConvert() }
func decode(_ type: Bool.Type) throws -> Bool {
if let result = Bool.fromDatabaseValue(dbValue) {
return result
} else {
throw DecodingError.dataCorruptedError(in: self, debugDescription: "value mismatch")
}
}
func decode(_ type: Int.Type) throws -> Int {
if let result = Int.fromDatabaseValue(dbValue) {
return result
} else {
throw DecodingError.dataCorruptedError(in: self, debugDescription: "value mismatch")
}
}
func decode(_ type: Int8.Type) throws -> Int8 {
if let result = Int8.fromDatabaseValue(dbValue) {
return result
} else {
throw DecodingError.dataCorruptedError(in: self, debugDescription: "value mismatch")
}
}
func decode(_ type: Int16.Type) throws -> Int16 {
if let result = Int16.fromDatabaseValue(dbValue) {
return result
} else {
throw DecodingError.dataCorruptedError(in: self, debugDescription: "value mismatch")
}
}
func decode(_ type: Int32.Type) throws -> Int32 {
if let result = Int32.fromDatabaseValue(dbValue) {
return result
} else {
throw DecodingError.dataCorruptedError(in: self, debugDescription: "value mismatch")
}
}
func decode(_ type: Int64.Type) throws -> Int64 {
if let result = Int64.fromDatabaseValue(dbValue) {
return result
} else {
throw DecodingError.dataCorruptedError(in: self, debugDescription: "value mismatch")
}
}
func decode(_ type: UInt.Type) throws -> UInt {
if let result = UInt.fromDatabaseValue(dbValue) {
return result
} else {
throw DecodingError.dataCorruptedError(in: self, debugDescription: "value mismatch")
}
}
func decode(_ type: UInt8.Type) throws -> UInt8 {
if let result = UInt8.fromDatabaseValue(dbValue) {
return result
} else {
throw DecodingError.dataCorruptedError(in: self, debugDescription: "value mismatch")
}
}
func decode(_ type: UInt16.Type) throws -> UInt16 {
if let result = UInt16.fromDatabaseValue(dbValue) {
return result
} else {
throw DecodingError.dataCorruptedError(in: self, debugDescription: "value mismatch")
}
}
func decode(_ type: UInt32.Type) throws -> UInt32 {
if let result = UInt32.fromDatabaseValue(dbValue) {
return result
} else {
throw DecodingError.dataCorruptedError(in: self, debugDescription: "value mismatch")
}
}
func decode(_ type: UInt64.Type) throws -> UInt64 {
if let result = UInt64.fromDatabaseValue(dbValue) {
return result
} else {
throw DecodingError.dataCorruptedError(in: self, debugDescription: "value mismatch")
}
}
func decode(_ type: Float.Type) throws -> Float {
if let result = Float.fromDatabaseValue(dbValue) {
return result
} else {
throw DecodingError.dataCorruptedError(in: self, debugDescription: "value mismatch")
}
}
func decode(_ type: Double.Type) throws -> Double {
if let result = Double.fromDatabaseValue(dbValue) {
return result
} else {
throw DecodingError.dataCorruptedError(in: self, debugDescription: "value mismatch")
}
}
func decode(_ type: String.Type) throws -> String {
if let result = String.fromDatabaseValue(dbValue) {
return result
} else {
throw DecodingError.dataCorruptedError(in: self, debugDescription: "value mismatch")
}
}
/// Decodes a single value of the given type.
///
@@ -41,7 +138,11 @@ private struct DatabaseValueDecodingContainer: SingleValueDecodingContainer {
// Prefer DatabaseValueConvertible decoding over Decodable.
// This allows custom database decoding, such as decoding Date from
// String, for example.
return type.fromDatabaseValue(dbValue) as! T
if let result = type.fromDatabaseValue(dbValue) {
return result as! T
} else {
throw DecodingError.dataCorruptedError(in: self, debugDescription: "value mismatch")
}
} else {
return try T(from: DatabaseValueDecoder(dbValue: dbValue, codingPath: codingPath))
}
@@ -105,7 +105,7 @@ extension Int: DatabaseValueConvertible, StatementColumnConvertible {
if let v = Int(exactly: int64) {
self = v
} else {
fatalError("could not convert database value \(int64) to Int")
fatalConversionError(to: Int.self, sqliteStatement: sqliteStatement, index: index)
}
}
@@ -133,7 +133,7 @@ extension Int8: DatabaseValueConvertible, StatementColumnConvertible {
if let v = Int8(exactly: int64) {
self = v
} else {
fatalError("could not convert database value \(int64) to Int8")
fatalConversionError(to: Int8.self, sqliteStatement: sqliteStatement, index: index)
}
}
@@ -161,7 +161,7 @@ extension Int16: DatabaseValueConvertible, StatementColumnConvertible {
if let v = Int16(exactly: int64) {
self = v
} else {
fatalError("could not convert database value \(int64) to Int16")
fatalConversionError(to: Int16.self, sqliteStatement: sqliteStatement, index: index)
}
}
@@ -189,7 +189,7 @@ extension Int32: DatabaseValueConvertible, StatementColumnConvertible {
if let v = Int32(exactly: int64) {
self = v
} else {
fatalError("could not convert database value \(int64) to Int32")
fatalConversionError(to: Int32.self, sqliteStatement: sqliteStatement, index: index)
}
}
@@ -249,7 +249,7 @@ extension UInt: DatabaseValueConvertible, StatementColumnConvertible {
if let v = UInt(exactly: int64) {
self = v
} else {
fatalError("could not convert database value \(int64) to UInt")
fatalConversionError(to: UInt.self, sqliteStatement: sqliteStatement, index: index)
}
}
@@ -277,7 +277,7 @@ extension UInt8: DatabaseValueConvertible, StatementColumnConvertible {
if let v = UInt8(exactly: int64) {
self = v
} else {
fatalError("could not convert database value \(int64) to UInt8")
fatalConversionError(to: UInt8.self, sqliteStatement: sqliteStatement, index: index)
}
}
@@ -305,7 +305,7 @@ extension UInt16: DatabaseValueConvertible, StatementColumnConvertible {
if let v = UInt16(exactly: int64) {
self = v
} else {
fatalError("could not convert database value \(int64) to UInt16")
fatalConversionError(to: UInt16.self, sqliteStatement: sqliteStatement, index: index)
}
}
@@ -333,7 +333,7 @@ extension UInt32: DatabaseValueConvertible, StatementColumnConvertible {
if let v = UInt32(exactly: int64) {
self = v
} else {
fatalError("could not convert database value \(int64) to UInt32")
fatalConversionError(to: UInt32.self, sqliteStatement: sqliteStatement, index: index)
}
}
@@ -361,7 +361,7 @@ extension UInt64: DatabaseValueConvertible, StatementColumnConvertible {
if let v = UInt64(exactly: int64) {
self = v
} else {
fatalError("could not convert database value \(int64) to UInt64")
fatalConversionError(to: UInt64.self, sqliteStatement: sqliteStatement, index: index)
}
}
@@ -445,7 +445,7 @@ extension String: DatabaseValueConvertible, StatementColumnConvertible {
/// - sqliteStatement: A pointer to an SQLite statement.
/// - index: The column index.
public init(sqliteStatement: SQLiteStatement, index: Int32) {
self = String(cString: sqlite3_column_text(sqliteStatement, Int32(index))!)
self = String(cString: sqlite3_column_text(sqliteStatement, index)!)
}
/// Returns a value that can be stored in the database.
@@ -456,6 +456,10 @@ extension String: DatabaseValueConvertible, StatementColumnConvertible {
/// Returns a String initialized from *dbValue*, if possible.
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> String? {
switch dbValue.storage {
case .blob(let data):
// Implicit conversion from blob to string, just as SQLite does
// See https://www.sqlite.org/c3ref/column_blob.html
return String(data: data, encoding: .utf8)
case .string(let string):
return string
default:
+64
View File
@@ -130,6 +130,70 @@
}
static func api(_ db: Database) -> UnsafePointer<fts5_api> {
// Access to FTS5 is one of the rare SQLite api which was broken in
// SQLite 3.20.0+, for security reasons:
//
// Starting SQLite 3.20.0+, we need to use the new sqlite3_bind_pointer api.
// The previous way to access FTS5 does not work any longer.
//
// So let's see which SQLite version we are linked against:
#if GRDBCUSTOMSQLITE || GRDBCIPHER
// GRDB is linked against SQLCipher or a custom SQLite build: SQLite 3.20.0 or more.
return api_v2(db, sqlite3_prepare_v3, sqlite3_bind_pointer)
#else
// GRDB is linked against the system SQLite.
//
// Do we use SQLite 3.19.3 (iOS 11.4), or SQLite 3.24.0 (iOS 12.0)?
// We need to check for available(iOS 12.0, OSX 10.14, watchOS 5.0, *).
//
// This test requires the Swift 4.2 compiler.
//
// It does not need the Swift 4.2 language, though: the Swift 4.2
// compiler running in Swift 4.0 compatibility mode is OK.
//
// On top of that, we want to preserve compatibility with Xcode 9.3+.
//
// So let's check exactly which compiler version we are using.
//
// Fortunately, this horribly complex check has been solved
// by @hartbit: see https://forums.swift.org/t/compiler-version-directive/11952
// and https://github.com/hartbit/swift-evolution/blob/compiler-directive/proposals/XXXX-compiler-version-directive.md
#if swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))
if #available(iOS 12.0, OSX 10.14, watchOS 5.0, *) {
// SQLite 3.24.0 or more
// setup: Xcode 10.0, SWIFT_VERSION = 4.0, iOS 12
// setup: Xcode 10.0, SWIFT_VERSION = 4.2, iOS 12
return api_v2(db, sqlite3_prepare_v3, sqlite3_bind_pointer)
} else {
// SQLite 3.19.3 or less
// setup: Xcode 10.0, SWIFT_VERSION = 4.0, iOS 11
// setup: Xcode 10.0, SWIFT_VERSION = 4.2, iOS 11
return api_v1(db)
}
#else
// SQLite 3.19.3 or less
// setup: Xcode 9.4.1, iOS 11
return api_v1(db)
#endif
#endif
}
private static func api_v1(_ db: Database) -> UnsafePointer<fts5_api> {
guard let data = try! Data.fetchOne(db, "SELECT fts5()") else {
fatalError("FTS5 is not available")
}
return data.withUnsafeBytes { $0.pointee }
}
// Technique given by Jordan Rose:
// https://forums.swift.org/t/c-interoperability-combinations-of-library-and-os-versions/14029/4
private static func api_v2(
_ db: Database,
_ sqlite3_prepare_v3: @convention(c) (OpaquePointer?, UnsafePointer<Int8>?, Int32, UInt32, UnsafeMutablePointer<OpaquePointer?>?, UnsafeMutablePointer<UnsafePointer<Int8>?>?) -> Int32,
_ sqlite3_bind_pointer: @convention(c) (OpaquePointer?, Int32, UnsafeMutableRawPointer?, UnsafePointer<Int8>?, (@convention(c) (UnsafeMutableRawPointer?) -> Void)?) -> Int32)
-> UnsafePointer<fts5_api>
{
let sqliteConnection = db.sqliteConnection
var statement: SQLiteStatement? = nil
var api: UnsafePointer<fts5_api>? = nil
+1 -1
View File
@@ -75,7 +75,7 @@
}
}
try db.makeSelectStatement("SELECT * FROM document WHERE document MATCH ?")
.cursor(arguments: [rawPattern])
.makeCursor(arguments: [rawPattern])
.next() // error on next() for invalid patterns
}
} catch let error as DatabaseError {
+2
View File
@@ -184,6 +184,7 @@ public typealias TransactionObserverType = TransactionObserver
@available(*, unavailable, renamed:"Column")
public typealias SQLColumn = Column
/// :nodoc:
extension SQLSpecificExpressible {
@available(*, unavailable, renamed:"capitalized")
public var capitalizedString: SQLExpression { get { return capitalized } }
@@ -195,6 +196,7 @@ extension SQLSpecificExpressible {
public var uppercaseString: SQLExpression { get { return uppercased } }
}
/// :nodoc:
@available(iOS 9.0, OSX 10.11, watchOS 3.0, *)
extension SQLSpecificExpressible {
@available(*, unavailable, renamed:"localizedCapitalized")
@@ -59,7 +59,7 @@ public protocol Association: DerivableRequest {
}
extension Association {
/// Creates an association with a new set of selected columns.
/// Creates an association which selects *selection*.
///
/// struct Player: TableRecord {
/// static let team = belongsTo(Team.self)
@@ -47,7 +47,7 @@ extension QueryInterfaceRequest : DerivableRequest, AggregatingRequest {
// MARK: Request Derivation
/// Creates a request with a new set of selected columns.
/// Creates a request which selects *selection*.
///
/// // SELECT id, email FROM player
/// var request = Player.all()
@@ -63,6 +63,42 @@ extension QueryInterfaceRequest : DerivableRequest, AggregatingRequest {
return QueryInterfaceRequest(query: query.select(selection))
}
/// Creates a request which selects *selection*, and fetches values of
/// type *type*.
///
/// try dbQueue.read { db in
/// // SELECT max(score) FROM player
/// let request = Player.all().select([max(Column("score"))], as: Int.self)
/// let maxScore: Int? = try request.fetchOne(db)
/// }
public func select<RowDecoder>(_ selection: [SQLSelectable], as type: RowDecoder.Type) -> QueryInterfaceRequest<RowDecoder> {
return QueryInterfaceRequest<RowDecoder>(query: query.select(selection))
}
/// Creates a request which selects *selection*, and fetches values of
/// type *type*.
///
/// try dbQueue.read { db in
/// // SELECT max(score) FROM player
/// let request = Player.all().select(max(Column("score")), as: Int.self)
/// let maxScore: Int? = try request.fetchOne(db)
/// }
public func select<RowDecoder>(_ selection: SQLSelectable..., as type: RowDecoder.Type) -> QueryInterfaceRequest<RowDecoder> {
return select(selection, as: type)
}
/// Creates a request which selects *sql*, and fetches values of
/// type *type*.
///
/// try dbQueue.read { db in
/// // SELECT max(score) FROM player
/// let request = Player.all().select(sql: "max(score)", as: Int.self)
/// let maxScore: Int? = try request.fetchOne(db)
/// }
public func select<RowDecoder>(sql: String, arguments: StatementArguments? = nil, as type: RowDecoder.Type) -> QueryInterfaceRequest<RowDecoder> {
return select(SQLSelectionLiteral(sql, arguments: arguments), as: type)
}
/// Creates a request which returns distinct rows.
///
/// // SELECT DISTINCT * FROM player
@@ -256,6 +292,42 @@ extension TableRecord {
return all().select(sql: sql, arguments: arguments)
}
/// Creates a request which selects *selection*, and fetches values of
/// type *type*.
///
/// try dbQueue.read { db in
/// // SELECT max(score) FROM player
/// let request = Player.select([max(Column("score"))], as: Int.self)
/// let maxScore: Int? = try request.fetchOne(db)
/// }
public static func select<RowDecoder>(_ selection: [SQLSelectable], as type: RowDecoder.Type) -> QueryInterfaceRequest<RowDecoder> {
return all().select(selection, as: type)
}
/// Creates a request which selects *selection*, and fetches values of
/// type *type*.
///
/// try dbQueue.read { db in
/// // SELECT max(score) FROM player
/// let request = Player.select(max(Column("score")), as: Int.self)
/// let maxScore: Int? = try request.fetchOne(db)
/// }
public static func select<RowDecoder>(_ selection: SQLSelectable..., as type: RowDecoder.Type) -> QueryInterfaceRequest<RowDecoder> {
return all().select(selection, as: type)
}
/// Creates a request which selects *sql*, and fetches values of
/// type *type*.
///
/// try dbQueue.read { db in
/// // SELECT max(score) FROM player
/// let request = Player.select(sql: "max(score)", as: Int.self)
/// let maxScore: Int? = try request.fetchOne(db)
/// }
public static func select<RowDecoder>(sql: String, arguments: StatementArguments? = nil, as type: RowDecoder.Type) -> QueryInterfaceRequest<RowDecoder> {
return all().select(sql: sql, arguments: arguments, as: type)
}
/// Creates a request with the provided *predicate*.
///
/// // SELECT * FROM player WHERE email = 'arthur@example.com'
+21 -3
View File
@@ -1,8 +1,10 @@
// MARK: - SelectionRequest
/// The protocol for all requests that can refine their selection.
///
/// :nodoc:
public protocol SelectionRequest {
/// Creates a request with a new set of selected columns.
/// Creates a request which selects *selection*.
///
/// // SELECT id, email FROM player
/// var request = Player.all()
@@ -17,8 +19,9 @@ public protocol SelectionRequest {
func select(_ selection: [SQLSelectable]) -> Self
}
/// :nodoc:
extension SelectionRequest {
/// Creates a request with a new set of selected columns.
/// Creates a request which selects *selection*.
///
/// // SELECT id, email FROM player
/// var request = Player.all()
@@ -34,7 +37,7 @@ extension SelectionRequest {
return select(selection)
}
/// Creates a request with a new set of selected columns.
/// Creates a request which selects *sql*.
///
/// // SELECT id, email FROM player
/// var request = Player.all()
@@ -54,6 +57,8 @@ extension SelectionRequest {
// MARK: - FilteredRequest
/// The protocol for all requests that can be filtered.
///
/// :nodoc:
public protocol FilteredRequest {
/// Creates a request with the provided *predicate promise* added to the
/// eventual set of already applied predicates.
@@ -64,6 +69,7 @@ public protocol FilteredRequest {
func filter(_ predicate: @escaping (Database) throws -> SQLExpressible) -> Self
}
/// :nodoc:
extension FilteredRequest {
/// Creates a request with the provided *predicate* added to the
/// eventual set of already applied predicates.
@@ -98,6 +104,8 @@ extension FilteredRequest {
// MARK: - TableRequest {
/// The protocol for all requests that feed from a database table
///
/// :nodoc:
public protocol TableRequest {
/// The name of the database table
var databaseTableName: String { get }
@@ -122,6 +130,7 @@ public protocol TableRequest {
func aliased(_ alias: TableAlias) -> Self
}
/// :nodoc:
extension TableRequest where Self: FilteredRequest {
/// Creates a request with the provided primary key *predicate*.
@@ -202,6 +211,7 @@ extension TableRequest where Self: FilteredRequest {
}
}
/// :nodoc:
extension TableRequest where Self: OrderedRequest {
/// Creates a request ordered by primary key.
public func orderByPrimaryKey() -> Self {
@@ -215,6 +225,8 @@ extension TableRequest where Self: OrderedRequest {
// MARK: - AggregatingRequest
/// The protocol for all requests that can aggregate.
///
/// :nodoc:
public protocol AggregatingRequest {
/// Creates a request grouped according to *expressions*.
func group(_ expressions: [SQLExpressible]) -> Self
@@ -224,6 +236,7 @@ public protocol AggregatingRequest {
func having(_ predicate: SQLExpressible) -> Self
}
/// :nodoc:
extension AggregatingRequest {
/// Creates a request grouped according to *expressions*.
public func group(_ expressions: SQLExpressible...) -> Self {
@@ -255,6 +268,8 @@ extension AggregatingRequest {
// MARK: - OrderedRequest
/// The protocol for all requests that be ordered.
///
/// :nodoc:
public protocol OrderedRequest {
/// Creates a request with the provided *orderings promise*.
///
@@ -285,6 +300,7 @@ public protocol OrderedRequest {
func reversed() -> Self
}
/// :nodoc:
extension OrderedRequest {
/// Creates a request with the provided *orderings*.
///
@@ -352,6 +368,8 @@ extension OrderedRequest {
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
///
/// The base protocol for all requests that can be refined.
///
/// :nodoc:
public protocol DerivableRequest: SelectionRequest, FilteredRequest, OrderedRequest {
associatedtype RowDecoder
}
@@ -7,6 +7,8 @@
///
/// // SELECT * FROM player WHERE email = 'arthur@example.com' COLLATE NOCASE
/// Player.filter(email == "arthur@example.com")
///
/// :nodoc:
public struct SQLCollatedExpression {
/// The tainted expression
public let expression: SQLExpression
@@ -48,6 +50,7 @@ public struct SQLCollatedExpression {
}
}
/// :nodoc:
extension SQLCollatedExpression : SQLOrderingTerm {
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
+1
View File
@@ -21,6 +21,7 @@ public protocol SQLCollection {
// MARK: Default Implementations
/// :nodoc:
extension SQLCollection {
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
///
@@ -30,7 +30,7 @@ extension SQLExpression {
///
/// SQLExpressionLiteral("1 + 2")
///
/// The SQL literal may contain `?` and colon-prefixed tokens:
/// The SQL literal may contain `?` and colon-prefixed arguments:
///
/// SQLExpressionLiteral("? + ?", arguments: [1, 2])
/// SQLExpressionLiteral(":one + :two", arguments: ["one": 1, "two": 2])
@@ -42,7 +42,7 @@ public struct SQLExpressionLiteral : SQLExpression {
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
///
/// Eventual arguments that feed the `?` and colon-prefixed tokens in the
/// Eventual arguments that feed the `?` and colon-prefixed arguments in the
/// SQL literal
public let arguments: StatementArguments?
@@ -121,20 +121,6 @@ public struct SQLUnaryOperator : Hashable {
self.sql = sql
self.needsRightSpace = needsRightSpace
}
/// The hash value
///
/// :nodoc:
public var hashValue: Int {
return sql.hashValue
}
/// Equality operator
///
/// :nodoc:
public static func == (lhs: SQLUnaryOperator, rhs: SQLUnaryOperator) -> Bool {
return lhs.sql == rhs.sql
}
}
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
@@ -227,15 +213,17 @@ public struct SQLBinaryOperator : Hashable {
return SQLBinaryOperator(negatedSQL, negated: sql)
}
/// The hash value
#if !swift(>=4.2)
/// :nodoc:
public var hashValue: Int {
return sql.hashValue
return sql.hashValue ^ (negatedSQL?.hashValue ?? 0)
}
/// Equality operator
/// :nodoc:
public static func == (lhs: SQLBinaryOperator, rhs: SQLBinaryOperator) -> Bool {
return lhs.sql == rhs.sql
return lhs.sql == rhs.sql && lhs.negatedSQL == rhs.negatedSQL
}
#endif
}
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
@@ -1,5 +1,9 @@
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
///
/// SQLGenerationContext is responsible for preventing SQL injection and
/// disambiguating table names when GRDB generates SQL queries.
///
/// :nodoc:
public struct SQLGenerationContext {
private(set) var arguments: StatementArguments?
private var resolvedNames: [TableAlias: String]
@@ -231,10 +235,17 @@ public class TableAlias: Hashable {
return expression.qualifiedExpression(with: self)
}
#if swift(>=4.2)
/// :nodoc:
public func hash(into hasher: inout Hasher) {
hasher.combine(ObjectIdentifier(root))
}
#else
/// :nodoc:
public var hashValue: Int {
return ObjectIdentifier(root).hashValue
}
#endif
/// :nodoc:
public static func == (lhs: TableAlias, rhs: TableAlias) -> Bool {
@@ -1,5 +1,6 @@
// MARK: - SQL Ordering Support
/// :nodoc:
extension SQLSpecificExpressible {
/// Returns a value that can be used as an argument to QueryInterfaceRequest.order()
@@ -20,6 +21,7 @@ extension SQLSpecificExpressible {
// MARK: - SQL Selection Support
/// :nodoc:
extension SQLSpecificExpressible {
/// Returns a value that can be used as an argument to QueryInterfaceRequest.select()
@@ -33,6 +35,7 @@ extension SQLSpecificExpressible {
// MARK: - SQL Collations Support
/// :nodoc:
extension SQLSpecificExpressible {
/// Returns a collated expression.
@@ -146,6 +146,7 @@ public func sum(_ value: SQLSpecificExpressible) -> SQLExpression {
// MARK: - Swift String functions
/// :nodoc:
extension SQLSpecificExpressible {
/// Returns an SQL expression that applies the Swift's built-in
/// capitalized String property. It is NULL for non-String arguments.
@@ -178,6 +179,7 @@ extension SQLSpecificExpressible {
}
}
/// :nodoc:
extension SQLSpecificExpressible {
/// Returns an SQL expression that applies the Swift's built-in
/// localizedCapitalized String property. It is NULL for non-String arguments.
@@ -789,6 +789,7 @@ extension SQLBinaryOperator {
static let like = SQLBinaryOperator("LIKE")
}
/// :nodoc:
extension SQLSpecificExpressible {
/// An SQL expression with the `LIKE` SQL operator.
+422 -257
View File
@@ -1,275 +1,440 @@
private struct RowKeyedDecodingContainer<Key: CodingKey>: KeyedDecodingContainerProtocol {
let decoder: RowDecoder
init(decoder: RowDecoder) {
self.decoder = decoder
}
var codingPath: [CodingKey] { return decoder.codingPath }
/// All the keys the `Decoder` has for this container.
///
/// Different keyed containers from the same `Decoder` may return different keys here; it is possible to encode with multiple key types which are not convertible to one another. This should report all keys present which are convertible to the requested type.
var allKeys: [Key] {
let row = decoder.row
let columnNames = Set(row.columnNames)
let scopeNames = Set(row.scopesTree.names)
return columnNames.union(scopeNames).compactMap { Key(stringValue: $0) }
}
/// Returns whether the `Decoder` contains a value associated with the given key.
///
/// The value associated with the given key may be a null value as appropriate for the data format.
///
/// - parameter key: The key to search for.
/// - returns: Whether the `Decoder` has an entry for the given key.
func contains(_ key: Key) -> Bool {
let row = decoder.row
return row.hasColumn(key.stringValue) || (row.scopesTree[key.stringValue] != nil)
}
/// Decodes a null value for the given key.
///
/// - parameter key: The key that the decoded value is associated with.
/// - returns: Whether the encountered value was null.
/// - throws: `DecodingError.keyNotFound` if `self` does not have an entry for the given key.
func decodeNil(forKey key: Key) throws -> Bool {
let row = decoder.row
return row[key.stringValue] == nil && (row.scopesTree[key.stringValue] == nil)
}
/// Decodes a value of the given type for the given key.
///
/// - parameter type: The type of value to decode.
/// - parameter key: The key that the decoded value is associated with.
/// - returns: A value of the requested type, if present for the given key and convertible to the requested type.
/// - throws: `DecodingError.typeMismatch` if the encountered encoded value is not convertible to the requested type.
/// - throws: `DecodingError.keyNotFound` if `self` does not have an entry for the given key.
/// - throws: `DecodingError.valueNotFound` if `self` has a null entry for the given key.
func decode(_ type: Bool.Type, forKey key: Key) throws -> Bool { return decoder.row[key.stringValue] }
func decode(_ type: Int.Type, forKey key: Key) throws -> Int { return decoder.row[key.stringValue] }
func decode(_ type: Int8.Type, forKey key: Key) throws -> Int8 { return decoder.row[key.stringValue] }
func decode(_ type: Int16.Type, forKey key: Key) throws -> Int16 { return decoder.row[key.stringValue] }
func decode(_ type: Int32.Type, forKey key: Key) throws -> Int32 { return decoder.row[key.stringValue] }
func decode(_ type: Int64.Type, forKey key: Key) throws -> Int64 { return decoder.row[key.stringValue] }
func decode(_ type: UInt.Type, forKey key: Key) throws -> UInt { return decoder.row[key.stringValue] }
func decode(_ type: UInt8.Type, forKey key: Key) throws -> UInt8 { return decoder.row[key.stringValue] }
func decode(_ type: UInt16.Type, forKey key: Key) throws -> UInt16 { return decoder.row[key.stringValue] }
func decode(_ type: UInt32.Type, forKey key: Key) throws -> UInt32 { return decoder.row[key.stringValue] }
func decode(_ type: UInt64.Type, forKey key: Key) throws -> UInt64 { return decoder.row[key.stringValue] }
func decode(_ type: Float.Type, forKey key: Key) throws -> Float { return decoder.row[key.stringValue] }
func decode(_ type: Double.Type, forKey key: Key) throws -> Double { return decoder.row[key.stringValue] }
func decode(_ type: String.Type, forKey key: Key) throws -> String { return decoder.row[key.stringValue] }
/// Decodes a value of the given type for the given key, if present.
///
/// This method returns nil if the container does not have a value
/// associated with key, or if the value is null. The difference between
/// these states can be distinguished with a contains(_:) call.
func decodeIfPresent<T>(_ type: T.Type, forKey key: Key) throws -> T? where T : Decodable {
let row = decoder.row
// Column?
if row.hasColumn(key.stringValue) {
let dbValue: DatabaseValue = row[key.stringValue]
if let type = T.self as? DatabaseValueConvertible.Type {
// Prefer DatabaseValueConvertible decoding over Decodable.
// This allows decoding Date from String, or DatabaseValue from NULL.
return type.fromDatabaseValue(dbValue) as! T?
} else if dbValue.isNull {
return nil
} else {
return try T(from: RowDecoder(row: row, codingPath: codingPath + [key]))
}
}
// Scope?
if let scopedRow = row.scopesTree[key.stringValue], scopedRow.containsNonNullValue {
if let type = T.self as? FetchableRecord.Type {
// Prefer FetchableRecord decoding over Decodable.
// This allows custom row decoding
return (type.init(row: scopedRow) as! T)
} else {
return try T(from: RowDecoder(row: scopedRow, codingPath: codingPath + [key]))
}
}
return nil
}
/// Decodes a value of the given type for the given key.
///
/// - parameter type: The type of value to decode.
/// - parameter key: The key that the decoded value is associated with.
/// - returns: A value of the requested type, if present for the given key and convertible to the requested type.
/// - throws: `DecodingError.typeMismatch` if the encountered encoded value is not convertible to the requested type.
/// - throws: `DecodingError.keyNotFound` if `self` does not have an entry for the given key.
/// - throws: `DecodingError.valueNotFound` if `self` has a null entry for the given key.
func decode<T>(_ type: T.Type, forKey key: Key) throws -> T where T : Decodable {
let row = decoder.row
// Column?
if row.hasColumn(key.stringValue) {
let dbValue: DatabaseValue = row[key.stringValue]
if let type = T.self as? DatabaseValueConvertible.Type {
// Prefer DatabaseValueConvertible decoding over Decodable.
// This allows decoding Date from String, or DatabaseValue from NULL.
return type.fromDatabaseValue(dbValue) as! T
} else {
return try T(from: RowDecoder(row: row, codingPath: codingPath + [key]))
}
}
// Scope?
if let scopedRow = row.scopesTree[key.stringValue] {
if let type = T.self as? FetchableRecord.Type {
// Prefer FetchableRecord decoding over Decodable.
// This allows custom row decoding
return type.init(row: scopedRow) as! T
} else {
return try T(from: RowDecoder(row: scopedRow, codingPath: codingPath + [key]))
}
}
// Base row
if let type = T.self as? FetchableRecord.Type {
// Prefer FetchableRecord decoding over Decodable.
// This allows custom row decoding
return type.init(row: row) as! T
} else {
return try T(from: RowDecoder(row: row, codingPath: codingPath + [key]))
}
}
/// Returns the data stored for the given key as represented in a container keyed by the given key type.
///
/// - parameter type: The key type to use for the container.
/// - parameter key: The key that the nested container is associated with.
/// - returns: A keyed decoding container view into `self`.
/// - throws: `DecodingError.typeMismatch` if the encountered stored value is not a keyed container.
func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type, forKey key: Key) throws -> KeyedDecodingContainer<NestedKey> where NestedKey : CodingKey {
fatalError("not implemented")
}
/// Returns the data stored for the given key as represented in an unkeyed container.
///
/// - parameter key: The key that the nested container is associated with.
/// - returns: An unkeyed decoding container view into `self`.
/// - throws: `DecodingError.typeMismatch` if the encountered stored value is not an unkeyed container.
func nestedUnkeyedContainer(forKey key: Key) throws -> UnkeyedDecodingContainer {
throw DecodingError.typeMismatch(
UnkeyedDecodingContainer.self,
DecodingError.Context(codingPath: codingPath, debugDescription: "unkeyed decoding is not supported"))
}
/// Returns a `Decoder` instance for decoding `super` from the container associated with the default `super` key.
///
/// Equivalent to calling `superDecoder(forKey:)` with `Key(stringValue: "super", intValue: 0)`.
///
/// - returns: A new `Decoder` to pass to `super.init(from:)`.
/// - throws: `DecodingError.keyNotFound` if `self` does not have an entry for the default `super` key.
/// - throws: `DecodingError.valueNotFound` if `self` has a null entry for the default `super` key.
public func superDecoder() throws -> Decoder {
return decoder
}
/// Returns a `Decoder` instance for decoding `super` from the container associated with the given key.
///
/// - parameter key: The key to decode `super` for.
/// - returns: A new `Decoder` to pass to `super.init(from:)`.
/// - throws: `DecodingError.keyNotFound` if `self` does not have an entry for the given key.
/// - throws: `DecodingError.valueNotFound` if `self` has a null entry for the given key.
public func superDecoder(forKey key: Key) throws -> Decoder {
return decoder
import Foundation
#if SWIFT_PACKAGE
import CSQLite
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
import SQLite3
#endif
extension FetchableRecord where Self: Decodable {
public init(row: Row) {
let decoder = RowDecoder<Self>(row: row, codingPath: [])
try! self.init(from: decoder)
}
}
private struct RowSingleValueDecodingContainer: SingleValueDecodingContainer {
let row: Row
// MARK: - RowDecoder
/// The decoder that decodes a record from a database row
private struct RowDecoder<Record: FetchableRecord>: Decoder {
var row: Row
var codingPath: [CodingKey]
let column: CodingKey
/// Decodes a null value.
///
/// - returns: Whether the encountered value was null.
func decodeNil() -> Bool {
return row[column.stringValue] == nil
}
/// Decodes a single value of the given type.
///
/// - parameter type: The type to decode as.
/// - returns: A value of the requested type.
/// - throws: `DecodingError.typeMismatch` if the encountered encoded value cannot be converted to the requested type.
/// - throws: `DecodingError.valueNotFound` if the encountered encoded value is null.
func decode(_ type: Bool.Type) throws -> Bool { return row[column.stringValue] }
func decode(_ type: Int.Type) throws -> Int { return row[column.stringValue] }
func decode(_ type: Int8.Type) throws -> Int8 { return row[column.stringValue] }
func decode(_ type: Int16.Type) throws -> Int16 { return row[column.stringValue] }
func decode(_ type: Int32.Type) throws -> Int32 { return row[column.stringValue] }
func decode(_ type: Int64.Type) throws -> Int64 { return row[column.stringValue] }
func decode(_ type: UInt.Type) throws -> UInt { return row[column.stringValue] }
func decode(_ type: UInt8.Type) throws -> UInt8 { return row[column.stringValue] }
func decode(_ type: UInt16.Type) throws -> UInt16 { return row[column.stringValue] }
func decode(_ type: UInt32.Type) throws -> UInt32 { return row[column.stringValue] }
func decode(_ type: UInt64.Type) throws -> UInt64 { return row[column.stringValue] }
func decode(_ type: Float.Type) throws -> Float { return row[column.stringValue] }
func decode(_ type: Double.Type) throws -> Double { return row[column.stringValue] }
func decode(_ type: String.Type) throws -> String { return row[column.stringValue] }
/// Decodes a single value of the given type.
///
/// - parameter type: The type to decode as.
/// - returns: A value of the requested type.
/// - throws: `DecodingError.typeMismatch` if the encountered encoded value cannot be converted to the requested type.
/// - throws: `DecodingError.valueNotFound` if the encountered encoded value is null.
func decode<T>(_ type: T.Type) throws -> T where T : Decodable {
if let type = T.self as? DatabaseValueConvertible.Type {
// Prefer DatabaseValueConvertible decoding over Decodable.
// This allows decoding Date from String, or DatabaseValue from NULL.
return type.fromDatabaseValue(row[column.stringValue]) as! T
} else {
return try T(from: RowDecoder(row: row, codingPath: [column]))
}
}
}
private struct RowDecoder: Decoder {
let row: Row
init(row: Row, codingPath: [CodingKey]) {
self.row = row
self.codingPath = codingPath
}
// Decoder
let codingPath: [CodingKey]
var userInfo: [CodingUserInfoKey : Any] { return [:] }
var userInfo: [CodingUserInfoKey: Any] { return Record.databaseDecodingUserInfo }
func container<Key>(keyedBy type: Key.Type) throws -> KeyedDecodingContainer<Key> {
return KeyedDecodingContainer(RowKeyedDecodingContainer<Key>(decoder: self))
return KeyedDecodingContainer(KeyedContainer<Key>(decoder: self))
}
func unkeyedContainer() throws -> UnkeyedDecodingContainer {
throw DecodingError.typeMismatch(
UnkeyedDecodingContainer.self,
DecodingError.Context(codingPath: codingPath, debugDescription: "unkeyed decoding is not supported"))
fatalError("unkeyed decoding from database row is not supported")
}
func singleValueContainer() throws -> SingleValueDecodingContainer {
// Asked for a value type: column name required
guard let codingKey = codingPath.last else {
throw DecodingError.typeMismatch(
RowDecoder.self,
DecodingError.Context(codingPath: codingPath, debugDescription: "single value decoding requires a coding key"))
guard let key = codingPath.last else {
fatalError("single value decoding from database row is not supported")
}
guard let index = row.index(ofColumn: key.stringValue) else {
// Don't use DecodingError.keyNotFound:
// We need to specifically recognize missing columns in order to
// provide correct feedback.
throw MissingColumnError(column: key.stringValue)
}
// TODO: test
// See DatabaseValueConversionErrorTests.testDecodableFetchableRecord2
return ColumnDecoder<Record>(row: row, columnIndex: index, codingPath: codingPath)
}
struct KeyedContainer<Key: CodingKey>: KeyedDecodingContainerProtocol {
let decoder: RowDecoder
var codingPath: [CodingKey] { return decoder.codingPath }
init(decoder: RowDecoder) {
self.decoder = decoder
}
var allKeys: [Key] {
let row = decoder.row
let columnNames = Set(row.columnNames)
let scopeNames = Set(row.scopesTree.names)
return columnNames.union(scopeNames).compactMap { Key(stringValue: $0) }
}
func contains(_ key: Key) -> Bool {
let row = decoder.row
return row.hasColumn(key.stringValue) || (row.scopesTree[key.stringValue] != nil)
}
func decodeNil(forKey key: Key) throws -> Bool {
let row = decoder.row
return row[key.stringValue] == nil && (row.scopesTree[key.stringValue] == nil)
}
func decode(_ type: Bool.Type, forKey key: Key) throws -> Bool { return decoder.row[key.stringValue] }
func decode(_ type: Int.Type, forKey key: Key) throws -> Int { return decoder.row[key.stringValue] }
func decode(_ type: Int8.Type, forKey key: Key) throws -> Int8 { return decoder.row[key.stringValue] }
func decode(_ type: Int16.Type, forKey key: Key) throws -> Int16 { return decoder.row[key.stringValue] }
func decode(_ type: Int32.Type, forKey key: Key) throws -> Int32 { return decoder.row[key.stringValue] }
func decode(_ type: Int64.Type, forKey key: Key) throws -> Int64 { return decoder.row[key.stringValue] }
func decode(_ type: UInt.Type, forKey key: Key) throws -> UInt { return decoder.row[key.stringValue] }
func decode(_ type: UInt8.Type, forKey key: Key) throws -> UInt8 { return decoder.row[key.stringValue] }
func decode(_ type: UInt16.Type, forKey key: Key) throws -> UInt16 { return decoder.row[key.stringValue] }
func decode(_ type: UInt32.Type, forKey key: Key) throws -> UInt32 { return decoder.row[key.stringValue] }
func decode(_ type: UInt64.Type, forKey key: Key) throws -> UInt64 { return decoder.row[key.stringValue] }
func decode(_ type: Float.Type, forKey key: Key) throws -> Float { return decoder.row[key.stringValue] }
func decode(_ type: Double.Type, forKey key: Key) throws -> Double { return decoder.row[key.stringValue] }
func decode(_ type: String.Type, forKey key: Key) throws -> String { return decoder.row[key.stringValue] }
func decodeIfPresent<T>(_ type: T.Type, forKey key: Key) throws -> T? where T : Decodable {
let row = decoder.row
let keyName = key.stringValue
// Column?
if let index = row.index(ofColumn: keyName) {
// Prefer DatabaseValueConvertible decoding over Decodable.
// This allows decoding Date from String, or DatabaseValue from NULL.
if type == Date.self {
return Record.databaseDateDecodingStrategy.decodeIfPresent(fromRow: row, columnAtIndex: index) as! T?
} else if let type = T.self as? (DatabaseValueConvertible & StatementColumnConvertible).Type {
return type.fastDecodeIfPresent(from: row, atUncheckedIndex: index) as! T?
} else if let type = T.self as? DatabaseValueConvertible.Type {
return type.decodeIfPresent(from: row, atUncheckedIndex: index) as! T?
} else if row.impl.hasNull(atUncheckedIndex: index) {
return nil
} else {
return try decode(type, fromRow: row, columnAtIndex: index, key: key)
}
}
// Scope? (beware left joins, and check if scoped row contains non-null values)
if let scopedRow = row.scopesTree[keyName], scopedRow.containsNonNullValue {
return try decode(type, fromRow: scopedRow, codingPath: codingPath + [key])
}
// Key is not a column, and not a scope.
return nil
}
func decode<T>(_ type: T.Type, forKey key: Key) throws -> T where T : Decodable {
let row = decoder.row
let keyName = key.stringValue
// Column?
if let index = row.index(ofColumn: keyName) {
// Prefer DatabaseValueConvertible decoding over Decodable.
// This allows decoding Date from String, or DatabaseValue from NULL.
if type == Date.self {
return Record.databaseDateDecodingStrategy.decode(fromRow: row, columnAtIndex: index) as! T
} else if let type = T.self as? (DatabaseValueConvertible & StatementColumnConvertible).Type {
return type.fastDecode(from: row, atUncheckedIndex: index) as! T
} else if let type = T.self as? DatabaseValueConvertible.Type {
return type.decode(from: row, atUncheckedIndex: index) as! T
} else {
return try decode(type, fromRow: row, columnAtIndex: index, key: key)
}
}
// Scope?
if let scopedRow = row.scopesTree[keyName] {
return try decode(type, fromRow: scopedRow, codingPath: codingPath + [key])
}
// Key is not a column, and not a scope.
//
// Should be throw an error? Well... The use case is the following:
//
// // SELECT book.*, author.* FROM book
// // JOIN author ON author.id = book.authorId
// let request = Book.including(required: Book.author)
//
// Rows loaded from this request don't have any "book" key:
//
// let row = try Row.fetchOne(db, request)!
// print(row.debugDescription)
// // ▿ [id:1 title:"Moby-Dick" authorId:2]
// // unadapted: [id:1 title:"Moby-Dick" authorId:2 id:2 name:"Melville"]
// // author: [id:2 name:"Melville"]
//
// And yet we have to decode the "book" key when we decode the
// BookInfo type below:
//
// struct BookInfo {
// var book: Book // <- decodes from the "book" key
// var author: Author
// }
// let infos = try BookInfos.fetchAll(db, request)
//
// Our current strategy is to assume that a missing key (such as
// "book", which is not the name of a column, and not the name of a
// scope) has to be decoded right from the base row.
//
// Yeah, there may be better ways to handle this.
return try decode(type, fromRow: row, codingPath: codingPath + [key])
}
func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type, forKey key: Key) throws -> KeyedDecodingContainer<NestedKey> where NestedKey : CodingKey {
fatalError("not implemented")
}
func nestedUnkeyedContainer(forKey key: Key) throws -> UnkeyedDecodingContainer {
throw DecodingError.typeMismatch(
UnkeyedDecodingContainer.self,
DecodingError.Context(codingPath: codingPath, debugDescription: "unkeyed decoding is not supported"))
}
func superDecoder() throws -> Decoder {
// Not sure
return decoder
}
func superDecoder(forKey key: Key) throws -> Decoder {
fatalError("not implemented")
}
// Helper methods
@inline(__always)
private func decode<T>(_ type: T.Type, fromRow row: Row, codingPath: [CodingKey]) throws -> T where T: Decodable {
if let type = T.self as? FetchableRecord.Type {
// Prefer FetchableRecord decoding over Decodable.
return type.init(row: row) as! T
} else {
do {
let decoder = RowDecoder(row: row, codingPath: codingPath)
return try T(from: decoder)
} catch let error as MissingColumnError {
// Support for DatabaseValueConversionErrorTests.testDecodableFetchableRecord2
fatalConversionError(
to: type,
from: nil,
conversionContext: ValueConversionContext(row).atColumn(error.column))
}
}
}
@inline(__always)
private func decode<T>(_ type: T.Type, fromRow row: Row, columnAtIndex index: Int, key: Key) throws -> T where T: Decodable {
do {
// This decoding will fail for types that decode from keyed
// or unkeyed containers, because we're decoding a single
// value here (string, int, double, data, null). If such an
// error happens, we'll switch to JSON decoding.
let columnDecoder = ColumnDecoder<Record>(
row: row,
columnIndex: index,
codingPath: codingPath + [key])
return try T(from: columnDecoder)
} catch is JSONRequiredError {
// Decode from JSON
guard let data = row.dataNoCopy(atIndex: index) else {
fatalConversionError(to: T.self, from: row[index], conversionContext: ValueConversionContext(row).atColumn(index))
}
return try Record
.databaseJSONDecoder(for: key.stringValue)
.decode(type.self, from: data)
}
}
return RowSingleValueDecodingContainer(row: row, codingPath: codingPath, column: codingKey)
}
}
extension FetchableRecord where Self: Decodable {
/// Initializes a record from `row`.
public init(row: Row) {
try! self.init(from: RowDecoder(row: row, codingPath: []))
// MARK: - ColumnDecoder
/// The decoder that decodes from a database column
private struct ColumnDecoder<Record: FetchableRecord>: Decoder {
var row: Row
var columnIndex: Int
var codingPath: [CodingKey]
var userInfo: [CodingUserInfoKey: Any] { return Record.databaseDecodingUserInfo }
func container<Key>(keyedBy type: Key.Type) throws -> KeyedDecodingContainer<Key> {
// We need to switch to JSON decoding
throw JSONRequiredError()
}
func unkeyedContainer() throws -> UnkeyedDecodingContainer {
// We need to switch to JSON decoding
throw JSONRequiredError()
}
func singleValueContainer() throws -> SingleValueDecodingContainer {
return self
}
}
extension ColumnDecoder: SingleValueDecodingContainer {
func decodeNil() -> Bool {
return row.hasNull(atIndex: columnIndex)
}
func decode(_ type: Bool.Type ) throws -> Bool { return row[columnIndex] }
func decode(_ type: Int.Type ) throws -> Int { return row[columnIndex] }
func decode(_ type: Int8.Type ) throws -> Int8 { return row[columnIndex] }
func decode(_ type: Int16.Type ) throws -> Int16 { return row[columnIndex] }
func decode(_ type: Int32.Type ) throws -> Int32 { return row[columnIndex] }
func decode(_ type: Int64.Type ) throws -> Int64 { return row[columnIndex] }
func decode(_ type: UInt.Type ) throws -> UInt { return row[columnIndex] }
func decode(_ type: UInt8.Type ) throws -> UInt8 { return row[columnIndex] }
func decode(_ type: UInt16.Type) throws -> UInt16 { return row[columnIndex] }
func decode(_ type: UInt32.Type) throws -> UInt32 { return row[columnIndex] }
func decode(_ type: UInt64.Type) throws -> UInt64 { return row[columnIndex] }
func decode(_ type: Float.Type ) throws -> Float { return row[columnIndex] }
func decode(_ type: Double.Type) throws -> Double { return row[columnIndex] }
func decode(_ type: String.Type) throws -> String { return row[columnIndex] }
func decode<T>(_ type: T.Type) throws -> T where T : Decodable {
// Prefer DatabaseValueConvertible decoding over Decodable.
// This allows decoding Date from String, or DatabaseValue from NULL.
if type == Date.self {
return Record.databaseDateDecodingStrategy.decode(fromRow: row, columnAtIndex: columnIndex) as! T
} else if let type = T.self as? (DatabaseValueConvertible & StatementColumnConvertible).Type {
return type.fastDecode(from: row, atUncheckedIndex: columnIndex) as! T
} else if let type = T.self as? DatabaseValueConvertible.Type {
return type.decode(from: row, atUncheckedIndex: columnIndex) as! T
} else {
return try T(from: self)
}
}
}
/// The error that triggers JSON decoding
private struct JSONRequiredError: Error { }
/// The error for missing columns
private struct MissingColumnError: Error {
var column: String
}
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
fileprivate var iso8601Formatter: ISO8601DateFormatter = {
let formatter = ISO8601DateFormatter()
formatter.formatOptions = .withInternetDateTime
return formatter
}()
private extension DatabaseDateDecodingStrategy {
@inline(__always)
func decodeIfPresent(fromRow row: Row, columnAtIndex index: Int) -> Date? {
if let sqliteStatement = row.sqliteStatement {
return decodeIfPresent(
sqliteStatement: sqliteStatement,
index: Int32(index))
} else {
return decodeIfPresent(
from: row[index],
conversionContext: ValueConversionContext(row).atColumn(index))
}
}
@inline(__always)
func decode(fromRow row: Row, columnAtIndex index: Int) -> Date {
if let sqliteStatement = row.sqliteStatement {
return decode(
sqliteStatement: sqliteStatement,
index: Int32(index))
} else {
return decode(
from: row[index],
conversionContext: ValueConversionContext(row).atColumn(index))
}
}
@inline(__always)
func decode(sqliteStatement: SQLiteStatement, index: Int32) -> Date {
switch self {
case .deferredToDate:
return Date(sqliteStatement: sqliteStatement, index: index)
case .timeIntervalSinceReferenceDate:
let timeInterval = TimeInterval(sqliteStatement: sqliteStatement, index: index)
return Date(timeIntervalSinceReferenceDate: timeInterval)
case .timeIntervalSince1970:
let timeInterval = TimeInterval(sqliteStatement: sqliteStatement, index: index)
return Date(timeIntervalSince1970: timeInterval)
case .millisecondsSince1970:
let timeInterval = TimeInterval(sqliteStatement: sqliteStatement, index: index)
return Date(timeIntervalSince1970: timeInterval / 1000.0)
case .iso8601:
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
let string = String(sqliteStatement: sqliteStatement, index: index)
guard let date = iso8601Formatter.date(from: string) else {
fatalConversionError(to: Date.self, sqliteStatement: sqliteStatement, index: index)
}
return date
} else {
fatalError("ISO8601DateFormatter is unavailable on this platform.")
}
case .formatted(let formatter):
let string = String(sqliteStatement: sqliteStatement, index: index)
guard let date = formatter.date(from: string) else {
fatalConversionError(to: Date.self, sqliteStatement: sqliteStatement, index: index)
}
return date
case .custom(let format):
let dbValue = DatabaseValue(sqliteStatement: sqliteStatement, index: index)
guard let date = format(dbValue) else {
fatalConversionError(to: Date.self, sqliteStatement: sqliteStatement, index: index)
}
return date
}
}
@inline(__always)
func decodeIfPresent(sqliteStatement: SQLiteStatement, index: Int32) -> Date? {
if sqlite3_column_type(sqliteStatement, index) == SQLITE_NULL {
return nil
}
return decode(sqliteStatement: sqliteStatement, index: index)
}
@inline(__always)
func decode(from dbValue: DatabaseValue, conversionContext: @autoclosure () -> ValueConversionContext?) -> Date {
if let date = dateFromDatabaseValue(dbValue) {
return date
} else {
fatalConversionError(to: Date.self, from: dbValue, conversionContext: conversionContext())
}
}
@inline(__always)
func decodeIfPresent(from dbValue: DatabaseValue, conversionContext: @autoclosure () -> ValueConversionContext?) -> Date? {
if dbValue.isNull {
return nil
} else if let date = dateFromDatabaseValue(dbValue) {
return date
} else {
fatalConversionError(to: Date.self, from: dbValue, conversionContext: conversionContext())
}
}
// Returns nil if decoding fails
@inline(__always)
private func dateFromDatabaseValue(_ dbValue: DatabaseValue) -> Date? {
switch self {
case .deferredToDate:
return Date.fromDatabaseValue(dbValue)
case .timeIntervalSinceReferenceDate:
return TimeInterval
.fromDatabaseValue(dbValue)
.map { Date(timeIntervalSinceReferenceDate: $0) }
case .timeIntervalSince1970:
return TimeInterval
.fromDatabaseValue(dbValue)
.map { Date(timeIntervalSince1970: $0) }
case .millisecondsSince1970:
return TimeInterval
.fromDatabaseValue(dbValue)
.map { Date(timeIntervalSince1970: $0 / 1000.0) }
case .iso8601:
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
return String
.fromDatabaseValue(dbValue)
.flatMap { iso8601Formatter.date(from: $0) }
} else {
fatalError("ISO8601DateFormatter is unavailable on this platform.")
}
case .formatted(let formatter):
return String
.fromDatabaseValue(dbValue)
.flatMap { formatter.date(from: $0) }
case .custom(let format):
return format(dbValue)
}
}
}
+199 -30
View File
@@ -1,3 +1,4 @@
import Foundation
#if SWIFT_PACKAGE
import CSQLite
#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER
@@ -24,46 +25,113 @@
/// FetchableRecord is adopted by Record.
public protocol FetchableRecord {
// MARK: - Row Decoding
/// Creates a record from `row`.
///
/// For performance reasons, the row argument may be 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()`.
init(row: Row)
// MARK: - Customizing the Format of Database Columns
/// When the FetchableRecord type also adopts the standard Decodable
/// protocol, you can use this dictionary to customize the decoding process
/// from database rows.
///
/// For example:
///
/// // A key that holds a decoder's name
/// let decoderName = CodingUserInfoKey(rawValue: "decoderName")!
///
/// // A FetchableRecord + Decodable record
/// struct Player: FetchableRecord, Decodable {
/// // Customize the decoder name when decoding a database row
/// static let databaseDecodingUserInfo: [CodingUserInfoKey: Any] = [decoderName: "Database"]
///
/// init(from decoder: Decoder) throws {
/// // Print the decoder name
/// print(decoder.userInfo[decoderName])
/// ...
/// }
/// }
///
/// // prints "Database"
/// let player = try Player.fetchOne(db, ...)
///
/// // prints "JSON"
/// let decoder = JSONDecoder()
/// decoder.userInfo = [decoderName: "JSON"]
/// let player = try decoder.decode(Player.self, from: ...)
static var databaseDecodingUserInfo: [CodingUserInfoKey: Any] { get }
/// When the FetchableRecord type also adopts the standard Decodable
/// protocol, this method controls the decoding process of nested properties
/// from JSON database columns.
///
/// The default implementation returns a JSONDecoder with the
/// following properties:
///
/// - dataDecodingStrategy: .base64
/// - dateDecodingStrategy: .millisecondsSince1970
/// - nonConformingFloatDecodingStrategy: .throw
///
/// You can override those defaults:
///
/// struct Achievement: Decodable {
/// var name: String
/// var date: Date
/// }
///
/// struct Player: Decodable, FetchableRecord {
/// // stored in a JSON column
/// var achievements: [Achievement]
///
/// static func databaseJSONDecoder(for column: String) -> JSONDecoder {
/// let decoder = JSONDecoder()
/// decoder.dateDecodingStrategy = .iso8601
/// return decoder
/// }
/// }
static func databaseJSONDecoder(for column: String) -> JSONDecoder
/// When the FetchableRecord type also adopts the standard Decodable
/// protocol, this property controls the decoding of date properties.
///
/// Default value is .deferredToDate
///
/// For example:
///
/// struct Player: FetchableRecord, Decodable {
/// static let databaseDateDecodingStrategy: DatabaseDateDecodingStrategy = .timeIntervalSince1970
///
/// var name: String
/// var registrationDate: Date // decoded from epoch timestamp
/// }
static var databaseDateDecodingStrategy: DatabaseDateDecodingStrategy { get }
}
/// A cursor of records. For example:
///
/// struct Player : FetchableRecord { ... }
/// try dbQueue.read { db in
/// let players: RecordCursor<Player> = try Player.fetchCursor(db, "SELECT * FROM player")
/// }
public final class RecordCursor<Record: FetchableRecord> : Cursor {
private let statement: SelectStatement
private let row: Row // Reused for performance
private let sqliteStatement: SQLiteStatement
private var done = false
init(statement: SelectStatement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws {
self.statement = statement
self.row = try Row(statement: statement).adapted(with: adapter, layout: statement)
self.sqliteStatement = statement.sqliteStatement
statement.cursorReset(arguments: arguments)
extension FetchableRecord {
public static var databaseDecodingUserInfo: [CodingUserInfoKey: Any] {
return [:]
}
/// :nodoc:
public func next() throws -> Record? {
if done { return nil }
switch sqlite3_step(sqliteStatement) {
case SQLITE_DONE:
done = true
return nil
case SQLITE_ROW:
return Record(row: row)
case let code:
statement.database.selectStatementDidFail(statement)
throw DatabaseError(resultCode: code, message: statement.database.lastErrorMessage, sql: statement.sql, arguments: statement.arguments)
}
/// Returns a JSONDecoder with the following properties:
///
/// - dataDecodingStrategy: .base64
/// - dateDecodingStrategy: .millisecondsSince1970
/// - nonConformingFloatDecodingStrategy: .throw
public static func databaseJSONDecoder(for column: String) -> JSONDecoder {
let decoder = JSONDecoder()
decoder.dataDecodingStrategy = .base64
decoder.dateDecodingStrategy = .millisecondsSince1970
decoder.nonConformingFloatDecodingStrategy = .throw
return decoder
}
public static var databaseDateDecodingStrategy: DatabaseDateDecodingStrategy {
return .deferredToDate
}
}
@@ -241,6 +309,8 @@ extension FetchableRecord {
}
}
// MARK: - FetchRequest
extension FetchRequest where RowDecoder: FetchableRecord {
// MARK: Fetching Records
@@ -289,3 +359,102 @@ extension FetchRequest where RowDecoder: FetchableRecord {
return try RowDecoder.fetchOne(db, self)
}
}
// MARK: - RecordCursor
/// A cursor of records. For example:
///
/// struct Player : FetchableRecord { ... }
/// try dbQueue.read { db in
/// let players: RecordCursor<Player> = try Player.fetchCursor(db, "SELECT * FROM player")
/// }
public final class RecordCursor<Record: FetchableRecord> : Cursor {
private let statement: SelectStatement
private let row: Row // Reused for performance
private let sqliteStatement: SQLiteStatement
private var done = false
init(statement: SelectStatement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws {
self.statement = statement
self.row = try Row(statement: statement).adapted(with: adapter, layout: statement)
self.sqliteStatement = statement.sqliteStatement
statement.reset(withArguments: arguments)
}
/// :nodoc:
public func next() throws -> Record? {
if done {
// make sure this instance never yields a value again, even if the
// statement is reset by another cursor.
return nil
}
switch sqlite3_step(sqliteStatement) {
case SQLITE_DONE:
done = true
return nil
case SQLITE_ROW:
return Record(row: row)
case let code:
statement.database.selectStatementDidFail(statement)
throw DatabaseError(resultCode: code, message: statement.database.lastErrorMessage, sql: statement.sql, arguments: statement.arguments)
}
}
}
// MARK: - DatabaseDateDecodingStrategy
/// DatabaseDateDecodingStrategy specifies how FetchableRecord types that also
/// adopt the standard Decodable protocol decode their date properties.
///
/// For example:
///
/// struct Player: FetchableRecord, Decodable {
/// static let databaseDateDecodingStrategy: DatabaseDateDecodingStrategy = .timeIntervalSince1970
///
/// var name: String
/// var registrationDate: Date // decoded from epoch timestamp
/// }
public enum DatabaseDateDecodingStrategy {
/// The strategy that uses formatting from the Date structure.
///
/// It decodes numeric values as a nunber of seconds since Epoch
/// (midnight UTC on January 1st, 1970).
///
/// It decodes strings in the following formats, assuming UTC time zone.
/// Missing components are assumed to be zero:
///
/// - `YYYY-MM-DD`
/// - `YYYY-MM-DD HH:MM`
/// - `YYYY-MM-DD HH:MM:SS`
/// - `YYYY-MM-DD HH:MM:SS.SSS`
/// - `YYYY-MM-DDTHH:MM`
/// - `YYYY-MM-DDTHH:MM:SS`
/// - `YYYY-MM-DDTHH:MM:SS.SSS`
case deferredToDate
/// Decodes numeric values as a number of seconds between the date and
/// midnight UTC on 1 January 2001
case timeIntervalSinceReferenceDate
/// Decodes numeric values as a number of seconds between the date and
/// midnight UTC on 1 January 1970
case timeIntervalSince1970
/// Decodes numeric values as a number of milliseconds between the date and
/// midnight UTC on 1 January 1970
case millisecondsSince1970
/// Decodes dates according to the ISO 8601 standards
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
case iso8601
/// Decodes a String, according to the provided formatter
case formatted(DateFormatter)
/// Decodes according to the user-provided function.
///
/// If the database value does not contain a suitable value, the function
/// must return nil (GRDB will interpret this nil result as a conversion
/// error, and react accordingly).
case custom((DatabaseValue) -> Date?)
}
+28 -49
View File
@@ -580,62 +580,41 @@ private func makeFetchFunction<Record, T>(
// Should controller become strong at any point before callbacks are
// called, such unowned reference would have an opportunity to crash.
return { [weak controller] observer in
// Return if observer has been invalidated
guard observer.isValid else { return }
// Return if fetched records controller has been deallocated
guard let request = controller?.request, let databaseWriter = controller?.databaseWriter else { return }
// Return if observer has been invalidated, or if fetched records
// controller has been deallocated
guard observer.isValid,
let request = controller?.request,
let databaseWriter = controller?.databaseWriter
else { return }
willProcessTransaction()
// Fetch items.
//
// This method is called from the database writer's serialized
// queue, so that we can fetch items before other writes have the
// opportunity to modify the database.
//
// However, we don't have to block the writer queue for all the
// duration of the fetch. We just need to block the writer queue
// until we can perform a fetch in isolation. This is the role of
// the readFromCurrentState method (see below).
//
// However, our fetch will last for an unknown duration. And since
// we release the writer queue early, the next database modification
// will triggers this callback while our fetch is, maybe, still
// running. This next callback will also perform its own fetch, that
// will maybe end before our own fetch.
//
// We have to make sure that our fetch is processed *before* the
// next fetch: let's immediately dispatch the processing task in our
// serialized FIFO queue, but have it wait for our fetch to
// complete, with a semaphore:
let semaphore = DispatchSemaphore(value: 0)
var result: Result<(fetchedItems: [Item<Record>], fetchedAlongside: T)>? = nil
do {
try databaseWriter.readFromCurrentState { db in
result = Result { try (
fetchedItems: request.fetchAll(db),
fetchedAlongside: fetchAlongside(db)) }
semaphore.signal()
}
} catch {
result = .failure(error)
semaphore.signal()
// Perform a concurrent read so that writer dispatch queue is released
// as soon as possible.
let future = databaseWriter.concurrentRead { db in
try (fetchedItems: request.fetchAll(db),
fetchedAlongside: fetchAlongside(db))
}
// Process the fetched items
// Dispatch processing immediately on observer.queue in order to
// process fetched values in the same order as transactions:
observer.queue.async { [weak observer] in
// Wait for the fetch to complete:
_ = semaphore.wait(timeout: .distantFuture)
// Return if observer has been deallocated or invalidated
guard let observer = observer,
observer.isValid
else { return }
// Return if observer has been invalidated
guard let strongObserver = observer else { return }
guard strongObserver.isValid else { return }
completion(result!.map { (fetchedItems, fetchedAlongside) in
(fetchedItems: fetchedItems, fetchedAlongside: fetchedAlongside, observer: strongObserver)
})
do {
// Wait for concurrent read to complete
let values = try future.wait()
completion(.success((
fetchedItems: values.fetchedItems,
fetchedAlongside: values.fetchedAlongside,
observer: observer)))
} catch {
completion(.failure(error))
}
}
}
}
+344 -193
View File
@@ -1,213 +1,364 @@
private struct PersistableRecordKeyedEncodingContainer<Key: CodingKey> : KeyedEncodingContainerProtocol {
let encode: (_ value: DatabaseValueConvertible?, _ key: String) -> Void
init(encode: @escaping (_ value: DatabaseValueConvertible?, _ key: String) -> Void) {
self.encode = encode
import Foundation
extension MutablePersistableRecord where Self: Encodable {
public func encode(to container: inout PersistenceContainer) {
let persistenceContainer = PersistenceContainer()
let encoder = RecordEncoder<Self>(persistenceContainer: persistenceContainer)
try! encode(to: encoder)
container = encoder.persistenceContainer
}
/// The path of coding keys taken to get to this point in encoding.
/// A `nil` value indicates an unkeyed container.
}
// MARK: - RecordEncoder
/// The encoder that encodes a record into GRDB's PersistenceContainer
private class RecordEncoder<Record: MutablePersistableRecord>: Encoder {
var codingPath: [CodingKey] { return [] }
var userInfo: [CodingUserInfoKey: Any] { return Record.databaseEncodingUserInfo }
private var _persistenceContainer: PersistenceContainer
var persistenceContainer: PersistenceContainer { return _persistenceContainer }
/// Encodes the given value for the given key.
///
/// - parameter value: The value to encode.
/// - parameter key: The key to associate the value with.
/// - throws: `EncodingError.invalidValue` if the given value is invalid in the current context for this format.
mutating func encode(_ value: Bool, forKey key: Key) throws { encode(value, key.stringValue) }
mutating func encode(_ value: Int, forKey key: Key) throws { encode(value, key.stringValue) }
mutating func encode(_ value: Int8, forKey key: Key) throws { encode(value, key.stringValue) }
mutating func encode(_ value: Int16, forKey key: Key) throws { encode(value, key.stringValue) }
mutating func encode(_ value: Int32, forKey key: Key) throws { encode(value, key.stringValue) }
mutating func encode(_ value: Int64, forKey key: Key) throws { encode(value, key.stringValue) }
mutating func encode(_ value: UInt, forKey key: Key) throws { encode(value, key.stringValue) }
mutating func encode(_ value: UInt8, forKey key: Key) throws { encode(value, key.stringValue) }
mutating func encode(_ value: UInt16, forKey key: Key) throws { encode(value, key.stringValue) }
mutating func encode(_ value: UInt32, forKey key: Key) throws { encode(value, key.stringValue) }
mutating func encode(_ value: UInt64, forKey key: Key) throws { encode(value, key.stringValue) }
mutating func encode(_ value: Float, forKey key: Key) throws { encode(value, key.stringValue) }
mutating func encode(_ value: Double, forKey key: Key) throws { encode(value, key.stringValue) }
mutating func encode(_ value: String, forKey key: Key) throws { encode(value, key.stringValue) }
/// Encodes the given value for the given key.
///
/// - parameter value: The value to encode.
/// - parameter key: The key to associate the value with.
/// - throws: `EncodingError.invalidValue` if the given value is invalid in the current context for this format.
mutating func encode<T>(_ value: T, forKey key: Key) throws where T : Encodable {
if T.self is DatabaseValueConvertible.Type {
// Prefer DatabaseValueConvertible encoding over Decodable.
// This allows us to encode Date as String, for example.
encode((value as! DatabaseValueConvertible), key.stringValue)
} else {
try value.encode(to: PersistableRecordEncoder(codingPath: [key], encode: encode))
}
init(persistenceContainer: PersistenceContainer) {
_persistenceContainer = persistenceContainer
}
// Provide explicit encoding of optionals, because default implementation does not encode nil values.
mutating func encodeNil(forKey key: Key) throws { encode(nil, key.stringValue) }
mutating func encodeIfPresent(_ value: Bool?, forKey key: Key) throws { if let value = value { try encode(value, forKey: key) } else { try encodeNil(forKey: key) } }
mutating func encodeIfPresent(_ value: Int?, forKey key: Key) throws { if let value = value { try encode(value, forKey: key) } else { try encodeNil(forKey: key) } }
mutating func encodeIfPresent(_ value: Int8?, forKey key: Key) throws { if let value = value { try encode(value, forKey: key) } else { try encodeNil(forKey: key) } }
mutating func encodeIfPresent(_ value: Int16?, forKey key: Key) throws { if let value = value { try encode(value, forKey: key) } else { try encodeNil(forKey: key) } }
mutating func encodeIfPresent(_ value: Int32?, forKey key: Key) throws { if let value = value { try encode(value, forKey: key) } else { try encodeNil(forKey: key) } }
mutating func encodeIfPresent(_ value: Int64?, forKey key: Key) throws { if let value = value { try encode(value, forKey: key) } else { try encodeNil(forKey: key) } }
mutating func encodeIfPresent(_ value: UInt?, forKey key: Key) throws { if let value = value { try encode(value, forKey: key) } else { try encodeNil(forKey: key) } }
mutating func encodeIfPresent(_ value: UInt8?, forKey key: Key) throws { if let value = value { try encode(value, forKey: key) } else { try encodeNil(forKey: key) } }
mutating func encodeIfPresent(_ value: UInt16?, forKey key: Key) throws { if let value = value { try encode(value, forKey: key) } else { try encodeNil(forKey: key) } }
mutating func encodeIfPresent(_ value: UInt32?, forKey key: Key) throws { if let value = value { try encode(value, forKey: key) } else { try encodeNil(forKey: key) } }
mutating func encodeIfPresent(_ value: UInt64?, forKey key: Key) throws { if let value = value { try encode(value, forKey: key) } else { try encodeNil(forKey: key) } }
mutating func encodeIfPresent(_ value: Float?, forKey key: Key) throws { if let value = value { try encode(value, forKey: key) } else { try encodeNil(forKey: key) } }
mutating func encodeIfPresent(_ value: Double?, forKey key: Key) throws { if let value = value { try encode(value, forKey: key) } else { try encodeNil(forKey: key) } }
mutating func encodeIfPresent(_ value: String?, forKey key: Key) throws { if let value = value { try encode(value, forKey: key) } else { try encodeNil(forKey: key) } }
mutating func encodeIfPresent<T>(_ value: T?, forKey key: Key) throws where T : Encodable { if let value = value { try encode(value, forKey: key) } else { try encodeNil(forKey: key) } }
/// Stores a keyed encoding container for the given key and returns it.
///
/// - parameter keyType: The key type to use for the container.
/// - parameter key: The key to encode the container for.
/// - returns: A new keyed encoding container.
mutating func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type, forKey key: Key) -> KeyedEncodingContainer<NestedKey> {
fatalError("Not implemented")
}
/// Stores an unkeyed encoding container for the given key and returns it.
///
/// - parameter key: The key to encode the container for.
/// - returns: A new unkeyed encoding container.
mutating func nestedUnkeyedContainer(forKey key: Key) -> UnkeyedEncodingContainer {
fatalError("Not implemented")
}
/// Stores a new nested container for the default `super` key and returns a new `Encoder` instance for encoding `super` into that container.
///
/// Equivalent to calling `superEncoder(forKey:)` with `Key(stringValue: "super", intValue: 0)`.
///
/// - returns: A new `Encoder` to pass to `super.encode(to:)`.
mutating func superEncoder() -> Encoder {
fatalError("Not implemented")
}
/// Stores a new nested container for the given key and returns a new `Encoder` instance for encoding `super` into that container.
///
/// - parameter key: The key to encode `super` for.
/// - returns: A new `Encoder` to pass to `super.encode(to:)`.
mutating func superEncoder(forKey key: Key) -> Encoder {
fatalError("Not implemented")
}
}
private struct DatabaseValueEncodingContainer : SingleValueEncodingContainer {
let key: CodingKey
let encode: (_ value: DatabaseValueConvertible?, _ key: String) -> Void
var codingPath: [CodingKey] { return [key] }
/// Encodes a null value.
///
/// - throws: `EncodingError.invalidValue` if a null value is invalid in the current context for this format.
/// - precondition: May not be called after a previous `self.encode(_:)` call.
func encodeNil() throws { encode(nil, key.stringValue) }
/// Encodes a single value of the given type.
///
/// - parameter value: The value to encode.
/// - throws: `EncodingError.invalidValue` if the given value is invalid in the current context for this format.
/// - precondition: May not be called after a previous `self.encode(_:)` call.
func encode(_ value: Bool) throws { encode(value, key.stringValue) }
func encode(_ value: Int) throws { encode(value, key.stringValue) }
func encode(_ value: Int8) throws { encode(value, key.stringValue) }
func encode(_ value: Int16) throws { encode(value, key.stringValue) }
func encode(_ value: Int32) throws { encode(value, key.stringValue) }
func encode(_ value: Int64) throws { encode(value, key.stringValue) }
func encode(_ value: UInt) throws { encode(value, key.stringValue) }
func encode(_ value: UInt8) throws { encode(value, key.stringValue) }
func encode(_ value: UInt16) throws { encode(value, key.stringValue) }
func encode(_ value: UInt32) throws { encode(value, key.stringValue) }
func encode(_ value: UInt64) throws { encode(value, key.stringValue) }
func encode(_ value: Float) throws { encode(value, key.stringValue) }
func encode(_ value: Double) throws { encode(value, key.stringValue) }
func encode(_ value: String) throws { encode(value, key.stringValue) }
/// Encodes a single value of the given type.
///
/// - parameter value: The value to encode.
/// - throws: `EncodingError.invalidValue` if the given value is invalid in the current context for this format.
/// - precondition: May not be called after a previous `self.encode(_:)` call.
func encode<T>(_ value: T) throws where T : Encodable {
if let dbValueConvertible = value as? DatabaseValueConvertible {
// Prefer DatabaseValueConvertible encoding over Decodable.
// This allows us to encode Date as String, for example.
encode(dbValueConvertible.databaseValue, key.stringValue)
} else {
try value.encode(to: PersistableRecordEncoder(codingPath: [key], encode: encode))
}
}
}
private struct PersistableRecordEncoder : Encoder {
/// The path of coding keys taken to get to this point in encoding.
/// A `nil` value indicates an unkeyed container.
var codingPath: [CodingKey]
/// Any contextual information set by the user for encoding.
var userInfo: [CodingUserInfoKey : Any] = [:]
let encode: (_ value: DatabaseValueConvertible?, _ key: String) -> Void
init(codingPath: [CodingKey], encode: @escaping (_ value: DatabaseValueConvertible?, _ key: String) -> Void) {
self.codingPath = codingPath
self.encode = encode
}
/// Returns an encoding container appropriate for holding multiple values keyed by the given key type.
///
/// - parameter type: The key type to use for the container.
/// - returns: A new keyed encoding container.
/// - precondition: May not be called after a prior `self.unkeyedContainer()` call.
/// - precondition: May not be called after a value has been encoded through a previous `self.singleValueContainer()` call.
func container<Key>(keyedBy type: Key.Type) -> KeyedEncodingContainer<Key> {
// Asked for a keyed type: top level required
guard codingPath.isEmpty else {
fatalError("unkeyed encoding is not supported")
}
return KeyedEncodingContainer(PersistableRecordKeyedEncodingContainer<Key>(encode: encode))
let container = KeyedContainer<Key>(recordEncoder: self)
return KeyedEncodingContainer(container)
}
/// Returns an encoding container appropriate for holding multiple unkeyed values.
///
/// - returns: A new empty unkeyed container.
/// - precondition: May not be called after a prior `self.container(keyedBy:)` call.
/// - precondition: May not be called after a value has been encoded through a previous `self.singleValueContainer()` call.
func unkeyedContainer() -> UnkeyedEncodingContainer {
fatalError("unkeyed encoding is not supported")
}
/// Returns an encoding container appropriate for holding a single primitive value.
///
/// - returns: A new empty single value container.
/// - precondition: May not be called after a prior `self.container(keyedBy:)` call.
/// - precondition: May not be called after a prior `self.unkeyedContainer()` call.
/// - precondition: May not be called after a value has been encoded through a previous `self.singleValueContainer()` call.
func singleValueContainer() -> SingleValueEncodingContainer {
return DatabaseValueEncodingContainer(key: codingPath.last!, encode: encode)
// @itaiferber on https://forums.swift.org/t/how-to-encode-objects-of-unknown-type/12253/11
//
// > Encoding a value into a single-value container is equivalent to
// > encoding the value directly into the encoder, with the primary
// > difference being the above: encoding into the encoder writes the
// > contents of a type into the encoder, while encoding to a
// > single-value container gives the encoder a chance to intercept the
// > type as a whole.
//
// Wait for somebody hitting this fatal error so that we can write a
// meaningful regression test.
fatalError("single value encoding is not supported")
}
private struct KeyedContainer<Key: CodingKey> : KeyedEncodingContainerProtocol {
var recordEncoder: RecordEncoder
var userInfo: [CodingUserInfoKey: Any] { return Record.databaseEncodingUserInfo }
init(recordEncoder: RecordEncoder) {
self.recordEncoder = recordEncoder
}
var codingPath: [CodingKey] { return [] }
func encode(_ value: Bool, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: Int, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: Int8, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: Int16, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: Int32, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: Int64, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: UInt, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: UInt8, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: UInt16, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: UInt32, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: UInt64, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: Float, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: Double, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: String, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encode<T>(_ value: T, forKey key: Key) throws where T : Encodable {
try recordEncoder.encode(value, forKey: key)
}
func encodeNil(forKey key: Key) throws { recordEncoder.persist(nil, forKey: key) }
func encodeIfPresent(_ value: Bool?, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encodeIfPresent(_ value: Int?, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encodeIfPresent(_ value: Int8?, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encodeIfPresent(_ value: Int16?, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encodeIfPresent(_ value: Int32?, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encodeIfPresent(_ value: Int64?, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encodeIfPresent(_ value: UInt?, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encodeIfPresent(_ value: UInt8?, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encodeIfPresent(_ value: UInt16?, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encodeIfPresent(_ value: UInt32?, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encodeIfPresent(_ value: UInt64?, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encodeIfPresent(_ value: Float?, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encodeIfPresent(_ value: Double?, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encodeIfPresent(_ value: String?, forKey key: Key) throws { recordEncoder.persist(value, forKey: key) }
func encodeIfPresent<T>(_ value: T?, forKey key: Key) throws where T : Encodable {
if let value = value {
try recordEncoder.encode(value, forKey: key)
} else {
recordEncoder.persist(nil, forKey: key)
}
}
func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type, forKey key: Key) -> KeyedEncodingContainer<NestedKey> {
fatalError("Not implemented")
}
func nestedUnkeyedContainer(forKey key: Key) -> UnkeyedEncodingContainer {
fatalError("Not implemented")
}
func superEncoder() -> Encoder {
fatalError("Not implemented")
}
func superEncoder(forKey key: Key) -> Encoder {
fatalError("Not implemented")
}
}
/// Helper methods
@inline(__always)
fileprivate func persist(_ value: DatabaseValueConvertible?, forKey key: CodingKey) {
_persistenceContainer[key.stringValue] = value
}
@inline(__always)
fileprivate func encode<T>(_ value: T, forKey key: CodingKey) throws where T : Encodable {
if let date = value as? Date {
persist(Record.databaseDateEncodingStrategy.encode(date), forKey: key)
} else if let uuid = value as? UUID {
persist(Record.databaseUUIDEncodingStrategy.encode(uuid), forKey: key)
} else if let value = value as? DatabaseValueConvertible {
// Prefer DatabaseValueConvertible encoding over Decodable.
persist(value.databaseValue, forKey: key)
} else {
do {
// This encoding will fail for types that encode into keyed
// or unkeyed containers, because we're encoding a single
// value here (string, int, double, data, null). If such an
// error happens, we'll switch to JSON encoding.
let encoder = ColumnEncoder(recordEncoder: self, key: key)
try value.encode(to: encoder)
} catch is JSONRequiredError {
// Encode to JSON
let jsonData = try Record.databaseJSONEncoder(for: key.stringValue).encode(value)
// Store JSON String in the database for easier debugging and
// database inspection. Thanks to SQLite weak typing, we won't
// have any trouble decoding this string into data when we
// eventually perform JSON decoding.
// TODO: possible optimization: avoid this conversion to string, and store raw data bytes as an SQLite string
let jsonString = String(data: jsonData, encoding: .utf8)! // force unwrap because json data is guaranteed to convert to String
persist(jsonString, forKey: key)
}
}
}
}
extension MutablePersistableRecord where Self: Encodable {
public func encode(to container: inout PersistenceContainer) {
// The inout container parameter won't enter an escaping closure since
// SE-0035: https://github.com/apple/swift-evolution/blob/master/proposals/0035-limit-inout-capture.md
//
// So let's use it in a non-escaping closure:
func encode(_ encode: (_ value: DatabaseValueConvertible?, _ key: String) -> Void) {
withoutActuallyEscaping(encode) { escapableEncode in
let encoder = PersistableRecordEncoder(codingPath: [], encode: escapableEncode)
try! self.encode(to: encoder)
}
// MARK: - ColumnEncoder
/// The encoder that encodes into a database column
private struct ColumnEncoder<Record: MutablePersistableRecord>: Encoder {
var recordEncoder: RecordEncoder<Record>
var key: CodingKey
var codingPath: [CodingKey] { return [key] }
var userInfo: [CodingUserInfoKey: Any] { return Record.databaseEncodingUserInfo }
init(recordEncoder: RecordEncoder<Record>, key: CodingKey) {
self.recordEncoder = recordEncoder
self.key = key
}
func container<Key>(keyedBy type: Key.Type) -> KeyedEncodingContainer<Key> where Key : CodingKey {
// Keyed values require JSON encoding: we need to throw
// JSONRequiredError. Since we can't throw right from here, let's
// delegate the job to a dedicated container.
let container = JSONRequiredEncoder<Record>.KeyedContainer<Key>(codingPath: codingPath)
return KeyedEncodingContainer(container)
}
func unkeyedContainer() -> UnkeyedEncodingContainer {
// Keyed values require JSON encoding: we need to throw
// JSONRequiredError. Since we can't throw right from here, let's
// delegate the job to a dedicated container.
return JSONRequiredEncoder<Record>(codingPath: codingPath)
}
func singleValueContainer() -> SingleValueEncodingContainer {
return self
}
}
extension ColumnEncoder: SingleValueEncodingContainer {
func encodeNil() throws { recordEncoder.persist(nil, forKey: key) }
func encode(_ value: Bool ) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: Int ) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: Int8 ) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: Int16 ) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: Int32 ) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: Int64 ) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: UInt ) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: UInt8 ) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: UInt16) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: UInt32) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: UInt64) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: Float ) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: Double) throws { recordEncoder.persist(value, forKey: key) }
func encode(_ value: String) throws { recordEncoder.persist(value, forKey: key) }
func encode<T>(_ value: T) throws where T : Encodable {
try recordEncoder.encode(value, forKey: key)
}
}
// MARK: - JSONRequiredEncoder
/// The error that triggers JSON encoding
private struct JSONRequiredError: Error { }
/// The encoder that always ends up with a JSONRequiredError
private struct JSONRequiredEncoder<Record: MutablePersistableRecord>: Encoder {
var codingPath: [CodingKey]
var userInfo: [CodingUserInfoKey: Any] { return Record.databaseEncodingUserInfo }
init(codingPath: [CodingKey]) {
self.codingPath = codingPath
}
func container<Key>(keyedBy type: Key.Type) -> KeyedEncodingContainer<Key> where Key : CodingKey {
let container = KeyedContainer<Key>(codingPath: codingPath)
return KeyedEncodingContainer(container)
}
func unkeyedContainer() -> UnkeyedEncodingContainer {
return self
}
func singleValueContainer() -> SingleValueEncodingContainer {
return self
}
struct KeyedContainer<KeyType: CodingKey>: KeyedEncodingContainerProtocol {
var codingPath: [CodingKey]
var userInfo: [CodingUserInfoKey: Any] { return Record.databaseEncodingUserInfo }
func encodeNil(forKey key: KeyType) throws { throw JSONRequiredError() }
func encode(_ value: Bool, forKey key: KeyType) throws { throw JSONRequiredError() }
func encode(_ value: Int, forKey key: KeyType) throws { throw JSONRequiredError() }
func encode(_ value: Int8, forKey key: KeyType) throws { throw JSONRequiredError() }
func encode(_ value: Int16, forKey key: KeyType) throws { throw JSONRequiredError() }
func encode(_ value: Int32, forKey key: KeyType) throws { throw JSONRequiredError() }
func encode(_ value: Int64, forKey key: KeyType) throws { throw JSONRequiredError() }
func encode(_ value: UInt, forKey key: KeyType) throws { throw JSONRequiredError() }
func encode(_ value: UInt8, forKey key: KeyType) throws { throw JSONRequiredError() }
func encode(_ value: UInt16, forKey key: KeyType) throws { throw JSONRequiredError() }
func encode(_ value: UInt32, forKey key: KeyType) throws { throw JSONRequiredError() }
func encode(_ value: UInt64, forKey key: KeyType) throws { throw JSONRequiredError() }
func encode(_ value: Float, forKey key: KeyType) throws { throw JSONRequiredError() }
func encode(_ value: Double, forKey key: KeyType) throws { throw JSONRequiredError() }
func encode(_ value: String, forKey key: KeyType) throws { throw JSONRequiredError() }
func encode<T>(_ value: T, forKey key: KeyType) throws where T : Encodable { throw JSONRequiredError() }
func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type, forKey key: KeyType) -> KeyedEncodingContainer<NestedKey> where NestedKey : CodingKey {
let container = KeyedContainer<NestedKey>(codingPath: codingPath + [key])
return KeyedEncodingContainer(container)
}
encode { (value, key) in
container[key] = value
func nestedUnkeyedContainer(forKey key: KeyType) -> UnkeyedEncodingContainer {
return JSONRequiredEncoder(codingPath: codingPath)
}
func superEncoder() -> Encoder {
return JSONRequiredEncoder(codingPath: codingPath)
}
func superEncoder(forKey key: KeyType) -> Encoder {
return JSONRequiredEncoder(codingPath: codingPath)
}
}
}
extension JSONRequiredEncoder: SingleValueEncodingContainer {
func encodeNil() throws { throw JSONRequiredError() }
func encode(_ value: Bool ) throws { throw JSONRequiredError() }
func encode(_ value: Int ) throws { throw JSONRequiredError() }
func encode(_ value: Int8 ) throws { throw JSONRequiredError() }
func encode(_ value: Int16 ) throws { throw JSONRequiredError() }
func encode(_ value: Int32 ) throws { throw JSONRequiredError() }
func encode(_ value: Int64 ) throws { throw JSONRequiredError() }
func encode(_ value: UInt ) throws { throw JSONRequiredError() }
func encode(_ value: UInt8 ) throws { throw JSONRequiredError() }
func encode(_ value: UInt16) throws { throw JSONRequiredError() }
func encode(_ value: UInt32) throws { throw JSONRequiredError() }
func encode(_ value: UInt64) throws { throw JSONRequiredError() }
func encode(_ value: Float ) throws { throw JSONRequiredError() }
func encode(_ value: Double) throws { throw JSONRequiredError() }
func encode(_ value: String) throws { throw JSONRequiredError() }
func encode<T>(_ value: T) throws where T : Encodable { throw JSONRequiredError() }
}
extension JSONRequiredEncoder: UnkeyedEncodingContainer {
var count: Int { return 0 }
mutating func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type) -> KeyedEncodingContainer<NestedKey> where NestedKey : CodingKey {
let container = KeyedContainer<NestedKey>(codingPath: codingPath)
return KeyedEncodingContainer(container)
}
mutating func nestedUnkeyedContainer() -> UnkeyedEncodingContainer {
return self
}
mutating func superEncoder() -> Encoder {
return self
}
}
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
fileprivate var iso8601Formatter: ISO8601DateFormatter = {
let formatter = ISO8601DateFormatter()
formatter.formatOptions = .withInternetDateTime
return formatter
}()
private extension DatabaseDateEncodingStrategy {
@inline(__always)
func encode(_ date: Date) -> DatabaseValueConvertible? {
switch self {
case .deferredToDate:
return date.databaseValue
case .timeIntervalSinceReferenceDate:
return date.timeIntervalSinceReferenceDate
case .timeIntervalSince1970:
return date.timeIntervalSince1970
case .millisecondsSince1970:
return Int64(floor(1000.0 * date.timeIntervalSince1970))
case .secondsSince1970:
return Int64(floor(date.timeIntervalSince1970))
case .iso8601:
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
return iso8601Formatter.string(from: date)
} else {
fatalError("ISO8601DateFormatter is unavailable on this platform.")
}
case .formatted(let formatter):
return formatter.string(from: date)
case .custom(let format):
return format(date)
}
}
}
private extension DatabaseUUIDEncodingStrategy {
@inline(__always)
func encode(_ uuid: UUID) -> DatabaseValueConvertible? {
switch self {
case .deferredToUUID:
return uuid.databaseValue
case .string:
return uuid.uuidString
}
}
}
+197 -2
View File
@@ -1,3 +1,5 @@
import Foundation
extension Database.ConflictResolution {
var invalidatesLastInsertedRowID: Bool {
switch self {
@@ -320,6 +322,127 @@ public protocol MutablePersistableRecord : TableRecord {
/// - returns: Whether the primary key matches a row in the database.
/// - throws: A DatabaseError is thrown whenever an SQLite error occurs.
func exists(_ db: Database) throws -> Bool
// MARK: - Customizing the Format of Database Columns
/// When the PersistableRecord type also adopts the standard Encodable
/// protocol, you can use this dictionary to customize the encoding process
/// into database rows.
///
/// For example:
///
/// // A key that holds a encoder's name
/// let encoderName = CodingUserInfoKey(rawValue: "encoderName")!
///
/// // A PersistableRecord + Encodable record
/// struct Player: PersistableRecord, Encodable {
/// // Customize the encoder name when encoding a database row
/// static let databaseEncodingUserInfo: [CodingUserInfoKey: Any] = [encoderName: "Database"]
///
/// func encode(to encoder: Encoder) throws {
/// // Print the encoder name
/// print(encoder.userInfo[encoderName])
/// ...
/// }
/// }
///
/// let player = Player(...)
///
/// // prints "Database"
/// try player.insert(db)
///
/// // prints "JSON"
/// let encoder = JSONEncoder()
/// encoder.userInfo = [encoderName: "JSON"]
/// let data = try encoder.encode(player)
static var databaseEncodingUserInfo: [CodingUserInfoKey: Any] { get }
/// When the PersistableRecord type also adopts the standard Encodable
/// protocol, this method controls the encoding process of nested properties
/// into JSON database columns.
///
/// The default implementation returns a JSONEncoder with the
/// following properties:
///
/// - dataEncodingStrategy: .base64
/// - dateEncodingStrategy: .millisecondsSince1970
/// - nonConformingFloatEncodingStrategy: .throw
/// - outputFormatting: .sortedKeys (iOS 11.0+, macOS 10.13+, watchOS 4.0+)
///
/// You can override those defaults:
///
/// struct Achievement: Encodable {
/// var name: String
/// var date: Date
/// }
///
/// struct Player: Encodable, PersistableRecord {
/// // stored in a JSON column
/// var achievements: [Achievement]
///
/// static func databaseJSONEncoder(for column: String) -> JSONEncoder {
/// let encoder = JSONEncoder()
/// encoder.dateEncodingStrategy = .iso8601
/// return encoder
/// }
/// }
static func databaseJSONEncoder(for column: String) -> JSONEncoder
/// When the PersistableRecord type also adopts the standard Encodable
/// protocol, this property controls the encoding of date properties.
///
/// Default value is .deferredToDate
///
/// For example:
///
/// struct Player: PersistableRecord, Encodable {
/// static let databaseDateEncodingStrategy: DatabaseDateEncodingStrategy = .timeIntervalSince1970
///
/// var name: String
/// var registrationDate: Date // encoded as an epoch timestamp
/// }
static var databaseDateEncodingStrategy: DatabaseDateEncodingStrategy { get }
/// When the PersistableRecord type also adopts the standard Encodable
/// protocol, this property controls the encoding of UUID properties.
///
/// Default value is .deferredToUUID
///
/// For example:
///
/// struct Player: PersistableProtocol, Encodable {
/// static let databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy = .string
///
/// // encoded in a string like "E621E1F8-C36C-495A-93FC-0C247A3E6E5F"
/// var uuid: UUID
/// }
static var databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy { get }
}
extension MutablePersistableRecord {
public static var databaseEncodingUserInfo: [CodingUserInfoKey: Any] {
return [:]
}
public static func databaseJSONEncoder(for column: String) -> JSONEncoder {
let encoder = JSONEncoder()
encoder.dataEncodingStrategy = .base64
encoder.dateEncodingStrategy = .millisecondsSince1970
encoder.nonConformingFloatEncodingStrategy = .throw
if #available(watchOS 4.0, OSX 10.13, iOS 11.0, *) {
// guarantee some stability in order to ease record comparison
encoder.outputFormatting = .sortedKeys
}
return encoder
}
public static var databaseDateEncodingStrategy: DatabaseDateEncodingStrategy {
return .deferredToDate
}
public static var databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy {
return .deferredToUUID
}
}
extension MutablePersistableRecord {
@@ -853,7 +976,77 @@ extension PersistableRecord {
try insert(db)
}
}
}
// MARK: - DatabaseDateEncodingStrategy
/// DatabaseDateEncodingStrategy specifies how PersistableRecord types that also
/// adopt the standard Encodable protocol encode their date properties.
///
/// For example:
///
/// struct Player: PersistableRecord, Encodable {
/// static let databaseDateEncodingStrategy: DatabaseDateEncodingStrategy = .timeIntervalSince1970
///
/// var name: String
/// var registrationDate: Date // encoded as an epoch timestamp
/// }
public enum DatabaseDateEncodingStrategy {
/// The strategy that uses formatting from the Date structure.
///
/// It encodes dates using the format "YYYY-MM-DD HH:MM:SS.SSS" in the
/// UTC time zone.
case deferredToDate
/// Encodes a Double: the number of seconds between the date and
/// midnight UTC on 1 January 2001
case timeIntervalSinceReferenceDate
/// Encodes a Double: the number of seconds between the date and
/// midnight UTC on 1 January 1970
case timeIntervalSince1970
/// Encodes an Int64: the number of seconds between the date and
/// midnight UTC on 1 January 1970
case secondsSince1970
/// Encodes an Int64: the number of milliseconds between the date and
/// midnight UTC on 1 January 1970
case millisecondsSince1970
/// Encodes dates according to the ISO 8601 and RFC 3339 standards
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
case iso8601
/// Encodes a String, according to the provided formatter
case formatted(DateFormatter)
/// Encodes the result of the user-provided function
case custom((Date) -> DatabaseValueConvertible?)
}
// MARK: - DatabaseUUIDEncodingStrategy
/// DatabaseUUIDEncodingStrategy specifies how FetchableRecord types that also
/// adopt the standard Encodable protocol encode their UUID properties.
///
/// For example:
///
/// struct Player: PersistableProtocol, Encodable {
/// static let databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy = .string
///
/// // encoded in a string like "E621E1F8-C36C-495A-93FC-0C247A3E6E5F"
/// var uuid: UUID
/// }
public enum DatabaseUUIDEncodingStrategy {
/// The strategy that uses formatting from the UUID type.
///
/// It encodes UUIDs as 16-bytes data blobs.
case deferredToUUID
/// Encodes UUIDs as strings such as "E621E1F8-C36C-495A-93FC-0C247A3E6E5F"
case string
}
// MARK: - DAO
@@ -992,8 +1185,9 @@ private struct InsertQuery: Hashable {
let tableName: String
let insertedColumns: [String]
// TODO: remove when Swift can generate it
#if !swift(>=4.2)
var hashValue: Int { return tableName.hashValue }
#endif
}
extension InsertQuery {
@@ -1025,8 +1219,9 @@ private struct UpdateQuery: Hashable {
let updatedColumns: [String]
let conditionColumns: [String]
// TODO: remove when Swift can generate it
#if !swift(>=4.2)
var hashValue: Int { return tableName.hashValue }
#endif
}
extension UpdateQuery {
+9
View File
@@ -37,4 +37,13 @@ enum Result<Value> {
return .failure(error)
}
}
func unwrap() throws -> Value {
switch self {
case .success(let value):
return value
case .failure(let error):
throw error
}
}
}
+1 -1
View File
@@ -46,6 +46,7 @@ extension Optional : _OptionalProtocol {
// MARK: - Internal
/// Reserved for GRDB: do not use.
@inline(__always)
func GRDBPrecondition(_ condition: @autoclosure() -> Bool, _ message: @autoclosure() -> String = "", file: StaticString = #file, line: UInt = #line) {
/// Custom precondition function which aims at solving
/// https://bugs.swift.org/browse/SR-905 and
@@ -68,4 +69,3 @@ extension Array {
}
}
}
+4 -4
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'GRDBCipher'
s.version = '3.2.0'
s.version = '3.3.0'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'A toolkit for SQLite databases, with a focus on application development.'
@@ -16,9 +16,9 @@ Pod::Spec.new do |s|
s.source_files = 'GRDB/**/*.swift', 'SQLCipher/*.h', 'Support/grdb_config.h'
s.module_map = 'SQLCipher/module.modulemap'
s.xcconfig = {
'OTHER_SWIFT_FLAGS' => '$(inherited) -D SQLITE_HAS_CODEC -D GRDBCIPHER',
'OTHER_CFLAGS' => '$(inherited) -DSQLITE_HAS_CODEC -DGRDBCIPHER',
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) SQLITE_HAS_CODEC=1 GRDBCIPHER=1'
'OTHER_SWIFT_FLAGS' => '$(inherited) -D SQLITE_HAS_CODEC -D GRDBCIPHER -D SQLITE_ENABLE_FTS5',
'OTHER_CFLAGS' => '$(inherited) -DSQLITE_HAS_CODEC -DGRDBCIPHER -DSQLITE_ENABLE_FTS5',
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) SQLITE_HAS_CODEC=1 GRDBCIPHER=1 SQLITE_ENABLE_FTS5=1'
}
s.framework = 'Foundation'
s.dependency 'SQLCipher', '~> 3.4.1'
+55 -27
View File
@@ -51,7 +51,6 @@
560FC56D1CB00B880014AA8E /* DatabaseMigratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238241B9C74A90082EB20 /* DatabaseMigratorTests.swift */; };
560FC5701CB00B880014AA8E /* DatabasePoolCollationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569531331C919DF200CF1A2B /* DatabasePoolCollationTests.swift */; };
560FC5711CB00B880014AA8E /* RecordPrimaryKeySingleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A2382B1B9C74A90082EB20 /* RecordPrimaryKeySingleTests.swift */; };
560FC5721CB00B880014AA8E /* StatementColumnConvertibleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56EE573C1BB317B7007A6A95 /* StatementColumnConvertibleTests.swift */; };
560FC5741CB00B880014AA8E /* DatabasePoolFunctionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569531361C919DF700CF1A2B /* DatabasePoolFunctionTests.swift */; };
560FC5761CB00B880014AA8E /* RowCopiedFromStatementTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A2381F1B9C74A90082EB20 /* RowCopiedFromStatementTests.swift */; };
560FC5771CB00B880014AA8E /* DatabaseQueueSchemaCacheTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569531231C90878D00CF1A2B /* DatabaseQueueSchemaCacheTests.swift */; };
@@ -185,6 +184,12 @@
564448851EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564448821EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift */; };
564448881EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564448821EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift */; };
564448891EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564448821EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift */; };
5644DE7C20F8C903001FFDDE /* DatabaseValueConversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5644DE7A20F8C903001FFDDE /* DatabaseValueConversion.swift */; };
5644DE7D20F8C903001FFDDE /* DatabaseValueConversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5644DE7A20F8C903001FFDDE /* DatabaseValueConversion.swift */; };
5644DE8220F8D1E4001FFDDE /* DatabaseValueConversionErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5644DE8120F8D1E4001FFDDE /* DatabaseValueConversionErrorTests.swift */; };
5644DE8320F8D1E4001FFDDE /* DatabaseValueConversionErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5644DE8120F8D1E4001FFDDE /* DatabaseValueConversionErrorTests.swift */; };
5644DE8420F8D1E4001FFDDE /* DatabaseValueConversionErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5644DE8120F8D1E4001FFDDE /* DatabaseValueConversionErrorTests.swift */; };
5644DE8520F8D1E4001FFDDE /* DatabaseValueConversionErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5644DE8120F8D1E4001FFDDE /* DatabaseValueConversionErrorTests.swift */; };
564E73EF203DA2A2000C443C /* JoinSupportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564E73EB203DA29B000C443C /* JoinSupportTests.swift */; };
564E73F0203DA2A3000C443C /* JoinSupportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564E73EB203DA29B000C443C /* JoinSupportTests.swift */; };
564E73F1203DA2A3000C443C /* JoinSupportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564E73EB203DA29B000C443C /* JoinSupportTests.swift */; };
@@ -336,6 +341,14 @@
5665F86D203EF47D0084C6C0 /* ColumnInfoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665F86A203EF47C0084C6C0 /* ColumnInfoTests.swift */; };
5665F86E203EF47D0084C6C0 /* ColumnInfoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665F86A203EF47C0084C6C0 /* ColumnInfoTests.swift */; };
5665F86F203EF47D0084C6C0 /* ColumnInfoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665F86A203EF47C0084C6C0 /* ColumnInfoTests.swift */; };
5665FA222129D81F004D8612 /* DatabaseDateDecodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665FA202129D81F004D8612 /* DatabaseDateDecodingStrategyTests.swift */; };
5665FA232129D81F004D8612 /* DatabaseDateDecodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665FA202129D81F004D8612 /* DatabaseDateDecodingStrategyTests.swift */; };
5665FA242129D81F004D8612 /* DatabaseDateDecodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665FA202129D81F004D8612 /* DatabaseDateDecodingStrategyTests.swift */; };
5665FA252129D81F004D8612 /* DatabaseDateDecodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665FA202129D81F004D8612 /* DatabaseDateDecodingStrategyTests.swift */; };
5665FA412129EEEF004D8612 /* DatabaseDateEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665FA3F2129EEEF004D8612 /* DatabaseDateEncodingStrategyTests.swift */; };
5665FA422129EEEF004D8612 /* DatabaseDateEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665FA3F2129EEEF004D8612 /* DatabaseDateEncodingStrategyTests.swift */; };
5665FA432129EEEF004D8612 /* DatabaseDateEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665FA3F2129EEEF004D8612 /* DatabaseDateEncodingStrategyTests.swift */; };
5665FA442129EEEF004D8612 /* DatabaseDateEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665FA3F2129EEEF004D8612 /* DatabaseDateEncodingStrategyTests.swift */; };
566A842920413D6F00E50BFD /* DatabaseSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566A842720413D6E00E50BFD /* DatabaseSnapshot.swift */; };
566A842A20413D8500E50BFD /* DatabaseSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566A842720413D6E00E50BFD /* DatabaseSnapshot.swift */; };
566A843020413DD000E50BFD /* DatabaseSnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566A842F20413DCF00E50BFD /* DatabaseSnapshotTests.swift */; };
@@ -362,6 +375,10 @@
566B912F1FA4D0CC0012D5B0 /* StatementAuthorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566B912A1FA4D0CC0012D5B0 /* StatementAuthorizer.swift */; };
566B91341FA4D3810012D5B0 /* TransactionObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566B91321FA4D3810012D5B0 /* TransactionObserver.swift */; };
566B91371FA4D3810012D5B0 /* TransactionObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566B91321FA4D3810012D5B0 /* TransactionObserver.swift */; };
5670329F212B546E007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5670329D212B546D007D270F /* DatabaseUUIDEncodingStrategyTests.swift */; };
567032A0212B546E007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5670329D212B546D007D270F /* DatabaseUUIDEncodingStrategyTests.swift */; };
567032A1212B546E007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5670329D212B546D007D270F /* DatabaseUUIDEncodingStrategyTests.swift */; };
567032A2212B546E007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5670329D212B546D007D270F /* DatabaseUUIDEncodingStrategyTests.swift */; };
567071F8208A00D4006AD95A /* SQLiteDateParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567071F6208A00D4006AD95A /* SQLiteDateParser.swift */; };
567071F9208A00D4006AD95A /* SQLiteDateParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567071F6208A00D4006AD95A /* SQLiteDateParser.swift */; };
567156141CB141D0007DC145 /* DatabaseQueueInMemoryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238141B9C74A90082EB20 /* DatabaseQueueInMemoryTests.swift */; };
@@ -380,7 +397,6 @@
5671562B1CB16729007DC145 /* DatabaseMigratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238241B9C74A90082EB20 /* DatabaseMigratorTests.swift */; };
5671562E1CB16729007DC145 /* DatabasePoolCollationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569531331C919DF200CF1A2B /* DatabasePoolCollationTests.swift */; };
5671562F1CB16729007DC145 /* RecordPrimaryKeySingleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A2382B1B9C74A90082EB20 /* RecordPrimaryKeySingleTests.swift */; };
567156301CB16729007DC145 /* StatementColumnConvertibleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56EE573C1BB317B7007A6A95 /* StatementColumnConvertibleTests.swift */; };
567156321CB16729007DC145 /* DatabasePoolFunctionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569531361C919DF700CF1A2B /* DatabasePoolFunctionTests.swift */; };
567156341CB16729007DC145 /* RowCopiedFromStatementTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A2381F1B9C74A90082EB20 /* RowCopiedFromStatementTests.swift */; };
567156351CB16729007DC145 /* DatabaseQueueSchemaCacheTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569531231C90878D00CF1A2B /* DatabaseQueueSchemaCacheTests.swift */; };
@@ -635,7 +651,6 @@
56AFCA3B1CB1AA9900F48B96 /* DatabaseMigratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238241B9C74A90082EB20 /* DatabaseMigratorTests.swift */; };
56AFCA3E1CB1AA9900F48B96 /* DatabasePoolCollationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569531331C919DF200CF1A2B /* DatabasePoolCollationTests.swift */; };
56AFCA3F1CB1AA9900F48B96 /* RecordPrimaryKeySingleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A2382B1B9C74A90082EB20 /* RecordPrimaryKeySingleTests.swift */; };
56AFCA411CB1AA9900F48B96 /* StatementColumnConvertibleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56EE573C1BB317B7007A6A95 /* StatementColumnConvertibleTests.swift */; };
56AFCA421CB1AA9900F48B96 /* DatabasePoolFunctionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569531361C919DF700CF1A2B /* DatabasePoolFunctionTests.swift */; };
56AFCA441CB1AA9900F48B96 /* RowCopiedFromStatementTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A2381F1B9C74A90082EB20 /* RowCopiedFromStatementTests.swift */; };
56AFCA451CB1AA9900F48B96 /* DatabaseQueueSchemaCacheTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569531231C90878D00CF1A2B /* DatabaseQueueSchemaCacheTests.swift */; };
@@ -695,7 +710,6 @@
56AFCA941CB1ABC800F48B96 /* DatabaseMigratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238241B9C74A90082EB20 /* DatabaseMigratorTests.swift */; };
56AFCA971CB1ABC800F48B96 /* DatabasePoolCollationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569531331C919DF200CF1A2B /* DatabasePoolCollationTests.swift */; };
56AFCA981CB1ABC800F48B96 /* RecordPrimaryKeySingleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A2382B1B9C74A90082EB20 /* RecordPrimaryKeySingleTests.swift */; };
56AFCA9A1CB1ABC800F48B96 /* StatementColumnConvertibleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56EE573C1BB317B7007A6A95 /* StatementColumnConvertibleTests.swift */; };
56AFCA9B1CB1ABC800F48B96 /* DatabasePoolFunctionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569531361C919DF700CF1A2B /* DatabasePoolFunctionTests.swift */; };
56AFCA9D1CB1ABC800F48B96 /* RowCopiedFromStatementTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A2381F1B9C74A90082EB20 /* RowCopiedFromStatementTests.swift */; };
56AFCA9E1CB1ABC800F48B96 /* DatabaseQueueSchemaCacheTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 569531231C90878D00CF1A2B /* DatabaseQueueSchemaCacheTests.swift */; };
@@ -961,6 +975,8 @@
5634B1061CF9B970005360B9 /* TransactionObserverSavepointsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionObserverSavepointsTests.swift; sourceTree = "<group>"; };
5636E9BB1D22574100B9B05F /* FetchRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchRequest.swift; sourceTree = "<group>"; };
564448821EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseAfterNextTransactionCommitTests.swift; sourceTree = "<group>"; };
5644DE7A20F8C903001FFDDE /* DatabaseValueConversion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseValueConversion.swift; sourceTree = "<group>"; };
5644DE8120F8D1E4001FFDDE /* DatabaseValueConversionErrorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseValueConversionErrorTests.swift; sourceTree = "<group>"; };
564A50C61BFF4B7F00B3A3A2 /* DatabaseCollationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseCollationTests.swift; sourceTree = "<group>"; };
564E73EB203DA29B000C443C /* JoinSupportTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JoinSupportTests.swift; sourceTree = "<group>"; };
564F9C1D1F069B4E00877A00 /* DatabaseAggregateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseAggregateTests.swift; sourceTree = "<group>"; };
@@ -1015,6 +1031,8 @@
566475CA1D981D5E00FF74B8 /* SQLFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLFunctions.swift; sourceTree = "<group>"; };
566475CB1D981D5E00FF74B8 /* SQLOperators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLOperators.swift; sourceTree = "<group>"; };
5665F86A203EF47C0084C6C0 /* ColumnInfoTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColumnInfoTests.swift; sourceTree = "<group>"; };
5665FA202129D81F004D8612 /* DatabaseDateDecodingStrategyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseDateDecodingStrategyTests.swift; sourceTree = "<group>"; };
5665FA3F2129EEEF004D8612 /* DatabaseDateEncodingStrategyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseDateEncodingStrategyTests.swift; sourceTree = "<group>"; };
566A842720413D6E00E50BFD /* DatabaseSnapshot.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseSnapshot.swift; sourceTree = "<group>"; };
566A842F20413DCF00E50BFD /* DatabaseSnapshotTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseSnapshotTests.swift; sourceTree = "<group>"; };
566A84452041AB3900E50BFD /* MutablePersistableRecordChangesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutablePersistableRecordChangesTests.swift; sourceTree = "<group>"; };
@@ -1025,6 +1043,7 @@
566B91221FA4CF810012D5B0 /* Database+Schema.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Database+Schema.swift"; sourceTree = "<group>"; };
566B912A1FA4D0CC0012D5B0 /* StatementAuthorizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatementAuthorizer.swift; sourceTree = "<group>"; };
566B91321FA4D3810012D5B0 /* TransactionObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionObserver.swift; sourceTree = "<group>"; };
5670329D212B546D007D270F /* DatabaseUUIDEncodingStrategyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseUUIDEncodingStrategyTests.swift; sourceTree = "<group>"; };
567071F6208A00D4006AD95A /* SQLiteDateParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteDateParser.swift; sourceTree = "<group>"; };
567156151CB142AA007DC145 /* DatabaseQueueReadOnlyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseQueueReadOnlyTests.swift; sourceTree = "<group>"; };
5671566C1CB16729007DC145 /* GRDBCipherOSXEncryptedTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GRDBCipherOSXEncryptedTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -1176,7 +1195,6 @@
56EA869D1C932597002BB4DF /* DatabasePoolReadOnlyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabasePoolReadOnlyTests.swift; sourceTree = "<group>"; };
56EB0AB11BCD787300A3DC55 /* DataMemoryTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataMemoryTests.swift; sourceTree = "<group>"; };
56ED8A7E1DAB8D6800BD0ABC /* FTS5WrapperTokenizerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5WrapperTokenizerTests.swift; sourceTree = "<group>"; };
56EE573C1BB317B7007A6A95 /* StatementColumnConvertibleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatementColumnConvertibleTests.swift; sourceTree = "<group>"; };
56F0B98E1B6001C600A2F135 /* FoundationNSDateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FoundationNSDateTests.swift; sourceTree = "<group>"; };
56F3E7481E66F83A00BF0F01 /* ResultCodeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultCodeTests.swift; sourceTree = "<group>"; };
56F3E7621E67F8C100BF0F01 /* Fixits-0.101.1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Fixits-0.101.1.swift"; sourceTree = "<group>"; };
@@ -1315,6 +1333,8 @@
560B3FA41C19DFF800C58EC7 /* PersistableRecord */ = {
isa = PBXGroup;
children = (
5665FA3F2129EEEF004D8612 /* DatabaseDateEncodingStrategyTests.swift */,
5670329D212B546D007D270F /* DatabaseUUIDEncodingStrategyTests.swift */,
566A84452041AB3900E50BFD /* MutablePersistableRecordChangesTests.swift */,
56FF453F1D2C23BA00F21EF9 /* MutablePersistableRecordDeleteTests.swift */,
5674A71C1F30A8DF0095F066 /* MutablePersistableRecordEncodableTests.swift */,
@@ -1538,6 +1558,7 @@
5674A7251F30A8EF0095F066 /* FetchableRecord */ = {
isa = PBXGroup;
children = (
5665FA202129D81F004D8612 /* DatabaseDateDecodingStrategyTests.swift */,
5674A7261F30A9090095F066 /* FetchableRecordDecodableTests.swift */,
565B0FEE1BBC7D980098DE03 /* FetchableRecordTests.swift */,
);
@@ -1613,6 +1634,7 @@
56C3F7521CF9F12400F6A361 /* DatabaseSavepointTests.swift */,
566A842F20413DCF00E50BFD /* DatabaseSnapshotTests.swift */,
56A238131B9C74A90082EB20 /* DatabaseTests.swift */,
5644DE8120F8D1E4001FFDDE /* DatabaseValueConversionErrorTests.swift */,
56A2381B1B9C74A90082EB20 /* DatabaseValueConversionTests.swift */,
56A238191B9C74A90082EB20 /* DatabaseValueConvertible */,
56A238181B9C74A90082EB20 /* DatabaseValueTests.swift */,
@@ -1627,7 +1649,7 @@
569C1EB11CF07DDD0042627B /* SchedulingWatchdogTests.swift */,
568068301EBBA26100EFB8AA /* SQLRequestTests.swift */,
56A238201B9C74A90082EB20 /* Statement */,
56EE573B1BB317B7007A6A95 /* StatementColumnConvertible */,
56E8CE0F1BB4FE5B00828BEC /* StatementColumnConvertibleFetchTests.swift */,
5607EFD11BB8253300605DE3 /* TransactionObserver */,
);
name = Core;
@@ -1709,6 +1731,7 @@
5695311E1C907A8C00CF1A2B /* DatabaseSchemaCache.swift */,
566A842720413D6E00E50BFD /* DatabaseSnapshot.swift */,
56A238751B9C75030082EB20 /* DatabaseValue.swift */,
5644DE7A20F8C903001FFDDE /* DatabaseValueConversion.swift */,
560D923E1C672C3E00F4F92B /* DatabaseValueConvertible.swift */,
563363C31C942C37000BE133 /* DatabaseWriter.swift */,
5636E9BB1D22574100B9B05F /* FetchRequest.swift */,
@@ -1782,15 +1805,6 @@
name = Cursor;
sourceTree = "<group>";
};
56EE573B1BB317B7007A6A95 /* StatementColumnConvertible */ = {
isa = PBXGroup;
children = (
56E8CE0F1BB4FE5B00828BEC /* StatementColumnConvertibleFetchTests.swift */,
56EE573C1BB317B7007A6A95 /* StatementColumnConvertibleTests.swift */,
);
name = StatementColumnConvertible;
sourceTree = "<group>";
};
56F0B98C1B6001C600A2F135 /* Foundation */ = {
isa = PBXGroup;
children = (
@@ -2200,6 +2214,7 @@
560FC5311CB003810014AA8E /* TableRecord.swift in Sources */,
56DAA2DC1DE9C827006E10C8 /* Cursor.swift in Sources */,
5674A6F11F307F0E0095F066 /* DatabaseValueConvertible+Encodable.swift in Sources */,
5644DE7C20F8C903001FFDDE /* DatabaseValueConversion.swift in Sources */,
560FC5321CB003810014AA8E /* DatabasePool.swift in Sources */,
560FC5331CB003810014AA8E /* Migration.swift in Sources */,
560FC5341CB003810014AA8E /* QueryInterfaceQuery.swift in Sources */,
@@ -2277,7 +2292,6 @@
56EA63CC209C7F31009715B8 /* DerivableRequestTests.swift in Sources */,
560FC5701CB00B880014AA8E /* DatabasePoolCollationTests.swift in Sources */,
560FC5711CB00B880014AA8E /* RecordPrimaryKeySingleTests.swift in Sources */,
560FC5721CB00B880014AA8E /* StatementColumnConvertibleTests.swift in Sources */,
5674A7191F3087710095F066 /* DatabaseValueConvertibleDecodableTests.swift in Sources */,
56B021CA1D8C0D3900B239BB /* MutablePersistableRecordPersistenceConflictPolicyTests.swift in Sources */,
562205F61E420E48005860AC /* DatabaseQueueReleaseMemoryTests.swift in Sources */,
@@ -2295,6 +2309,7 @@
56176C611EACCCC7000F3F2B /* FTS5RecordTests.swift in Sources */,
567DAF361EAB789800FC0928 /* DatabaseLogErrorTests.swift in Sources */,
566AD8C71D531BEA002EC1A8 /* TableDefinitionTests.swift in Sources */,
5665FA222129D81F004D8612 /* DatabaseDateDecodingStrategyTests.swift in Sources */,
560FC5781CB00B880014AA8E /* RowFromStatementTests.swift in Sources */,
560FC5791CB00B880014AA8E /* RecordPrimaryKeyMultipleTests.swift in Sources */,
56CC9257201E094F00CB597E /* PrefixCursorTests.swift in Sources */,
@@ -2349,6 +2364,8 @@
560FC58F1CB00B880014AA8E /* DatabaseReaderTests.swift in Sources */,
5653EBD020961FE800F46237 /* AssociationRowScopeSearchTests.swift in Sources */,
560FC5901CB00B880014AA8E /* RecordEditedTests.swift in Sources */,
5665FA412129EEEF004D8612 /* DatabaseDateEncodingStrategyTests.swift in Sources */,
5644DE8220F8D1E4001FFDDE /* DatabaseValueConversionErrorTests.swift in Sources */,
560FC5911CB00B880014AA8E /* RecordPrimaryKeySingleWithReplaceConflictResolutionTests.swift in Sources */,
56CC924C201E059100CB597E /* DropFirstCursorTests.swift in Sources */,
562393311DEDFC5700A6B01F /* AnyCursorTests.swift in Sources */,
@@ -2377,6 +2394,7 @@
562205F51E420E48005860AC /* DatabasePoolSchemaCacheTests.swift in Sources */,
566A84462041AB3900E50BFD /* MutablePersistableRecordChangesTests.swift in Sources */,
562393581DEE013C00A6B01F /* FilterCursorTests.swift in Sources */,
5670329F212B546E007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */,
560FC59E1CB00B880014AA8E /* FoundationNSDateTests.swift in Sources */,
568068321EBBA26100EFB8AA /* SQLRequestTests.swift in Sources */,
560FC59F1CB00B880014AA8E /* DatabaseTests.swift in Sources */,
@@ -2435,7 +2453,6 @@
5671562E1CB16729007DC145 /* DatabasePoolCollationTests.swift in Sources */,
5671562F1CB16729007DC145 /* RecordPrimaryKeySingleTests.swift in Sources */,
5653EBE120961FE800F46237 /* AssociationBelongsToSQLTests.swift in Sources */,
567156301CB16729007DC145 /* StatementColumnConvertibleTests.swift in Sources */,
56EA63CD209C7F31009715B8 /* DerivableRequestTests.swift in Sources */,
56C3F7551CF9F12400F6A361 /* DatabaseSavepointTests.swift in Sources */,
5672DE5B1CDB72520022BA81 /* DatabaseQueueBackupTests.swift in Sources */,
@@ -2457,6 +2474,7 @@
56176C671EACCCC8000F3F2B /* FTS5RecordTests.swift in Sources */,
567DAF371EAB789800FC0928 /* DatabaseLogErrorTests.swift in Sources */,
567156351CB16729007DC145 /* DatabaseQueueSchemaCacheTests.swift in Sources */,
5665FA232129D81F004D8612 /* DatabaseDateDecodingStrategyTests.swift in Sources */,
567156361CB16729007DC145 /* RowFromStatementTests.swift in Sources */,
567156371CB16729007DC145 /* RecordPrimaryKeyMultipleTests.swift in Sources */,
5657AB401D108BA9006283EF /* FoundationNSDataTests.swift in Sources */,
@@ -2511,6 +2529,8 @@
567156501CB16729007DC145 /* RecordPrimaryKeySingleWithReplaceConflictResolutionTests.swift in Sources */,
5653EBD120961FE800F46237 /* AssociationRowScopeSearchTests.swift in Sources */,
567156511CB16729007DC145 /* FetchableRecordTests.swift in Sources */,
5665FA422129EEEF004D8612 /* DatabaseDateEncodingStrategyTests.swift in Sources */,
5644DE8320F8D1E4001FFDDE /* DatabaseValueConversionErrorTests.swift in Sources */,
56A8C2441D1918EE0096E9D4 /* FoundationUUIDTests.swift in Sources */,
56CC924D201E059100CB597E /* DropFirstCursorTests.swift in Sources */,
562393321DEDFC5700A6B01F /* AnyCursorTests.swift in Sources */,
@@ -2539,6 +2559,7 @@
562205F81E420E49005860AC /* DatabasePoolSchemaCacheTests.swift in Sources */,
566A84472041AB3900E50BFD /* MutablePersistableRecordChangesTests.swift in Sources */,
562393591DEE013C00A6B01F /* FilterCursorTests.swift in Sources */,
567032A0212B546E007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */,
5671565B1CB16729007DC145 /* TableRecord+QueryInterfaceRequestTests.swift in Sources */,
568068331EBBA26100EFB8AA /* SQLRequestTests.swift in Sources */,
5671565C1CB16729007DC145 /* FoundationNSDateTests.swift in Sources */,
@@ -2635,6 +2656,7 @@
56AFCA061CB1A8BB00F48B96 /* Configuration.swift in Sources */,
56DAA2DF1DE9C827006E10C8 /* Cursor.swift in Sources */,
5674A6EE1F307F0E0095F066 /* DatabaseValueConvertible+Encodable.swift in Sources */,
5644DE7D20F8C903001FFDDE /* DatabaseValueConversion.swift in Sources */,
56AFCA071CB1A8BB00F48B96 /* DatabasePool.swift in Sources */,
56AFCA081CB1A8BB00F48B96 /* Statement.swift in Sources */,
56AFCA091CB1A8BB00F48B96 /* QueryInterfaceQuery.swift in Sources */,
@@ -2711,7 +2733,6 @@
56FF455B1D2CDA5200F21EF9 /* RecordUniqueIndexTests.swift in Sources */,
56EA63CE209C7F31009715B8 /* DerivableRequestTests.swift in Sources */,
56AFCA3F1CB1AA9900F48B96 /* RecordPrimaryKeySingleTests.swift in Sources */,
56AFCA411CB1AA9900F48B96 /* StatementColumnConvertibleTests.swift in Sources */,
56AFCA421CB1AA9900F48B96 /* DatabasePoolFunctionTests.swift in Sources */,
5674A7181F3087710095F066 /* DatabaseValueConvertibleDecodableTests.swift in Sources */,
56AFCA441CB1AA9900F48B96 /* RowCopiedFromStatementTests.swift in Sources */,
@@ -2730,6 +2751,7 @@
56176C731EACCCCA000F3F2B /* FTS5RecordTests.swift in Sources */,
567DAF3A1EAB789800FC0928 /* DatabaseLogErrorTests.swift in Sources */,
56B15D0C1CD4C35100A24C8B /* FetchedRecordsControllerTests.swift in Sources */,
5665FA242129D81F004D8612 /* DatabaseDateDecodingStrategyTests.swift in Sources */,
56AFCA4A1CB1AA9900F48B96 /* RecordInitializersTests.swift in Sources */,
566AD8CB1D531BED002EC1A8 /* TableDefinitionTests.swift in Sources */,
56AFCA4B1CB1AA9900F48B96 /* MutablePersistableRecordTests.swift in Sources */,
@@ -2784,6 +2806,8 @@
56A8C2491D1918F10096E9D4 /* FoundationNSUUIDTests.swift in Sources */,
5653EBD220961FE800F46237 /* AssociationRowScopeSearchTests.swift in Sources */,
56AFCA5E1CB1AA9900F48B96 /* FetchableRecordTests.swift in Sources */,
5665FA432129EEEF004D8612 /* DatabaseDateEncodingStrategyTests.swift in Sources */,
5644DE8420F8D1E4001FFDDE /* DatabaseValueConversionErrorTests.swift in Sources */,
56AFCA5F1CB1AA9900F48B96 /* DatabaseValueConvertibleFetchTests.swift in Sources */,
56AFCA601CB1AA9900F48B96 /* RecordPrimaryKeyRowIDTests.swift in Sources */,
56CC924E201E059100CB597E /* DropFirstCursorTests.swift in Sources */,
@@ -2812,6 +2836,7 @@
56AFCA681CB1AA9900F48B96 /* RecordMinimalPrimaryKeySingleTests.swift in Sources */,
566A84482041AB3900E50BFD /* MutablePersistableRecordChangesTests.swift in Sources */,
56B14E841D4DAE54000BF4A3 /* RowFromDictionaryLiteralTests.swift in Sources */,
567032A1212B546E007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */,
56AFCA6B1CB1AA9900F48B96 /* DatabaseTimestampTests.swift in Sources */,
568068361EBBA26100EFB8AA /* SQLRequestTests.swift in Sources */,
56AFCA6C1CB1AA9900F48B96 /* StatementArguments+FoundationTests.swift in Sources */,
@@ -2881,7 +2906,6 @@
562393361DEDFC5700A6B01F /* AnyCursorTests.swift in Sources */,
5653EBDF20961FE800F46237 /* AssociationParallelRowScopesTests.swift in Sources */,
5698ACDD1DA925430056AF8C /* RowTestCase.swift in Sources */,
56AFCA9A1CB1ABC800F48B96 /* StatementColumnConvertibleTests.swift in Sources */,
5653EBCF20961FE800F46237 /* AssociationHasOneSQLTests.swift in Sources */,
562756491E963AAC0035B653 /* DatabaseWriterTests.swift in Sources */,
56AFCA9B1CB1ABC800F48B96 /* DatabasePoolFunctionTests.swift in Sources */,
@@ -2892,6 +2916,7 @@
56176C791EACCCCB000F3F2B /* FTS5RecordTests.swift in Sources */,
567DAF3B1EAB789800FC0928 /* DatabaseLogErrorTests.swift in Sources */,
56AFCA9F1CB1ABC800F48B96 /* RecordPrimaryKeyMultipleTests.swift in Sources */,
5665FA252129D81F004D8612 /* DatabaseDateDecodingStrategyTests.swift in Sources */,
569C1EB71CF07DDD0042627B /* SchedulingWatchdogTests.swift in Sources */,
56AFCAA01CB1ABC800F48B96 /* RowFromStatementTests.swift in Sources */,
5690C32C1D23E6D800E59934 /* FoundationDateComponentsTests.swift in Sources */,
@@ -2946,6 +2971,8 @@
5657AB3C1D108BA9006283EF /* FoundationDataTests.swift in Sources */,
5653EBD320961FE800F46237 /* AssociationRowScopeSearchTests.swift in Sources */,
5634B10C1CF9B970005360B9 /* TransactionObserverSavepointsTests.swift in Sources */,
5665FA442129EEEF004D8612 /* DatabaseDateEncodingStrategyTests.swift in Sources */,
5644DE8520F8D1E4001FFDDE /* DatabaseValueConversionErrorTests.swift in Sources */,
56AFCAB51CB1ABC800F48B96 /* DatabaseQueueReadOnlyTests.swift in Sources */,
56AFCAB61CB1ABC800F48B96 /* DatabaseReaderTests.swift in Sources */,
56CC924F201E059100CB597E /* DropFirstCursorTests.swift in Sources */,
@@ -2974,6 +3001,7 @@
56AFCAC11CB1ABC800F48B96 /* RecordMinimalPrimaryKeySingleTests.swift in Sources */,
566A84492041AB3900E50BFD /* MutablePersistableRecordChangesTests.swift in Sources */,
56B14E851D4DAE54000BF4A3 /* RowFromDictionaryLiteralTests.swift in Sources */,
567032A2212B546E007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */,
56AFCAC41CB1ABC800F48B96 /* DatabaseTimestampTests.swift in Sources */,
568068371EBBA26100EFB8AA /* SQLRequestTests.swift in Sources */,
56AFCAC51CB1ABC800F48B96 /* StatementArguments+FoundationTests.swift in Sources */,
@@ -3089,7 +3117,7 @@
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
OTHER_SWIFT_FLAGS = "-D USING_BUILTIN_SQLITE -D GRDBCIPHER -D SQLITE_HAS_CODEC";
OTHER_SWIFT_FLAGS = "-D USING_BUILTIN_SQLITE -D GRDBCIPHER -D SQLITE_HAS_CODEC -D SQLITE_ENABLE_FTS5";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCipherOSXTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
@@ -3107,7 +3135,7 @@
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
OTHER_SWIFT_FLAGS = "-D USING_BUILTIN_SQLITE -D GRDBCIPHER -D SQLITE_HAS_CODEC";
OTHER_SWIFT_FLAGS = "-D USING_BUILTIN_SQLITE -D GRDBCIPHER -D SQLITE_HAS_CODEC -D SQLITE_ENABLE_FTS5";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCipherOSXTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
@@ -3125,7 +3153,7 @@
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
OTHER_SWIFT_FLAGS = "-D USING_BUILTIN_SQLITE -D GRDBCIPHER -D GRDBCIPHER_USE_ENCRYPTION -D SQLITE_HAS_CODEC";
OTHER_SWIFT_FLAGS = "-D USING_BUILTIN_SQLITE -D GRDBCIPHER -D GRDBCIPHER_USE_ENCRYPTION -D SQLITE_HAS_CODEC -D SQLITE_ENABLE_FTS5";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCipherOSXTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
@@ -3143,7 +3171,7 @@
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
OTHER_SWIFT_FLAGS = "-D USING_BUILTIN_SQLITE -D GRDBCIPHER -D GRDBCIPHER_USE_ENCRYPTION -D SQLITE_HAS_CODEC";
OTHER_SWIFT_FLAGS = "-D USING_BUILTIN_SQLITE -D GRDBCIPHER -D GRDBCIPHER_USE_ENCRYPTION -D SQLITE_HAS_CODEC -D SQLITE_ENABLE_FTS5";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCipherOSXTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
@@ -3212,7 +3240,7 @@
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-D USING_BUILTIN_SQLITE -D GRDBCIPHER -D SQLITE_HAS_CODEC";
OTHER_SWIFT_FLAGS = "-D USING_BUILTIN_SQLITE -D GRDBCIPHER -D SQLITE_HAS_CODEC -D SQLITE_ENABLE_FTS5";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCipheriOSTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
@@ -3230,7 +3258,7 @@
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-D USING_BUILTIN_SQLITE -D GRDBCIPHER -D SQLITE_HAS_CODEC";
OTHER_SWIFT_FLAGS = "-D USING_BUILTIN_SQLITE -D GRDBCIPHER -D SQLITE_HAS_CODEC -D SQLITE_ENABLE_FTS5";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCipheriOSTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
@@ -3248,7 +3276,7 @@
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-D USING_BUILTIN_SQLITE -D GRDBCIPHER -D SQLITE_HAS_CODEC -D GRDBCIPHER_USE_ENCRYPTION";
OTHER_SWIFT_FLAGS = "-D USING_BUILTIN_SQLITE -D GRDBCIPHER -D SQLITE_HAS_CODEC -D GRDBCIPHER_USE_ENCRYPTION -D SQLITE_ENABLE_FTS5";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCipheriOSEncryptedTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
@@ -3266,7 +3294,7 @@
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-D USING_BUILTIN_SQLITE -D GRDBCIPHER -D SQLITE_HAS_CODEC -D GRDBCIPHER_USE_ENCRYPTION";
OTHER_SWIFT_FLAGS = "-D USING_BUILTIN_SQLITE -D GRDBCIPHER -D SQLITE_HAS_CODEC -D GRDBCIPHER_USE_ENCRYPTION -D SQLITE_ENABLE_FTS5";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCipheriOSEncryptedTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
+31 -15
View File
@@ -45,6 +45,10 @@
5636E9C11D22574100B9B05F /* FetchRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5636E9BB1D22574100B9B05F /* FetchRequest.swift */; };
564448861EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564448821EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift */; };
5644488A1EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564448821EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift */; };
5644DE7820F8C8EA001FFDDE /* DatabaseValueConversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5644DE7620F8C8E9001FFDDE /* DatabaseValueConversion.swift */; };
5644DE7920F8C8EA001FFDDE /* DatabaseValueConversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5644DE7620F8C8E9001FFDDE /* DatabaseValueConversion.swift */; };
5644DE7F20F8D1D1001FFDDE /* DatabaseValueConversionErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5644DE7E20F8D1D1001FFDDE /* DatabaseValueConversionErrorTests.swift */; };
5644DE8020F8D1D1001FFDDE /* DatabaseValueConversionErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5644DE7E20F8D1D1001FFDDE /* DatabaseValueConversionErrorTests.swift */; };
564E73F3203DA2AC000C443C /* JoinSupportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564E73E7203DA278000C443C /* JoinSupportTests.swift */; };
564E73F4203DA2AD000C443C /* JoinSupportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564E73E7203DA278000C443C /* JoinSupportTests.swift */; };
564F9C211F069B4E00877A00 /* DatabaseAggregateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564F9C1D1F069B4E00877A00 /* DatabaseAggregateTests.swift */; };
@@ -141,6 +145,10 @@
566475D81D981D5E00FF74B8 /* SQLOperators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566475CB1D981D5E00FF74B8 /* SQLOperators.swift */; };
5665F868203EF4640084C6C0 /* ColumnInfoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665F865203EF4590084C6C0 /* ColumnInfoTests.swift */; };
5665F869203EF4650084C6C0 /* ColumnInfoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665F865203EF4590084C6C0 /* ColumnInfoTests.swift */; };
5665FA1E2129D807004D8612 /* DatabaseDateDecodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665FA1C2129D807004D8612 /* DatabaseDateDecodingStrategyTests.swift */; };
5665FA1F2129D807004D8612 /* DatabaseDateDecodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665FA1C2129D807004D8612 /* DatabaseDateDecodingStrategyTests.swift */; };
5665FA3D2129EED8004D8612 /* DatabaseDateEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665FA3B2129EED8004D8612 /* DatabaseDateEncodingStrategyTests.swift */; };
5665FA3E2129EED8004D8612 /* DatabaseDateEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5665FA3B2129EED8004D8612 /* DatabaseDateEncodingStrategyTests.swift */; };
566A842D20413D9A00E50BFD /* DatabaseSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566A842B20413D9A00E50BFD /* DatabaseSnapshot.swift */; };
566A842E20413D9A00E50BFD /* DatabaseSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566A842B20413D9A00E50BFD /* DatabaseSnapshot.swift */; };
566A843520413DE400E50BFD /* DatabaseSnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566A843420413DE400E50BFD /* DatabaseSnapshotTests.swift */; };
@@ -161,6 +169,8 @@
566B91301FA4D0CC0012D5B0 /* StatementAuthorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566B912A1FA4D0CC0012D5B0 /* StatementAuthorizer.swift */; };
566B91351FA4D3810012D5B0 /* TransactionObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566B91321FA4D3810012D5B0 /* TransactionObserver.swift */; };
566B91381FA4D3810012D5B0 /* TransactionObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566B91321FA4D3810012D5B0 /* TransactionObserver.swift */; };
5670329B212B5462007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56703299212B5461007D270F /* DatabaseUUIDEncodingStrategyTests.swift */; };
5670329C212B5462007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56703299212B5461007D270F /* DatabaseUUIDEncodingStrategyTests.swift */; };
567071F4208A00BE006AD95A /* SQLiteDateParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567071F2208A00BE006AD95A /* SQLiteDateParser.swift */; };
567071F5208A00BE006AD95A /* SQLiteDateParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567071F2208A00BE006AD95A /* SQLiteDateParser.swift */; };
5671FC221DA3CAC9003BF4FF /* FTS3TokenizerDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5671FC1F1DA3CAC9003BF4FF /* FTS3TokenizerDescriptor.swift */; };
@@ -483,9 +493,7 @@
F3BA80F01CFB3017003DC1BA /* FetchableRecordTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 565B0FEE1BBC7D980098DE03 /* FetchableRecordTests.swift */; };
F3BA80F11CFB3019003DC1BA /* DatabaseSavepointTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56C3F7521CF9F12400F6A361 /* DatabaseSavepointTests.swift */; };
F3BA80F21CFB301A003DC1BA /* DatabaseSavepointTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56C3F7521CF9F12400F6A361 /* DatabaseSavepointTests.swift */; };
F3BA80F31CFB301D003DC1BA /* StatementColumnConvertibleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56EE573C1BB317B7007A6A95 /* StatementColumnConvertibleTests.swift */; };
F3BA80F41CFB301D003DC1BA /* StatementColumnConvertibleFetchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56E8CE0F1BB4FE5B00828BEC /* StatementColumnConvertibleFetchTests.swift */; };
F3BA80F51CFB301E003DC1BA /* StatementColumnConvertibleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56EE573C1BB317B7007A6A95 /* StatementColumnConvertibleTests.swift */; };
F3BA80F61CFB301E003DC1BA /* StatementColumnConvertibleFetchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56E8CE0F1BB4FE5B00828BEC /* StatementColumnConvertibleFetchTests.swift */; };
F3BA80F71CFB3021003DC1BA /* SelectStatementTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238211B9C74A90082EB20 /* SelectStatementTests.swift */; };
F3BA80F81CFB3021003DC1BA /* StatementArgumentsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DE7B101C3D93ED00861EB8 /* StatementArgumentsTests.swift */; };
@@ -632,6 +640,8 @@
5634B1061CF9B970005360B9 /* TransactionObserverSavepointsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionObserverSavepointsTests.swift; sourceTree = "<group>"; };
5636E9BB1D22574100B9B05F /* FetchRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchRequest.swift; sourceTree = "<group>"; };
564448821EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseAfterNextTransactionCommitTests.swift; sourceTree = "<group>"; };
5644DE7620F8C8E9001FFDDE /* DatabaseValueConversion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseValueConversion.swift; sourceTree = "<group>"; };
5644DE7E20F8D1D1001FFDDE /* DatabaseValueConversionErrorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseValueConversionErrorTests.swift; sourceTree = "<group>"; };
564A50C61BFF4B7F00B3A3A2 /* DatabaseCollationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseCollationTests.swift; sourceTree = "<group>"; };
564E73E7203DA278000C443C /* JoinSupportTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JoinSupportTests.swift; sourceTree = "<group>"; };
564F9C1D1F069B4E00877A00 /* DatabaseAggregateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseAggregateTests.swift; sourceTree = "<group>"; };
@@ -685,6 +695,8 @@
566475CA1D981D5E00FF74B8 /* SQLFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLFunctions.swift; sourceTree = "<group>"; };
566475CB1D981D5E00FF74B8 /* SQLOperators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLOperators.swift; sourceTree = "<group>"; };
5665F865203EF4590084C6C0 /* ColumnInfoTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColumnInfoTests.swift; sourceTree = "<group>"; };
5665FA1C2129D807004D8612 /* DatabaseDateDecodingStrategyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseDateDecodingStrategyTests.swift; sourceTree = "<group>"; };
5665FA3B2129EED8004D8612 /* DatabaseDateEncodingStrategyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseDateEncodingStrategyTests.swift; sourceTree = "<group>"; };
566A842B20413D9A00E50BFD /* DatabaseSnapshot.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseSnapshot.swift; sourceTree = "<group>"; };
566A843420413DE400E50BFD /* DatabaseSnapshotTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseSnapshotTests.swift; sourceTree = "<group>"; };
566A84422041AB2D00E50BFD /* MutablePersistableRecordChangesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutablePersistableRecordChangesTests.swift; sourceTree = "<group>"; };
@@ -695,6 +707,7 @@
566B91221FA4CF810012D5B0 /* Database+Schema.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Database+Schema.swift"; sourceTree = "<group>"; };
566B912A1FA4D0CC0012D5B0 /* StatementAuthorizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatementAuthorizer.swift; sourceTree = "<group>"; };
566B91321FA4D3810012D5B0 /* TransactionObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionObserver.swift; sourceTree = "<group>"; };
56703299212B5461007D270F /* DatabaseUUIDEncodingStrategyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseUUIDEncodingStrategyTests.swift; sourceTree = "<group>"; };
567071F2208A00BE006AD95A /* SQLiteDateParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteDateParser.swift; sourceTree = "<group>"; };
567156151CB142AA007DC145 /* DatabaseQueueReadOnlyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseQueueReadOnlyTests.swift; sourceTree = "<group>"; };
567156701CB18050007DC145 /* EncryptionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EncryptionTests.swift; sourceTree = "<group>"; };
@@ -837,7 +850,6 @@
56EA869D1C932597002BB4DF /* DatabasePoolReadOnlyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabasePoolReadOnlyTests.swift; sourceTree = "<group>"; };
56EB0AB11BCD787300A3DC55 /* DataMemoryTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataMemoryTests.swift; sourceTree = "<group>"; };
56ED8A7E1DAB8D6800BD0ABC /* FTS5WrapperTokenizerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5WrapperTokenizerTests.swift; sourceTree = "<group>"; };
56EE573C1BB317B7007A6A95 /* StatementColumnConvertibleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatementColumnConvertibleTests.swift; sourceTree = "<group>"; };
56F0B98E1B6001C600A2F135 /* FoundationNSDateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FoundationNSDateTests.swift; sourceTree = "<group>"; };
56F3E7481E66F83A00BF0F01 /* ResultCodeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultCodeTests.swift; sourceTree = "<group>"; };
56F3E7621E67F8C100BF0F01 /* Fixits-0.101.1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Fixits-0.101.1.swift"; sourceTree = "<group>"; };
@@ -974,6 +986,8 @@
560B3FA41C19DFF800C58EC7 /* PersistableRecord */ = {
isa = PBXGroup;
children = (
5665FA3B2129EED8004D8612 /* DatabaseDateEncodingStrategyTests.swift */,
56703299212B5461007D270F /* DatabaseUUIDEncodingStrategyTests.swift */,
566A84422041AB2D00E50BFD /* MutablePersistableRecordChangesTests.swift */,
56FF453F1D2C23BA00F21EF9 /* MutablePersistableRecordDeleteTests.swift */,
5674A71C1F30A8DF0095F066 /* MutablePersistableRecordEncodableTests.swift */,
@@ -1182,6 +1196,7 @@
5674A7251F30A8EF0095F066 /* FetchableRecord */ = {
isa = PBXGroup;
children = (
5665FA1C2129D807004D8612 /* DatabaseDateDecodingStrategyTests.swift */,
5674A7261F30A9090095F066 /* FetchableRecordDecodableTests.swift */,
565B0FEE1BBC7D980098DE03 /* FetchableRecordTests.swift */,
);
@@ -1257,6 +1272,7 @@
56C3F7521CF9F12400F6A361 /* DatabaseSavepointTests.swift */,
566A843420413DE400E50BFD /* DatabaseSnapshotTests.swift */,
56A238131B9C74A90082EB20 /* DatabaseTests.swift */,
5644DE7E20F8D1D1001FFDDE /* DatabaseValueConversionErrorTests.swift */,
56A2381B1B9C74A90082EB20 /* DatabaseValueConversionTests.swift */,
56A238191B9C74A90082EB20 /* DatabaseValueConvertible */,
56A238181B9C74A90082EB20 /* DatabaseValueTests.swift */,
@@ -1271,7 +1287,7 @@
569C1EB11CF07DDD0042627B /* SchedulingWatchdogTests.swift */,
568068301EBBA26100EFB8AA /* SQLRequestTests.swift */,
56A238201B9C74A90082EB20 /* Statement */,
56EE573B1BB317B7007A6A95 /* StatementColumnConvertible */,
56E8CE0F1BB4FE5B00828BEC /* StatementColumnConvertibleFetchTests.swift */,
5607EFD11BB8253300605DE3 /* TransactionObserver */,
);
name = Core;
@@ -1353,6 +1369,7 @@
5695311E1C907A8C00CF1A2B /* DatabaseSchemaCache.swift */,
566A842B20413D9A00E50BFD /* DatabaseSnapshot.swift */,
56A238751B9C75030082EB20 /* DatabaseValue.swift */,
5644DE7620F8C8E9001FFDDE /* DatabaseValueConversion.swift */,
560D923E1C672C3E00F4F92B /* DatabaseValueConvertible.swift */,
563363C31C942C37000BE133 /* DatabaseWriter.swift */,
5636E9BB1D22574100B9B05F /* FetchRequest.swift */,
@@ -1426,15 +1443,6 @@
name = Cursor;
sourceTree = "<group>";
};
56EE573B1BB317B7007A6A95 /* StatementColumnConvertible */ = {
isa = PBXGroup;
children = (
56E8CE0F1BB4FE5B00828BEC /* StatementColumnConvertibleFetchTests.swift */,
56EE573C1BB317B7007A6A95 /* StatementColumnConvertibleTests.swift */,
);
name = StatementColumnConvertible;
sourceTree = "<group>";
};
56F0B98C1B6001C600A2F135 /* Foundation */ = {
isa = PBXGroup;
children = (
@@ -1873,6 +1881,7 @@
F3BA801D1CFB288C003DC1BA /* DatabaseDateComponents.swift in Sources */,
5674A6ED1F307F0E0095F066 /* DatabaseValueConvertible+Encodable.swift in Sources */,
5657AB141D10899D006283EF /* URL.swift in Sources */,
5644DE7920F8C8EA001FFDDE /* DatabaseValueConversion.swift in Sources */,
56DAA2E01DE9C827006E10C8 /* Cursor.swift in Sources */,
F3BA800C1CFB286F003DC1BA /* DatabaseError.swift in Sources */,
566B91301FA4D0CC0012D5B0 /* StatementAuthorizer.swift in Sources */,
@@ -1967,6 +1976,7 @@
56AF74721D41FB9C005E9FF3 /* DatabaseValueConvertibleEscapingTests.swift in Sources */,
F3BA80D21CFB2FF3003DC1BA /* PersistableRecordTests.swift in Sources */,
5698AC501DA2D48A0056AF8C /* FTS3RecordTests.swift in Sources */,
5665FA1F2129D807004D8612 /* DatabaseDateDecodingStrategyTests.swift in Sources */,
F3BA80FD1CFB3024003DC1BA /* TransactionObserverSavepointsTests.swift in Sources */,
F3BA811F1CFB3063003DC1BA /* RecordMinimalPrimaryKeySingleTests.swift in Sources */,
5657AB451D108BA9006283EF /* FoundationNSDataTests.swift in Sources */,
@@ -1976,7 +1986,6 @@
56CC9235201E009100CB597E /* DropWhileCursorTests.swift in Sources */,
56D507651F6BAE8600AE1C5B /* PrimaryKeyInfoTests.swift in Sources */,
5657AB651D108BA9006283EF /* FoundationNSURLTests.swift in Sources */,
F3BA80F31CFB301D003DC1BA /* StatementColumnConvertibleTests.swift in Sources */,
5657AB6D1D108BA9006283EF /* FoundationURLTests.swift in Sources */,
567F45AF1F888B2600030B59 /* TruncateOptimizationTests.swift in Sources */,
F3BA804C1CFB2B24003DC1BA /* GRDBTestCase.swift in Sources */,
@@ -2022,6 +2031,8 @@
F3BA80D61CFB2FFD003DC1BA /* DatabaseReaderTests.swift in Sources */,
5653EB7520961FB200F46237 /* AssociationRowScopeSearchTests.swift in Sources */,
5698AC9D1DA4B0430056AF8C /* FTS4RecordTests.swift in Sources */,
5665FA3E2129EED8004D8612 /* DatabaseDateEncodingStrategyTests.swift in Sources */,
5644DE8020F8D1D1001FFDDE /* DatabaseValueConversionErrorTests.swift in Sources */,
56A4CDB71D4234B200B1A9B9 /* SQLExpressionLiteralTests.swift in Sources */,
56CC924A201E058900CB597E /* DropFirstCursorTests.swift in Sources */,
56B964D21DA521450002DA19 /* FTS5RecordTests.swift in Sources */,
@@ -2050,6 +2061,7 @@
567DAF3C1EAB789800FC0928 /* DatabaseLogErrorTests.swift in Sources */,
566A84442041AB2D00E50BFD /* MutablePersistableRecordChangesTests.swift in Sources */,
F3BA81171CFB305E003DC1BA /* QueryInterfaceExpressionsTests.swift in Sources */,
5670329C212B5462007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */,
F3BA810B1CFB3056003DC1BA /* Row+FoundationTests.swift in Sources */,
5698AC901DA389380056AF8C /* FTS3TableBuilderTests.swift in Sources */,
568068381EBBA26100EFB8AA /* SQLRequestTests.swift in Sources */,
@@ -2146,6 +2158,7 @@
F3BA80791CFB2E61003DC1BA /* DatabaseDateComponents.swift in Sources */,
5674A6EC1F307F0E0095F066 /* DatabaseValueConvertible+Encodable.swift in Sources */,
5657AB111D10899D006283EF /* URL.swift in Sources */,
5644DE7820F8C8EA001FFDDE /* DatabaseValueConversion.swift in Sources */,
56DAA2DD1DE9C827006E10C8 /* Cursor.swift in Sources */,
F3BA80681CFB2E55003DC1BA /* DatabaseError.swift in Sources */,
566B912D1FA4D0CC0012D5B0 /* StatementAuthorizer.swift in Sources */,
@@ -2240,6 +2253,7 @@
F3BA80D41CFB2FF4003DC1BA /* PersistableRecordTests.swift in Sources */,
6340BF831E5E3F7900832805 /* RecordPersistenceConflictPolicy.swift in Sources */,
F3BA80FF1CFB3025003DC1BA /* TransactionObserverSavepointsTests.swift in Sources */,
5665FA1E2129D807004D8612 /* DatabaseDateDecodingStrategyTests.swift in Sources */,
5698AC4C1DA2D48A0056AF8C /* FTS3RecordTests.swift in Sources */,
F3BA80EF1CFB3017003DC1BA /* RowFromStatementTests.swift in Sources */,
5657AB511D108BA9006283EF /* FoundationNSNumberTests.swift in Sources */,
@@ -2250,7 +2264,6 @@
56D507611F6BAE8600AE1C5B /* PrimaryKeyInfoTests.swift in Sources */,
F3BA80B01CFB2FB2003DC1BA /* DatabaseCollationTests.swift in Sources */,
56C7A6AE1D2DFF6100EFB0C2 /* FoundationNSDateTests.swift in Sources */,
F3BA80F51CFB301E003DC1BA /* StatementColumnConvertibleTests.swift in Sources */,
567F45AB1F888B2600030B59 /* TruncateOptimizationTests.swift in Sources */,
F3BA80A61CFB2F91003DC1BA /* GRDBTestCase.swift in Sources */,
5657AB411D108BA9006283EF /* FoundationNSDataTests.swift in Sources */,
@@ -2295,6 +2308,8 @@
F3BA81321CFB3064003DC1BA /* RecordPrimaryKeySingleWithReplaceConflictResolutionTests.swift in Sources */,
5653EB7420961FB200F46237 /* AssociationRowScopeSearchTests.swift in Sources */,
5623935A1DEE013C00A6B01F /* FilterCursorTests.swift in Sources */,
5665FA3D2129EED8004D8612 /* DatabaseDateEncodingStrategyTests.swift in Sources */,
5644DE7F20F8D1D1001FFDDE /* DatabaseValueConversionErrorTests.swift in Sources */,
F3BA80FC1CFB3021003DC1BA /* UpdateStatementTests.swift in Sources */,
56CC9249201E058900CB597E /* DropFirstCursorTests.swift in Sources */,
5623936C1DEE0CD200A6B01F /* FlattenCursorTests.swift in Sources */,
@@ -2323,6 +2338,7 @@
F3BA81021CFB3032003DC1BA /* CGFloatTests.swift in Sources */,
566A84432041AB2D00E50BFD /* MutablePersistableRecordChangesTests.swift in Sources */,
567DAF381EAB789800FC0928 /* DatabaseLogErrorTests.swift in Sources */,
5670329B212B5462007D270F /* DatabaseUUIDEncodingStrategyTests.swift in Sources */,
F3BA81131CFB305B003DC1BA /* DatabaseMigratorTests.swift in Sources */,
F3BA81381CFB3064003DC1BA /* RecordSubClassTests.swift in Sources */,
F3BA81351CFB3064003DC1BA /* RecordEditedTests.swift in Sources */,
+24
View File
@@ -0,0 +1,24 @@
Pod::Spec.new do |s|
s.name = 'GRDBPlus'
s.version = '3.3.0'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'A toolkit for SQLite databases, with a focus on application development.'
s.homepage = 'https://github.com/groue/GRDB.swift'
s.author = { 'Gwendal Roué' => 'gr@pierlis.com' }
s.source = { :git => 'https://github.com/groue/GRDB.swift.git', :tag => "v#{s.version}" }
s.module_name = 'GRDB'
s.ios.deployment_target = '11.4'
s.osx.deployment_target = '10.13'
s.watchos.deployment_target = '4.3'
s.source_files = 'GRDB/**/*.swift', 'Support/*.h'
s.module_map = 'Support/module.modulemap'
s.framework = 'Foundation'
s.library = 'sqlite3'
s.xcconfig = {
'OTHER_SWIFT_FLAGS' => '$(inherited) -D SQLITE_ENABLE_FTS5',
}
end
+149 -14
View File
@@ -45,10 +45,19 @@ XCPRETTY_PATH := $(shell command -v xcpretty 2> /dev/null)
TEST_ACTIONS = clean build build-for-testing test-without-building
# When adding support for an Xcode version, look for available devices with `instruments -s devices`
ifeq ($(XCODEVERSION),9.4)
ifeq ($(XCODEVERSION),10.0)
MIN_SWIFT_VERSION = 4.0
MAX_SWIFT_VERSION = 4.2
MAX_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 8,OS=12.0"
MIN_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 4s,OS=9.0"
else ifeq ($(XCODEVERSION),9.4)
# MIN_SWIFT_VERSION undefined: only check MAX_SWIFT_VERSION
MAX_SWIFT_VERSION = 4.0
MAX_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 8,OS=11.4"
MIN_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 4s,OS=9.0"
else ifeq ($(XCODEVERSION),9.3)
# MIN_SWIFT_VERSION undefined: only check MAX_SWIFT_VERSION
MAX_SWIFT_VERSION = 4.0
MAX_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 8,OS=11.3"
MIN_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 4s,OS=9.0"
else
@@ -92,38 +101,75 @@ 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_CocoaPodsLint
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_framework_GRDBOSX:
test_framework_GRDBOSX: test_framework_GRDBOSX_maxSwift test_framework_GRDBOSX_minSwift
test_framework_GRDBOSX_maxSwift:
# SQLITE_ENABLE_FTS5 requires macOS 10.13+
$(XCODEBUILD) \
-project GRDB.xcodeproj \
-scheme GRDBOSX \
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
'OTHER_SWIFT_FLAGS=$(inherited) -D SQLITE_ENABLE_FTS5' \
$(TEST_ACTIONS) \
$(XCPRETTY)
test_framework_GRDBOSX_minSwift:
ifdef MIN_SWIFT_VERSION
# SQLITE_ENABLE_FTS5 requires macOS 10.13+
$(XCODEBUILD) \
-project GRDB.xcodeproj \
-scheme GRDBOSX \
SWIFT_VERSION=$(MIN_SWIFT_VERSION) \
'OTHER_SWIFT_FLAGS=$(inherited) -D SQLITE_ENABLE_FTS5' \
$(TEST_ACTIONS) \
$(XCPRETTY)
endif
test_framework_GRDBWatchOS:
# XCTest is not supported for watchOS: we only make sure that the framework builds.
$(XCODEBUILD) \
-project GRDB.xcodeproj \
-scheme GRDBWatchOS \
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
clean build \
$(XCPRETTY)
test_framework_GRDBiOS: test_framework_GRDBiOS_maxTarget test_framework_GRDBiOS_minTarget
test_framework_GRDBiOS_maxTarget: test_framework_GRDBiOS_maxTarget_maxSwift test_framework_GRDBiOS_maxTarget_minSwift
test_framework_GRDBiOS_maxTarget:
test_framework_GRDBiOS_maxTarget_maxSwift:
# SQLITE_ENABLE_FTS5 requires iOS 11.4+
$(XCODEBUILD) \
-project GRDB.xcodeproj \
-scheme GRDBiOS \
-destination $(MAX_IOS_DESTINATION) \
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
'OTHER_SWIFT_FLAGS=$(inherited) -D SQLITE_ENABLE_FTS5' \
$(TEST_ACTIONS) \
$(XCPRETTY)
test_framework_GRDBiOS_maxTarget_minSwift:
ifdef MIN_SWIFT_VERSION
# SQLITE_ENABLE_FTS5 requires iOS 11.4+
$(XCODEBUILD) \
-project GRDB.xcodeproj \
-scheme GRDBiOS \
-destination $(MAX_IOS_DESTINATION) \
SWIFT_VERSION=$(MIN_SWIFT_VERSION) \
'OTHER_SWIFT_FLAGS=$(inherited) -D SQLITE_ENABLE_FTS5' \
$(TEST_ACTIONS) \
$(XCPRETTY)
endif
test_framework_GRDBiOS_minTarget:
$(XCODEBUILD) \
-project GRDB.xcodeproj \
-scheme GRDBiOS \
-destination $(MIN_IOS_DESTINATION) \
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
$(TEST_ACTIONS) \
$(XCPRETTY)
@@ -131,24 +177,39 @@ test_framework_GRDBCustomSQLiteOSX: SQLiteCustom
$(XCODEBUILD) \
-project GRDBCustom.xcodeproj \
-scheme GRDBCustomSQLiteOSX \
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
$(TEST_ACTIONS) \
$(XCPRETTY)
test_framework_GRDBCustomSQLiteiOS: test_framework_GRDBCustomSQLiteiOS_maxTarget test_framework_GRDBCustomSQLiteiOS_minTarget
test_framework_GRDBCustomSQLiteiOS_maxTarget: test_framework_GRDBCustomSQLiteiOS_maxTarget_maxSwift test_framework_GRDBCustomSQLiteiOS_maxTarget_minSwift
test_framework_GRDBCustomSQLiteiOS_maxTarget: SQLiteCustom
test_framework_GRDBCustomSQLiteiOS_maxTarget_maxSwift: SQLiteCustom
$(XCODEBUILD) \
-project GRDBCustom.xcodeproj \
-scheme GRDBCustomSQLiteiOS \
-destination $(MAX_IOS_DESTINATION) \
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
$(TEST_ACTIONS) \
$(XCPRETTY)
test_framework_GRDBCustomSQLiteiOS_maxTarget_minSwift: SQLiteCustom
ifdef MIN_SWIFT_VERSION
$(XCODEBUILD) \
-project GRDBCustom.xcodeproj \
-scheme GRDBCustomSQLiteiOS \
-destination $(MAX_IOS_DESTINATION) \
SWIFT_VERSION=$(MIN_SWIFT_VERSION) \
$(TEST_ACTIONS) \
$(XCPRETTY)
endif
test_framework_GRDBCustomSQLiteiOS_minTarget: SQLiteCustom
$(XCODEBUILD) \
-project GRDBCustom.xcodeproj \
-scheme GRDBCustomSQLiteiOS \
-destination $(MIN_IOS_DESTINATION) \
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
$(TEST_ACTIONS) \
$(XCPRETTY)
@@ -156,6 +217,7 @@ test_framework_GRDBCipherOSX: SQLCipher
$(XCODEBUILD) \
-project GRDBCipher.xcodeproj \
-scheme GRDBCipherOSX \
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
$(TEST_ACTIONS) \
$(XCPRETTY)
@@ -166,6 +228,7 @@ test_framework_GRDBCipheriOS_maxTarget: SQLCipher
-project GRDBCipher.xcodeproj \
-scheme GRDBCipheriOS \
-destination $(MAX_IOS_DESTINATION) \
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
$(TEST_ACTIONS) \
$(XCPRETTY)
@@ -174,6 +237,7 @@ test_framework_GRDBCipheriOS_minTarget: SQLCipher
-project GRDBCipher.xcodeproj \
-scheme GRDBCipheriOS \
-destination $(MIN_IOS_DESTINATION) \
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
$(TEST_ACTIONS) \
$(XCPRETTY)
@@ -213,11 +277,82 @@ test_install_SPM:
./.build/debug/SPM && \
$(SWIFT) package unedit --force GRDB
test_CocoaPodsLint:
test_install_GRDB_CocoaPods:
ifdef POD
$(POD) lib lint --allow-warnings
cd Tests/CocoaPods/GRDBiOS && \
rm -rf iOS.xcworkspace && \
rm -rf Pods && \
rm -rf Podfile.lock && \
$(POD) install && \
$(XCODEBUILD) \
-workspace iOS.xcworkspace \
-scheme iOS \
-configuration Release \
-destination $(MAX_IOS_DESTINATION) \
clean build \
$(XCPRETTY)
else
@echo CocoaPods must be installed for test_CocoaPodsLint
@echo CocoaPods must be installed for test_install_GRDB_CocoaPods
@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 && \
rm -rf GRDBCipherMacOS.xcworkspace && \
rm -rf Pods && \
rm -rf Podfile.lock && \
$(POD) install && \
$(XCODEBUILD) \
-workspace GRDBCipherMacOS.xcworkspace \
-scheme GRDBCipherMacOS \
-configuration Release \
clean build \
$(XCPRETTY)
else
@echo CocoaPods must be installed for test_install_GRDBCipher_CocoaPods
@exit 1
endif
test_CocoaPodsLint_GRDB:
ifdef POD
$(POD) lib lint GRDB.swift.podspec --allow-warnings
else
@echo CocoaPods must be installed for test_CocoaPodsLint_GRDB
@exit 1
endif
test_CocoaPodsLint_GRDBPlus:
ifdef POD
$(POD) lib lint GRDBPlus.podspec --allow-warnings
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
else
@echo CocoaPods must be installed for test_CocoaPodsLint_GRDBCipher
@exit 1
endif
@@ -243,10 +378,10 @@ test_performance: Realm FMDB SQLite.swift
-scheme GRDBOSXPerformanceComparisonTests \
build-for-testing test-without-building
Realm: Tests/Performance/Realm/build/osx/swift-4.1/RealmSwift.framework
Realm: Tests/Performance/Realm/build/osx/swift-4.1.2/RealmSwift.framework
# Makes sure the Tests/Performance/Realm submodule has been downloaded, and Realm framework has been built.
Tests/Performance/Realm/build/osx/swift-4.1/RealmSwift.framework:
Tests/Performance/Realm/build/osx/swift-4.1.2/RealmSwift.framework:
$(GIT) submodule update --init --recursive Tests/Performance/Realm
cd Tests/Performance/Realm && sh build.sh osx-swift
@@ -295,12 +430,12 @@ 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.2.0 \
--module-version 3.2 \
--github-file-prefix https://github.com/groue/GRDB.swift/tree/v3.3.0 \
--module-version 3.3 \
--module GRDB \
--root-url http://groue.github.io/GRDB.swift/docs/3.2/ \
--root-url http://groue.github.io/GRDB.swift/docs/3.3/ \
--output Documentation/Reference \
--podspec GRDB.swift.podspec
--xcodebuild-arguments -project,GRDB.xcodeproj,-scheme,GRDBiOS
else
@echo Jazzy must be installed for doc
@exit 1
+791 -399
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -4,5 +4,5 @@ PRODUCT_NAME = GRDBCipher
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.$(PRODUCT_NAME:rfc1034identifier)
MODULEMAP_FILE = $(SRCROOT)/SQLCipher/module.modulemap
OTHER_CFLAGS = -DSQLITE_HAS_CODEC
OTHER_SWIFT_FLAGS = -D SQLITE_HAS_CODEC -D USING_BUILTIN_SQLITE -D GRDBCIPHER
OTHER_SWIFT_FLAGS = -D SQLITE_HAS_CODEC -D USING_BUILTIN_SQLITE -D GRDBCIPHER -D SQLITE_ENABLE_FTS5
HEADER_SEARCH_PATHS = $(SRCROOT)/SQLCipher/src
+1 -1
View File
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.2.0</string>
<string>3.3.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
+18 -1
View File
@@ -21,8 +21,25 @@
- [ ] UPSERT https://www.sqlite.org/lang_UPSERT.html
- [ ] https://github.com/apple/swift-evolution/blob/master/proposals/0075-import-test.md
- [ ] Avoid code duplication: https://forums.swift.org/t/c-interoperability-combinations-of-library-and-os-versions/14029/4
- [ ] Expose FTS5 in regular GRDB: https://github.com/groue/GRDB.swift/issues/373
- [ ] Allow joining methods on DerivableRequest
- [ ] DatabaseWriter.assertWriteAccess()
- [ ] Configuration.crashOnError = true
- [ ] Support for "INSERT INTO ... SELECT ...". For example:
```swift
// INSERT INTO rigth (id, name) SELECT id, name FROM left
let lefts = Left.select(Left.Columns.id, Left.Columns.name)
try Right.insert(lefts)
```
- [ ] select values from a JSON column:
```swift
let nesteds = try Record
.select(Column("nested"), as: Nested.self)
.fetchAll(db)
```
- [ ] Consider renaming dbQueue.inDatabase, dbPool.writeWithoutTransaction -> dbQueue/Pool.exclusive
- [ ] FetchedRecordsController diff algorithm: check https://github.com/RxSwiftCommunity/RxDataSources/issues/256
Swift 4.2
+15 -23
View File
@@ -7,18 +7,16 @@
objects = {
/* Begin PBXBuildFile section */
277479482141D92B00FCD661 /* PlayerEditionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 277479452141D92B00FCD661 /* PlayerEditionViewController.swift */; };
277479492141D92B00FCD661 /* PlayersViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 277479462141D92B00FCD661 /* PlayersViewController.swift */; };
2774794A2141D92B00FCD661 /* Player.swift in Sources */ = {isa = PBXBuildFile; fileRef = 277479472141D92B00FCD661 /* Player.swift */; };
5644E4041C1072A30090716E /* GRDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5644E4031C1072A30090716E /* GRDB.framework */; };
5644E4061C1072CA0090716E /* GRDB.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5644E4031C1072A30090716E /* GRDB.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
567374431B4D46600089DE44 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 567374411B4D46600089DE44 /* Main.storyboard */; };
567374451B4D46600089DE44 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 567374441B4D46600089DE44 /* Assets.xcassets */; };
567374481B4D46600089DE44 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 567374461B4D46600089DE44 /* LaunchScreen.storyboard */; };
568E2B991CACE4ED00426E7B /* SimplePersonsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 568E2B981CACE4ED00426E7B /* SimplePersonsViewController.swift */; };
56AEC9D91CAA985700452D96 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56AEC9D21CAA985700452D96 /* AppDelegate.swift */; };
56AEC9DA1CAA985700452D96 /* AppDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56AEC9D31CAA985700452D96 /* AppDatabase.swift */; };
56AEC9DB1CAA985700452D96 /* DemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56AEC9D41CAA985700452D96 /* DemoViewController.swift */; };
56AEC9DD1CAA985700452D96 /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56AEC9D61CAA985700452D96 /* Person.swift */; };
56AEC9DE1CAA985700452D96 /* PersonEditionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56AEC9D71CAA985700452D96 /* PersonEditionViewController.swift */; };
56AEC9DF1CAA985700452D96 /* PersonsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56AEC9D81CAA985700452D96 /* PersonsViewController.swift */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -36,19 +34,17 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
277479452141D92B00FCD661 /* PlayerEditionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlayerEditionViewController.swift; sourceTree = "<group>"; };
277479462141D92B00FCD661 /* PlayersViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlayersViewController.swift; sourceTree = "<group>"; };
277479472141D92B00FCD661 /* Player.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Player.swift; sourceTree = "<group>"; };
5644E4031C1072A30090716E /* GRDB.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GRDB.framework; path = ../../../Carthage/Build/iOS/GRDB.framework; sourceTree = "<group>"; };
567374381B4D46600089DE44 /* iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
567374421B4D46600089DE44 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
567374441B4D46600089DE44 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
567374471B4D46600089DE44 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
567374491B4D46600089DE44 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
568E2B981CACE4ED00426E7B /* SimplePersonsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimplePersonsViewController.swift; sourceTree = "<group>"; };
56AEC9D21CAA985700452D96 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
56AEC9D31CAA985700452D96 /* AppDatabase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDatabase.swift; sourceTree = "<group>"; };
56AEC9D41CAA985700452D96 /* DemoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DemoViewController.swift; sourceTree = "<group>"; };
56AEC9D61CAA985700452D96 /* Person.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Person.swift; sourceTree = "<group>"; };
56AEC9D71CAA985700452D96 /* PersonEditionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PersonEditionViewController.swift; sourceTree = "<group>"; };
56AEC9D81CAA985700452D96 /* PersonsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PersonsViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -84,16 +80,14 @@
isa = PBXGroup;
children = (
56AEC9D21CAA985700452D96 /* AppDelegate.swift */,
567374441B4D46600089DE44 /* Assets.xcassets */,
56AEC9D31CAA985700452D96 /* AppDatabase.swift */,
56AEC9D41CAA985700452D96 /* DemoViewController.swift */,
277479472141D92B00FCD661 /* Player.swift */,
277479452141D92B00FCD661 /* PlayerEditionViewController.swift */,
277479462141D92B00FCD661 /* PlayersViewController.swift */,
567374441B4D46600089DE44 /* Assets.xcassets */,
567374491B4D46600089DE44 /* Info.plist */,
567374461B4D46600089DE44 /* LaunchScreen.storyboard */,
567374411B4D46600089DE44 /* Main.storyboard */,
56AEC9D61CAA985700452D96 /* Person.swift */,
56AEC9D71CAA985700452D96 /* PersonEditionViewController.swift */,
56AEC9D81CAA985700452D96 /* PersonsViewController.swift */,
568E2B981CACE4ED00426E7B /* SimplePersonsViewController.swift */,
);
name = GRDBDemoiOS;
path = ../../../DemoApps/GRDBDemoiOS/GRDBDemoiOS;
@@ -190,12 +184,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
56AEC9DD1CAA985700452D96 /* Person.swift in Sources */,
56AEC9DF1CAA985700452D96 /* PersonsViewController.swift in Sources */,
56AEC9DB1CAA985700452D96 /* DemoViewController.swift in Sources */,
277479482141D92B00FCD661 /* PlayerEditionViewController.swift in Sources */,
56AEC9DA1CAA985700452D96 /* AppDatabase.swift in Sources */,
568E2B991CACE4ED00426E7B /* SimplePersonsViewController.swift in Sources */,
56AEC9DE1CAA985700452D96 /* PersonEditionViewController.swift in Sources */,
277479492141D92B00FCD661 /* PlayersViewController.swift in Sources */,
2774794A2141D92B00FCD661 /* Player.swift in Sources */,
56AEC9D91CAA985700452D96 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -263,7 +255,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
@@ -300,7 +292,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
VALIDATE_PRODUCT = YES;
};
name = Release;
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -0,0 +1,395 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
56269776211036C10066800A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56269775211036C10066800A /* AppDelegate.swift */; };
56269778211036C30066800A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 56269777211036C30066800A /* Assets.xcassets */; };
5626977B211036C30066800A /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 56269779211036C30066800A /* MainMenu.xib */; };
A32FEE3772DAB0501EE4369C /* Pods_GRDBCipherMacOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7FC038F3B5C9412A5DFDB72 /* Pods_GRDBCipherMacOS.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
2AB57EA4305B77469C9A4267 /* Pods-GRDBCipherMacOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GRDBCipherMacOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-GRDBCipherMacOS/Pods-GRDBCipherMacOS.release.xcconfig"; sourceTree = "<group>"; };
56269772211036C10066800A /* GRDBCipherMacOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GRDBCipherMacOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
56269775211036C10066800A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
56269777211036C30066800A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
5626977A211036C30066800A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
5626977C211036C30066800A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5626977D211036C30066800A /* GRDBCipherMacOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = GRDBCipherMacOS.entitlements; sourceTree = "<group>"; };
A3F8791E6F512575865AC37C /* Pods-GRDBCipherMacOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GRDBCipherMacOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-GRDBCipherMacOS/Pods-GRDBCipherMacOS.debug.xcconfig"; sourceTree = "<group>"; };
E7FC038F3B5C9412A5DFDB72 /* Pods_GRDBCipherMacOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GRDBCipherMacOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
5626976F211036C10066800A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A32FEE3772DAB0501EE4369C /* Pods_GRDBCipherMacOS.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
37312FDE6F3590F7D4DA75E3 /* Pods */ = {
isa = PBXGroup;
children = (
A3F8791E6F512575865AC37C /* Pods-GRDBCipherMacOS.debug.xcconfig */,
2AB57EA4305B77469C9A4267 /* Pods-GRDBCipherMacOS.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
56269769211036C10066800A = {
isa = PBXGroup;
children = (
56269774211036C10066800A /* GRDBCipherMacOS */,
56269773211036C10066800A /* Products */,
37312FDE6F3590F7D4DA75E3 /* Pods */,
86105FE752FB45E05465BA44 /* Frameworks */,
);
sourceTree = "<group>";
};
56269773211036C10066800A /* Products */ = {
isa = PBXGroup;
children = (
56269772211036C10066800A /* GRDBCipherMacOS.app */,
);
name = Products;
sourceTree = "<group>";
};
56269774211036C10066800A /* GRDBCipherMacOS */ = {
isa = PBXGroup;
children = (
56269775211036C10066800A /* AppDelegate.swift */,
56269777211036C30066800A /* Assets.xcassets */,
56269779211036C30066800A /* MainMenu.xib */,
5626977C211036C30066800A /* Info.plist */,
5626977D211036C30066800A /* GRDBCipherMacOS.entitlements */,
);
path = GRDBCipherMacOS;
sourceTree = "<group>";
};
86105FE752FB45E05465BA44 /* Frameworks */ = {
isa = PBXGroup;
children = (
E7FC038F3B5C9412A5DFDB72 /* Pods_GRDBCipherMacOS.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
56269771211036C10066800A /* GRDBCipherMacOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 56269780211036C30066800A /* Build configuration list for PBXNativeTarget "GRDBCipherMacOS" */;
buildPhases = (
7B68FB6434FA20203C21B0A7 /* [CP] Check Pods Manifest.lock */,
5626976E211036C10066800A /* Sources */,
5626976F211036C10066800A /* Frameworks */,
56269770211036C10066800A /* Resources */,
D151C0BABC336CE195E1761D /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = GRDBCipherMacOS;
productName = GRDBCipherMacOS;
productReference = 56269772211036C10066800A /* GRDBCipherMacOS.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
5626976A211036C10066800A /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0940;
LastUpgradeCheck = 0940;
ORGANIZATIONNAME = "Gwendal Roué";
TargetAttributes = {
56269771211036C10066800A = {
CreatedOnToolsVersion = 9.4.1;
};
};
};
buildConfigurationList = 5626976D211036C10066800A /* Build configuration list for PBXProject "GRDBCipherMacOS" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 56269769211036C10066800A;
productRefGroup = 56269773211036C10066800A /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
56269771211036C10066800A /* GRDBCipherMacOS */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
56269770211036C10066800A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
56269778211036C30066800A /* Assets.xcassets in Resources */,
5626977B211036C30066800A /* MainMenu.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
7B68FB6434FA20203C21B0A7 /* [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-GRDBCipherMacOS-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;
};
D151C0BABC336CE195E1761D /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-GRDBCipherMacOS/Pods-GRDBCipherMacOS-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/GRDBCipher/GRDBCipher.framework",
"${BUILT_PRODUCTS_DIR}/SQLCipher/SQLCipher.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GRDBCipher.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SQLCipher.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-GRDBCipherMacOS/Pods-GRDBCipherMacOS-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
5626976E211036C10066800A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
56269776211036C10066800A /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
56269779211036C30066800A /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
5626977A211036C30066800A /* Base */,
);
name = MainMenu.xib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
5626977E211036C30066800A /* 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;
};
5626977F211036C30066800A /* 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;
};
56269781211036C30066800A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = A3F8791E6F512575865AC37C /* Pods-GRDBCipherMacOS.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = GRDBCipherMacOS/GRDBCipherMacOS.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = AMD8W895CT;
INFOPLIST_FILE = GRDBCipherMacOS/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCipherMacOS;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
};
name = Debug;
};
56269782211036C30066800A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 2AB57EA4305B77469C9A4267 /* Pods-GRDBCipherMacOS.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = GRDBCipherMacOS/GRDBCipherMacOS.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = AMD8W895CT;
INFOPLIST_FILE = GRDBCipherMacOS/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBCipherMacOS;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
5626976D211036C10066800A /* Build configuration list for PBXProject "GRDBCipherMacOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5626977E211036C30066800A /* Debug */,
5626977F211036C30066800A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
56269780211036C30066800A /* Build configuration list for PBXNativeTarget "GRDBCipherMacOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
56269781211036C30066800A /* Debug */,
56269782211036C30066800A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 5626976A211036C10066800A /* Project object */;
}
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:GRDBCipherMacOS.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -0,0 +1,18 @@
import Cocoa
import GRDBCipher
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!
func applicationDidFinishLaunching(_ aNotification: Notification) {
let dbQueue = DatabaseQueue()
// Make sure FTS5 is enabled
try! dbQueue.write { db in
try db.create(virtualTable: "document", using: FTS5()) { t in
t.column("content")
}
}
}
}
@@ -0,0 +1,58 @@
{
"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"
}
}
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,692 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11134"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
<connections>
<outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSApplication"/>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModuleProvider="target">
<connections>
<outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
</connections>
</customObject>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
<items>
<menuItem title="GRDBCipherMacOS" id="1Xt-HY-uBw">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="GRDBCipherMacOS" systemMenu="apple" id="uQy-DD-JDr">
<items>
<menuItem title="About GRDBCipherMacOS" id="5kV-Vb-QxS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
<menuItem title="Services" id="NMo-om-nkz">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
<menuItem title="Hide GRDBCipherMacOS" keyEquivalent="h" id="Olw-nP-bQN">
<connections>
<action selector="hide:" target="-1" id="PnN-Uc-m68"/>
</connections>
</menuItem>
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
</connections>
</menuItem>
<menuItem title="Show All" id="Kd2-mp-pUS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
<menuItem title="Quit GRDBCipherMacOS" keyEquivalent="q" id="4sb-4s-VLi">
<connections>
<action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="File" id="dMs-cI-mzQ">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="File" id="bib-Uj-vzu">
<items>
<menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
<connections>
<action selector="newDocument:" target="-1" id="4Si-XN-c54"/>
</connections>
</menuItem>
<menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
<connections>
<action selector="openDocument:" target="-1" id="bVn-NM-KNZ"/>
</connections>
</menuItem>
<menuItem title="Open Recent" id="tXI-mr-wws">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
<items>
<menuItem title="Clear Menu" id="vNY-rz-j42">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="clearRecentDocuments:" target="-1" id="Daa-9d-B3U"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
<menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
<connections>
<action selector="performClose:" target="-1" id="HmO-Ls-i7Q"/>
</connections>
</menuItem>
<menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
<connections>
<action selector="saveDocument:" target="-1" id="teZ-XB-qJY"/>
</connections>
</menuItem>
<menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
<connections>
<action selector="saveDocumentAs:" target="-1" id="mDf-zr-I0C"/>
</connections>
</menuItem>
<menuItem title="Revert to Saved" keyEquivalent="r" id="KaW-ft-85H">
<connections>
<action selector="revertDocumentToSaved:" target="-1" id="iJ3-Pv-kwq"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
<menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
<connections>
<action selector="runPageLayout:" target="-1" id="Din-rz-gC5"/>
</connections>
</menuItem>
<menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
<connections>
<action selector="print:" target="-1" id="qaZ-4w-aoO"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Edit" id="5QF-Oa-p0T">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Edit" id="W48-6f-4Dl">
<items>
<menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
<connections>
<action selector="undo:" target="-1" id="M6e-cu-g7V"/>
</connections>
</menuItem>
<menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
<connections>
<action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
<menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
<connections>
<action selector="cut:" target="-1" id="YJe-68-I9s"/>
</connections>
</menuItem>
<menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
<connections>
<action selector="copy:" target="-1" id="G1f-GL-Joy"/>
</connections>
</menuItem>
<menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
<connections>
<action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
</connections>
</menuItem>
<menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
</connections>
</menuItem>
<menuItem title="Delete" id="pa3-QI-u2k">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
</connections>
</menuItem>
<menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
<connections>
<action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
<menuItem title="Find" id="4EN-yA-p0u">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Find" id="1b7-l0-nxx">
<items>
<menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
<connections>
<action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
</connections>
</menuItem>
<menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
</connections>
</menuItem>
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
<connections>
<action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
</connections>
</menuItem>
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
<connections>
<action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
</connections>
</menuItem>
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
<connections>
<action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
</connections>
</menuItem>
<menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
<connections>
<action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
<items>
<menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
<connections>
<action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
</connections>
</menuItem>
<menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
<connections>
<action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
<menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
</connections>
</menuItem>
<menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
</connections>
</menuItem>
<menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Substitutions" id="9ic-FL-obx">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
<items>
<menuItem title="Show Substitutions" id="z6F-FW-3nz">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
<menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
</connections>
</menuItem>
<menuItem title="Smart Quotes" id="hQb-2v-fYv">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
</connections>
</menuItem>
<menuItem title="Smart Dashes" id="rgM-f4-ycn">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
</connections>
</menuItem>
<menuItem title="Smart Links" id="cwL-P1-jid">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
</connections>
</menuItem>
<menuItem title="Data Detectors" id="tRr-pd-1PS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
</connections>
</menuItem>
<menuItem title="Text Replacement" id="HFQ-gK-NFA">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Transformations" id="2oI-Rn-ZJC">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Transformations" id="c8a-y6-VQd">
<items>
<menuItem title="Make Upper Case" id="vmV-6d-7jI">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
</connections>
</menuItem>
<menuItem title="Make Lower Case" id="d9M-CD-aMd">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
</connections>
</menuItem>
<menuItem title="Capitalize" id="UEZ-Bs-lqG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Speech" id="xrE-MZ-jX0">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Speech" id="3rS-ZA-NoH">
<items>
<menuItem title="Start Speaking" id="Ynk-f8-cLZ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
</connections>
</menuItem>
<menuItem title="Stop Speaking" id="Oyz-dy-DGm">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Format" id="jxT-CU-nIS">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Format" id="GEO-Iw-cKr">
<items>
<menuItem title="Font" id="Gi5-1S-RQB">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
<items>
<menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
<connections>
<action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
</connections>
</menuItem>
<menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
<connections>
<action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
</connections>
</menuItem>
<menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
<connections>
<action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
</connections>
</menuItem>
<menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
<connections>
<action selector="underline:" target="-1" id="FYS-2b-JAY"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
<menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
<connections>
<action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
</connections>
</menuItem>
<menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
<connections>
<action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
<menuItem title="Kern" id="jBQ-r6-VK2">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Kern" id="tlD-Oa-oAM">
<items>
<menuItem title="Use Default" id="GUa-eO-cwY">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useStandardKerning:" target="-1" id="6dk-9l-Ckg"/>
</connections>
</menuItem>
<menuItem title="Use None" id="cDB-IK-hbR">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="turnOffKerning:" target="-1" id="U8a-gz-Maa"/>
</connections>
</menuItem>
<menuItem title="Tighten" id="46P-cB-AYj">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="tightenKerning:" target="-1" id="hr7-Nz-8ro"/>
</connections>
</menuItem>
<menuItem title="Loosen" id="ogc-rX-tC1">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="loosenKerning:" target="-1" id="8i4-f9-FKE"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Ligatures" id="o6e-r0-MWq">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
<items>
<menuItem title="Use Default" id="agt-UL-0e3">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useStandardLigatures:" target="-1" id="7uR-wd-Dx6"/>
</connections>
</menuItem>
<menuItem title="Use None" id="J7y-lM-qPV">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="turnOffLigatures:" target="-1" id="iX2-gA-Ilz"/>
</connections>
</menuItem>
<menuItem title="Use All" id="xQD-1f-W4t">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useAllLigatures:" target="-1" id="KcB-kA-TuK"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Baseline" id="OaQ-X3-Vso">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Baseline" id="ijk-EB-dga">
<items>
<menuItem title="Use Default" id="3Om-Ey-2VK">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="unscript:" target="-1" id="0vZ-95-Ywn"/>
</connections>
</menuItem>
<menuItem title="Superscript" id="Rqc-34-cIF">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="superscript:" target="-1" id="3qV-fo-wpU"/>
</connections>
</menuItem>
<menuItem title="Subscript" id="I0S-gh-46l">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="subscript:" target="-1" id="Q6W-4W-IGz"/>
</connections>
</menuItem>
<menuItem title="Raise" id="2h7-ER-AoG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="raiseBaseline:" target="-1" id="4sk-31-7Q9"/>
</connections>
</menuItem>
<menuItem title="Lower" id="1tx-W0-xDw">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="lowerBaseline:" target="-1" id="OF1-bc-KW4"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
<menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
<connections>
<action selector="orderFrontColorPanel:" target="-1" id="mSX-Xz-DV3"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
<menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="copyFont:" target="-1" id="GJO-xA-L4q"/>
</connections>
</menuItem>
<menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="pasteFont:" target="-1" id="JfD-CL-leO"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Text" id="Fal-I4-PZk">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Text" id="d9c-me-L2H">
<items>
<menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
<connections>
<action selector="alignLeft:" target="-1" id="zUv-R1-uAa"/>
</connections>
</menuItem>
<menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
<connections>
<action selector="alignCenter:" target="-1" id="spX-mk-kcS"/>
</connections>
</menuItem>
<menuItem title="Justify" id="J5U-5w-g23">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="alignJustified:" target="-1" id="ljL-7U-jND"/>
</connections>
</menuItem>
<menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
<connections>
<action selector="alignRight:" target="-1" id="r48-bG-YeY"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
<menuItem title="Writing Direction" id="H1b-Si-o9J">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
<items>
<menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="YGs-j5-SAR">
<string key="title"> Default</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionNatural:" target="-1" id="qtV-5e-UBP"/>
</connections>
</menuItem>
<menuItem id="Lbh-J2-qVU">
<string key="title"> Left to Right</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionLeftToRight:" target="-1" id="S0X-9S-QSf"/>
</connections>
</menuItem>
<menuItem id="jFq-tB-4Kx">
<string key="title"> Right to Left</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionRightToLeft:" target="-1" id="5fk-qB-AqJ"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
<menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="Nop-cj-93Q">
<string key="title"> Default</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionNatural:" target="-1" id="lPI-Se-ZHp"/>
</connections>
</menuItem>
<menuItem id="BgM-ve-c93">
<string key="title"> Left to Right</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionLeftToRight:" target="-1" id="caW-Bv-w94"/>
</connections>
</menuItem>
<menuItem id="RB4-Sm-HuC">
<string key="title"> Right to Left</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionRightToLeft:" target="-1" id="EXD-6r-ZUu"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
<menuItem title="Show Ruler" id="vLm-3I-IUL">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleRuler:" target="-1" id="FOx-HJ-KwY"/>
</connections>
</menuItem>
<menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="copyRuler:" target="-1" id="71i-fW-3W2"/>
</connections>
</menuItem>
<menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="pasteRuler:" target="-1" id="cSh-wd-qM2"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="View" id="H8h-7b-M4v">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="View" id="HyV-fh-RgO">
<items>
<menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="toggleToolbarShown:" target="-1" id="BXY-wc-z0C"/>
</connections>
</menuItem>
<menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="runToolbarCustomizationPalette:" target="-1" id="pQI-g3-MTW"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="hB3-LF-h0Y"/>
<menuItem title="Show Sidebar" keyEquivalent="s" id="kIP-vf-haE">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="toggleSourceList:" target="-1" id="iwa-gc-5KM"/>
</connections>
</menuItem>
<menuItem title="Enter Full Screen" keyEquivalent="f" id="4J7-dP-txa">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="toggleFullScreen:" target="-1" id="dU3-MA-1Rq"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Window" id="aUF-d1-5bR">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
<items>
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
<connections>
<action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
</connections>
</menuItem>
<menuItem title="Zoom" id="R4o-n2-Eq4">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Help" id="wpr-3q-Mcd">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
<items>
<menuItem title="GRDBCipherMacOS Help" keyEquivalent="?" id="FKE-Sm-Kum">
<connections>
<action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
<window title="GRDBCipherMacOS" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="335" y="390" width="480" height="360"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="480" height="360"/>
<autoresizingMask key="autoresizingMask"/>
</view>
</window>
</objects>
</document>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
</dict>
</plist>
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018 Gwendal Roué. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
+4
View File
@@ -0,0 +1,4 @@
target 'GRDBCipherMacOS'
platform :macos, '10.13'
use_frameworks!
pod 'GRDBCipher', :path => '../../..'
@@ -0,0 +1,393 @@
// !$*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 = "<group>"; };
562697B621107C140066800A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
562697B921107C140066800A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
562697BB21107C140066800A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
562697BC21107C140066800A /* GRDBFTS5MacOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = GRDBFTS5MacOS.entitlements; sourceTree = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
/* 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 = "<group>";
};
562697B221107C130066800A /* Products */ = {
isa = PBXGroup;
children = (
562697B121107C130066800A /* GRDBFTS5MacOS.app */,
);
name = Products;
sourceTree = "<group>";
};
562697B321107C130066800A /* GRDBFTS5MacOS */ = {
isa = PBXGroup;
children = (
562697B421107C130066800A /* AppDelegate.swift */,
562697B621107C140066800A /* Assets.xcassets */,
562697B821107C140066800A /* MainMenu.xib */,
562697BB21107C140066800A /* Info.plist */,
562697BC21107C140066800A /* GRDBFTS5MacOS.entitlements */,
);
path = GRDBFTS5MacOS;
sourceTree = "<group>";
};
A3A77F69118F72CFF483B37C /* Frameworks */ = {
isa = PBXGroup;
children = (
6CD0FDB86C1C7C5D392EEDC0 /* Pods_GRDBFTS5MacOS.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
BC88EA1E9BA0651EB954E368 /* Pods */ = {
isa = PBXGroup;
children = (
EC2C210DD2F8C1485D2B51F8 /* Pods-GRDBFTS5MacOS.debug.xcconfig */,
966036335047A35A92E51A77 /* Pods-GRDBFTS5MacOS.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
/* 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 = "<group>";
};
/* 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 */;
}
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:GRDBFTS5MacOS.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -0,0 +1,21 @@
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")
}
}
}
}
@@ -0,0 +1,58 @@
{
"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"
}
}
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,692 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11134"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
<connections>
<outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSApplication"/>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModuleProvider="target">
<connections>
<outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
</connections>
</customObject>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
<items>
<menuItem title="GRDBFTS5MacOS" id="1Xt-HY-uBw">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="GRDBFTS5MacOS" systemMenu="apple" id="uQy-DD-JDr">
<items>
<menuItem title="About GRDBFTS5MacOS" id="5kV-Vb-QxS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
<menuItem title="Services" id="NMo-om-nkz">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
<menuItem title="Hide GRDBFTS5MacOS" keyEquivalent="h" id="Olw-nP-bQN">
<connections>
<action selector="hide:" target="-1" id="PnN-Uc-m68"/>
</connections>
</menuItem>
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
</connections>
</menuItem>
<menuItem title="Show All" id="Kd2-mp-pUS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
<menuItem title="Quit GRDBFTS5MacOS" keyEquivalent="q" id="4sb-4s-VLi">
<connections>
<action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="File" id="dMs-cI-mzQ">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="File" id="bib-Uj-vzu">
<items>
<menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
<connections>
<action selector="newDocument:" target="-1" id="4Si-XN-c54"/>
</connections>
</menuItem>
<menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
<connections>
<action selector="openDocument:" target="-1" id="bVn-NM-KNZ"/>
</connections>
</menuItem>
<menuItem title="Open Recent" id="tXI-mr-wws">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
<items>
<menuItem title="Clear Menu" id="vNY-rz-j42">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="clearRecentDocuments:" target="-1" id="Daa-9d-B3U"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
<menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
<connections>
<action selector="performClose:" target="-1" id="HmO-Ls-i7Q"/>
</connections>
</menuItem>
<menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
<connections>
<action selector="saveDocument:" target="-1" id="teZ-XB-qJY"/>
</connections>
</menuItem>
<menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
<connections>
<action selector="saveDocumentAs:" target="-1" id="mDf-zr-I0C"/>
</connections>
</menuItem>
<menuItem title="Revert to Saved" keyEquivalent="r" id="KaW-ft-85H">
<connections>
<action selector="revertDocumentToSaved:" target="-1" id="iJ3-Pv-kwq"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
<menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
<connections>
<action selector="runPageLayout:" target="-1" id="Din-rz-gC5"/>
</connections>
</menuItem>
<menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
<connections>
<action selector="print:" target="-1" id="qaZ-4w-aoO"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Edit" id="5QF-Oa-p0T">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Edit" id="W48-6f-4Dl">
<items>
<menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
<connections>
<action selector="undo:" target="-1" id="M6e-cu-g7V"/>
</connections>
</menuItem>
<menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
<connections>
<action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
<menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
<connections>
<action selector="cut:" target="-1" id="YJe-68-I9s"/>
</connections>
</menuItem>
<menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
<connections>
<action selector="copy:" target="-1" id="G1f-GL-Joy"/>
</connections>
</menuItem>
<menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
<connections>
<action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
</connections>
</menuItem>
<menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
</connections>
</menuItem>
<menuItem title="Delete" id="pa3-QI-u2k">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
</connections>
</menuItem>
<menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
<connections>
<action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
<menuItem title="Find" id="4EN-yA-p0u">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Find" id="1b7-l0-nxx">
<items>
<menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
<connections>
<action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
</connections>
</menuItem>
<menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
</connections>
</menuItem>
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
<connections>
<action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
</connections>
</menuItem>
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
<connections>
<action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
</connections>
</menuItem>
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
<connections>
<action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
</connections>
</menuItem>
<menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
<connections>
<action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
<items>
<menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
<connections>
<action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
</connections>
</menuItem>
<menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
<connections>
<action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
<menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
</connections>
</menuItem>
<menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
</connections>
</menuItem>
<menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Substitutions" id="9ic-FL-obx">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
<items>
<menuItem title="Show Substitutions" id="z6F-FW-3nz">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
<menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
</connections>
</menuItem>
<menuItem title="Smart Quotes" id="hQb-2v-fYv">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
</connections>
</menuItem>
<menuItem title="Smart Dashes" id="rgM-f4-ycn">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
</connections>
</menuItem>
<menuItem title="Smart Links" id="cwL-P1-jid">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
</connections>
</menuItem>
<menuItem title="Data Detectors" id="tRr-pd-1PS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
</connections>
</menuItem>
<menuItem title="Text Replacement" id="HFQ-gK-NFA">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Transformations" id="2oI-Rn-ZJC">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Transformations" id="c8a-y6-VQd">
<items>
<menuItem title="Make Upper Case" id="vmV-6d-7jI">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
</connections>
</menuItem>
<menuItem title="Make Lower Case" id="d9M-CD-aMd">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
</connections>
</menuItem>
<menuItem title="Capitalize" id="UEZ-Bs-lqG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Speech" id="xrE-MZ-jX0">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Speech" id="3rS-ZA-NoH">
<items>
<menuItem title="Start Speaking" id="Ynk-f8-cLZ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
</connections>
</menuItem>
<menuItem title="Stop Speaking" id="Oyz-dy-DGm">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Format" id="jxT-CU-nIS">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Format" id="GEO-Iw-cKr">
<items>
<menuItem title="Font" id="Gi5-1S-RQB">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
<items>
<menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
<connections>
<action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
</connections>
</menuItem>
<menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
<connections>
<action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
</connections>
</menuItem>
<menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
<connections>
<action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
</connections>
</menuItem>
<menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
<connections>
<action selector="underline:" target="-1" id="FYS-2b-JAY"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
<menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
<connections>
<action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
</connections>
</menuItem>
<menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
<connections>
<action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
<menuItem title="Kern" id="jBQ-r6-VK2">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Kern" id="tlD-Oa-oAM">
<items>
<menuItem title="Use Default" id="GUa-eO-cwY">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useStandardKerning:" target="-1" id="6dk-9l-Ckg"/>
</connections>
</menuItem>
<menuItem title="Use None" id="cDB-IK-hbR">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="turnOffKerning:" target="-1" id="U8a-gz-Maa"/>
</connections>
</menuItem>
<menuItem title="Tighten" id="46P-cB-AYj">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="tightenKerning:" target="-1" id="hr7-Nz-8ro"/>
</connections>
</menuItem>
<menuItem title="Loosen" id="ogc-rX-tC1">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="loosenKerning:" target="-1" id="8i4-f9-FKE"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Ligatures" id="o6e-r0-MWq">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
<items>
<menuItem title="Use Default" id="agt-UL-0e3">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useStandardLigatures:" target="-1" id="7uR-wd-Dx6"/>
</connections>
</menuItem>
<menuItem title="Use None" id="J7y-lM-qPV">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="turnOffLigatures:" target="-1" id="iX2-gA-Ilz"/>
</connections>
</menuItem>
<menuItem title="Use All" id="xQD-1f-W4t">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useAllLigatures:" target="-1" id="KcB-kA-TuK"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Baseline" id="OaQ-X3-Vso">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Baseline" id="ijk-EB-dga">
<items>
<menuItem title="Use Default" id="3Om-Ey-2VK">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="unscript:" target="-1" id="0vZ-95-Ywn"/>
</connections>
</menuItem>
<menuItem title="Superscript" id="Rqc-34-cIF">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="superscript:" target="-1" id="3qV-fo-wpU"/>
</connections>
</menuItem>
<menuItem title="Subscript" id="I0S-gh-46l">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="subscript:" target="-1" id="Q6W-4W-IGz"/>
</connections>
</menuItem>
<menuItem title="Raise" id="2h7-ER-AoG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="raiseBaseline:" target="-1" id="4sk-31-7Q9"/>
</connections>
</menuItem>
<menuItem title="Lower" id="1tx-W0-xDw">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="lowerBaseline:" target="-1" id="OF1-bc-KW4"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
<menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
<connections>
<action selector="orderFrontColorPanel:" target="-1" id="mSX-Xz-DV3"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
<menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="copyFont:" target="-1" id="GJO-xA-L4q"/>
</connections>
</menuItem>
<menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="pasteFont:" target="-1" id="JfD-CL-leO"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Text" id="Fal-I4-PZk">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Text" id="d9c-me-L2H">
<items>
<menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
<connections>
<action selector="alignLeft:" target="-1" id="zUv-R1-uAa"/>
</connections>
</menuItem>
<menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
<connections>
<action selector="alignCenter:" target="-1" id="spX-mk-kcS"/>
</connections>
</menuItem>
<menuItem title="Justify" id="J5U-5w-g23">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="alignJustified:" target="-1" id="ljL-7U-jND"/>
</connections>
</menuItem>
<menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
<connections>
<action selector="alignRight:" target="-1" id="r48-bG-YeY"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
<menuItem title="Writing Direction" id="H1b-Si-o9J">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
<items>
<menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="YGs-j5-SAR">
<string key="title"> Default</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionNatural:" target="-1" id="qtV-5e-UBP"/>
</connections>
</menuItem>
<menuItem id="Lbh-J2-qVU">
<string key="title"> Left to Right</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionLeftToRight:" target="-1" id="S0X-9S-QSf"/>
</connections>
</menuItem>
<menuItem id="jFq-tB-4Kx">
<string key="title"> Right to Left</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionRightToLeft:" target="-1" id="5fk-qB-AqJ"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
<menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="Nop-cj-93Q">
<string key="title"> Default</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionNatural:" target="-1" id="lPI-Se-ZHp"/>
</connections>
</menuItem>
<menuItem id="BgM-ve-c93">
<string key="title"> Left to Right</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionLeftToRight:" target="-1" id="caW-Bv-w94"/>
</connections>
</menuItem>
<menuItem id="RB4-Sm-HuC">
<string key="title"> Right to Left</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionRightToLeft:" target="-1" id="EXD-6r-ZUu"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
<menuItem title="Show Ruler" id="vLm-3I-IUL">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleRuler:" target="-1" id="FOx-HJ-KwY"/>
</connections>
</menuItem>
<menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="copyRuler:" target="-1" id="71i-fW-3W2"/>
</connections>
</menuItem>
<menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="pasteRuler:" target="-1" id="cSh-wd-qM2"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="View" id="H8h-7b-M4v">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="View" id="HyV-fh-RgO">
<items>
<menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="toggleToolbarShown:" target="-1" id="BXY-wc-z0C"/>
</connections>
</menuItem>
<menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="runToolbarCustomizationPalette:" target="-1" id="pQI-g3-MTW"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="hB3-LF-h0Y"/>
<menuItem title="Show Sidebar" keyEquivalent="s" id="kIP-vf-haE">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="toggleSourceList:" target="-1" id="iwa-gc-5KM"/>
</connections>
</menuItem>
<menuItem title="Enter Full Screen" keyEquivalent="f" id="4J7-dP-txa">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="toggleFullScreen:" target="-1" id="dU3-MA-1Rq"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Window" id="aUF-d1-5bR">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
<items>
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
<connections>
<action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
</connections>
</menuItem>
<menuItem title="Zoom" id="R4o-n2-Eq4">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Help" id="wpr-3q-Mcd">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
<items>
<menuItem title="GRDBFTS5MacOS Help" keyEquivalent="?" id="FKE-Sm-Kum">
<connections>
<action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
<window title="GRDBFTS5MacOS" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="335" y="390" width="480" height="360"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="480" height="360"/>
<autoresizingMask key="autoresizingMask"/>
</view>
</window>
</objects>
</document>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
</dict>
</plist>
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018 Gwendal Roué. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
+5
View File
@@ -0,0 +1,5 @@
use_frameworks!
target 'GRDBFTS5MacOS'
platform :macos, '10.13'
pod 'GRDBPlus', :path => '../../..'
Loaded 100 of 150 files, more files were not shown because too many files have changed in this diff. Show more