Compare commits

..
2756 Commits
Author SHA1 Message Date
Gwendal Roué a67070dd9a Merge branch 'development' 2019-11-20 18:51:03 +01:00
Gwendal Roué f257fb7a4e v4.6.2 2019-11-20 18:47:28 +01:00
Gwendal Roué 3f79892fdb Merge pull request #653 from signalapp/mkirk/empty-migrations
Fix: `appliedMigrations` throws error on new install
2019-11-20 09:04:35 +01:00
Michael Kirk cd6d46e349 move fix to private 2019-11-18 11:33:35 -07:00
Michael Kirk 9ea160b116 Fix: appliedMigrations throws error on new install
Before setup, the grdb_migrations table doesn't exist, so calling
`appliedMigrations` would throw an error.

To avoid this, if the table to track migrations doesn't exist yet, we can be
sure no migrations have been run, and we retun the empty set.

FIXES https://github.com/groue/GRDB.swift/issues/652
2019-11-18 09:09:46 -07:00
Gwendal Roué 8f03b5c8f3 Improve Configuration.targetQueue documentation - #651 2019-11-17 17:41:55 +01:00
Gwendal Roué 3ce3f2fa71 Xcode 11.3 in the Makefile 2019-11-17 17:31:42 +01:00
Gwendal Roué d9c26a40b4 Fix Swiftlint warning 2019-11-14 08:21:50 +01:00
Gwendal Roué 09e271de77 TODO 2019-11-13 19:25:09 +01:00
Gwendal Roué 205dea122f Upgrade performance tests 2019-11-13 04:37:08 +01:00
Gwendal Roué 2eb10aa19a Upgrade performance tests 2019-11-13 04:37:08 +01:00
Gwendal Roué 63fc59fd7c Merge pull request #649 from AnthonyEgerton/patch-1
Fix typo in Release Notes
2019-11-13 04:34:57 +01:00
Anthony Egerton bf6ee31491 Fix typo 2019-11-13 10:44:05 +11:00
Gwendal Roué 146151ffd7 Merge branch 'development' 2019-11-10 17:07:35 +01:00
Gwendal Roué 5b24f598a5 v4.6.1 2019-11-10 17:07:12 +01:00
Gwendal Roué 51a1c418a6 Merge pull request #647 from groue/dev/batch-update-policy
Honor conflict resolution for batch updates
2019-11-10 16:58:32 +01:00
Gwendal Roué e1ff862ffc CHANGELOG 2019-11-10 13:12:42 +01:00
Gwendal Roué 630a2c358a Document conflict resolution for batch updates 2019-11-10 13:05:33 +01:00
Gwendal Roué e0ea30041f Batch update: customization of conflict resolution 2019-11-10 13:00:19 +01:00
Gwendal Roué 58263e9b60 Fix failing test for batch update policy 2019-11-10 12:42:01 +01:00
Gwendal Roué 1e80aecfbd Failing test for batch update policy 2019-11-10 12:34:33 +01:00
Gwendal Roué d5c6dde3d9 Merge branch 'development' 2019-11-10 08:24:32 +01:00
Gwendal Roué 7819c9026a v4.6.0 2019-11-09 17:44:26 +01:00
Gwendal Roué e6617c8e12 Fix typo 2019-11-09 17:24:25 +01:00
Gwendal Roué d03a01a84a Fix typo 2019-11-09 16:23:51 +01:00
Gwendal Roué 90735fb3a7 CHANGELOG 2019-11-09 16:22:42 +01:00
Gwendal Roué 264906221e New Ordered vs. Unordered Associations chapter 2019-11-09 15:51:12 +01:00
Gwendal Roué be21704633 More usage tests for ordered to-many associations: reordering 2019-11-09 15:50:14 +01:00
Gwendal Roué b68bb00033 Simplify association to property type documentation 2019-11-09 14:52:32 +01:00
Gwendal Roué 1dd5c17bc7 Simplify Refining Association Requests chapter 2019-11-09 14:48:49 +01:00
Gwendal Roué c8a2c68728 Typo fix 2019-11-09 14:46:59 +01:00
Gwendal Roué f40c6511ef Usage tests for ordered to-many associations 2019-11-09 14:01:15 +01:00
Gwendal Roué 60aa6c2bf2 Less TODO 2019-11-09 13:11:25 +01:00
Gwendal Roué fe7446431b More NSDecimalNumber tests 2019-11-09 13:07:47 +01:00
Gwendal Roué abe2a62d47 Less TODO 2019-11-09 12:37:00 +01:00
Gwendal Roué 65d0f1edcc Merge pull request #646 from groue/dev/batch-update
Batch updates
2019-11-09 08:49:30 +01:00
Gwendal Roué c09615bab0 Fix bad tests 2019-11-08 20:32:54 +01:00
Gwendal Roué 218afa72c3 Test that order without limit is unused and harmless with updateAll() and deleteAll() 2019-11-08 18:09:11 +01:00
Gwendal Roué cb77fe2ed3 Don't check for ENABLE_UPDATE_DELETE_LIMIT: let SQLite emit syntax errors 2019-11-08 18:08:27 +01:00
Gwendal Roué 7345c5f2dd Fix Swiftlint warnings 2019-11-08 09:04:34 +01:00
Gwendal Roué efdebf59d3 CHANGELOG 2019-11-08 09:04:34 +01:00
Gwendal Roué 35d7490092 Fix SQLCipher tests (it misses ENABLE_UPDATE_DELETE_LIMIT) 2019-11-08 09:04:34 +01:00
Gwendal Roué dd4a2c5d9c Better error message when ENABLE_UPDATE_DELETE_LIMIT is missing 2019-11-08 09:04:34 +01:00
Gwendal Roué eae70f426e URIs don't change: people change them. 2019-11-08 09:04:34 +01:00
Gwendal Roué c7a6ca964c Doc cleanup 2019-11-08 09:04:34 +01:00
Gwendal Roué acb0004cea Move Full-Text documentation in its own file 2019-11-08 09:04:34 +01:00
Gwendal Roué 995d1b851a Rename setter to assignment 2019-11-08 09:04:34 +01:00
Gwendal Roué beab493dd5 Batch update documentation 2019-11-08 09:04:34 +01:00
Gwendal Roué 1c76eb7e9f Test encapsulation of batch update 2019-11-08 09:04:34 +01:00
Gwendal Roué 205398b65a Batch update 2019-11-08 09:04:34 +01:00
Gwendal Roué 61a6c5785f More request.deleteAll() tests 2019-11-08 09:04:34 +01:00
Gwendal Roué d983c6407c Update the list of extended result codes 2019-11-08 09:03:55 +01:00
Gwendal Roué 7cb78a4c86 Makefile: support for Xcode 11.2.1 GM seed 2019-11-08 09:03:47 +01:00
Gwendal Roué 733f6883d0 More TODO 2019-11-07 12:01:07 +01:00
Gwendal Roué 594874656a TODO 2019-11-06 08:24:22 +01:00
Gwendal Roué 6142020c50 Test association aggregate + inner join 2019-11-06 08:24:16 +01:00
Gwendal Roué 6f5b18854d TODO: enhance SQLRequest documentation - #617 2019-11-05 19:05:54 +01:00
Gwendal Roué b39c678a3d Remove dead code 2019-11-05 08:55:30 +01:00
Gwendal Roué a8a85d9a1f Disable some Travis tests
WTF? Travis has removed some simulators in the Xcode 11 setup?

https://travis-ci.org/groue/GRDB.swift/jobs/604303972
https://travis-ci.org/groue/GRDB.swift/jobs/604303975
2019-10-30 08:20:35 +01:00
Gwendal Roué 182b92f010 Opt in for more Swiftlint rules 2019-10-27 19:27:53 +01:00
Gwendal Roué a78f3699eb Help compiling GRDB with SWIFT_VERSION 5.0 and all opt-in APIs 2019-10-27 19:20:21 +01:00
Gwendal Roué 89bc509170 Merge branch 'development' 2019-10-15 18:55:25 +02:00
Gwendal Roué cfa615444e v4.5.0 2019-10-15 08:27:56 +02:00
Gwendal Roué 35389ed978 Fix demo app paths 2019-10-15 07:45:05 +02:00
Gwendal Roué caacecfd83 Remove obsolete GRDBPlus.podspec 2019-10-14 08:07:19 +02:00
Gwendal Roué 924b460c7a Move playgrounds to the Documentation folder 2019-10-14 08:05:50 +02:00
Gwendal Roué 60a9cf4942 Move the demo app to the Documentation folder 2019-10-14 08:03:54 +02:00
Gwendal Roué f9f3080819 Merge pull request #635 from groue/dev/sunsetFetchedRecordsController
Sunset FetchedRecordsController
2019-10-13 19:41:19 +02:00
Gwendal Roué 02c024e819 CocoaPods test apps don't rely on demo app, which requires Swift 5.1 2019-10-13 12:53:09 +02:00
Gwendal Roué 10249675ff CHANGELOG 2019-10-12 15:19:50 +02:00
Gwendal Roué b6553c0b59 Demo app: replace FetchedRecordsController with ValueObservation 2019-10-12 14:49:18 +02:00
Gwendal Roué dfd3e50b9c Sunset FetchedRecordsController 2019-10-12 14:10:56 +02:00
Gwendal Roué 79b8f7ed1d Merge pull request #633 from groue/dev/CocoaPodsOptions
SQLITE_ENABLE_PREUPDATE_HOOK support with CocoaPods
2019-10-12 13:00:22 +02:00
Gwendal Roué f184c626e0 SQLITE_ENABLE_PREUPDATE_HOOK documentation 2019-10-12 12:56:39 +02:00
Gwendal Roué 24ba40a77e GRDB_SQLITE_ENABLE_PREUPDATE_HOOK exposes missing SQLITE_ENABLE_PREUPDATE_HOOK declarations 2019-10-10 20:16:15 +02:00
Gwendal Roué 66326d79a2 Minor doc fix 2019-10-10 19:50:30 +02:00
Gwendal Roué fcd6c100ee Fix Xcode 11.1 tvOS destination in Makefile 2019-10-10 18:33:53 +02:00
Gwendal Roué 95b7879e33 CHANGELOG 2019-10-10 18:33:17 +02:00
Gwendal Roué 404532f6f0 Add LockedBox to GRDBCustom 2019-10-10 13:52:33 +02:00
Gwendal Roué 751262cdb3 Better DatabaseReader tests 2019-10-10 13:51:44 +02:00
Gwendal Roué 0ac0d31796 Better snapshot tests 2019-10-10 13:51:33 +02:00
Gwendal Roué 9d5d7f0216 Database.withSchemaCache 2019-10-10 13:51:00 +02:00
Gwendal Roué b59521e247 ReadWriteBox(value:) initializer 2019-10-10 13:50:42 +02:00
Gwendal Roué 7dd90c4af3 Don’t return Void 2019-10-10 13:49:55 +02:00
Gwendal Roué b06e4ad298 Make DatabaseSnapshot.reentrantRead actually reentrant 2019-10-10 13:49:39 +02:00
Gwendal Roué ff21f86341 DatabasePool setup: handle #102 in a savepoint 2019-10-10 13:49:12 +02:00
Gwendal Roué c89d41adbb Rename readerConfig to readerConfiguration 2019-10-10 13:48:20 +02:00
Gwendal Roué b3e1bf6f05 Database.checkpoint 2019-10-10 13:45:01 +02:00
Gwendal Roué fc57a69672 Rename beginSnapshotTransaction to beginSnapshotTransaction 2019-10-10 13:43:10 +02:00
Gwendal Roué fdbc0c8ec8 LockedBox: for when one does not need single writer/multiple readers 2019-10-10 13:41:58 +02:00
Gwendal Roué e3edf6daec Snapshot documentation improvements 2019-10-10 13:38:43 +02:00
Gwendal Roué 1b8f7b95f4 CHANGELOG and thank you notice 2019-10-10 08:20:32 +02:00
Gwendal Roué f756f39772 Merge pull request #632 from runhum/bugfix/readme-typos
Fix Accout -> Account
2019-10-09 17:28:45 +02:00
Runar Hummelsund 836f34297d Fix Accout -> Account 2019-10-09 17:19:44 +02:00
Gwendal Roué cd6d2579a5 Merge pull request #631 from groue/dev/issue630
Fix custom SQLite builds
2019-10-07 06:31:00 +02:00
Gwendal Roué 2892424006 CHANGELOG 2019-10-06 13:51:03 +02:00
Gwendal Roué 856792d688 Travis: test custom SQLite installation 2019-10-06 13:03:43 +02:00
Gwendal Roué 00115ba60c More explicit documentation for the Pre-action script 2019-10-06 12:57:03 +02:00
Gwendal Roué 1cdddd35c8 Fix Xcode warnings 2019-10-06 12:55:35 +02:00
Gwendal Roué ccaf4c942f Test installation procedure for custom SQLite 2019-10-06 12:55:21 +02:00
Gwendal Roué 9f9fcb1a8e Address #630 2019-10-06 12:21:49 +02:00
Gwendal Roué b6955377c9 CHANGELOG 2019-10-06 11:49:45 +02:00
Gwendal Roué 5f085f2df8 Merge pull request #627 from groue/dev/SPM
Swift Package Manager: define SQLite as a system library target
2019-10-04 19:01:49 +02:00
Gwendal Roué 3cc5bb7c98 Test SPM integration from Xcode 2019-10-02 18:27:40 +02:00
Gwendal Roué 3dc4567233 SPM: Replace groue/CSQLite with a systemLibrary target 2019-10-02 18:02:49 +02:00
Gwendal Roué 37477adada Merge pull request #622 from groue/dev/620
Allow observation of FTS4 virtual tables
2019-09-27 06:04:03 +02:00
Gwendal Roué a44afd79e0 Makefile: support for Xcode 11.1 2019-09-26 13:15:32 +02:00
Gwendal Roué 61088ee2e7 Makefile: use iPhone 11 simulator with Xcode 11.0 2019-09-26 13:07:47 +02:00
Gwendal Roué a721917d95 CHANGELOG 2019-09-26 09:03:10 +02:00
Gwendal Roué a08b078c3e Fix a swiftlint warning 2019-09-26 08:49:57 +02:00
Gwendal Roué aa1cfb9020 Fix testSynchronizedFTS4Observation 2019-09-26 08:49:44 +02:00
Gwendal Roué 0d961ce48e Simplify DatabaseRegion.iisModified(by:)
There is no "fast path" any longer. Performance impact should be minimal since most observers call `stopObservingDatabaseChangesUntilNextTransaction` on first impactful change anyway.
2019-09-26 06:55:54 +02:00
Gwendal Roué 1b753802dd Address #620, but a failing test remains 2019-09-25 20:03:00 +02:00
Gwendal Roué 3f3bdde10c #620 explorations 2019-09-25 17:08:02 +02:00
Gwendal Roué b2ea9e51d2 Help debugging authorization issues like #620 2019-09-25 17:04:26 +02:00
Gwendal Roué 27a05028db SQLRequest+SQLLiteral: added literal initialization tests 2019-09-17 08:54:34 +02:00
Gwendal Roué 725e16390b Fix failing test for eraseDatabaseOnSchemaChange 2019-09-17 08:22:36 +02:00
Gwendal Roué 6b83ba3585 Failing test for eraseDatabaseOnSchemaChange 2019-09-17 08:18:45 +02:00
Gwendal Roué 62e50b1a73 Simplify eraseDatabaseOnSchemaChange implementation 2019-09-17 08:10:28 +02:00
Gwendal Roué bf7192cef1 Siimplify Row: Swift has better ARC optimizations now 2019-09-13 19:39:45 +02:00
Gwendal Roué 18d634b171 Update performance tests for Xcode 11 2019-09-13 19:11:21 +02:00
Gwendal Roué a5b5bccc61 Update TODO.md 2019-09-13 14:04:43 +02:00
Gwendal Roué 988852a438 Makefile/Travis: min tvOS 10.2 on Xcode 10.3 2019-09-13 04:59:51 +02:00
Gwendal Roué 2313713603 Makefile/Travis: min iOS 10.3.1 on Xcode 10.3 2019-09-13 04:56:32 +02:00
Gwendal Roué 6a5ce71c12 Makefile/Travis: Don't code sign 2019-09-12 07:09:27 +02:00
Gwendal Roué 9872e945ba Makefile/Travis: Xcode 11 use iPhone Xs + iOS 13.0 2019-09-11 19:48:50 +02:00
Gwendal Roué b3341cc552 Makefile/Travis: Xcode 11 min iOS is 10.3.1 2019-09-11 19:42:41 +02:00
Gwendal Roué 0a1e3afa82 Makefile/Travis: Xcode 11 2019-09-11 08:52:18 +02:00
Gwendal Roué 483728bfbf Fix typo 2019-09-09 08:43:29 +02:00
Gwendal Roué b459536b66 TODO 2019-09-07 15:55:07 +02:00
Gwendal Roué d990b47814 Fix compiler warnings 2019-09-07 12:51:46 +02:00
Gwendal Roué aa157a77d2 Merge branch 'development' 2019-09-06 08:07:49 +02:00
Gwendal Roué 254f3760b4 v4.4.0 2019-09-06 08:06:15 +02:00
Gwendal Roué 896ec284e1 Merge pull request #602 from groue/dev/passphrase-refactoring
Don't keep the sqlCipher passphrase in memory longer than necessary
2019-09-06 07:59:35 +02:00
Gwendal Roué 036178a55a CHANGELOG 2019-09-06 07:52:18 +02:00
Gwendal Roué 3ff94c7607 CHANGELOG 2019-09-06 07:44:15 +02:00
Gwendal Roué 5c125fae8b Add a "Managing the lifetime of the passphrase string" security consideration 2019-09-05 13:28:19 +02:00
Gwendal Roué 642089f41a Suggest using Data Protection 2019-09-04 19:16:14 +02:00
Gwendal Roué 6285a59926 Fix sample code 2019-09-04 19:09:32 +02:00
Gwendal Roué 4ba199f0aa Organization 2019-09-04 18:53:11 +02:00
Gwendal Roué 75f3540b8f Typo 2019-09-04 18:50:16 +02:00
Gwendal Roué bfa1689d7d Typo 2019-09-04 18:49:47 +02:00
Gwendal Roué a1c96f9093 Another suggestion by @michaelkirk-signal 2019-09-04 18:46:44 +02:00
Gwendal Roué 32842c22f0 Wording 2019-09-04 18:38:37 +02:00
Gwendal Roué 8e764aadd2 Fix typo 2019-09-04 18:36:53 +02:00
Gwendal Roué ad9b32f9a2 Fix ambiguous wording 2019-09-04 18:35:52 +02:00
Gwendal Roué cb9323480c Fix typo 2019-09-04 18:31:32 +02:00
Gwendal Roué cc7d19d925 Apply wording by @michaelkirk-signal 2019-09-04 18:24:25 +02:00
Gwendal Roué c2e68d95fe Passphrase documentation 2019-09-04 08:54:22 +02:00
Gwendal Roué 7b3275ce45 Make lastErrorCode and lastErrorMessage public 2019-09-04 08:54:06 +02:00
Gwendal Roué 9a69dbd8a1 Remove testDatabaseQueueWithPassphraseToDatabaseQueueWithWrongPassphraseAndRetry 2019-09-03 13:26:16 +02:00
Gwendal Roué f2198f5af7 Passphrase documentation (WIP) 2019-09-03 09:11:52 +02:00
Gwendal Roué 8150dda951 Passphrase documentation (WIP) 2019-09-03 09:10:02 +02:00
Gwendal Roué d4928eff99 Test that prepareDatabase errors are rethrown 2019-09-03 09:07:14 +02:00
Gwendal Roué 1f48405b5c Rewrite passphrase documentation (WIP) 2019-09-03 08:56:41 +02:00
Gwendal Roué 55d4a9c029 Test for attempting several passphrases 2019-09-03 08:56:16 +02:00
Gwendal Roué e6bc1c40fe CHANGELOG 2019-09-03 08:55:57 +02:00
Gwendal Roué b9e2f35728 Deprecate change(passphrase:), and provide an alternative solution 2019-09-02 09:05:37 +02:00
Gwendal Roué 6fc7794e64 Restore testDeprecatedPassphrase 2019-09-02 08:38:15 +02:00
Gwendal Roué 1d71b9f311 Update testPrepareDatabase for snapshots 2019-09-02 08:38:15 +02:00
Gwendal Roué 9f26777cc3 prepareDatabase did not need to be deprecated, after all 2019-09-02 08:38:15 +02:00
Gwendal Roué 0b9fe9ae92 Documentation 2019-09-02 08:38:15 +02:00
Gwendal Roué 1ba4e8c771 Fix failing test for change(passphrase:) 2019-09-02 08:38:15 +02:00
Gwendal Roué aded6d206d Failing test for change(passphrase:) 2019-09-02 08:38:15 +02:00
Gwendal Roué d644f01557 Deprecate Configuration.passphrase, introduce Database.usePassphrase(_:) 2019-09-02 08:38:15 +02:00
Gwendal Roué eb112c912c Fix Xcode 11 warnings in SQLCipher test projects 2019-09-02 08:37:28 +02:00
Gwendal Roué d8b0b95842 DatabaseConfiguration.onConnect 2019-09-02 08:37:28 +02:00
Gwendal Roué 8f66114042 Deprecate Configuration.prepareDatabase 2019-09-02 08:37:28 +02:00
Gwendal Roué 943eca10a6 TODO 2019-09-02 08:37:28 +02:00
Gwendal Roué 82f56ee596 Merge pull request #603 from groue/dev/pool-barrier
DatabasePool write barrier
2019-09-02 08:36:01 +02:00
Gwendal Roué 00e2c2a626 Fix testBarrierIsLockedByOneUnfinishedRead for Swift 4.2 2019-09-02 05:39:38 +02:00
Gwendal Roué c7e4492846 Fix DatabasePool.change(passphrase:) 2019-09-01 19:33:03 +02:00
Gwendal Roué 04a6e969a5 DatabasePool.barrierWriteWithoutTransaction documentation 2019-09-01 17:30:01 +02:00
Gwendal Roué 5b4a225dc3 DatabasePool.barrierWriteWithoutTransaction tests 2019-09-01 17:19:12 +02:00
Gwendal Roué e3efcc0d87 CHANGELOG 2019-09-01 17:03:22 +02:00
Gwendal Roué 8580023eda DatabasePool.barrierWriteWithoutTransaction 2019-09-01 16:46:17 +02:00
Gwendal Roué 473f6ff0d8 Tests for Pool.barrier 2019-09-01 16:32:39 +02:00
Gwendal Roué e495df0114 Pool.barrier 2019-09-01 16:32:18 +02:00
Gwendal Roué 06d6c3866b ReadWriteBox Cleanup 2019-09-01 16:28:16 +02:00
Gwendal Roué da459386a0 Merge branch 'development' 2019-08-28 08:25:35 +02:00
Gwendal Roué 1023f260b7 v4.3.0 2019-08-28 08:22:38 +02:00
Gwendal Roué a6fa76a954 More TODO 2019-08-28 08:07:19 +02:00
Gwendal Roué 3e48eb703e CHANGELOG 2019-08-24 10:57:24 +02:00
Gwendal Roué 7cf10bfb67 Merge pull request #600 from outfoxx/tvos-support
Add support for tvOS
2019-08-24 10:49:20 +02:00
Kevin Wooten 055e33b381 Add missing tvOS stages to Xcode 10.1 2019-08-23 10:54:58 -07:00
Kevin Wooten 7fffc2791e Bump min tvOS to 10.0
tvOS 9.0 appears to have issues with running tests
2019-08-23 10:54:27 -07:00
Kevin Wooten 4d3f0bd88b Add support for tvOS
## Xcode Project
- [x] tvOS Target
- [x] tvOS Unit Test Target
- [x] tvOS Scheme

## Makefile
- [x] tvOS Target Min/Max
- [x] tvOS Actions (copies iOS)

## CI
- [x] tvOS Travis stages

## Packaging
- [x] CocoaPods - Podfile Updated
- [x] ~SwiftPM - Not Changes Required~

## Documentation
- [x] Readme Updated
2019-08-22 13:15:31 -07:00
Gwendal Roué 881d4c6bfc TODO 2019-08-22 05:34:43 +02:00
Gwendal Roué ba02713d78 TODO 2019-08-14 07:55:49 +02:00
Gwendal Roué 6f6e382948 Merge branch 'development' 2019-08-13 07:58:27 +02:00
Gwendal Roué b7c7892a74 v4.2.1 2019-08-13 07:56:28 +02:00
Gwendal Roué a6112a5ca2 Merge pull request #592 from groue/dev/issue-591
Fix Data interpolation
2019-08-12 12:34:24 +02:00
Gwendal Roué d219f5589e CHANGELOG 2019-08-11 13:14:44 +02:00
Gwendal Roué 01a1a7c962 Fix typo 2019-08-11 13:04:24 +02:00
Gwendal Roué 8e38af9aae Fix #591 2019-08-11 13:03:43 +02:00
Gwendal Roué d28847bf3d Failing test for https://github.com/groue/GRDB.swift/issues/591 2019-08-11 12:56:29 +02:00
Gwendal Roué 24c25dfd04 Explicit tests for DatabaseValueConvertible interpolation 2019-08-11 12:25:48 +02:00
Gwendal Roué 18e09cda11 TODO 2019-08-11 12:04:03 +02:00
Gwendal Roué fb54c2ae45 Merge branch 'development' 2019-08-06 12:10:28 +02:00
Gwendal Roué a08e8f0ef6 Merge pull request #587 from groue/GRDB-4.2
GRDB 4.2.0
2019-08-06 12:09:28 +02:00
Gwendal Roué bd81f6e7a6 v4.2.0 2019-08-06 06:58:13 +02:00
Gwendal Roué eea8f7b1e9 Use ValueObservation.tracking(value:) in demo app 2019-08-06 06:54:39 +02:00
Gwendal Roué c734eba245 Upgrade performance tests
Upgrade Realm to v3.17.3
Upgrade FMDB to v2.7.4
Upgrade SQLite.swift to v0.12.2
2019-08-05 20:56:49 +02:00
Gwendal Roué 71bf6fdbcf TODO 2019-08-05 20:30:29 +02:00
Gwendal Roué 226410caf8 TODO cleanup 2019-08-05 20:19:48 +02:00
Gwendal Roué 82d80d4120 Merge pull request #586 from groue/dev/value-observation-variable-region
Automatic region tracking for ValueObservation
2019-08-05 19:47:59 +02:00
Gwendal Roué 80baa798d6 CHANGELOG 2019-08-05 12:39:37 +02:00
Gwendal Roué ba1142ac58 Fix typo 2019-08-05 12:34:23 +02:00
Gwendal Roué e279d287b9 Even more fostering of ValueObservation.tracking(fetch:) in README 2019-08-05 12:32:12 +02:00
Gwendal Roué 87b474029e Test that observations of tuples are easy to consume. 2019-08-05 12:31:39 +02:00
Gwendal Roué 8af3b58e54 Fix documentation 2019-08-05 09:04:14 +02:00
Gwendal Roué a770d46843 Rename ValueObservation.tracking(fetch:) to ValueObservation.tracking(value:) 2019-08-05 09:03:05 +02:00
Gwendal Roué efaa387ee2 Remove useless documentation paragraph 2019-08-05 08:38:25 +02:00
Gwendal Roué f849c38f43 Foster ValueObservation.tracking(fetch:) in README 2019-08-05 08:34:47 +02:00
Gwendal Roué ea43468a6f Documentation 2019-08-05 07:52:32 +02:00
Gwendal Roué fd18a7b75d Fix for Xcode < 10.2 2019-08-05 07:48:34 +02:00
Gwendal Roué fe9c4381e0 Makefile: support for Xcode 10.3, and fix test_performance target 2019-08-04 14:59:48 +02:00
Gwendal Roué 0f2c5cd8a0 Fix failling test for rowid optimization in Database.recordingSelectedRegion 2019-08-04 14:37:40 +02:00
Gwendal Roué 9c864bc768 Failling test for rowid optimization in Database.recordingSelectedRegion 2019-08-04 14:37:10 +02:00
Gwendal Roué dc146a431c Tests for Database.recordingSelectedRegion 2019-08-04 14:36:20 +02:00
Gwendal Roué c718889418 Update ValueObservation documentation 2019-08-04 11:45:43 +02:00
Gwendal Roué d61522ee5f Update ValueObservation documentation 2019-08-04 11:42:54 +02:00
Gwendal Roué c4481f4e79 Fix ValueObservationRegionRecordingTests for SQLite < 3.19.0 2019-08-04 10:44:08 +02:00
Gwendal Roué 731a83908d Test automatic ValueObservation region tracking with various schedulings 2019-08-03 18:03:05 +02:00
Gwendal Roué 62a12d94ce CHANGELOG 2019-08-03 17:41:39 +02:00
Gwendal Roué 4f025e59af Documentation 2019-08-03 17:21:42 +02:00
Gwendal Roué 2039cd4874 Documentation 2019-08-03 17:18:47 +02:00
Gwendal Roué 1b94c38b4f Documentation 2019-08-03 17:16:03 +02:00
Gwendal Roué f556fc39ab Documentation 2019-08-03 17:01:16 +02:00
Gwendal Roué a5c8f23ba4 Support for variable observed region of ValueObservation based on actual selection 2019-08-03 16:32:33 +02:00
Gwendal Roué af0ac156aa More explicit observation initializers 2019-08-03 14:21:46 +02:00
Gwendal Roué 8d5cddd293 Merge pull request #585 from groue/dev/issue-583
Fix use of SQLite authorizers
2019-08-03 13:37:50 +02:00
Gwendal Roué 38599b007f CHANGELOG 2019-08-03 07:15:55 +02:00
Gwendal Roué 5908c26a79 Fix Makefile so that it can checkoutt the FMDB submodule 2019-08-03 06:48:08 +02:00
Gwendal Roué d32b5271bd Performance tests: update paths for Xcode 10.3 2019-08-03 06:43:31 +02:00
Gwendal Roué 55803b29b0 Keep a memory of how to trigger #583 error 2019-08-02 17:56:47 +02:00
Gwendal Roué 870d22fd95 Explain why we call sqlite3_set_authorizer once per database connection 2019-08-02 16:06:19 +02:00
Gwendal Roué c6cb92d757 Cleanup 2019-08-02 15:40:19 +02:00
Gwendal Roué 3ab8a34d58 Fix a Swiftlint warning 2019-08-02 15:34:49 +02:00
Gwendal Roué bd9104d29f Cleanup 2019-08-02 15:34:25 +02:00
Gwendal Roué e351b79526 Database only exposes its current authorizer with the withAuthorizer(_:_:) wrapper method. 2019-08-02 15:16:48 +02:00
Gwendal Roué a59f4ef096 Fix #583 by keeping a single authorizer active for the whole lifetime of a database connection
SQLite invalidates statements when authorizer changes, which can lead to undesired behaviors. This is why we now call sqlite3_set_authorizer only once. See http://sqlite.1065341.n5.nabble.com/Issue-report-sqlite3-set-authorizer-triggers-error-4-516-SQLITE-ABORT-ROLLBACK-during-statement-itern-td107972.html
2019-08-02 14:17:48 +02:00
Gwendal Roué bb959fa5c3 Add failing test for #583 2019-08-02 14:14:48 +02:00
Gwendal Roué 2b3e5a06db CONTRIBUTING: mention GRDBCombine 2019-07-31 08:07:52 +02:00
Gwendal Roué e58b652970 CONTRIBUTING: static libray is possible since #570 2019-07-31 08:04:38 +02:00
Gwendal Roué 62f5bd1940 CONTRIBUTING: fix inner link 2019-07-31 08:03:04 +02:00
Gwendal Roué 63cb9f2ad2 CONTRIBUTING: mention #575 2019-07-31 08:01:39 +02:00
Gwendal Roué 19cf569036 Add @chrisballinger to the thank you notice 2019-07-31 07:43:16 +02:00
Gwendal Roué e23cb4ed76 Merge pull request #570 from Rightpoint/fix-issue-360-modulemap
Allow Swift static library integration via CocoaPods
2019-07-31 06:59:05 +02:00
Chris Ballinger bdf802ab34 Update CHANGELOG and README 2019-07-30 16:34:19 -07:00
Gwendal Roué 507ae0dfdc Tests for framework & static CocoaPods integration 2019-07-30 16:33:20 -07:00
Chris Ballinger 56af3ceff6 Remove modulemap from podspec 2019-07-30 16:33:20 -07:00
Gwendal Roué 4ffb59719a Fix #580 2019-07-30 06:57:03 +02:00
Gwendal Roué bb0c11f7d5 TODO 2019-07-29 09:11:47 +02:00
Gwendal Roué 82c8958c44 Merge pull request #576 from groue/dev/fullltext
Expose table name and full-text filtering methods to DerivableRequest
2019-07-28 14:00:59 +02:00
Gwendal Roué e8ad3871f7 Fix for Xcode 10.0, 10.1 2019-07-28 08:59:23 +02:00
Gwendal Roué 53aaca480e Merge branch 'development' into dev/fullltext
# Conflicts:
#	CHANGELOG.md
2019-07-27 23:11:00 +02:00
Gwendal Roué 23678ab9da Update documentatiion for #577 2019-07-27 23:06:36 +02:00
Gwendal Roué 2996a24de9 Merge pull request #577 from groue/dev/renameAliased
Rename aliased(_:) methods to forKey(_:)
2019-07-27 22:59:09 +02:00
Gwendal Roué dba8d636bb Less TODO 2019-07-27 17:10:31 +02:00
Gwendal Roué faa7bf7e53 Less TODO 2019-07-27 17:10:01 +02:00
Gwendal Roué 05fdf5cfdd CHANGELOG 2019-07-27 17:08:53 +02:00
Gwendal Roué b4ef6a3dad CHANGELOG 2019-07-27 17:08:11 +02:00
Gwendal Roué 0c709294a0 Fix documentation 2019-07-27 16:45:06 +02:00
Gwendal Roué d15bb190eb Enable Code Coverage in GRDBCustomSQLiteOSX target 2019-07-27 16:36:53 +02:00
Gwendal Roué ede4572da3 Update tests for the new forKey(_:) methods 2019-07-27 16:34:17 +02:00
Gwendal Roué b4929bb638 Rename aliased(_:) to forKey(_:) 2019-07-27 16:29:09 +02:00
Gwendal Roué 52cd98547d Fix DerivableRequest.matching(_:) tests so that OSX 10.0 is not required 2019-07-27 15:58:33 +02:00
Gwendal Roué 5cced46a61 API diff 2019-07-27 15:23:29 +02:00
Gwendal Roué 3f8e994501 API diff 2019-07-27 15:23:29 +02:00
Gwendal Roué ae60bc6e18 CHANGELOG 2019-07-27 15:23:29 +02:00
Gwendal Roué 462e5eee24 Cleanup 2019-07-27 15:23:29 +02:00
Gwendal Roué c1a0b7f9e2 Add missing Foundation imports (https://github.com/openbitapp/GRDB.swift/commit/9669e3007f42359e4165759208c5df8455531b12) 2019-07-27 15:23:29 +02:00
Gwendal Roué 89001f11c3 Spot that annotations are another challenge on the way to optional + required join chaining 2019-07-27 15:23:29 +02:00
Gwendal Roué 026db8f19a Tests for TableRequest requirement on DerivableRequest, including the new support for full-text search 2019-07-27 15:23:29 +02:00
Gwendal Roué 2d1f218ec5 Force TableRecord on Association origin & destination, append TableRequest to DerivableRequest requirements 2019-07-27 15:23:29 +02:00
Gwendal Roué 4d558488c0 Expose matching(_:) on TableRequest&FilteredRequest 2019-07-27 15:23:29 +02:00
Gwendal Roué bf73f0ded2 CHANGELOG 2019-07-27 15:22:13 +02:00
Gwendal Roué b8cc4c30f9 TODO 2019-07-27 12:47:39 +02:00
Gwendal Roué cf2a6763b5 Merge pull request #574 from groue/dev/swiftlint
SwiftLint
2019-07-27 12:46:53 +02:00
Gwendal Roué e65e2a3bd1 CHANGELOG 2019-07-26 21:18:51 +02:00
Gwendal Roué 56d355c903 The kiss of Xcode 10.3 2019-07-26 21:09:19 +02:00
Gwendal Roué 35ceeebb3d Style tweaks 2019-07-26 20:56:33 +02:00
Gwendal Roué d9e1a04cc2 Fix FTS3 & FTS4 regressions 2019-07-26 19:52:34 +02:00
Gwendal Roué d7a51c39ca Remove Swiift 5 conversion warning 2019-07-26 19:30:59 +02:00
Gwendal Roué 756f1b9387 swiftlint: remove large_tuple, add unused_declaration 2019-07-26 19:30:52 +02:00
Gwendal Roué df6bb8761c Swiftlint + whitespace 2019-07-01 08:57:53 +02:00
Gwendal Roué b3215cc471 Less TODO 2019-06-30 13:43:12 +02:00
Gwendal Roué 7defc8ea07 Merge pull request #563 from groue/dev/eager-loading-from-optional-to-one
More tests for eager loading of hasMany associations
2019-06-30 10:24:33 +02:00
Gwendal Roué 2b401fe745 We don't really care about useless LEFT JOINs 2019-06-29 15:32:13 +02:00
Gwendal Roué 3e4c6fd102 Add more eager loading SQL tests (and spot a possible optimization) 2019-06-29 15:21:24 +02:00
Gwendal Roué 9946880c5e Add tests for including(optional: hasOne.including(all: hasMany)) 2019-06-29 14:12:46 +02:00
Gwendal Roué 738ea4ed10 Merge pull request #562 from groue/dev/fix-561
Fix crash when using more than one DatabaseCollation
2019-06-29 10:31:53 +02:00
Gwendal Roué 498c65a64c CHANGELOG 2019-06-28 19:06:49 +02:00
Gwendal Roué fbc50dd2d1 CHANGELOG 2019-06-28 19:06:11 +02:00
Gwendal Roué 7802eb356d Fix failing test for #561 2019-06-28 19:02:21 +02:00
Gwendal Roué 036e236dc0 Failing test for #561 2019-06-28 19:01:58 +02:00
Gwendal Roué ff2f8bd88e More TODO 2019-06-28 17:18:00 +02:00
Gwendal Roué 1d47fb16be TODO: predicates 2019-06-26 09:34:50 +02:00
Gwendal Roué 5345ccd53e Merge pull request #560 from bellebethcooper/patch-1
Minor typo fix
2019-06-26 09:31:29 +02:00
bellebethcooper e1ee2afba1 Minor typo fix 2019-06-26 17:24:26 +10:00
Gwendal Roué d290102d9c v4.1.1 2019-06-22 09:14:48 +02:00
Gwendal Roué de3f32b6ad Merge pull request #552 from groue/GRDB-4.1
GRDB 4.1
2019-06-20 08:13:03 +02:00
Gwendal Roué cb517dc5c9 Update release date 2019-06-20 08:08:32 +02:00
Gwendal Roué 49d098eb7b Merge pull request #555 from groue/dev/readOnlyError
Avoid a crash when read-only access can't be established
2019-06-19 08:04:00 +02:00
Gwendal Roué caa624f56b Readonly: avoid hitting the db if unnecessary 2019-06-19 04:16:07 +02:00
Gwendal Roué c190b1355e CHANGELOG 2019-06-18 20:45:23 +02:00
Gwendal Roué 335850c5fe Fix #554 2019-06-18 20:40:49 +02:00
Gwendal Roué 2730f8f806 Fix DatabasePool.concurrentRead for Swift < 5 2019-06-18 08:37:21 +02:00
Gwendal Roué dc2871d5eb DatabaseWriter.spawnConcurrentRead (experimental method) 2019-06-18 08:21:55 +02:00
Gwendal Roué cdccac8c86 Documentation 2019-06-17 19:52:55 +02:00
Gwendal Roué 173c8af3ef asyncConcurrentRead documentation 2019-06-17 19:48:25 +02:00
Gwendal Roué 3cea3db2b4 DatabasePool.asyncConcurrentRead 2019-06-17 19:35:11 +02:00
Gwendal Roué 7526276f98 Documentation 2019-06-16 14:54:42 +02:00
Gwendal Roué b9925d1620 Avoid iPhone XS/iPhone Xs ambiguity 2019-06-15 14:16:52 +02:00
Gwendal Roué 68d4889864 Ignore various Podfile.lock 2019-06-15 14:14:45 +02:00
Gwendal Roué c5cb8f44f3 Fix Xcode warnings and update GRDBDemoiOS to latest APIs 2019-06-15 13:29:24 +02:00
Gwendal Roué 309fa97606 Prepare 4.1.0: README.md 2019-06-15 12:44:52 +02:00
Gwendal Roué a2ba53ab26 Prepare 4.1.0: Info.plist 2019-06-15 12:37:18 +02:00
Gwendal Roué 3a98f337bd Prepare 4.1.0: GRDB.swift.podspec 2019-06-15 12:36:40 +02:00
Gwendal Roué 8663a1bf3f Prepare 4.1.0: CustomSQLiteBuilds.md 2019-06-15 12:35:39 +02:00
Gwendal Roué fc13454f29 Prepare 4.1.0: Makefile 2019-06-15 12:34:53 +02:00
Gwendal Roué 8cadb97b2f Prepare 4.1.0: CHANGELOG 2019-06-15 12:33:13 +02:00
Gwendal Roué 278e4190db Enhance SQLite error 10/23 FAQ with sample code 2019-06-15 04:55:53 +02:00
Gwendal Roué d3fe40127c Forget SR-1570 2019-06-15 04:44:16 +02:00
Gwendal Roué 3f9b94f95e Group SQLite error FAQs together 2019-06-15 04:39:07 +02:00
Gwendal Roué 02e1793cc9 Move configuration requirement to DatabaseReader 2019-06-15 04:32:14 +02:00
Gwendal Roué e40e37bd04 FetchRequest.makePreparedRequest 2019-06-15 04:24:29 +02:00
Gwendal Roué 65de31a335 Polishing 2019-06-14 22:01:57 +02:00
Gwendal Roué 66552ebc77 Merge pull request #550 from groue/dev/async
Asynchronous Database Access Methods
2019-06-14 18:58:06 +02:00
Gwendal Roué 4a79a20116 Foster asyncWrite over asyncWriteWithoutTransaction 2019-06-14 08:10:16 +02:00
Gwendal Roué f03fd276f1 asyncWrite's completion handler accepts a database connection
This guarantees that the asyncWrite method provides exclusive write access for the whole duration of (transaction + result handling).
2019-06-14 08:03:13 +02:00
Gwendal Roué 0e031cd5a9 CHANGELOG 2019-06-13 22:40:51 +02:00
Gwendal Roué cd3c84d19e Stop fostering ValueObservation.start(in:onChange:) without error handling 2019-06-13 22:37:21 +02:00
Gwendal Roué 29cfebdec0 GRDBCombine is a companion library 2019-06-13 20:26:44 +02:00
Gwendal Roué d0e839c2b4 Note about availability of asynchronous APIs 2019-06-13 20:13:19 +02:00
Gwendal Roué d18c65fbe5 Documentation for asynchronous APIs 2019-06-13 20:06:58 +02:00
Gwendal Roué 07ade5ee75 Merge branch 'development' into dev/async 2019-06-13 19:20:57 +02:00
Gwendal Roué 3897e9824c CHANGELOG 2019-06-13 19:20:46 +02:00
Gwendal Roué 0c2875a310 TODO 2019-06-13 14:39:50 +02:00
Gwendal Roué f7946834f1 Fix compiler checks for async methods 2019-06-13 14:14:35 +02:00
Gwendal Roué 0ad819902d Tests for asyncRead, asyncWrite, asyncWriteWithoutTransaction 2019-06-13 13:42:31 +02:00
Gwendal Roué b715ca5eb8 DatabaseWriter.asyncWrite 2019-06-13 13:20:59 +02:00
Gwendal Roué bc7c3e5eb1 DatabaseReader.asyncRead 2019-06-13 08:45:49 +02:00
Gwendal Roué 9650783ea4 Update code snippets for ValueObservation.start 2019-06-13 06:13:26 +02:00
Gwendal Roué 4b0e43f884 TODO 2019-06-13 05:29:05 +02:00
Gwendal Roué f120632e36 Rename unsafeAsyncWrite to asyncWriteWithoutTransaction
Hold on: a more complete set of async APIs will come eventually.
2019-06-13 05:25:56 +02:00
Gwendal Roué d42b515fb6 Documentation 2019-06-13 04:56:05 +02:00
Gwendal Roué 47b813057a Merge pull request #549 from groue/dev/CombineSupport
Support for Combine
2019-06-13 04:28:09 +02:00
Gwendal Roué 1db76a9d85 Merge pull request #540 from groue/dev/SQLite-3.28.0
Update SQLite to 3.28.0
2019-06-13 04:24:29 +02:00
Gwendal Roué a59546203f CHANGELOG 2019-06-12 19:54:39 +02:00
Gwendal Roué 085f4c9597 removeDuplicates 2019-06-12 19:48:32 +02:00
Gwendal Roué bec731d763 Rename file 2019-06-12 19:40:07 +02:00
Gwendal Roué b0be32be71 Merge branch 'development' into dev/SQLite-3.28.0 2019-06-12 19:09:40 +02:00
Gwendal Roué d774d353e7 Upgrade swiftlyfalling/SQLiteLib 2019-06-12 19:09:19 +02:00
Gwendal Roué 44138c433f Refactor ValueObservation scheduling 2019-06-11 21:45:27 +02:00
Gwendal Roué f502db40b0 combine instance method 2019-06-10 23:24:02 +02:00
Gwendal Roué 86f7ab74a7 More ValueReducers namespacing 2019-06-10 22:18:20 +02:00
Gwendal Roué cea22f261e observationForCount, observationForAll, observationForFirst documentation 2019-06-10 20:19:08 +02:00
Gwendal Roué da34694663 observationForCount, observationForAll, observationForFirst 2019-06-10 20:19:00 +02:00
Gwendal Roué 085fd13ef6 CHANGELOG 2019-06-09 12:05:05 +02:00
Gwendal Roué 50c9792eb2 Merge pull request #546 from openbitapp/master
fix errors for Xcode 11 beta
2019-06-09 11:57:59 +02:00
Gwendal Roué 795056a3b6 Restore swift-tools-version:4.2 2019-06-09 11:47:08 +02:00
Gwendal Roué aca4db2c96 Move reducers to the ValueReducers namespace 2019-06-09 11:43:44 +02:00
Gwendal Roué cdec1a4318 Remove ImmediateValueReducer 2019-06-09 11:43:21 +02:00
Gwendal Roué 3971058dd8 Hide request from DatabaseValue reducers 2019-06-08 17:28:01 +02:00
Roberto Casula b6f988194c fix errors for Xcode 11 beta 2019-06-08 15:46:48 +02:00
Gwendal Roué ad24bd8021 RawValueReducer is an ImmediateValueReducer 2019-06-08 14:07:29 +02:00
Gwendal Roué 096096684e SPM requires Swift 5: don't test Xcode 10.1 and 10 2019-06-07 07:35:00 +02:00
Gwendal Roué 038a8d2d88 SPM requires Swift 5 2019-06-06 21:06:43 +02:00
Gwendal Roué 5abd21fa4a swift-tools-version:5.0 2019-06-06 21:01:52 +02:00
Gwendal Roué a80d6731a8 swift-tools-version:5.0 2019-06-06 20:57:08 +02:00
Gwendal Roué e7ed67d41d Introduce ImmediateValueReducer 2019-06-06 20:05:25 +02:00
Gwendal Roué da042eaae9 Clean up ValueObservation fetching system 2019-06-06 19:56:41 +02:00
Gwendal Roué 416d2cae1e Make sure ValueObservation.combine results can be splatted 2019-06-06 19:08:22 +02:00
Gwendal Roué ac85ffff84 Database.readOnly is reentrant 2019-06-06 18:58:44 +02:00
Gwendal Roué e3d2559b9d Add tests for combining up to 8 ValueObservation 2019-06-05 08:58:42 +02:00
Gwendal Roué c1a926e6dc Combine up to 8 ValueObservation 2019-06-05 08:39:38 +02:00
Gwendal Roué b31f46cbc0 Cleanup 2019-06-05 08:31:20 +02:00
Gwendal Roué 6b236ceb5c Import ValueObservation combine reducers from #541 2019-06-05 08:14:36 +02:00
Gwendal Roué 30812792df Merge branch 'development' into dev/SQLite-3.28.0
# Conflicts:
#	CHANGELOG.md
2019-06-04 18:46:07 +02:00
Gwendal Roué c1cbe51747 Merge pull request #542 from groue/dev/FetchRequest-cleanup
Move eager loading of hasMany associations to FetchRequest
2019-06-04 18:41:27 +02:00
Gwendal Roué 1416c6e179 CHANGELOG 2019-06-01 17:20:20 +02:00
Gwendal Roué 91ff9ce0b8 Documentation 2019-06-01 17:16:04 +02:00
Gwendal Roué 5099305257 Documentation 2019-06-01 17:11:09 +02:00
Gwendal Roué 92c13c3ea8 Documentation 2019-06-01 17:01:42 +02:00
Gwendal Roué 872f394339 Move eager loading of hasMany associations to FetchRequest 2019-06-01 16:08:05 +02:00
Gwendal Roué deaf60263d TODO 2019-05-31 08:44:54 +02:00
Gwendal Roué 7e53901544 New example of record definition 2019-05-31 08:19:25 +02:00
Gwendal Roué ce95590b8a New example of record definition 2019-05-31 07:59:33 +02:00
Gwendal Roué c42cf38fc2 TODO 2019-05-30 20:32:18 +02:00
Gwendal Roué dc4a66fe2c Changelog 2019-05-30 14:10:47 +02:00
Gwendal Roué c9ab5eb551 Update SQLite version in documentation 2019-05-30 14:10:40 +02:00
Gwendal Roué 4e33b06f0b Wait for https://github.com/swiftlyfalling/SQLiteLib/pull/41 to be merged 2019-05-30 14:03:30 +02:00
Gwendal Roué ff45864454 Merge pull request #539 from groue/dev/JoinableRequest
Expose joining methods of both requests and associations
2019-05-30 08:50:05 +02:00
Gwendal Roué fb3c722724 Merge branch 'development' into dev/JoinableRequest
# Conflicts:
#	CHANGELOG.md
2019-05-29 20:04:54 +02:00
Gwendal Roué 6c93e1509d Merge pull request #538 from Timac/#530
Add FAQ to clarify "Wrong number of statement arguments" error with "like '%?%'"
2019-05-29 19:59:27 +02:00
Gwendal Roué 0680e5abd7 Thank you notice 2019-05-29 19:55:32 +02:00
Gwendal Roué aefaa86302 CHANGELOG 2019-05-29 19:54:40 +02:00
Gwendal Roué ed509c5349 Merge branch 'development' into #530 2019-05-29 19:50:40 +02:00
Gwendal Roué 0232c8e792 Slight rewriting: focus on what's wrong, and provide a single fix because choices are complicated 2019-05-29 19:48:33 +02:00
Gwendal Roué cba1113a03 Wording 2019-05-29 19:27:04 +02:00
Gwendal Roué 1b4c3808d1 CHANGELOG 2019-05-29 19:23:09 +02:00
Gwendal Roué ac583e8fdf Fix link 2019-05-29 19:18:23 +02:00
Gwendal Roué fff7d1c49e Rewrite the request chapter 2019-05-29 19:17:09 +02:00
Gwendal Roué 0fe96619bf Layout 2019-05-29 14:13:04 +02:00
Gwendal Roué 0440736f3b The case of singletons 2019-05-29 14:08:48 +02:00
Gwendal Roué 35e1aeb7a8 The case of singletons 2019-05-29 14:07:03 +02:00
Gwendal Roué 8fe3b18121 Remove ambiguity 2019-05-29 14:00:22 +02:00
Gwendal Roué 26259ef0f9 didInsert(with:for:) is not always well understood 2019-05-29 13:58:56 +02:00
Gwendal Roué fb9244e5bb Foster DerivableRequest in GoodPracticesForDesigningRecordTypes.md 2019-05-29 13:48:06 +02:00
Gwendal Roué 03d9727f61 Add tests for joining methods added on DerivableRequest 2019-05-29 09:00:28 +02:00
Gwendal Roué e7a590b82b Extract joining methods to the JoinableRequest protocol 2019-05-29 08:36:55 +02:00
Gwendal Roué 1b5e94a050 Merge branch 'master' into development 2019-05-29 08:14:44 +02:00
Alexandre Colucci 3669fadecb Provide one example that lets Swift build the pattern and an example with the query interface. Then provide the second approach using the || operator. 2019-05-28 22:53:33 +02:00
Alexandre Colucci 7ed4b799b7 Use an SQLite query with the correct GRDB style 2019-05-28 22:51:29 +02:00
Alexandre Colucci bba9d42433 Remove the line "[? as a parameter]" in the "Good to Know" section 2019-05-28 22:41:28 +02:00
Gwendal Roué 6a5d3fe85b Update the List of Record Methods 2019-05-28 20:15:09 +02:00
Gwendal Roué 957d7b4c86 Update the List of Record Methods 2019-05-28 20:11:51 +02:00
Gwendal Roué 2dd5058878 Update the List of Record Methods 2019-05-28 19:46:21 +02:00
Gwendal Roué a02bbc5748 Update the List of Record Methods 2019-05-28 19:43:15 +02:00
Gwendal Roué bef13a7d0e Update the List of Record Methods 2019-05-28 19:41:51 +02:00
Gwendal Roué b0e140d4bb Add two safety tests for parenthesis 2019-05-28 08:03:33 +02:00
Alexandre Colucci ca9ecd7f66 #530: Wrong number of statement arguments with "like '%?%'"
- Rewrite the paragraph as an FAQ
- Explicitly mention the error "Wrong number of statement arguments" and give an example causing such issue.
- Improve the wording and add a link to the SQLite documentation
2019-05-27 21:22:55 +02:00
Gwendal Roué 4729405625 Merge branch 'master' into development 2019-05-27 18:24:03 +02:00
Gwendal Roué 7d92c665f0 Update link to migration guide 2019-05-27 18:23:37 +02:00
Gwendal Roué 4f4a5d92c7 Merge pull request #537 from groue/dev/remove-parenthesis
Remove useless parenthesis from generated SQL
2019-05-27 12:29:15 +02:00
Gwendal Roué 5bb54f0049 Less parenthesis in SQL interpolation 2019-05-27 07:59:11 +02:00
Gwendal Roué 543dfe9e69 CHANGELOG 2019-05-26 22:03:08 +02:00
Gwendal Roué 8b8722f376 Document that generated SQL can change without notice 2019-05-26 21:57:19 +02:00
Gwendal Roué 1d75863c9a Also turn SQLAssociationCondition SQL expression into an array 2019-05-26 21:46:19 +02:00
Gwendal Roué 6fa452b68c Fix joined(operator:) 2019-05-26 20:46:11 +02:00
Gwendal Roué ab000d7a4f Remove useless expression parenthesis from SQL 2019-05-26 20:08:13 +02:00
Gwendal Roué 680f3ad20c Nicer WHERE, HAVING and ON output 2019-05-26 15:32:00 +02:00
Gwendal Roué b6b1f9b3e8 Remove useless comment 2019-05-26 07:33:38 +02:00
Gwendal Roué 05a547f2df Fix typo 2019-05-26 07:21:36 +02:00
Gwendal Roué 1602a37d08 Small improvement 2019-05-26 06:22:28 +02:00
Gwendal Roué 49a7b2091c v4.0.1 2019-05-25 23:16:00 +02:00
Gwendal Roué bf94fc168e Merge pull request #534 from groue/dev/cocoapods-1.7.0
Support for CocoaPods 1.7.0
2019-05-25 23:09:08 +02:00
Gwendal Roué d2aea2e3a7 Wording 2019-05-25 20:20:03 +02:00
Gwendal Roué 0159d75b38 Wording 2019-05-25 20:10:43 +02:00
Gwendal Roué c8755a91e8 Wording 2019-05-25 20:01:25 +02:00
Gwendal Roué b0e4f286cb Wording 2019-05-25 19:59:58 +02:00
Gwendal Roué f641e2fc39 A wild comparison 2019-05-25 19:39:13 +02:00
Gwendal Roué 1402100d26 Link Good Practices for Designing Record Types from Why Adopt GRDB? 2019-05-25 19:03:31 +02:00
Gwendal Roué eda36829d0 CHANGELOG 2019-05-25 18:56:36 +02:00
Gwendal Roué 48017b2de2 Update tests for GRDB/SQLCipher 2019-05-25 18:55:09 +02:00
Gwendal Roué 862886fa0a Use CocoaPods 1.7.0 on Travis 2019-05-25 18:55:09 +02:00
Gwendal Roué 68221af5c3 Podspec swift_versions = ['4.2', '5'] 2019-05-25 18:55:09 +02:00
Gwendal Roué b3e547a347 Merge pull request #535 from groue/dev/record-good-practices
Update the Good Practices for Designing Record Types
2019-05-25 18:53:39 +02:00
Gwendal Roué 498c153be1 CHANGELOG 2019-05-25 18:50:28 +02:00
Gwendal Roué 7ed8168f11 Wording 2019-05-25 18:32:23 +02:00
Gwendal Roué 547fc98358 Wording 2019-05-25 18:28:28 +02:00
Gwendal Roué 6397d5757e Wording 2019-05-25 18:26:07 +02:00
Gwendal Roué 6d71f8b17c Relationship between view controllers and database managers 2019-05-25 18:18:53 +02:00
Gwendal Roué cafb329d6e Link to conventions 2019-05-25 17:44:42 +02:00
Gwendal Roué 071fdd3711 Improve Good Practices for Designing Record Types 2019-05-25 17:15:34 +02:00
Gwendal Roué 0cca73cdfc CHANGELOG 2019-05-25 08:41:23 +02:00
Gwendal Roué 31e59f3968 Merge pull request #533 from groue/dev/fix-has-many-through
Fix eager loading of HasManyThrough associations
2019-05-25 08:37:07 +02:00
Gwendal Roué d6e0dcafcb Fix two README typos 2019-05-25 08:35:56 +02:00
Gwendal Roué 203130da31 Test that merging of HasManyThrough happens on the pivot key 2019-05-24 19:02:15 +02:00
Gwendal Roué af4a83115b Ttest for parallel inclusion of hasManyThrough(_, through: hasOne, via: hasMany) 2019-05-24 18:56:54 +02:00
Gwendal Roué 0ad7d5e894 Fix failing test for parallel inclusion of hasManyThrough(_, through: belongsTo, via: hasMany) 2019-05-24 13:18:00 +02:00
Gwendal Roué 6e7a923d6e Failing test for parallel inclusion of hasManyThrough(_, through: belongsTo, via: hasMany) 2019-05-24 13:17:47 +02:00
Gwendal Roué d7d3f87921 Merge pull request #479 from groue/GRDB-4.0
GRDB 4.0
2019-05-23 19:39:32 +02:00
Gwendal Roué 3e7df8c774 Update badge name 2019-05-23 19:34:38 +02:00
Gwendal Roué db4598d881 performance tests update 2019-05-23 19:26:30 +02:00
Gwendal Roué 60312f63d7 v4.0.0 2019-05-23 18:56:22 +02:00
Gwendal Roué f54297d488 Make it possible to build GRDBDemo app on a (my) device 2019-05-23 14:21:59 +02:00
Gwendal Roué 4368c529fa Realm 3.15.0 2019-05-23 13:49:01 +02:00
Gwendal Roué bf40e77d9c stephencelis/SQLite.swift 0.12.0 2019-05-23 13:38:25 +02:00
Gwendal Roué 4ce4b2e0d1 Performance tests: updates for Swift 5.0.1 2019-05-23 13:36:51 +02:00
Gwendal Roué a3c86e343b Less @inlinable methods 2019-05-23 13:27:23 +02:00
Gwendal Roué 962ab13da9 TODO 2019-05-23 13:13:26 +02:00
Gwendal Roué 4085050e96 API diff 2019-05-23 08:56:26 +02:00
Gwendal Roué a80a2571f6 API diff 2019-05-23 08:52:34 +02:00
Gwendal Roué 2a43377079 API diff 2019-05-23 08:48:43 +02:00
Gwendal Roué 2a0bd93795 API diff 2019-05-23 08:42:31 +02:00
Gwendal Roué 05747a62ea API diff 2019-05-23 08:29:08 +02:00
Gwendal Roué e201dd21ac Enhance Inflections setup APIs 2019-05-23 08:23:30 +02:00
Gwendal Roué c04f3c7faa API diff 2019-05-23 07:34:17 +02:00
Gwendal Roué 83409e3dec API diff 2019-05-23 07:33:35 +02:00
Gwendal Roué def9997698 Reduce Travis coverage 2019-05-23 07:25:43 +02:00
Gwendal Roué bb7f4b2f86 Documentation diff 2019-05-22 23:35:26 +02:00
Gwendal Roué ee703142ce CHANGELOG 2019-05-22 23:16:59 +02:00
Gwendal Roué 324db50668 API diff 2019-05-22 23:04:21 +02:00
Gwendal Roué 2e84e11bfa API diff 2019-05-22 22:59:52 +02:00
Gwendal Roué 6062beb9f4 API diff 2019-05-22 22:58:05 +02:00
Gwendal Roué 1d8c924c4e API diff 2019-05-22 22:57:31 +02:00
Gwendal Roué 8b35343f3d API diff 2019-05-22 22:56:22 +02:00
Gwendal Roué 35ead1d4c1 API diff 2019-05-22 22:50:23 +02:00
Gwendal Roué 2c3e639f39 API diff 2019-05-22 22:49:28 +02:00
Gwendal Roué 0f9fb9a3e0 API diff 2019-05-22 22:48:27 +02:00
Gwendal Roué 567547a205 API diff 2019-05-22 22:44:54 +02:00
Gwendal Roué 9a28c0ae03 Fix a decoding error diagnostic 2019-05-22 22:28:13 +02:00
Gwendal Roué 82ccc121dd Cleanup 2019-05-22 22:25:24 +02:00
Gwendal Roué 472063c7c1 API diff 2019-05-22 22:25:15 +02:00
Gwendal Roué f23e41a866 Fix wrong Columns enums 2019-05-22 20:28:07 +02:00
Gwendal Roué faae864699 Query Interface code organization 2019-05-22 20:13:33 +02:00
Gwendal Roué d2b9137548 Stop fostering CodingKeys that adopt ColumnExpression. Expose Column(CodingKey) initializer instead 2019-05-22 13:42:26 +02:00
Gwendal Roué dec80ac300 Give a default name to the isEmpty aggregate 2019-05-22 13:19:47 +02:00
Gwendal Roué b471488a83 Documentation 2019-05-22 09:08:52 +02:00
Gwendal Roué 21d2df9ade New SQL interpolation "... \(tableOf: record) ..." (addresses #524) 2019-05-22 08:53:50 +02:00
Gwendal Roué 7461342089 Fix doc: Record Comparison only requires EncodableRecord conformance 2019-05-22 08:40:03 +02:00
Gwendal Roué e4498b2784 contains operator generates SQL equality test when collection contains a single element 2019-05-22 08:13:42 +02:00
Gwendal Roué 2734bd1266 Fix for Swift 4.2 2019-05-21 23:14:52 +02:00
Gwendal Roué 77a677296b Migration guide menu 2019-05-21 20:41:39 +02:00
Gwendal Roué c90560fda9 Documentation 2019-05-21 20:35:13 +02:00
Gwendal Roué f5be0e176d Fix failing test for observation of QueryInterfaceRequest with prefetched rows 2019-05-21 20:27:08 +02:00
Gwendal Roué 9691adc0bb Failing test for observation of QueryInterfaceRequest with prefetched rows 2019-05-21 20:26:30 +02:00
Gwendal Roué b1c953c536 Better error reporting for missing scopes or prefetched rows 2019-05-21 19:56:55 +02:00
Gwendal Roué 059ae19974 QueryInterfaceRequest unconditionnally conforms to TableRequest 2019-05-21 19:18:26 +02:00
Gwendal Roué 65c6360d0c Fix typo and add a TODO 2019-05-21 19:02:01 +02:00
Gwendal Roué 25526472b3 Test Xcode 10.2 with Travis 2019-05-21 09:01:51 +02:00
Gwendal Roué a4a26e01e7 SelectionRequest.annotated(with:) 2019-05-21 08:05:07 +02:00
Gwendal Roué e163b91cf0 Merge pull request #525 from groue/feature/including-all
Eager Loading of HasMany associations
2019-05-21 07:35:03 +02:00
Gwendal Roué c19b3ad305 Documentation 2019-05-20 20:19:30 +02:00
Gwendal Roué 6628c09db7 Documentation 2019-05-20 20:17:34 +02:00
Gwendal Roué 7674f2f522 Association prefetching: add support for composite foreign keys 2019-05-20 19:35:50 +02:00
Gwendal Roué c841120d3b Cleanup 2019-05-20 19:18:27 +02:00
Gwendal Roué 81476e58b8 Improve SQLAssociationKey documentation 2019-05-20 19:03:57 +02:00
Gwendal Roué 69baff31ef Remove a hack: merging hasMany and hasManyThrough with include(all:) is simply not supported yet 2019-05-20 19:03:43 +02:00
Gwendal Roué 6f6a8e3c3b Migration Guide: Associations 2019-05-20 14:31:55 +02:00
Gwendal Roué 403e5ab058 Fix SPM tests 2019-05-20 14:29:54 +02:00
Gwendal Roué bc1e74a73e Migration Guide: Associations 2019-05-20 14:25:56 +02:00
Gwendal Roué 1fdd0bc428 Migration Guide: fix links 2019-05-20 14:22:27 +02:00
Gwendal Roué 940e9c3871 Migration Guide: Associations 2019-05-20 14:21:29 +02:00
Gwendal Roué 844fb3ca8b Fix iOS9 test 2019-05-20 12:15:50 +02:00
Gwendal Roué 721fd52d12 Association documentation 2019-05-20 11:56:49 +02:00
Gwendal Roué 85a86424c9 Association documentation 2019-05-20 11:54:49 +02:00
Gwendal Roué 7d4306d383 Association documentation 2019-05-20 11:53:42 +02:00
Gwendal Roué 96780419e9 Association documentation 2019-05-20 11:50:15 +02:00
Gwendal Roué 332f42bba3 English table names is recommended 2019-05-20 11:46:48 +02:00
Gwendal Roué bab21d4c59 CHANGELOG 2019-05-20 08:14:05 +02:00
Gwendal Roué 2c7b3e7667 Association documentation 2019-05-20 07:55:59 +02:00
Gwendal Roué 30839bd19d Association documentation 2019-05-20 07:54:36 +02:00
Gwendal Roué 304fdabd88 Association documentation 2019-05-20 07:31:27 +02:00
Gwendal Roué fde53b13c6 Association documentation 2019-05-20 07:28:59 +02:00
Gwendal Roué 62557343a1 Restore the Convention for Database Table Names chapter 2019-05-20 07:25:43 +02:00
Gwendal Roué 4b565ae262 Association documentation 2019-05-20 06:22:07 +02:00
Gwendal Roué 64bcbde1ab Association documentation 2019-05-20 06:17:30 +02:00
Gwendal Roué 76891a351d Association documentation 2019-05-20 06:14:35 +02:00
Gwendal Roué b29b5215b9 Character.uppercased() and lowercased() come with the Swiift 5 compiller 2019-05-20 06:12:51 +02:00
Gwendal Roué 507d603a4e At last 2019-05-19 23:44:27 +02:00
Gwendal Roué a38850ab00 Association documentation 2019-05-19 23:40:34 +02:00
Gwendal Roué 6af4b180df Association documentation 2019-05-19 23:31:54 +02:00
Gwendal Roué 8f3036b090 Association documentation 2019-05-19 22:42:38 +02:00
Gwendal Roué 8fd4108463 Association documentation 2019-05-19 22:11:30 +02:00
Gwendal Roué 40260c2316 Association documentation 2019-05-19 20:59:16 +02:00
Gwendal Roué 7268085692 Association documentation 2019-05-19 20:54:14 +02:00
Gwendal Roué 5f3b879efd Association documentation and tests 2019-05-19 20:27:13 +02:00
Gwendal Roué 5b15a88974 Fix HasManyThrough row scopes 2019-05-19 19:59:28 +02:00
Gwendal Roué 95c7c10f35 Association documentation 2019-05-19 19:06:37 +02:00
Gwendal Roué d5943962b3 Documentation: associations no longer need a convention for database table names 2019-05-19 18:58:38 +02:00
Gwendal Roué ada6002c91 Cleanup 2019-05-19 18:50:13 +02:00
Gwendal Roué 09afd2fadf Tests for singularization of hasMany relationship 2019-05-19 18:20:55 +02:00
Gwendal Roué 4f17444a7e Cleanup 2019-05-19 17:38:15 +02:00
Gwendal Roué 87b77768ec Documentation 2019-05-19 17:18:37 +02:00
Gwendal Roué fe0198f453 Cleanup 2019-05-19 16:22:39 +02:00
Gwendal Roué ae6a224122 Documentation 2019-05-19 16:08:29 +02:00
Gwendal Roué 73773358c9 Tests for non-inflected singular 2019-05-19 16:06:36 +02:00
Gwendal Roué 8e2a8fe9d8 More Associations and inflections 2019-05-19 15:03:54 +02:00
Gwendal Roué a1b0baaca9 leaf, foot, hero 2019-05-19 13:55:38 +02:00
Gwendal Roué 15dd4fc477 Inflections Cleanup 2019-05-19 13:36:29 +02:00
Gwendal Roué 52add837e5 More inflections 2019-05-19 13:06:56 +02:00
Gwendal Roué 637c94b265 Pluralize/Singularize last word 2019-05-19 08:38:11 +02:00
Gwendal Roué ca76032b8b Association name is turned into singularized or pluralized keys 2019-05-19 07:33:18 +02:00
Gwendal Roué 35027a825f Add Rails license 2019-05-18 20:19:18 +02:00
Gwendal Roué 98a7f94248 Cleanup 2019-05-18 20:09:03 +02:00
Gwendal Roué cdcaaa4b77 Irregularity 2019-05-18 19:49:30 +02:00
Gwendal Roué d2c33715d0 String.pluralized, String.singularized 2019-05-18 19:48:51 +02:00
Gwendal Roué 5113d08ce3 AssociationPrefetchingSQLTests: no need for association keys 2019-05-18 16:02:00 +02:00
Gwendal Roué cd53e0102b Simplify PrefetchedRowsDecoder 2019-05-18 15:53:06 +02:00
Gwendal Roué c95e9fafb1 Cleanup 2019-05-18 15:43:57 +02:00
Gwendal Roué 1a368d30b0 Cleanup 2019-05-18 15:03:17 +02:00
Gwendal Roué ebd393f52a Cleanuo 2019-05-18 14:18:35 +02:00
Gwendal Roué 27cbe18c51 Pass tests for database region of prefetching requests 2019-05-18 14:09:00 +02:00
Gwendal Roué 670bca00b0 Failing tests for database region of prefetching requests 2019-05-17 18:23:28 +02:00
Gwendal Roué 2a85d89364 Cleanup 2019-05-17 18:16:01 +02:00
Gwendal Roué c5ac0ea941 Cleanup 2019-05-17 18:13:32 +02:00
Gwendal Roué d23f4c3ac7 Prevent fetching cursor of prefetched rows with a "Not implemented" fatal error 2019-05-17 18:10:26 +02:00
Gwendal Roué 604a51bb79 Cleanup 2019-05-17 17:58:57 +02:00
Gwendal Roué 3786482368 Add unordered() to OrderedRequest 2019-05-17 17:53:25 +02:00
Gwendal Roué f98502a136 Association: remove pivot/destination relation ambiguity 2019-05-17 17:24:02 +02:00
Gwendal Roué 7703741f25 Cleanup 2019-05-17 17:10:26 +02:00
Gwendal Roué 5f36b43441 Tests for Row.debugDescription with prefetched rows 2019-05-17 16:55:25 +02:00
Gwendal Roué eb977e9391 Make Row.PrefetchedView order predictible 2019-05-17 16:53:43 +02:00
Gwendal Roué ad1bdd7f01 Rename Row.prefetches to Row.prefetchedRows 2019-05-17 14:08:33 +02:00
Gwendal Roué c1ed3aa094 Better error messages 2019-05-17 13:46:54 +02:00
Gwendal Roué 901015368c Failing tests for copied prefetched rows 2019-05-17 13:42:58 +02:00
Gwendal Roué ae18041861 Pass tests for prefetched rows and equality check 2019-05-17 08:58:35 +02:00
Gwendal Roué a6d348fc57 Failing tests for prefetched rows and equality check 2019-05-17 08:58:29 +02:00
Gwendal Roué 70b948b1c8 Row subscript accepts any RangeReplaceableCollection 2019-05-16 22:30:35 +02:00
Gwendal Roué 8038a9db05 Tests for consumption of prefetched rows into sets 2019-05-16 22:21:52 +02:00
Gwendal Roué 3337e49f64 Tests for consumption of prefetched rows into FetchableRecord 2019-05-16 22:02:02 +02:00
Gwendal Roué 67ec70a117 Row prefetch subscript 2019-05-16 22:00:30 +02:00
Gwendal Roué c4be3e527d Split AssociationPrefetchingTests.swift 2019-05-16 20:35:03 +02:00
Gwendal Roué f5177a5612 Cleanup 2019-05-16 19:54:00 +02:00
Gwendal Roué d18c00231e Remove Swift 5 migration warning 2019-05-16 19:44:56 +02:00
Gwendal Roué 644064aa08 More tests for consumption of prefetched rows into Decodable records 2019-05-16 19:44:43 +02:00
Gwendal Roué 881bb45fae More tests for consumption of prefetched rows into Decodable records 2019-05-16 19:35:24 +02:00
Gwendal Roué 46b7618f38 More tests for consumption of prefetched rows into Decodable records 2019-05-16 19:21:12 +02:00
Alexandre Colucci 490a124cbf #530: Wrong number of statement arguments with "like '%?%'"
Add "? as a parameter" in the "Good to Know" section to explain how to build like pattern like '%?%'.
2019-05-14 08:59:41 +02:00
Gwendal Roué a7ea0913fa Fix SPM 2019-05-08 07:59:34 +02:00
Gwendal Roué c0616c6a26 More tests for consumption of prefetched rows into Decodable records 2019-05-07 08:37:39 +02:00
Gwendal Roué 9fc5cda92b Rename PrefetchesTreeView to PrefetchesView 2019-05-06 08:19:12 +02:00
Gwendal Roué 1c47f01e9a More tests for consumption of prefetched rows into Decodable records 2019-05-05 22:47:16 +02:00
Gwendal Roué 04ffc71dbb TODO 2019-05-05 22:35:37 +02:00
Gwendal Roué 2634a0918d More tests for consumption of prefetched rows into Decodable records 2019-05-05 22:00:41 +02:00
Gwendal Roué c7fed1c0b3 More tests for consumption of prefetched rows into Decodable records 2019-05-05 21:20:10 +02:00
Gwendal Roué 17e8df2d25 Tests for consumption of prefetched rows into Decodable records 2019-05-05 21:09:23 +02:00
Gwendal Roué 8786a60d31 More tests for consumption of prefetched rows 2019-05-05 20:31:56 +02:00
Gwendal Roué acb7432610 TODO 2019-05-05 20:23:23 +02:00
Gwendal Roué 560676a4bb More tests for consumption of prefetched rows 2019-05-05 19:54:15 +02:00
Gwendal Roué a45065c340 Fix failing tests for consumption of prefetched rows 2019-05-05 19:31:43 +02:00
Gwendal Roué bd0884503e Failing tests for consumption of prefetched rows 2019-05-05 18:19:19 +02:00
Gwendal Roué f6b2c7e9f3 More tests for consumption of prefetched rows 2019-05-05 17:46:05 +02:00
Gwendal Roué 814ed0e4f1 Fix failing tests for consumption of prefetched rows 2019-05-05 17:44:11 +02:00
Gwendal Roué 5eff7755fe More tests for consumption of prefetched rows 2019-05-05 17:37:05 +02:00
Gwendal Roué b1bcf637ab Fix failing tests for consumption of prefetched rows 2019-05-05 17:25:17 +02:00
Gwendal Roué f199dc3cbe Rubber duck debugging 2019-05-05 16:36:56 +02:00
Gwendal Roué 40b11f9f2f TODO: light HasManyThrough 2019-05-05 16:36:22 +02:00
Gwendal Roué 8f678c94cc Failing tests for consumption of prefetched rows 2019-05-05 16:03:10 +02:00
Gwendal Roué 171cdcb36e More tests for consumption of prefetched rows 2019-05-05 15:37:25 +02:00
Gwendal Roué 1dce152f95 Introduce Row.prefetchTree 2019-05-05 15:26:40 +02:00
Gwendal Roué 90dd8d19bc More tests for consumption of prefetched rows 2019-05-05 15:10:55 +02:00
Gwendal Roué efe89f000d More tests for consumption of prefetched rows 2019-05-05 14:52:54 +02:00
Gwendal Roué 590f6c2b2a More tests for consumption of prefetched rows 2019-05-05 14:23:45 +02:00
Gwendal Roué 623f2eaf43 First tests for consumption of prefetched rows 2019-05-05 13:54:55 +02:00
Gwendal Roué 8d759898d3 Cleanup 2019-05-04 23:07:45 +02:00
Gwendal Roué 5fb6c40036 Almost ready to use prefetched rows 2019-05-04 22:54:10 +02:00
Gwendal Roué 91ec3bada3 Group prefetched rows 2019-05-04 22:29:07 +02:00
Gwendal Roué 217b7eee9f AssociationHasManyPrefetchingSQLTests cleanup 2019-05-04 22:04:22 +02:00
Gwendal Roué f1522c09b5 AssociationHasManyPrefetchingSQLTests cleanup 2019-05-04 22:00:37 +02:00
Gwendal Roué b00271ad80 AssociationHasManyPrefetchingSQLTests cleanup 2019-05-04 21:45:29 +02:00
Gwendal Roué d7b4cf364d More passing prefetch tests 2019-05-04 21:35:06 +02:00
Gwendal Roué 7ef5669710 More passing prefetch tests 2019-05-04 21:28:59 +02:00
Gwendal Roué 73d622a074 Don't prefetch when there is no row 2019-05-04 21:28:47 +02:00
Gwendal Roué ce782cecac More passing prefetch tests 2019-05-04 21:04:55 +02:00
Gwendal Roué a7431403a5 AssociationHasManyPrefetchingSQLTests cleanup 2019-05-04 20:39:56 +02:00
Gwendal Roué 4b82656d3a More passing prefetch tests 2019-05-04 17:20:56 +02:00
Gwendal Roué 2ca2f11883 First prefetch and passing tests 2019-05-04 17:02:19 +02:00
Gwendal Roué 1fbe7cfecf Type constraint: check Row equality, not subtyping 2019-05-04 17:01:23 +02:00
Gwendal Roué 331938c647 More including(all:) 2019-05-04 15:48:58 +02:00
Gwendal Roué 995657108d Not all relation children impact parent's count 2019-05-04 14:34:49 +02:00
Gwendal Roué f6a5279ac9 Use "join" for actual SQL joins, and refactor SQLRelation around "children" 2019-05-04 14:15:53 +02:00
Gwendal Roué a88f20fb50 Introduce including(all:) 2019-05-04 12:24:43 +02:00
Gwendal Roué cfb1b2fc4d QueryInterfaceRequest is not a FetchRequest like others: it will prefetch 2019-05-04 12:20:36 +02:00
Gwendal Roué 0e2daff329 More Association cleanup 2019-05-04 12:17:47 +02:00
Gwendal Roué 18bd025e1c SQLAssociation clarification 2019-05-03 20:32:21 +02:00
Gwendal Roué dd87a8d42c SQLAssociation clarification 2019-05-03 20:16:05 +02:00
Gwendal Roué 96c10f017e TODO 2019-05-02 20:38:24 +02:00
Gwendal Roué 95ccb511db Fix typo 2019-05-02 20:38:15 +02:00
Gwendal Roué 820db3f07d Refactor SQLAssociation
# Conflicts:
#	GRDB/QueryInterface/Association/Association.swift
2019-05-02 20:34:10 +02:00
Gwendal Roué 1317dc5db0 Fix typo 2019-04-28 16:34:45 +02:00
Gwendal Roué 76971c44f6 Merge pull request #521 from groue/feature/join-condition-cleanup
Associations: join condition cleanup
2019-04-28 16:29:58 +02:00
Gwendal Roué 708538bcf0 Refactor join conditions 2019-04-28 14:46:20 +02:00
Gwendal Roué 1e3de49251 Rename SQLJoin.Condition to SQLJoinCondition 2019-04-28 13:25:56 +02:00
Gwendal Roué 73f4a9fb23 whitespace 2019-04-28 13:23:53 +02:00
Gwendal Roué aec26c66be Merge pull request #519 from Lutzifer/patch-1 2019-04-26 12:06:56 +02:00
Wolfgang Lutz 8fcabb5b73 fix typos in documentation 2019-04-26 11:50:22 +02:00
Gwendal Roué 9090c54c93 Migrating From GRDB 3 to GRDB 4 2019-04-24 13:50:49 +02:00
Gwendal Roué 425debd0db Migrating From GRDB 3 to GRDB 4 2019-04-24 13:39:08 +02:00
Gwendal Roué f335005efd Migrating From GRDB 3 to GRDB 4 2019-04-24 13:30:55 +02:00
Gwendal Roué 8084e83760 Migrating From GRDB 3 to GRDB 4 2019-04-24 13:28:54 +02:00
Gwendal Roué bdbcf682c4 Merge pull request #517 from groue/SQLCipher-4
Support for SQLCipher 4
2019-04-22 17:03:01 +02:00
Gwendal Roué 29188a0606 CHANGELOG 2019-04-21 14:21:21 +02:00
Gwendal Roué fba553bbb9 Fix typo 2019-04-21 14:00:08 +02:00
Gwendal Roué 2932b72200 Update documentation for SQLCipher and raw SQLite pointers 2019-04-21 13:56:13 +02:00
Gwendal Roué e6bbdeab2c SQLCipher installation documentation 2019-04-21 13:51:03 +02:00
Gwendal Roué c37ccb6448 Test for PRAGMA cipher_compatibility 2019-04-21 13:46:05 +02:00
Gwendal Roué 330005596a Carthage: don't beat around the bush 2019-04-21 13:08:40 +02:00
Gwendal Roué a336cf6ca4 Drop obsolete documentation 2019-04-21 13:04:07 +02:00
Gwendal Roué 801e8bb23c Remove remaining references to Carthage 2019-04-21 13:03:28 +02:00
Gwendal Roué 235ce0aba2 Remove remaining references to GRDBCipher 2019-04-21 13:01:54 +02:00
Gwendal Roué 2a72d08334 Restore Database.logError 2019-04-21 12:59:12 +02:00
Gwendal Roué 6b04996290 Remove remaining references to GRDBCipher 2019-04-21 12:55:24 +02:00
Gwendal Roué d2b65d9fb8 Travis 2019-04-21 12:47:26 +02:00
Gwendal Roué 1b9a1d3e30 SQLCipher tests: don't sign code 2019-04-20 22:03:48 +02:00
Gwendal Roué 5730dd5414 Refactor Makefile and .travis.yml for new SQLCipher tests 2019-04-20 20:44:52 +02:00
Gwendal Roué 322039d490 Drop GRDBCipher project 2019-04-20 20:24:34 +02:00
Gwendal Roué c0c2a40c22 SQLCipher3 tests 2019-04-20 20:15:45 +02:00
Gwendal Roué 7d50825bff SQLCipher4 tests 2019-04-20 20:10:50 +02:00
Gwendal Roué da55d09960 Travis cleanup - and disable flaky Carthage test nobody cares about 2019-04-20 16:40:33 +02:00
Gwendal Roué f9b0af5f7b Remove obsolete make test_CocoaPodsLint_GRDBCipher 2019-04-20 16:24:14 +02:00
Gwendal Roué d1fa479b31 Ignore test Podfile.lock 2019-04-20 16:10:29 +02:00
Gwendal Roué 6b3f2e844c Fix make test_install_GRDBCipher_CocoaPods 2019-04-20 16:06:25 +02:00
Gwendal Roué 9370036baf make test_install_GRDBCipher is obsolete 2019-04-20 16:05:44 +02:00
Gwendal Roué 95274c57dd SQLCipher 4: adapt tests for past-error Cursor.next() 2019-04-20 15:32:01 +02:00
Gwendal Roué e55a5bd1d0 SQLCipher can't backup encrypted databases 2019-04-20 15:29:43 +02:00
Gwendal Roué 97173dea60 Fix Xcode 10.2.1 warnings 2019-04-20 14:49:43 +02:00
Gwendal Roué 7e3e91ac99 Update Makefile for SQLCipher via CocoaPods 2019-04-20 11:08:43 +02:00
Gwendal Roué 1c1ee4e92a GRDBCipher is no longer. Long live GRDB.swift/SQLCipher. 2019-04-19 13:11:55 +02:00
Gwendal Roué 1e06ff24ec cocoapods ~> 1.6 2019-04-19 08:49:24 +02:00
Gwendal Roué ba91a79798 Instruct Travis to honor Gemfile 2019-04-19 08:41:11 +02:00
Gwendal Roué 3c977d7bf8 Add cocapods to the Travis gems 2019-04-19 08:36:55 +02:00
Gwendal Roué 261e9481b2 Fix share schemes 2019-04-19 08:33:19 +02:00
Gwendal Roué 1f50b4fefe Integrate SQLCipher as a CocoaPod 2019-04-19 08:33:19 +02:00
Gwendal Roué cbb1b27830 Delete SQLCipher/src submodule 2019-04-19 08:33:19 +02:00
Gwendal Roué bdf8d0bcd5 Merge pull request #515 from alextrob/feature/fetchOne-limit-1
Add "LIMIT 1" to `fetchOne` requests
2019-04-18 07:04:56 +02:00
Gwendal Roué 5af1686677 Thank you notice 2019-04-18 07:02:42 +02:00
Gwendal Roué 2711b9bb04 Merge branch 'GRDB-4.0' into feature/fetchOne-limit-1 2019-04-18 07:01:03 +02:00
Gwendal Roué a172473e37 CHANGELOG 2019-04-17 21:35:23 +02:00
Gwendal Roué 3f8047fc0e Tests for the singleResult hint and SQLRequest.init(_:request:) 2019-04-17 21:32:47 +02:00
Gwendal Roué a12830050b Tests for the singleResult hint and databaseRegion 2019-04-17 21:32:13 +02:00
Gwendal Roué 21c0175a71 Tests for the singleResult hint and fetchCount 2019-04-17 21:31:53 +02:00
Gwendal Roué 65fe2bb50c Tests for the singleResult hint and fetching methods 2019-04-17 21:31:30 +02:00
Gwendal Roué e3a0935914 Add SQL tests for all record testFetchOne…() methods
We usually update all those tests together
2019-04-17 14:01:16 +02:00
Gwendal Roué 693e6da773 Do not test that fetchOne does not add LIMIT 1 to raw SQL requests
We do not add LIMIT 1 to raw SQL requests because it is difficult. But it would not be wrong to do so.
2019-04-17 13:08:51 +02:00
Gwendal Roué 4716f91d8b Bake the single result expectation right into filter(key:) methods
This better hides this flag inside SQLSelectQuery, and avoids explicit support from FetchableRecord and TableRecord
2019-04-16 08:47:50 +02:00
Gwendal Roué 46791c8f74 Remove QueryInterfaceRequest.init(query:) 2019-04-16 07:56:44 +02:00
Alex Robinson 1b3f0e8ece Update FetchRequest protocol in README 2019-04-16 11:11:37 +10:00
Alex Robinson e2211aca21 Exclude LIMIT 1 in more cases
Adds a flag to SQLSelectQuery indicating that it expects a single record (for example when querying by primary or unique key).

Ensures that this example doesn't add an unnecessary LIMIT 1 to the resulting query:

    let request = Player.filter(key: 123) // or Player.filter(key: ["email": "me@example.com"])
    let player = try dbQueue.read { db in try request.fetchOne(db) }
2019-04-16 11:10:43 +10:00
Alex Robinson 235a612ce0 Remove LIMIT 1 from expected SQL when filtering by key
Tests now fail
2019-04-16 10:29:40 +10:00
Alex Robinson 7070dedf1a Replace FetchRequestHint with a boolean for single results
Fixes previous test failure
2019-04-16 10:20:36 +10:00
Alex Robinson 20aecd5328 Add failing test for fetchOne with a non-zero offset 2019-04-16 10:20:36 +10:00
Gwendal Roué 1af55653d3 Fix typo 2019-04-13 17:06:41 +02:00
Gwendal Roué 9efc20fa51 Association: introduce request(for:) before using it 2019-04-13 13:55:15 +02:00
Gwendal Roué f847be98f5 Associations: aggregates are available on HasManyThrough, too 2019-04-13 13:48:12 +02:00
Gwendal Roué ff00dabcd1 Associations documentation 2019-04-13 13:46:28 +02:00
Gwendal Roué 72f00ccd9a Associations: delay introduction of request(for:) 2019-04-13 13:34:34 +02:00
Gwendal Roué 5995f468e3 Associations: improve "Required Protocols" chapter 2019-04-13 06:55:28 +02:00
Gwendal Roué 023afce21b Put #514 in TODO 2019-04-11 08:31:16 +02:00
Gwendal Roué 9b24671043 Disable #514 failing tests 2019-04-11 08:14:04 +02:00
Alex Robinson 088f6c92c7 Update inline docs 2019-04-11 13:50:57 +10:00
Alex Robinson 207b90f1b5 Update FetchRequest protocol in README 2019-04-11 13:27:32 +10:00
Alex Robinson dd139b6268 Fix testing lastSQLQuery when a cursor hasn't retrieved a record
This problem was masked by the fact all queries in the test expected the same SQL query.
2019-04-11 13:19:04 +10:00
Alex Robinson 072fa2583a Add hints for use in request preparation
Hints are ignored by SQLRequest. When you write raw SQL you probably don't want GRDB to modify your query.
2019-04-11 13:14:41 +10:00
Alex Robinson af1fd6b90c More tests for presence of LIMIT 1 2019-04-11 13:08:29 +10:00
Alex Robinson f9868bd8b5 Update tests to expect "LIMIT 1" where appropriate
Tests currently fail
2019-04-11 11:51:16 +10:00
Gwendal Roué 00ae2de14e Another failing test for #514 2019-04-10 19:54:44 +02:00
Gwendal Roué a6cbd242e6 Add a failing test forr #514 2019-04-10 19:29:50 +02:00
Gwendal Roué be950162d0 Merge pull request #508 from michaelkirk-signal/mkirk/GRDB-4.0-sqlcipher-cipher_compatibility
Allow Database Connection Configuration
2019-04-10 13:47:03 +02:00
Gwendal Roué db34d9537b Remove more useless failing tests 2019-04-10 07:49:06 +02:00
Gwendal Roué 1682df5c4e Thank you notice 2019-04-09 20:26:28 +02:00
Gwendal Roué 3ca7647110 Merge branch 'GRDB-4.0' into mkirk/GRDB-4.0-sqlcipher-cipher_compatibility
# Conflicts:
#	CHANGELOG.md
2019-04-09 20:25:22 +02:00
Gwendal Roué 2c4a449c5b Fix prepareDatabase sample code and markdown layout 2019-04-09 20:23:08 +02:00
Gwendal Roué 49d92dc6ce Three slashes for documentation comment 2019-04-09 20:21:34 +02:00
Gwendal Roué d52fcbe0c9 Fixits for Configuration.cipherPageSize and kdfIterations 2019-04-09 20:21:17 +02:00
Gwendal Roué 5bf54dc5c9 Update README for cipher_page_size and kdf_iter SQLCipher pragmas 2019-04-09 20:15:46 +02:00
Gwendal Roué 0a814ee1e7 CHANGELOG 2019-04-09 20:04:20 +02:00
Gwendal Roué 94316540de Remove useless failing tests
They were failing because database initialization now uses high level methods which throw detailed errors.
2019-04-09 20:01:22 +02:00
Gwendal Roué b67a53e645 whitespace 2019-04-09 19:57:22 +02:00
Gwendal Roué a0f37c6e85 Simplify Database.validateFormat() 2019-04-09 19:56:01 +02:00
Gwendal Roué 82dc51c554 Document prepareDatabase call site
Because it willl be easy to forget the context of #508 when we read this code in the future
2019-04-09 19:55:45 +02:00
Gwendal Roué 6115078e95 Simplify Database.validateSQLCipher() 2019-04-09 19:46:58 +02:00
Gwendal Roué 8d35330e12 whitespace 2019-04-09 19:40:27 +02:00
Gwendal Roué e0e07a7454 Merge pull request #510 from signalapp/charlesmchen/tableRegionVisibility
Expose DatabaseRegion(table:) initializer
2019-04-09 19:31:57 +02:00
Gwendal Roué 7a42bb42f5 README: make DatabaseRegion documentation less detailed 2019-04-09 19:29:38 +02:00
Gwendal Roué 212290bbf9 Make DatabaseRegion documentation less detailed 2019-04-09 19:23:50 +02:00
Gwendal Roué 6f20d8b406 CHANGELOG 2019-04-09 19:17:24 +02:00
Matthew Chen 0561b7de5d Respond to CR. 2019-04-05 09:50:07 -04:00
Matthew Chen 9f41277bd4 Make more DatabaseRegion initializers public; elaborate docs. 2019-04-05 09:47:08 -04:00
Matthew Chen 9f4cad4134 Make DatabaseRegion initializer public to enable observation of tables. 2019-04-05 09:47:08 -04:00
Gwendal Roué bf012614bc CHANGELOG and thank you notice 2019-04-05 07:49:16 +02:00
Gwendal Roué aeeb59601a Merge pull request #511 from signalapp/charlesmchen/fixPoolNotificationName
Fix notification name.
2019-04-05 07:43:02 +02:00
Michael Kirk 747a6352d6 example docs 2019-04-04 16:03:30 -06:00
Matthew Chen 325b376f4c Fix notification name. 2019-04-04 18:01:12 -04:00
Michael Kirk dcc3db2730 Revert "update sqlcipher"
This reverts commit 26b8682e63.
2019-04-04 15:57:21 -06:00
Michael Kirk 29c1c5481c inline setupConnection, re-order method calls to call validateFormat later, convert static->instance methods where possible 2019-04-04 15:55:53 -06:00
Michael Kirk ebc7a9d8e0 fix #if scope 2019-04-04 15:42:19 -06:00
Michael Kirk 99065a4faf prepareDB block 2019-04-02 10:47:31 -06:00
Michael Kirk 26b8682e63 update sqlcipher 2019-03-31 14:27:46 -06:00
Gwendal Roué d41f6b4466 Makefile: support for Xcode 10.2 2019-03-28 07:08:18 +01:00
Gwendal Roué bfa5fbe8ce Documentation tweaks 2019-03-20 16:50:03 +01:00
Gwendal Roué 900134729a Where has count(where:) gone? 2019-03-16 15:31:00 +01:00
Gwendal Roué d888423676 Fix outdated documentation 2019-03-16 14:32:10 +01:00
Gwendal Roué eac38be34b Fix for Swift 5 2019-03-16 14:26:06 +01:00
Gwendal Roué f42a184401 Merge pull request #503 from groue/feature/aggregate-ifnull
IFNULL support for association aggregates
2019-03-15 13:06:56 +01:00
Gwendal Roué 5fbf56c373 KISS 2019-03-15 08:51:02 +01:00
Gwendal Roué 784ebcc8e9 Tighten SQLJoin 2019-03-15 08:41:57 +01:00
Gwendal Roué df84654554 Delete unused code 2019-03-15 08:23:08 +01:00
Gwendal Roué 53e513f1f8 Merge branch 'GRDB-4.0' into feature/aggregate-ifnull
# Conflicts:
#	CHANGELOG.md
2019-03-15 07:58:42 +01:00
Gwendal Roué 0074adc023 Merge pull request #502 from groue/feature/rename-future
Rename Future to DatabaseFuture
2019-03-15 07:56:56 +01:00
Gwendal Roué ca8987ad98 Remove ill-advised TODOs 2019-03-14 07:57:30 +01:00
Gwendal Roué 6460f639ee Cleanup: SQLRelation, JoinOperator, JoinCondition are no longer public 2019-03-14 07:54:45 +01:00
Gwendal Roué 41d93f546c Document aggregate operations 2019-03-14 07:46:49 +01:00
Gwendal Roué 80a642260f CHANGELOG 2019-03-14 07:29:47 +01:00
Gwendal Roué 39800b1257 IFNULL support for aggregates 2019-03-14 07:21:09 +01:00
Gwendal Roué d04fc07337 CHANGELOG 2019-03-14 07:02:39 +01:00
Gwendal Roué 11fd8d6b87 Update documentation 2019-03-14 07:01:39 +01:00
Gwendal Roué 7183457217 Rename Future to DatabaseFuture 2019-03-14 06:43:40 +01:00
Gwendal Roué cf4e512894 Documentation 2019-03-13 21:24:54 +01:00
Gwendal Roué cf837855f2 HasManyThroughAssociation and HasOneThroughAssociation doc 2019-03-13 21:19:13 +01:00
Gwendal Roué 916d3931aa Cleanup SQLAssociation 2019-03-13 20:47:55 +01:00
Gwendal Roué 9d9bbc5f5d Documentation 2019-03-13 10:24:00 +01:00
Gwendal Roué 153233ace4 Documentation 2019-03-13 10:16:46 +01:00
Gwendal Roué 4bae8e9ac5 More request(for:association) tests 2019-03-13 08:33:14 +01:00
Gwendal Roué 1e617381a8 AssociationsBasics.md: remove inner link 2019-03-13 07:57:01 +01:00
Gwendal Roué 6d5215c8cb One less contribution needed #499 2019-03-11 09:02:48 +01:00
Gwendal Roué 4ce6271f6d Merge pull request #499 from groue/feature/EndodableRecord
Extract EncodableRecord from MutablePersistableRecord
2019-03-10 23:01:24 +01:00
Gwendal Roué 10c75d1e5e CHANGELOG 2019-03-10 15:25:39 +01:00
Gwendal Roué 05258b1098 Fix SPM build 2019-03-10 15:21:39 +01:00
Gwendal Roué 1a513e8e6e EncodableRecord documentation 2019-03-10 15:07:05 +01:00
Gwendal Roué 4ae1fb11cc Extract EncodableRecord from MutablePersistableRecord
This fixes issue #426
2019-03-10 14:00:01 +01:00
Gwendal Roué 9500a74744 Merge branch 'development' into GRDB-4.0
# Conflicts:
#	.travis.yml
#	CHANGELOG.md
#	GRDB/QueryInterface/SQLSelectQueryGenerator.swift
#	GRDB/Utils/OrderedDictionary.swift
#	README.md
2019-03-10 12:16:08 +01:00
Gwendal Roué 973e82b139 Fix a typo 2019-03-10 05:48:25 +01:00
Gwendal Roué d88fb4d96f Fix typo 2019-03-09 15:27:09 +01:00
Gwendal Roué cd6c4a4232 CHANGELOG 2019-03-09 15:11:48 +01:00
Gwendal Roué aeb41dc1eb v3.7.0 2019-03-09 14:21:28 +01:00
Gwendal Roué d2b2e12a10 Remove CHANGELOG.md requirement from PULL_REQUEST_TEMPLATE.md 2019-03-09 14:05:57 +01:00
Gwendal Roué 9040970c8d CHANGELOG 2019-03-09 14:04:49 +01:00
Gwendal Roué 211ac7aada Make Configuration.cipherPageSize an Int
As said in https://github.com/groue/GRDB.swift/issues/498#issuecomment-471156347
2019-03-09 13:38:28 +01:00
Gwendal Roué d60b68ab8a Document the BusyMode.timeout unit (#498) 2019-03-09 12:45:11 +01:00
Gwendal Roué 82423c41f2 Disable Travis check for CocoaPods GRDBCipher until we figure out what has turned wrong 2019-03-08 12:55:05 +01:00
Gwendal Roué 2b460083af GRDBPlus CocoaPod is deprecated 2019-03-08 12:52:17 +01:00
Gwendal Roué bad862ba16 Remove all mentions of GRDBPlus 2019-03-08 12:40:00 +01:00
Gwendal Roué adc4aa7c41 Merge pull request #497 from Marus/sqlcipher_config_options
Add additional SQLCipher configuration options
2019-03-08 08:40:39 +01:00
Gwendal Roué 53d2e6b895 Fix typo 2019-03-08 08:26:18 +01:00
Gwendal Roué c46dbdd97e Turn WARNING into a Note 2019-03-08 08:25:02 +01:00
Marcel Ball 6543d75f6d Updated based upon feedback from @groue
- Renamed `KDFIternations` to `kdfIterations` to better fit naming conventions
- In case of errors setting values return the sqlite error code and message instead of .SQLITE_MISUSE and a generic message
- Fixed formatting/typos in documentation
2019-03-07 17:51:16 -04:00
Gwendal Roué 32f6a45e8f SE-0209: support both swift 4.2 and 5 2019-03-07 20:54:42 +01:00
Gwendal Roué 519fa9a41a Don't codesign GRDBCipherMacOS test app 2019-03-07 18:34:19 +01:00
Gwendal Roué 7d0b5cf03c Don't codesign GRDBFTS5MacOS test app 2019-03-07 18:32:30 +01:00
Gwendal Roué 35ffe9a9fd Merge pull request #496 from groue/feature/fix-495
Fix crash when trying to perform fetchCount or ValueObservation.trackCount on joined query
2019-03-07 07:54:04 +01:00
Gwendal Roué b063870739 Too much future: firstIndex is not available on Xcode 9.4- 2019-03-07 05:06:58 +01:00
Marcel Ball 8ca9839433 Cleanup of some things leftover from debugging/testing 2019-03-06 21:31:37 -04:00
Marcel Ball 47f9b0f4a9 Added inline comments for new configuration options. 2019-03-06 21:21:43 -04:00
Marcel Ball 349ef328c7 Updated documentation to cover new configuration options 2019-03-06 21:01:08 -04:00
Marcel Ball 8415e8c2a0 Rename parameter to better align with the SQLCipher PRAGMA 2019-03-06 20:58:55 -04:00
Marcel Ball d4eb7ba27b Added configuration options to GRDBcipher for kdf_iterations 2019-03-06 20:41:38 -04:00
Marcel Ball 090eea9923 Update naming for the enumeration to be clearer 2019-03-06 20:41:01 -04:00
Gwendal Roué d566838dc5 Restore missing comment 2019-03-06 22:22:35 +01:00
Gwendal Roué 5bed0ac58e Too much future 2019-03-06 22:12:54 +01:00
Gwendal Roué ee481b2327 Fix #495 2019-03-06 22:09:31 +01:00
Gwendal Roué 8fbc3ca875 From future import OrderedDictionary 2019-03-06 22:09:01 +01:00
Gwendal Roué 4aecad3649 Failing test for https://github.com/groue/GRDB.swift/issues/495 2019-03-06 21:58:36 +01:00
Marcel Ball cf128ac800 Added configuration option to set cipher_page_size on connection
* Defaults to 1024 - which is the default in SQLCipher
2019-03-06 16:50:55 -04:00
Marcel Ball 1a51eb6b52 Merge pull request #2 from groue/development
Down merge changes from @groue
2019-03-06 16:41:30 -04:00
Gwendal Roué a355b9eb03 Merge pull request #490 from groue/feature/HasOneThroughAssociation
Indirect Associations
2019-03-06 21:40:47 +01:00
Gwendal Roué a3c2cb7f1c Merge branch 'GRDB-4.0' into feature/HasOneThroughAssociation 2019-03-06 18:58:05 +01:00
Gwendal Roué 4ba16067d0 Merge branch 'development' into GRDB-4.0 2019-03-06 18:57:06 +01:00
Gwendal Roué 605b6f7593 Merge branch 'master' into development 2019-03-06 18:55:07 +01:00
Gwendal Roué 43fff32156 Thank you notice for davidkraus :-) 2019-03-06 18:51:08 +01:00
Gwendal Roué 9f776a119f Merge pull request #494 from davidkraus/master
improve fts5 documentation
2019-03-06 18:49:10 +01:00
Gwendal Roué 658c9d34cb Remove GRDBPlus from ReleaseProcess.md 2019-03-06 18:43:21 +01:00
Gwendal Roué 2f447cc237 Wording and formatting 2019-03-06 18:42:45 +01:00
Gwendal Roué 403c4a894f Apply lovely advice from @glessard 2019-03-06 18:18:15 +01:00
David Kraus ccf339d6ef improve fts5 documentation 2019-03-06 14:55:11 +01:00
Gwendal Roué 7ff21981f0 Restore tests by disabling a sanity check 2019-03-06 09:08:59 +01:00
Gwendal Roué 5d9fa76754 Fix fetchCount(_:) for joined queries 2019-03-06 08:59:06 +01:00
Gwendal Roué bd633e25ee Aggregate tests for HasManyThroughAssociation 2019-03-06 08:17:47 +01:00
Gwendal Roué 87cd76a468 Association aggregates are defined on AssociationToMany 2019-03-06 08:17:20 +01:00
Gwendal Roué fca6420053 Documentation 2019-03-06 06:10:18 +01:00
Gwendal Roué ec51f4dbdf CHANGELOG 2019-03-05 18:54:06 +01:00
Gwendal Roué 916311a851 Remove outdated information 2019-03-05 18:51:58 +01:00
Gwendal Roué d6b6028e42 Typo fix 2019-03-05 18:49:51 +01:00
Gwendal Roué c756d27808 Documentation 2019-03-05 18:48:03 +01:00
Gwendal Roué 13985d0553 Merge branch 'GRDB-4.0' into feature/HasOneThroughAssociation 2019-03-05 18:40:12 +01:00
Gwendal Roué 0363ca406d Merge pull request #493 from groue/feature/SQLite-3.27.2
Bump SQLite to 3.27.2
2019-03-05 18:29:46 +01:00
Gwendal Roué c20b7e5799 Bump swiftlyfalling/SQLiteLib 2019-03-05 18:29:07 +01:00
Gwendal Roué 7642eb054b Documentation 2019-03-05 08:33:17 +01:00
Gwendal Roué f3c68420a0 CHANGELOG 2019-03-05 08:05:39 +01:00
Gwendal Roué 223ed4c73c Merge branch 'GRDB-4.0' into feature/SQLite-3.27.2 2019-03-05 08:00:53 +01:00
Gwendal Roué 99d010cded SQLite 3.27.2 2019-03-05 07:58:07 +01:00
Gwendal Roué 5bf1e6f818 Association documentation: contextualize schema recommendations 2019-03-04 20:37:47 +01:00
Gwendal Roué 06f0961b13 Association documentation: avoid painful repetition 2019-03-04 20:13:12 +01:00
Gwendal Roué addfa45d3a hasMany(_:through:using:) 2019-03-04 08:52:07 +01:00
Gwendal Roué 6489c80846 hasOne(_:through:using:) 2019-03-04 08:49:03 +01:00
Gwendal Roué 9e8e00ff99 AssociationHasManySQLTests 2019-03-04 08:06:50 +01:00
Gwendal Roué 9ee25fdec1 Rename ToOneAssociation to AssociationToOne 2019-03-04 08:01:45 +01:00
Gwendal Roué 4d5e5e1de3 HasManyThroughAssociation 2019-03-03 18:35:05 +01:00
Gwendal Roué 1188969144 Cleanup 2019-03-03 17:34:23 +01:00
Gwendal Roué 66c72e7bd2 HasOneThroughAssociation request tests 2019-03-03 15:29:27 +01:00
Gwendal Roué eed30c0954 AssociationHasOneThroughDecodableRecordTests 2019-03-03 09:21:49 +01:00
Gwendal Roué 8dd9f5fd40 AssociationHasOneThroughFetchableRecordTests cleanup 2019-03-03 09:21:34 +01:00
Gwendal Roué 7cab5dbf2b Cleanup 2019-03-02 20:42:52 +01:00
Gwendal Roué 6fd14d0a70 AssociationHasOneThroughFetchableRecordTests 2019-03-02 20:41:52 +01:00
Gwendal Roué 51c0b7a2f8 Renamed AssociationHasOneThroughRowscopeTests 2019-03-02 20:26:31 +01:00
Gwendal Roué 679f989e96 More AssociationHasOneThroughSQLDerivationTests 2019-03-02 17:35:00 +01:00
Gwendal Roué 1a24f61723 HasOneThroughAssociation adopts TableRequest 2019-03-02 17:24:17 +01:00
Gwendal Roué 1ff5552d5e AssociationHasOneThroughSQLDerivationTests 2019-03-02 17:14:58 +01:00
Gwendal Roué 4815807f09 More AssociationHasOneThroughSQLTests 2019-03-02 17:01:27 +01:00
Gwendal Roué 8fc23e1771 Complete AssociationHasOneThroughSQLTests 2019-03-02 15:48:17 +01:00
Gwendal Roué 5cf2d4920d TODO 2019-03-02 15:37:44 +01:00
Gwendal Roué 3d6d1c89b2 HasOneThroughAssociation 2019-03-02 14:46:31 +01:00
Gwendal Roué 08451dfced Rename AssociationImpl to SQLAssociation 2019-03-02 14:46:12 +01:00
Gwendal Roué b506838519 ToOneAssociation 2019-03-01 19:13:46 +01:00
Gwendal Roué 1511981dc7 AssociationImpl is no longer a protocol 2019-03-01 19:13:28 +01:00
Gwendal Roué 661cca9f80 Merge pull request #488 from groue/feature/ValueObservationCleanup
ValueObservation Cleanup
2019-03-01 16:55:24 +01:00
Gwendal Roué 4ee2523d59 CHANGELOG 2019-03-01 13:51:22 +01:00
Gwendal Roué 997be18718 Update ValueObservation documentation 2019-03-01 13:51:15 +01:00
Gwendal Roué e966544aeb Remove ValueObservation.extent 2019-03-01 13:17:48 +01:00
Gwendal Roué 4935c6f258 Rename ValueScheduling.onQueue(_:startImmediately:) to .async(onQueue:startImmediately:) 2019-03-01 08:24:00 +01:00
Gwendal Roué 03fafa437c Cleanup 2019-03-01 08:05:46 +01:00
Gwendal Roué 0fe7db2694 Assume NSUUID.fromDatabaseValue no longer needs special care in Release configuration, since we target Xcode 10+ now 2019-02-28 13:28:06 +01:00
Gwendal Roué 22edb91796 Merge pull request #487 from groue/feature/SR-6067
Remove SR-6067 workaround
2019-02-28 12:15:41 +01:00
Gwendal Roué 5ffc35a955 Remove SR-6067 workaround 2019-02-28 08:35:16 +01:00
Gwendal Roué 1084fe0425 Cleanup 2019-02-26 20:45:58 +01:00
Gwendal Roué 8d867320b0 Remove DatabaseValue.losslessConvert methods
They were used by RxGRDB until 0.13.0.
2019-02-26 20:40:13 +01:00
Gwendal Roué 34dd011e90 TODO: replace ValueObservation.extent 2019-02-26 20:23:14 +01:00
Gwendal Roué 8fce4faeea Fix typo 2019-02-26 09:00:29 +01:00
Gwendal Roué 8faff704d5 Merge pull request #486 from groue/feature/RecordNotFound
Refactor PersistenceError.recordNotFound
2019-02-26 08:09:04 +01:00
Gwendal Roué 2d71679476 Cleanup 2019-02-26 08:07:13 +01:00
Gwendal Roué 715b7a7867 CHANGELOG 2019-02-25 20:48:35 +01:00
Gwendal Roué 8ef28b0683 Fix PersistenceError.description 2019-02-25 20:43:40 +01:00
Gwendal Roué 31bdb2eeaa PersistenceError.recordNotFound documentation 2019-02-25 20:21:20 +01:00
Gwendal Roué 63192e2b75 Refactor PersistenceError.recordNotFound 2019-02-25 20:17:49 +01:00
Gwendal Roué fcbbe17909 Documentation 2019-02-25 18:53:32 +01:00
Gwendal Roué a1e809cbc7 Cleanup TODO 2019-02-25 17:23:02 +01:00
Gwendal Roué 93b429cca4 CHANGELOG 2019-02-24 18:02:57 +01:00
Gwendal Roué 3aaa5e74ec Update README 2019-02-24 17:48:10 +01:00
Gwendal Roué 27156fd215 Support for remove_diacritics=2 in FTS5 2019-02-24 17:38:04 +01:00
Gwendal Roué bcac197910 [whitespace] FTS5 files indentation 2019-02-24 17:12:10 +01:00
Gwendal Roué 336081a78a Support for remove_diacritics=2 in FTS3/4 2019-02-24 17:06:44 +01:00
Gwendal Roué 6306bd31e3 Update SQLiiteCustom/src to branch 3.27.1 of groue/SQLiteLib 2019-02-24 16:00:17 +01:00
Gwendal Roué 690e980018 Fix double inclusion of GRDB-4.0.swift in GRDBWatchOS target 2019-02-24 15:40:15 +01:00
Gwendal Roué f9fbd42962 CHANGELOG 2019-02-24 15:22:40 +01:00
Gwendal Roué 919f6095c6 Merge pull request #484 from groue/feature/SE-0193
SE-0193 Cross-module inlining and specialization
2019-02-24 15:18:49 +01:00
Gwendal Roué 83f62eed79 CHANGELOG 2019-02-24 15:18:04 +01:00
Gwendal Roué 96b971b0da PersistenceContainer specialization 2019-02-24 14:42:00 +01:00
Gwendal Roué 05fe018fed GRDBProfiling enhancements 2019-02-24 06:28:35 +01:00
Gwendal Roué 921c5d636a Remove SQLite.swift dependency from GRDBOSXPerformanceTests target 2019-02-24 06:26:51 +01:00
Gwendal Roué 61ae460525 Persistence methods specialization, PersistenceContainer optimizations 2019-02-24 06:26:08 +01:00
Gwendal Roué caaf2365e0 Fix compiler warning: make SQLiteValue @usableFromInline 2019-02-23 20:31:56 +01:00
Gwendal Roué bed9164bcd Allow specialization of fetching methods 2019-02-23 18:34:42 +01:00
Gwendal Roué f3621da329 @inlinable remaining Row subscripts 2019-02-23 17:37:04 +01:00
Gwendal Roué 2c75582c22 @inlinable RecordCursor 2019-02-23 17:23:30 +01:00
Gwendal Roué aa4f7c3d78 @inlinable StatementCursor 2019-02-23 17:19:56 +01:00
Gwendal Roué 9906cf799c @inlinable DatabaseValueCursor and NullableDatabaseValueCursor 2019-02-23 17:04:32 +01:00
Gwendal Roué 304937161c Performance comparison: Realm 3.13.1 2019-02-23 16:17:23 +01:00
Gwendal Roué 789497da75 FMDatabaseQueue(path:) is a failable initializer 2019-02-23 16:08:24 +01:00
Gwendal Roué 14371cd7c6 Performance comparison: update Realm location 2019-02-23 15:57:56 +01:00
Gwendal Roué b9dbce47a2 Performance comparison: FMDB 2.7.5 2019-02-23 15:46:09 +01:00
Gwendal Roué eb1672dec3 Revert wrong Xcode refactoring 2019-02-23 15:41:38 +01:00
Gwendal Roué dd0926ebfb ValueConversionContext does not need to be @usableFromInline 2019-02-23 15:35:23 +01:00
Gwendal Roué e80f3639af Revert wrong Xcode refactoring 2019-02-23 15:34:25 +01:00
Gwendal Roué 944b3ac07d @inlinable RowCursor, and Row subscript returning StatementColumnConvertible 2019-02-23 15:27:12 +01:00
Gwendal Roué 746c22e950 @inlinable FastDatabaseValueCursor and FastNullableDatabaseValueCursor 2019-02-23 14:28:44 +01:00
Gwendal Roué a0c85f093c Remove all @inline(__always) 2019-02-23 13:37:00 +01:00
Gwendal Roué 728c3b28ed Typo fix 2019-02-22 14:28:36 +01:00
Gwendal Roué 03b8df2fe1 Merge pull request #478 from groue/feature/SQLInterpolation2
Swift 5: SQL interpolation
2019-02-22 13:43:11 +01:00
Gwendal Roué dae55e4105 Merge branch 'GRDB-4.0' into feature/SQLInterpolation2 2019-02-22 13:37:44 +01:00
Gwendal Roué f8a1ecb644 Use query variable name when an SQLLiteral contains a full SQL query 2019-02-22 13:34:30 +01:00
Gwendal Roué 22c2cfb4ea Test SQLRequest interpolation 2019-02-22 13:28:58 +01:00
Gwendal Roué b15eaa826b TODO 2019-02-22 13:07:27 +01:00
Gwendal Roué 32b8d87a64 Use sqlite3_prepare_v3 on iOS 12.0, OSX 10.14, watchOS 5.0 2019-02-22 13:06:24 +01:00
Gwendal Roué 62ba97f517 Inline documentation 2019-02-22 12:59:44 +01:00
Gwendal Roué e81a514f29 SQLInterpolation.md 2019-02-22 09:15:05 +01:00
Gwendal Roué e36ca9f645 Foster SQL interpolation 2019-02-21 23:23:35 +01:00
Gwendal Roué d9dc21a073 Merge branch 'GRDB-4.0' into feature/SQLInterpolation2 2019-02-21 23:11:58 +01:00
Gwendal Roué 59cc1fef67 SQLInterpolation.md 2019-02-21 23:10:06 +01:00
Gwendal Roué 8df8129743 SQLInterpolation.appendInterpolation(SQLRequest) 2019-02-21 14:20:50 +01:00
Gwendal Roué b6481e8a68 SQLInterpolation.md 2019-02-21 12:20:16 +01:00
Gwendal Roué 65b65f4d70 SQL Interpolation documentation 2019-02-21 08:51:01 +01:00
Gwendal Roué 870ef6bac8 CHANGELOG 2019-02-21 08:48:22 +01:00
Gwendal Roué f7f0810c17 Documentation 2019-02-20 14:08:31 +01:00
Gwendal Roué 17c3ac1911 Link to #482 2019-02-20 08:54:35 +01:00
Gwendal Roué d74340a317 GRDB 4 development process 2019-02-20 08:17:23 +01:00
Gwendal Roué e54410b608 Swift 5: link to the GRDB-4.0 branch 2019-02-20 07:56:52 +01:00
Gwendal Roué 58dc1c67d6 Fix some sample code 2019-02-17 13:28:41 +01:00
Gwendal Roué 7e9e50e52d Up to date playgrounds 2019-02-17 13:28:41 +01:00
Gwendal Roué df05e940e8 Minor 2019-02-17 13:28:41 +01:00
Gwendal Roué 8d6a2fb4f1 Documentation, support for interpolation of empty sequences 2019-02-17 13:28:41 +01:00
Gwendal Roué afa8360397 Restore SQLExpressionLiteral.sql and arguments 2019-02-17 13:28:41 +01:00
Gwendal Roué 50f8bcec34 Fixit for SQLExpression.literal 2019-02-17 13:28:41 +01:00
Gwendal Roué d13968b753 Documentation 2019-02-17 13:28:41 +01:00
Gwendal Roué 086e3e918e joined(separator:) for SQLLiteral sequences 2019-02-17 13:28:41 +01:00
Gwendal Roué e986f0d6e5 Test for interpolation of empty sequence 2019-02-17 13:28:41 +01:00
Gwendal Roué 36ce78bd37 Explicit sql argument label when building prepared statements 2019-02-17 13:28:41 +01:00
Gwendal Roué e2a11eeb05 Update some inline documentation 2019-02-17 13:28:41 +01:00
Gwendal Roué 2d40b86a50 Rename SQLLiteral.append(literal:) to append(_:) 2019-02-17 13:28:41 +01:00
Gwendal Roué 4f350631ff Remove fetching methods from SQLLiteral. 2019-02-17 13:28:41 +01:00
Gwendal Roué db67d3840b Principle of least astonishment: rrename argument label rawSQL to sql 2019-02-17 13:28:41 +01:00
Gwendal Roué 2cd20b79f7 Fix typo 2019-02-17 13:28:40 +01:00
Gwendal Roué b296e9824a SQLGenerationContext.append(arguments:) cleanup 2019-02-17 13:28:40 +01:00
Gwendal Roué b0d9c519e1 Fix SPM test 2019-02-17 13:28:40 +01:00
Gwendal Roué 6937193d28 Fix SPM compilation 2019-02-17 13:28:40 +01:00
Gwendal Roué 500a5eea28 SQLRequest(rawSQL:arguments:adapter:) 2019-02-17 13:28:40 +01:00
Gwendal Roué 9758e1783e [whitespace] 2019-02-17 13:28:40 +01:00
Gwendal Roué a57aa2e346 rawSQL migration complete 2019-02-17 13:28:40 +01:00
Gwendal Roué 4bd5ace2ee Use rawSQL as parameter name for raw SQL 2019-02-17 13:28:40 +01:00
Gwendal Roué 85f618e16e SQLLiteral.mapSQL 2019-02-17 13:28:40 +01:00
Gwendal Roué e7995b9cd4 SQLExpressionLiteral(rawSQL:) 2019-02-17 13:28:40 +01:00
Gwendal Roué 6e80c748d2 SQLRequest(rawSQL:arguments:adapter:) 2019-02-17 13:28:40 +01:00
Gwendal Roué c546c578ce fetchCursor/All/One(_:rawSQL:arguments:adapter:) 2019-02-17 13:28:40 +01:00
Gwendal Roué 59162d93de Rename Database.execute(_:String) to Database.execute(rawSQL:String) 2019-02-17 13:27:54 +01:00
Gwendal Roué 354d22d70d Update documentation for literal interpolation 2019-02-17 13:24:38 +01:00
Gwendal Roué f15b2e12d6 Remove support for check constraint defined with a literal
That's because we can't support it until SQLLiteral is able to quote values
2019-02-17 13:24:38 +01:00
Gwendal Roué 4ecef0ea11 Don't be shy on interpolation 2019-02-17 13:24:38 +01:00
Gwendal Roué 637de8b6fa SQLiteral are passed via a literal parameter 2019-02-17 13:24:38 +01:00
Gwendal Roué aa6f55d72f Statement arguments are generally non optional 2019-02-17 13:24:38 +01:00
Gwendal Roué f018c7f823 Rename SQLString to SQLLiteral 2019-02-17 13:24:38 +01:00
Gwendal Roué 98e2d009c6 SQLString tests 2019-02-17 13:24:38 +01:00
Gwendal Roué 09e85ba341 SQLString everywhere 2019-02-17 13:24:38 +01:00
Gwendal Roué f27a1e9504 request.select(SQLString) 2019-02-17 13:24:38 +01:00
Gwendal Roué 86409687a4 TODO: Documentation 2019-02-17 13:24:38 +01:00
Gwendal Roué ff439c2dbc Documentation 2019-02-17 13:24:37 +01:00
Gwendal Roué 9b6c9b421a Update CustomizedDecodingOfDatabaseRows for SQLString 2019-02-17 13:24:37 +01:00
Gwendal Roué b5bcdd9df4 Fetch FetchableRecord from SQLString 2019-02-17 13:24:37 +01:00
Gwendal Roué b36cf84b23 Fetch StatementColumnConvertible from SQLString 2019-02-17 13:24:37 +01:00
Gwendal Roué fb89b540cd Fetch DatabaseValueConvertible from SQLString 2019-02-17 13:24:37 +01:00
Gwendal Roué 86b8c35c04 Fetch rows from SQLString 2019-02-17 13:24:37 +01:00
Gwendal Roué e7497e707e SQLRequest.init(SQLString) 2019-02-17 13:24:37 +01:00
Gwendal Roué b7089bb025 Database.execute(SQLString) 2019-02-17 13:24:37 +01:00
Gwendal Roué 612bd70710 Test SQLString in Swift 4.2 mode 2019-02-17 13:24:37 +01:00
Gwendal Roué 8affc8abe4 Remove dead code 2019-02-17 13:24:37 +01:00
Gwendal Roué d9cf760a25 SQLString 2019-02-17 13:24:37 +01:00
Gwendal Roué 5b6d882d67 SQLRequest adopts ExpressibleByStringInterpolation 2019-02-17 13:24:37 +01:00
Gwendal Roué 87ee00c2c5 SQLInterpolation 2019-02-17 13:24:37 +01:00
Gwendal Roué e100287bd8 Fixits for ValueObservation 2019-02-17 13:09:19 +01:00
Gwendal Roué 323b8de3dc Fixits for ColumnCursor and NullableColumnCursor 2019-02-17 13:02:48 +01:00
Gwendal Roué 06ec4580be Fixit for DatabaseWriter.readFromCurrentState 2019-02-17 12:59:32 +01:00
Gwendal Roué efd69a628a Add fixit for Cursor.flatMap 2019-02-17 12:50:29 +01:00
Gwendal Roué cc80daec99 Fixit/GRDB-4.0.swift 2019-02-17 12:48:13 +01:00
Gwendal Roué fd398aa434 Fix cocapods lint tests 2019-02-17 11:09:56 +01:00
Gwendal Roué 4b8ea08f4f Simplify Statement preparation now that SR-2347 is solved 2019-02-10 14:20:12 +01:00
Gwendal Roué e57cf49dc4 Remove useless check 2019-02-09 20:27:15 +01:00
Gwendal Roué 111dcbcad4 Fix warnings 2019-02-09 20:10:11 +01:00
Gwendal Roué 4174896225 Fix DataMemoryTests 2019-02-09 16:05:03 +01:00
Gwendal Roué 5738edc1bb CHANGELOG 2019-02-09 14:25:33 +01:00
Gwendal Roué 192bd71c12 SQLRequest.arguments is no longer optional 2019-02-09 14:14:07 +01:00
Gwendal Roué 5ee3b9c878 SE-0235 Add Result to the Standard Library 2019-02-09 12:54:30 +01:00
Gwendal Roué d3020dbd8f Workaround SR-9893
https://bugs.swift.org/browse/SR-9893
2019-02-09 11:10:27 +01:00
Gwendal Roué 493575a47b SE-0220 count(where:) 2019-02-09 10:21:34 +01:00
Gwendal Roué fa4febfa93 GRDB 4.0 TODO 2019-02-09 10:04:24 +01:00
Gwendal Roué 8cd49082ec SE-0205 withUnsafePointer(to:_:) and withUnsafeBytes(of:_:) for immutable values 2019-02-09 09:56:12 +01:00
Gwendal Roué 0dbfe7d9e3 GRDB 4.0 TODO 2019-02-09 09:50:32 +01:00
Gwendal Roué bbc64e38c7 SE-0207 Add an allSatisfy algorithm to Sequence 2019-02-09 09:50:04 +01:00
Gwendal Roué d7188f4b93 TODO: Rename Future 2019-02-08 10:19:01 +01:00
Gwendal Roué bb045235bf Remove tests for deprecated methods 2019-02-08 10:16:17 +01:00
Gwendal Roué ca4879c496 Remove deprecated ValueObservation methods 2019-02-08 10:16:17 +01:00
Gwendal Roué a466a8b253 Remove deprecated Cursor types 2019-02-08 10:16:17 +01:00
Gwendal Roué 5cd66c1be8 Remove deprecated Cursor.flatMap 2019-02-08 10:16:17 +01:00
Gwendal Roué 4489106bd6 Remove deprecated DatabaseWriter.readFromCurrentState 2019-02-08 10:16:17 +01:00
Gwendal Roué 485d42373b GRDB 4 is the latest version for Swift 4.2 2019-02-08 09:00:34 +01:00
Gwendal Roué 249484a21f SE-0204 Add last(where:) and lastIndex(where:) Methods 2019-02-08 08:47:45 +01:00
Gwendal Roué fb8946254d Swift 5: update calls to Data.withUnsafeBytes 2019-02-08 08:22:23 +01:00
Gwendal Roué b8a2592737 TODO future support for SQLite 3.27.0 2019-02-08 07:55:07 +01:00
Gwendal Roué 3029949731 Add () to forward @autoclosure parameters 2019-02-08 05:30:57 +01:00
Gwendal Roué 91061ee669 Remove redundant public modifiers 2019-02-08 05:27:50 +01:00
Gwendal Roué 90a9aa3523 Fix SPM compilation 2019-02-07 12:57:09 +01:00
Gwendal Roué ad04ccc094 Drop all fixits for GRDB < 3.0 2019-02-07 12:52:52 +01:00
Gwendal Roué a230fe400d Availability checks: assume iOS >= 9.0 2019-02-07 08:52:38 +01:00
Gwendal Roué 62ef344a6c Simplify FTS5, assuming swift(>=4.2) 2019-02-07 08:39:06 +01:00
Gwendal Roué 3eb36768c6 Simplify iOS memory management, assuming swift(>=4.2) 2019-02-07 08:25:31 +01:00
Gwendal Roué b6f79f176c SE-0206 : Hashable Enhancements 2019-02-07 08:21:48 +01:00
Gwendal Roué e2d151e748 Travis: test Xcode 10.1 2019-02-06 21:30:49 +01:00
Gwendal Roué 54ddd3e025 Set IPHONEOS_DEPLOYMENT_TARGET to 9.0 2019-02-06 20:05:53 +01:00
Gwendal Roué 2d7857f45b Package.swift uses swift-tools-version:4.2 2019-02-06 20:04:39 +01:00
Gwendal Roué 81892491f2 Set default SWIFT_VERSION to 4.2 2019-02-06 19:53:00 +01:00
Gwendal Roué 0493a9646f GRDB 4.0 kickoff 2019-02-06 19:45:19 +01:00
Gwendal Roué e99823dbcc Make DatabasePromise a proper monad 2019-02-04 19:27:18 +01:00
Gwendal Roué a1c99425cc SQLQualifiedSource.init(_:) bugfix, and cleanup 2019-02-04 08:18:20 +01:00
Gwendal Roué dc6db13134 Merge pull request #476 from groue/feature/cleanup
SQL Generation Winter Cleaning
2019-02-04 07:41:56 +01:00
Gwendal Roué 699c63e913 Explain how SQLSelectQueryGenerator uses RowAdapter 2019-02-03 19:55:26 +01:00
Gwendal Roué e924587236 Extract generation of SQL SELECT queries into SQLSelectQueryGenerator 2019-02-03 14:56:28 +01:00
Gwendal Roué c776801c4a Document "merging" and "finalization" 2019-02-03 11:58:16 +01:00
Gwendal Roué 73782d5e9d BelongsTo, HasOne and HasMany share the same JoinAssociationImpl 2019-02-03 10:23:34 +01:00
Gwendal Roué 659171902e Move join-related types to SQLRelation.swift 2019-02-03 10:09:34 +01:00
Gwendal Roué 4a209fcbc4 Rename SQLSource to SQLRelation.Source 2019-02-03 10:06:23 +01:00
Gwendal Roué 91b68ffa4f Trim 2019-02-03 09:29:52 +01:00
Gwendal Roué 5ea914ce0a YAGNI: JoinCondition.sqlExpression is not optional 2019-02-03 08:42:37 +01:00
Gwendal Roué 950fa607a1 Hide implementation details of associations 2019-02-03 08:26:58 +01:00
Gwendal Roué c9ff5a53a1 JoinCondition: Equatable 2019-02-03 00:03:04 +01:00
Gwendal Roué f42d5f202d White space 2019-02-02 17:57:01 +01:00
Gwendal Roué 27c6390635 More Association trimming 2019-02-02 17:53:01 +01:00
Gwendal Roué e62cfe086c Documentation 2019-02-02 17:23:50 +01:00
Gwendal Roué 40f6b351ea Rename QueryInterfaceQuery to SQLSelectQuery 2019-02-02 17:15:29 +01:00
Gwendal Roué 89dda44364 Extract and document DatabasePromise 2019-02-02 17:04:16 +01:00
Gwendal Roué 9addac6f54 Rename QueryOrdering to SQLRelation.Ordering 2019-02-02 16:43:10 +01:00
Gwendal Roué 5a942d7213 More trimming: QueryInterfaceQuery now embeds a SQLRelation 2019-02-02 16:20:43 +01:00
Gwendal Roué bb972a351a Refactor JoinQuery into SQLRelation 2019-02-02 15:39:18 +01:00
Gwendal Roué 5f037c7e4e Replace JoinQuery initializer with QueryInterfaceRequest.asJoinQuery() 2019-02-02 14:54:31 +01:00
Gwendal Roué 9d391badc0 Documentation 2019-02-02 14:31:12 +01:00
Gwendal Roué f309a0c5f3 Documentation 2019-02-02 13:30:57 +01:00
Gwendal Roué d9530433f2 Move JoinCondition definition 2019-02-02 13:15:17 +01:00
Gwendal Roué 20d067c826 Documentation 2019-02-02 13:11:00 +01:00
Gwendal Roué 1e7840f0e4 More trimming 2019-02-02 11:38:27 +01:00
Gwendal Roué 77fd2b8411 Restore failing tests 2019-02-02 10:51:33 +01:00
Gwendal Roué b180fc37bb Trim associations 2019-02-02 10:38:47 +01:00
Gwendal Roué 4e4d591109 Typo fix 2019-01-30 08:46:18 +01:00
Gwendal Roué 7745e92a1f Merge pull request #470 from timwredwards/master
Update README.md
2019-01-14 14:06:22 +01:00
Tim Edwards b70de2033a Update README.md
Fixed "latest release" date
2019-01-14 13:02:50 +00:00
Gwendal Roué 134bc670ef CHANGELOG 2019-01-05 15:57:10 +01:00
Gwendal Roué d265e2d77b v3.6.2 2019-01-05 15:40:05 +01:00
Gwendal Roué ac40b63262 Merge pull request #464 from groue/feature/updatesChanges
Make updateChanges(_:with:) available to PersistableRecord structs
2019-01-05 14:47:35 +01:00
Gwendal Roué bac9d8e425 CHANGELOG.md 2019-01-05 14:46:38 +01:00
Gwendal Roué bf0c9b5c27 Move non-mutating updateChanges(_:with:) from PersistableRecord to PersistableRecord & AnyObject. 2019-01-05 12:35:28 +01:00
Gwendal Roué f70d04c76a Failing test for updateChanges(_:with:) for PersistableRecord struct
The problem is that the code does not compile :'(
2019-01-05 12:30:48 +01:00
Gwendal Roué 85aa899c7b Fix #462 2019-01-02 17:49:36 +01:00
Gwendal Roué 19fa05aecc Update TODO.md 2018-12-13 16:46:13 +01:00
Gwendal Roué 9c4a8fb0b2 Fix typo 2018-12-09 11:35:22 +01:00
Gwendal Roué e19f02b77e v3.6.1 2018-12-09 11:18:41 +01:00
Gwendal Roué b34030fc39 Merge pull request #458 from groue/feature/FixValueObserverOverRetain
Fix ValueObservation duration - code & doc
2018-12-09 10:37:51 +01:00
Gwendal Roué 40a5fb1195 Observer deallocation needs better tests 2018-12-09 06:17:36 +01:00
Gwendal Roué d9dd880d6d Fix flaky test 2018-12-09 05:45:14 +01:00
Gwendal Roué c51b0ba862 Fix documentation about ValueObservation.extent, and add a note in remove(transactionObserver:) documentation. 2018-12-08 17:32:18 +01:00
Gwendal Roué 197f922e7e Fix failing tests for over-retained ValueObserver 2018-12-08 17:11:53 +01:00
Gwendal Roué 25f6bd9673 Failing tests for over-retained ValueObserver 2018-12-08 17:11:30 +01:00
Gwendal Roué 909821f4e5 Add a link to Codable records 2018-12-08 14:57:20 +01:00
Gwendal Roué b211dc55c4 Put associations in the feature list
... and use the "relation" keyword: people familiar with other toolkits may search for this word https://forums.swift.org/t/new-release-grdb-3-6-0/18660/4
2018-12-08 14:36:45 +01:00
Gwendal Roué 863a762eca Wording 2018-12-08 12:23:41 +01:00
Gwendal Roué bb01da7635 Mention ValueObservation iin WhyAdoptGRDB 2018-12-08 11:32:26 +01:00
Gwendal Roué 558cdacb5b Fix typo 2018-12-08 07:50:41 +01:00
Gwendal Roué eff7dbd798 CHANGELOG 2018-12-08 07:18:22 +01:00
Gwendal Roué 1d3935baaf Merge pull request #457 from diatoming/patch-2
Typo in AssociationsBasics.md
2018-12-08 05:40:39 +01:00
diatoming b40e4e58e1 Typo in AssociationsBasics.md 2018-12-08 07:08:20 +08:00
Gwendal Roué 36d3607565 http://github.com/groue/GRDBDemo is no longer 2018-12-07 20:56:04 +01:00
Gwendal Roué d55807e2a2 Realm 3.12.0, Swift 4.2.1 2018-12-07 20:55:12 +01:00
Gwendal Roué 6447eeca17 v3.6.0 2018-12-07 18:58:30 +01:00
Gwendal Roué 1fea9c06e8 Merge branch 'development' 2018-12-07 18:30:07 +01:00
Gwendal Roué 11d3dd9538 CHANGELOG 2018-12-07 18:22:01 +01:00
Gwendal Roué f6f236512b Documentation 2018-12-07 18:08:53 +01:00
Gwendal Roué 343816ed7b Documentation 2018-12-07 18:04:16 +01:00
Gwendal Roué 59a65bf81e PULL_REQUEST_TEMPLATE 2018-12-07 17:57:50 +01:00
Gwendal Roué a5b06b5cb0 Merge branch 'master' into development 2018-12-07 17:55:00 +01:00
Gwendal Roué 802575c505 Merge pull request #456 from diatoming/patch-1
fix typo in AssociationsBasics.md
2018-12-07 13:13:04 +01:00
diatoming c433a130e5 Update AssociationsBasics.md
just fix typo
2018-12-07 19:56:28 +08:00
Gwendal Roué ca4a867803 Remove picture that breaks anchor linking 2018-12-07 08:43:59 +01:00
Gwendal Roué 37ac126d26 Documentation 2018-12-07 08:42:28 +01:00
Gwendal Roué 5badd62515 Documentation 2018-12-07 08:41:17 +01:00
Gwendal Roué 37983b8581 Documentation 2018-12-07 08:36:11 +01:00
Gwendal Roué 815a3697da Documentation 2018-12-07 08:20:18 +01:00
Gwendal Roué 32acfb2cf4 Merge pull request #455 from groue/feature/DatabaseRegionObserver
DatabaseRegionObservation
2018-12-07 08:07:28 +01:00
Gwendal Roué 9fd802b3ea Documentation 2018-12-06 18:54:09 +01:00
Gwendal Roué 21d243fc33 Documentation 2018-12-06 18:51:45 +01:00
Gwendal Roué 97936c3fad Documentation 2018-12-06 18:46:57 +01:00
Gwendal Roué 03934041c2 Fix DatabaseRegion doc layout 2018-12-06 18:41:43 +01:00
Gwendal Roué 862563fdaa Remove obsolete test 2018-12-06 16:42:20 +01:00
Gwendal Roué 73935dfa9d CHANGELOG 2018-12-06 14:02:10 +01:00
Gwendal Roué 9a3e6f0b97 CHANGELOG 2018-12-06 13:58:47 +01:00
Gwendal Roué bc5899543f Documentation 2018-12-06 13:55:08 +01:00
Gwendal Roué fd79a53a96 Documentation 2018-12-06 13:34:02 +01:00
Gwendal Roué 194624212e Move db observation documentations around 2018-12-06 13:33:17 +01:00
Gwendal Roué 1472385242 Documentation 2018-12-06 08:55:31 +01:00
Gwendal Roué 78bb086f69 Documentation 2018-12-06 08:43:44 +01:00
Gwendal Roué e3681fdde5 DatabaseRegionObservationTests 2018-12-06 08:28:43 +01:00
Gwendal Roué 6ec4556c2c DatabaseRegionObservation 2018-12-06 07:49:41 +01:00
Gwendal Roué 1e72731c07 Distinguish distinctUntilChanged from distinctUntilDatabaseChanged 2018-12-06 07:04:40 +01:00
Gwendal Roué 82329c899e Hide DatabaseWriter.remove(transactionObserver:) from Jazzy 2018-12-05 19:27:04 +01:00
Gwendal Roué 8ab6e67f07 Hide DatabaseWriter.add(observation:onError:onChange:) from Jazzy 2018-12-05 19:23:06 +01:00
Gwendal Roué 643bbc7076 Merge pull request #454 from groue/feature/distinctUntilChanged
ValueObservation.distinctUntilChanged
2018-12-05 12:06:42 +01:00
Gwendal Roué 61f2544afe Remove a breaking change introduced by #446 2018-12-05 08:47:55 +01:00
Gwendal Roué 546289bc88 CHANGELOG 2018-12-05 08:29:49 +01:00
Gwendal Roué d3d5b1d24c CHANGELOG 2018-12-05 08:28:08 +01:00
Gwendal Roué dd59186887 Documentation 2018-12-05 08:24:12 +01:00
Gwendal Roué 88d7c58522 TODO: remove some magic in GRDB 4 2018-12-05 08:02:18 +01:00
Gwendal Roué c711ca1e8f ValueObservation.distinctUntilChanged() 2018-12-05 07:58:03 +01:00
Gwendal Roué 56d49dd385 Cleanup 2018-12-02 10:12:21 +01:00
Gwendal Roué 7b97d75a80 Merge pull request #452 from groue/feature/MapReducer
ValueObservation.mapReducer
2018-12-02 07:56:50 +01:00
Gwendal Roué a8d9f2d82b CHANGELOG 2018-12-02 01:11:58 +01:00
Gwendal Roué c7d28de386 CHANGELOG 2018-12-02 01:10:13 +01:00
Gwendal Roué ce61d27a9e CHANGELOG 2018-12-02 01:02:14 +01:00
Gwendal Roué b8e3994858 ValueObservation.mapReducer
and expose more precise value reducers
2018-12-02 00:01:21 +01:00
Gwendal Roué 7c6c615969 Merge pull request #451 from groue/feature/CompactMap
ValueObservation.compactMap
2018-12-01 21:03:34 +01:00
Gwendal Roué 8c543f5078 Fix failing tests 2018-12-01 19:07:58 +01:00
Gwendal Roué 3884141fc2 map/compactMap fail preserving ValueObservation configuration 2018-12-01 19:06:16 +01:00
Gwendal Roué 2c3776d372 Fix typo 2018-12-01 18:59:01 +01:00
Gwendal Roué c1d8dcb105 Link to ValueObservation from GoodPracticesForDesigningRecordTypes 2018-12-01 17:17:54 +01:00
Gwendal Roué c89540683f README 2018-12-01 17:11:56 +01:00
Gwendal Roué 3687e11958 README 2018-12-01 17:10:17 +01:00
Gwendal Roué 90c588a9f5 README 2018-12-01 17:06:10 +01:00
Gwendal Roué 838d9204ab CHANGELOG 2018-12-01 17:02:30 +01:00
Gwendal Roué 2488007b9c README 2018-12-01 17:02:25 +01:00
Gwendal Roué 5b3412e9f7 ValueObservation.compactMap 2018-12-01 16:35:19 +01:00
Gwendal Roué f07eee3ca7 DispatchQueue creation cleanup 2018-12-01 16:22:05 +01:00
Gwendal Roué 769b247da9 Merge pull request #449 from groue/feature/fixEmptyContainersJSONEncoding
Fix JSON encoding of empty containers
2018-11-28 12:24:14 +01:00
Gwendal Roué ef54efcb75 Cleanup 2018-11-28 09:11:36 +01:00
Gwendal Roué f41112c071 Documentation 2018-11-28 08:46:48 +01:00
Gwendal Roué e8ad816de5 CHANGELOG 2018-11-28 08:41:30 +01:00
Gwendal Roué 32f1a7ae0f Fix JSON encoding of empty arrays and dictionaries 2018-11-28 08:34:32 +01:00
Gwendal Roué 3dcae6d409 Forgot that reducer factory closure throws 2018-11-25 18:35:05 +01:00
Gwendal Roué 550c016a98 Merge pull request #446 from groue/feature/ValueReducerFactory
ValueObservation: delayed reducer creation
2018-11-25 18:24:35 +01:00
Gwendal Roué e092e8b3ec CHANGELOG 2018-11-25 15:42:34 +01:00
Gwendal Roué 1b53bf9ea2 Documentation 2018-11-25 15:27:26 +01:00
Gwendal Roué 3f001ba04d ValueObservation now accept a reducer factory 2018-11-25 15:18:03 +01:00
Gwendal Roué 87c4775421 ValueObservation creates a reducer when its starts 2018-11-25 14:26:04 +01:00
Gwendal Roué 2e3f2f9d61 Tests for reducer queue labels 2018-11-25 09:35:17 +01:00
Gwendal Roué 798b727d7f Reducer queue honors qos and targetQueue configuration 2018-11-25 09:35:04 +01:00
Gwendal Roué 54361617fe Remove headers 2018-11-25 09:33:55 +01:00
Gwendal Roué 417b830b61 CHANGELOG menu 2018-11-25 07:51:08 +01:00
Gwendal Roué b757a44a77 CHANGELOG menu 2018-11-25 07:47:57 +01:00
Gwendal Roué 6b78be51e2 CHANGELOG 2018-11-24 23:22:12 +01:00
Gwendal Roué 466140e699 Merge pull request #445 from groue/feature/qos
Quality of service and target dispatch queue
2018-11-24 23:18:57 +01:00
Gwendal Roué 4e1eea5743 Run run qos and targetQueue tests on Xcode 9.3, iOS 9.0
We lack dispatchPrecondition(condition:)
2018-11-24 21:46:50 +01:00
Gwendal Roué 267b4f958d Remove useless availability check 2018-11-24 21:22:47 +01:00
Gwendal Roué 9c71061629 Tests for QoS 2018-11-24 21:14:35 +01:00
Gwendal Roué 40ba0a7e8f CHANGELOG 2018-11-24 20:57:43 +01:00
Gwendal Roué bf6a101338 dispatchPrecondition(condition:) iOS availability 2018-11-24 20:56:36 +01:00
Gwendal Roué 736db6a546 Confiiguration.qos and targetQueue 2018-11-24 20:48:17 +01:00
Gwendal Roué 6a10ad0e11 Merge pull request #444 from groue/feature/ValueObservationCombine
Combine Value Observations
2018-11-24 19:39:51 +01:00
Gwendal Roué a521c89962 Documentation 2018-11-24 19:39:15 +01:00
Gwendal Roué b155ab742a Documentation 2018-11-24 19:38:24 +01:00
Gwendal Roué 4376e7519f Documentation 2018-11-24 14:55:15 +01:00
Gwendal Roué 42f13a621a Documentation 2018-11-24 14:53:23 +01:00
Gwendal Roué 8a9ccccf93 Documentation 2018-11-24 14:47:34 +01:00
Gwendal Roué e3a8bfda6f Documentation 2018-11-24 14:37:36 +01:00
Gwendal Roué a5c291e7a8 CHANGELOG 2018-11-24 14:35:27 +01:00
Gwendal Roué 71b75ee265 Documentation 2018-11-24 14:27:41 +01:00
Gwendal Roué 3f1db5aa10 Cleanup 2018-11-24 14:22:04 +01:00
Gwendal Roué 5ff519afcb Documentation 2018-11-24 13:50:36 +01:00
Gwendal Roué 41d814b540 Tests for ValueObservation combine 2018-11-24 12:57:24 +01:00
Gwendal Roué 326ef19fe9 ValueObservation combination 2018-11-24 11:38:47 +01:00
Gwendal Roué 796644edda Fix test
Concurrency is hard
2018-11-23 07:41:31 +01:00
Gwendal Roué 03b51ee899 Second failed test :-( 2018-11-22 09:34:10 +01:00
Gwendal Roué a2af4fb99a Merge pull request #443 from groue/feature/updateChanges
In place record update
2018-11-22 08:16:09 +01:00
Gwendal Roué e95119130c Documentation tweaks 2018-11-22 08:14:00 +01:00
Gwendal Roué 9735d8b74e Record Comparison documentation 2018-11-21 23:08:53 +01:00
Gwendal Roué f4c0eaa912 updateChanges(_:with:) documentation 2018-11-21 23:03:30 +01:00
Gwendal Roué d6e7d74a12 Cleanup 2018-11-21 22:27:33 +01:00
Gwendal Roué 771c85581c Fix documentation typo 2018-11-21 22:13:07 +01:00
Gwendal Roué 1baca23500 CHANGELOG 2018-11-21 22:12:52 +01:00
Gwendal Roué cc2a2a3545 Non-mutating version of updateChanges 2018-11-21 22:09:41 +01:00
Gwendal Roué 72a2408fce CHANGELOG 2018-11-21 22:08:05 +01:00
Gwendal Roué 0cd1ca11ef TODO 2018-11-21 21:48:34 +01:00
Gwendal Roué c04e6ad86d Tests for updateChanges(_:with:) 2018-11-21 21:48:24 +01:00
Gwendal Roué 3e67a1a021 Why use fileprivate when private is enough? 2018-11-21 20:33:21 +01:00
Gwendal Roué a3e62d8734 Factor updateChanges 2018-11-21 20:28:22 +01:00
Gwendal Roué f5bfb9df95 MutablePersistableRecord.updateChanges(_:with:) 2018-11-21 08:37:51 +01:00
Gwendal Roué d45ed56b64 Fix documentation typo 2018-11-19 09:01:26 +01:00
Gwendal Roué 59175a6b4d DatabasePool: block reader until concurrent fetch has been executed 2018-11-18 17:18:29 +01:00
Gwendal Roué f4e77c7700 Fix Swift 4.1 "expression was too complex to be solved in reasonable time" error 2018-11-18 17:05:10 +01:00
Gwendal Roué cbc3467e2d Database.beginSnapshotIsolation() 2018-11-18 16:49:51 +01:00
Gwendal Roué 65cc0bb2b3 Cache frequently used statements 2018-11-18 16:49:14 +01:00
Gwendal Roué 7e548aee13 Cleanup SchemaInfo 2018-11-18 15:47:11 +01:00
Gwendal Roué 8d18b06e5d Merge pull request #442 from groue/feature/reindex
Reindex
2018-11-17 22:12:34 +01:00
Gwendal Roué 55c8d350b8 CHANGELOG 2018-11-17 19:17:25 +01:00
Gwendal Roué 064f1005e5 CHANGELOG 2018-11-17 19:12:20 +01:00
Gwendal Roué 53adad16e5 Tests for Database.reindex(collation:) 2018-11-17 18:56:38 +01:00
Gwendal Roué 466a1ad4d5 Database.reindex(collation:) 2018-11-17 18:56:29 +01:00
Gwendal Roué f80f59cc38 Tweaks to demo app 2018-11-17 18:41:46 +01:00
Gwendal Roué ead2b13362 Optimize value observation for views that feed from a single table
By removing views from the observed database region, we allow the "single-table observation optimization" to kick in.

Thank you @foxware00 for revealing this opportunity in #441 :-)
2018-11-17 16:29:31 +01:00
Gwendal Roué 0ea9a1ce0d Use SchemaInfo more 2018-11-17 15:59:09 +01:00
Gwendal Roué 3b7801efff Cache full database schema 2018-11-17 15:38:55 +01:00
Gwendal Roué 5efbbe9f0c Typo 2018-11-17 14:13:58 +01:00
Gwendal Roué d868b7e1ce Test ValueObservation with database queue and pool 2018-11-17 14:12:03 +01:00
Gwendal Roué 60358ba0c0 CHANGELOG 2018-11-17 13:43:03 +01:00
Gwendal Roué b6eb5ab399 ValueObservation: tests for region arrays 2018-11-17 13:26:14 +01:00
Gwendal Roué b9ab74cb1d ValueObservation: support region arrays (address #441) 2018-11-17 13:25:55 +01:00
Gwendal Roué d3fd838c6c DatabaseRegion cleanup and documentation
Goal: improve understanding of observation performance.
Context: https://github.com/groue/GRDB.swift/issues/441
2018-11-17 12:46:01 +01:00
Gwendal Roué 1108ba4bf2 DatabaseError gets a default message, derived from its resultCode 2018-11-16 09:07:52 +01:00
Gwendal Roué 49de0e0f49 Call sqlite3_close() even if opening failed
Thanks to https://github.com/feistydog/FeistyDB/commit/6859f622797480656f8897c2db5e620e6a98c858
2018-11-16 08:48:25 +01:00
Gwendal Roué d56b62a65f Flag ValueReducer as experimental 2018-11-10 12:31:35 +01:00
Gwendal Roué c28a4d4061 Remove public initializers of utility value reducers 2018-11-10 12:29:31 +01:00
Gwendal Roué 3971b43894 Cleanup 2018-11-05 09:08:14 +01:00
Gwendal Roué 9fc5c2680b Typo 2018-11-05 09:08:01 +01:00
Gwendal Roué 0f8156afed Cleanup demo app 2018-11-04 03:50:19 +01:00
Gwendal Roué da3f14c29a Typo 2018-11-03 16:39:36 +01:00
Gwendal Roué dbacf3acf0 Documentation 2018-11-02 18:04:48 +01:00
Gwendal Roué 961138b09b v3.5.0 2018-11-02 17:01:39 +01:00
Gwendal Roué 6c6e46b8d6 Merge branch 'development' 2018-11-02 16:55:53 +01:00
Gwendal Roué 0cbf259ed1 Merge pull request #435 from groue/feature/ValueObservation
Improved support for values observation
2018-11-02 16:47:22 +01:00
Gwendal Roué 07bf5882fe Adding more reactive engines is no longer hard 2018-11-02 16:28:06 +01:00
Gwendal Roué b3c7fec676 Documentation 2018-11-02 13:56:52 +01:00
Gwendal Roué 296a1d5b12 CHANGELOG 2018-11-02 13:18:27 +01:00
Gwendal Roué 8c5e3df546 Documentation 2018-11-02 13:04:22 +01:00
Gwendal Roué 50213c925f Documentation 2018-11-02 13:00:42 +01:00
Gwendal Roué a1a5165bd2 Documentation 2018-11-02 12:48:48 +01:00
Gwendal Roué 7d9e87088d Rename ValueObservation.isReadOnly to requiresWriteAccess 2018-11-02 12:31:26 +01:00
Gwendal Roué c300cf2a38 Documentation 2018-11-02 12:15:04 +01:00
Gwendal Roué c48d2e484a Documentation 2018-11-02 12:10:49 +01:00
Gwendal Roué 2bc8f33249 Cleanup 2018-11-02 11:49:03 +01:00
Gwendal Roué 257fc8b66a Cleanup 2018-11-02 08:35:16 +01:00
Gwendal Roué bc274a603c Documentation 2018-11-02 08:35:04 +01:00
Gwendal Roué ab7970d470 Documentation 2018-11-01 22:58:20 +01:00
Gwendal Roué 087a899f13 Rename ValueObservation.tracking(withUniquing:fetch) to ValueObservation.tracking(_:fetchDistinct) 2018-11-01 22:18:58 +01:00
Gwendal Roué 842eaf0816 ValueObservation: perform uniquing by default 2018-11-01 21:46:59 +01:00
Gwendal Roué f7b79e05f6 Attempt at addressing https://github.com/groue/GRDB.swift/issues/430 2018-11-01 16:59:39 +01:00
Gwendal Roué 1867ee91de Documentation 2018-11-01 13:38:54 +01:00
Gwendal Roué d53412d404 Documentation 2018-11-01 13:22:02 +01:00
Gwendal Roué 74ca85e52c More links to the demo app 2018-11-01 13:16:04 +01:00
Gwendal Roué 51942046b9 Avoid the "No output has been received in the last 10m0s" error on Travis 2018-11-01 13:10:52 +01:00
Gwendal Roué 38e1cc9a27 Use ValueObservation is demo application 2018-11-01 12:58:17 +01:00
Gwendal Roué 7e8ebed7a8 Documentation 2018-10-31 19:39:44 +01:00
Gwendal Roué eb95562b73 Documentation 2018-10-31 19:37:35 +01:00
Gwendal Roué 44af4e62a6 Documentation 2018-10-31 19:35:49 +01:00
Gwendal Roué 30363b4a5b Tests for ValueObservation.map 2018-10-31 19:02:47 +01:00
Gwendal Roué bb02d9d857 ValueObservation.map 2018-10-31 12:07:08 +01:00
Gwendal Roué 9babbcbcb3 README: foster ValueObservation 2018-10-31 08:59:50 +01:00
Gwendal Roué 04de6193c0 Documentation 2018-10-31 07:37:05 +01:00
Gwendal Roué 6fa72ebea1 Documentation 2018-10-30 13:44:05 +01:00
Gwendal Roué 0e51a0ff65 Documentation 2018-10-30 13:40:32 +01:00
Gwendal Roué a276a49a26 CHANGELOG 2018-10-30 13:37:58 +01:00
Gwendal Roué 741f0b2a43 CHANGELOG 2018-10-30 13:37:05 +01:00
Gwendal Roué 3d21773496 CHANGELOG 2018-10-30 13:33:24 +01:00
Gwendal Roué cca716e1ab Cleanup 2018-10-30 08:49:36 +01:00
Gwendal Roué 8e13cb4e6c Cleanup 2018-10-30 07:46:41 +01:00
Gwendal Roué c4d328783f Documentation 2018-10-30 07:24:27 +01:00
Gwendal Roué 22b5990669 Documentation 2018-10-29 23:04:00 +01:00
Gwendal Roué d3838d1d73 ValueObservation error handling 2018-10-29 21:13:14 +01:00
Gwendal Roué cdd7579104 Documentation 2018-10-29 19:40:37 +01:00
Gwendal Roué 4e3b7c14a9 Documentation 2018-10-29 19:39:44 +01:00
Gwendal Roué b4b824c360 dbQueue.start(observation) -> observation.start(in: dbQueue) 2018-10-29 19:31:04 +01:00
Gwendal Roué 6f86cbf0c4 Documentation 2018-10-29 18:48:16 +01:00
Gwendal Roué f68b1cd2c3 Documentation 2018-10-29 18:44:48 +01:00
Gwendal Roué 53f98a7bf6 Documentation 2018-10-29 18:42:04 +01:00
Gwendal Roué 77de519fcc More tests for read/write observations 2018-10-29 18:40:12 +01:00
Gwendal Roué 739c325079 Documentation 2018-10-29 18:34:11 +01:00
Gwendal Roué 10650704b5 Documentation (todo: document error handling) 2018-10-29 18:32:54 +01:00
Gwendal Roué 735394669d Documentation 2018-10-29 18:28:10 +01:00
Gwendal Roué 4e40d755f4 Documentation 2018-10-29 18:26:27 +01:00
Gwendal Roué e5f43e341b ValueScheduling.unsafe guarantees that initial value is notified on the dispatch queue which starts the observation 2018-10-29 18:23:38 +01:00
Gwendal Roué 72c5769e8b ValueScheduling.unsafe 2018-10-29 13:59:02 +01:00
Gwendal Roué 669b9c4e91 Test for the ValueReducer documented in README 2018-10-29 13:31:42 +01:00
Gwendal Roué a489959780 Typo 2018-10-29 13:10:04 +01:00
Gwendal Roué 1985b9129a Fix SPM build 2018-10-29 13:09:56 +01:00
Gwendal Roué f7712473aa Move Sequence.allSatisfy where it is used: tests 2018-10-29 12:27:39 +01:00
Gwendal Roué f582683f20 Move remove(transactionObserver:) to DatabaseReader 2018-10-29 12:26:12 +01:00
Gwendal Roué a4b35729df Documentation 2018-10-29 12:22:16 +01:00
Gwendal Roué 191607fc13 Documentation 2018-10-29 09:18:29 +01:00
Gwendal Roué 5a540e8850 Documentation 2018-10-29 09:16:42 +01:00
Gwendal Roué f59dba711c Try with "tracking" 2018-10-29 09:15:18 +01:00
Gwendal Roué 93326307fa Documentation 2018-10-29 09:00:15 +01:00
Gwendal Roué 8d6ec6297a Backport Sequence.allSatisfy in Swift 4.1 2018-10-29 08:52:59 +01:00
Gwendal Roué 1d47853abe Documentation 2018-10-29 08:47:51 +01:00
Gwendal Roué 38e4027599 Documentation 2018-10-29 08:41:22 +01:00
Gwendal Roué 29b54dd37d Documentation 2018-10-29 08:17:35 +01:00
Gwendal Roué 03d2bc43ac Documentation 2018-10-29 08:07:28 +01:00
Gwendal Roué 22ed0fb1a1 Documentation 2018-10-29 08:00:39 +01:00
Gwendal Roué 489454b0d4 add(observation:observation) -> start(observation) 2018-10-29 07:19:36 +01:00
Gwendal Roué 840f8358b5 Documentation 2018-10-29 06:51:56 +01:00
Gwendal Roué 470e1534dc Documentation 2018-10-28 22:29:15 +01:00
Gwendal Roué 158177364b Documentation 2018-10-28 22:04:39 +01:00
Gwendal Roué de2823b613 ValueObservation: StatementColumnConvertible tests 2018-10-28 19:28:19 +01:00
Gwendal Roué 0d5adfe5a9 ValueObservation: FetchableRecord & DatabaseValueConvertible tests 2018-10-28 19:16:55 +01:00
Gwendal Roué 0010be4e56 ValueObservation: row tests 2018-10-28 18:40:21 +01:00
Gwendal Roué 62f6cfe6b5 ValueObservation: count tests 2018-10-28 17:41:18 +01:00
Gwendal Roué 31e6ddeac3 ValueObservation: test scheduling 2018-10-28 17:32:31 +01:00
Gwendal Roué f2c3c213cc Read-only observation is enforced. When not read-only, savepoint is enforced. 2018-10-28 17:04:36 +01:00
Gwendal Roué f303664808 Cleanup 2018-10-28 16:20:57 +01:00
Gwendal Roué 471808fa3b More ValueObseervation tests: fetch, with and without uniquing 2018-10-28 16:13:58 +01:00
Gwendal Roué cbe505f4a4 Cleanup 2018-10-28 16:13:34 +01:00
Gwendal Roué 087989fc89 More ValueObseervation tests: extent 2018-10-28 15:57:27 +01:00
Gwendal Roué a519a4ab86 Documentation 2018-10-28 15:38:01 +01:00
Gwendal Roué 627e8ec969 Fix wrong documentation 2018-10-28 15:35:25 +01:00
Gwendal Roué 2b78479a5e More ValueReducer tests: error 2018-10-28 15:32:55 +01:00
Gwendal Roué e0a9cced4a First tests for ValueObservation: focus on reducers 2018-10-28 13:27:43 +01:00
Gwendal Roué 26ba5768b2 whitespace 2018-10-28 13:26:40 +01:00
Gwendal Roué 09581c6ae0 ValueObservation factory requires a DatabaseRegionConvertible. Introduce AnyDatabaseRegionConvertible. 2018-10-28 11:45:49 +01:00
Gwendal Roué fc3aca792f Replace InitialDispatch with ValueScheduling 2018-10-28 11:28:31 +01:00
Gwendal Roué a043c4c29e QoS are hard 2018-10-27 23:01:24 +02:00
Gwendal Roué ec5451ee70 Cleanup 2018-10-27 17:18:03 +02:00
Gwendal Roué 7c4462641e ValueObservation creation is always done with a factory initializer 2018-10-27 17:16:03 +02:00
Gwendal Roué 82efe7ca23 AnyValueReducer 2018-10-27 17:06:23 +02:00
Gwendal Roué 052d2e3008 Value (string, int, etc.) observation, with uniquing 2018-10-27 16:41:42 +02:00
Gwendal Roué de227bdce1 Bake uniquing right into ValueObservation: introduce ValueReducer 2018-10-27 16:12:42 +02:00
Gwendal Roué 697b2af61d Wrap long lines 2018-10-27 05:11:19 +02:00
Gwendal Roué ff4f6f3b12 Cleanup 2018-10-27 04:59:24 +02:00
Gwendal Roué 31b688d801 ValueObservationn has a QoS 2018-10-27 04:24:17 +02:00
Gwendal Roué f694437f5b Add missing public qualifiers 2018-10-27 04:23:45 +02:00
Gwendal Roué 69853d7901 Now that user implementations of DatabaseWriter are no longer supported...
...stop pretending we have to implement concurrentRead
on top of the deprecated readFromCurrentState.

And this fixes #419 :-)
2018-10-26 16:53:30 +02:00
Gwendal Roué abe6957c85 Typo 2018-10-26 16:42:27 +02:00
Gwendal Roué 08b103f5f5 DatabaseReader and DatabaseWriter are no longer available for user types
- stop testing compatibility with user types
- document that they are no longer available for user types (readme, changelog)
2018-10-26 16:42:14 +02:00
Gwendal Roué 9c71356e3d Honor ValueObservation.readonly 2018-10-26 09:10:26 +02:00
Gwendal Roué 2341523c41 API cleanup 2018-10-26 08:50:59 +02:00
Gwendal Roué 0df4815086 Move ValueObservation support to DatabaseReader 2018-10-25 20:39:04 +02:00
Gwendal Roué fe0f238f32 Cleanup 2018-10-25 08:49:57 +02:00
Gwendal Roué fda04a105d ValueObservation: extract callbacks 2018-10-25 08:39:52 +02:00
Gwendal Roué e5d97c15ad Looking for a good API 2018-10-25 08:05:55 +02:00
Gwendal Roué ce95ff7278 Move towards observation from reader 2018-10-24 19:17:11 +02:00
Gwendal Roué 33927e7f4d FetchResultsObserver 2018-10-23 13:24:46 +02:00
Gwendal Roué 6a4d9fb8fc Merge pull request #431 from KyleLeneau/codeable-json-sync-playground
Working on a Codable JSON sync example
2018-10-17 19:14:49 +02:00
Kyle LeNeau cf33d78f49 Working on a Codable JSON sync example 2018-10-14 12:49:37 -07:00
Gwendal Roué 0d89aa911b Documentation 2018-10-09 08:35:17 +02:00
Gwendal Roué d521a99d87 Typo fix 2018-10-09 08:10:56 +02:00
Gwendal Roué a848d864ce Documentation 2018-10-08 21:59:04 +02:00
Gwendal Roué 759c1088a1 v3.4.0 2018-10-08 21:37:58 +02:00
Gwendal Roué 2d004a1a26 Merge branch 'development' 2018-10-08 21:22:10 +02:00
Gwendal Roué 35e1de495e Merge pull request #428 from groue/feature/SQLite-3.25.2
Upgrade custom SQLite builds to version 3.25.2
2018-10-08 21:19:51 +02:00
Gwendal Roué 697709c82f thank you note 2018-10-08 19:19:45 +02:00
Gwendal Roué 9ad476235d CHANGELOG 2018-10-08 19:17:02 +02:00
Gwendal Roué dadc5c3c58 Fix a test for syntax error that fails with SQLite 3.25.2 2018-10-08 19:16:54 +02:00
Gwendal Roué 3be3a51cdc Fix a compiler warning 2018-10-08 19:13:12 +02:00
Gwendal Roué 7bdbfb77dd Upgrade SQLite version in documentation 2018-10-08 19:11:24 +02:00
Gwendal Roué 8e0c01ef70 SQLite 3.25.2 2018-10-08 19:03:41 +02:00
Gwendal Roué 1c5cecf568 Merge pull request #423 from groue/feature/annotation
Association Aggregates
2018-10-08 13:59:14 +02:00
Gwendal Roué 9330468f92 Documentation 2018-10-08 09:10:48 +02:00
Gwendal Roué fcbea047cc Documentation 2018-10-08 09:08:37 +02:00
Gwendal Roué 619b73ea76 Documentation 2018-10-08 09:04:14 +02:00
Gwendal Roué 597d745e37 Documentation 2018-10-08 09:02:53 +02:00
Gwendal Roué 52ffb4a02c Documentation 2018-10-08 08:59:56 +02:00
Gwendal Roué c007c04afb Documentation 2018-10-08 08:58:21 +02:00
Gwendal Roué 4b92968912 Documentation 2018-10-08 08:56:36 +02:00
Gwendal Roué 2938a95270 Inline documentation 2018-10-08 08:24:14 +02:00
Gwendal Roué 5b2e9cdaa5 Fix link 2018-10-07 20:01:39 +02:00
Gwendal Roué 5736cd2740 CHANGELOG 2018-10-07 19:59:35 +02:00
Gwendal Roué 6b05617d8d Documentation 2018-10-07 19:10:37 +02:00
Gwendal Roué 58470fa959 Documentation 2018-10-07 18:50:50 +02:00
Gwendal Roué 43c04268ee Documentation 2018-10-07 18:47:21 +02:00
Gwendal Roué 3ba8d7ae60 Documentation 2018-10-07 18:45:17 +02:00
Gwendal Roué 97c22cde40 Documentation 2018-10-07 18:26:10 +02:00
Gwendal Roué 8a983274af Documentation 2018-10-07 18:25:33 +02:00
Gwendal Roué 445ec18d6e Documentation 2018-10-07 18:20:22 +02:00
Gwendal Roué a441b1d24d Documentation 2018-10-07 18:18:51 +02:00
Gwendal Roué 23743680d2 Documentation 2018-10-07 18:11:52 +02:00
Gwendal Roué afaabfe872 Documentation 2018-10-07 18:09:53 +02:00
Gwendal Roué 53114ea491 Documentation 2018-10-07 18:05:41 +02:00
Gwendal Roué 12745b2882 Documentation 2018-10-07 18:03:38 +02:00
Gwendal Roué 19291e2501 Documentation 2018-10-07 17:55:49 +02:00
Gwendal Roué 3890d2659f Documentation 2018-10-07 17:51:51 +02:00
Gwendal Roué 68a8592bcd Documentation 2018-10-07 17:42:55 +02:00
Gwendal Roué 445187c276 Documentation 2018-10-07 17:37:55 +02:00
Gwendal Roué 55707e67d4 Documentation 2018-10-07 17:31:58 +02:00
Gwendal Roué 82435db722 Documentation 2018-10-07 17:29:59 +02:00
Gwendal Roué a47a0c9d2d Typo 2018-10-07 17:17:41 +02:00
Gwendal Roué 5a24726cf1 Documentation 2018-10-07 17:08:24 +02:00
Gwendal Roué 7ecacaaccc Documentation 2018-10-07 16:34:49 +02:00
Gwendal Roué 704da35576 aliased(CodingKey), annotated(with: aggregate, ...), count and isEmpty are now properties 2018-10-07 16:20:13 +02:00
Gwendal Roué 2774aaf292 aggregate alias cleanup 2018-10-07 15:40:38 +02:00
Gwendal Roué 8ffeb28b02 Tests for association aggregate operators 2018-10-07 15:20:24 +02:00
Gwendal Roué 5f92209c59 AssociationAggregates: logic, arithmetic, and comparison operators 2018-10-07 12:22:48 +02:00
Gwendal Roué 4f8e97a07c AssociationAggregate is now generic on its anchor type only 2018-10-07 12:08:25 +02:00
Gwendal Roué 39bc140dc8 Rename Annotation to AssociationAggregate 2018-10-07 11:39:46 +02:00
Gwendal Roué 0838d5903e Documentation 2018-10-06 15:46:47 +02:00
Gwendal Roué a0cd603c61 Nicer SQL generation for isEmpty annotation 2018-10-06 14:50:08 +02:00
Gwendal Roué 3ef8083043 testAnnotationWithJoiningMethodAndTableAliasAndSQLSnippet 2018-10-06 14:29:48 +02:00
Gwendal Roué 35ed13c940 Test for annotations in HAVING clauses 2018-10-06 14:15:35 +02:00
Gwendal Roué 1da41c7fe5 TODO 2018-10-05 18:50:34 +02:00
Gwendal Roué 01069ee998 fix typo 2018-10-05 18:50:34 +02:00
Gwendal Roué ebbf858da4 Documentation 2018-10-05 18:50:34 +02:00
Gwendal Roué 047a95f2c9 Improve sample code 2018-10-05 18:50:34 +02:00
Gwendal Roué 7508811e40 Fix typo 2018-10-05 18:50:34 +02:00
Gwendal Roué 2ae8e236c0 Aggregates are no longer a missing association feature :-) 2018-10-05 18:50:34 +02:00
Gwendal Roué a13903e7a1 Documentation 2018-10-05 18:50:34 +02:00
Gwendal Roué c25bc1d5fa Documentation 2018-10-05 18:50:34 +02:00
Gwendal Roué d004372b63 More cleanup 2018-10-05 18:50:34 +02:00
Gwendal Roué 789248e369 minor 2018-10-05 18:50:34 +02:00
Gwendal Roué 3404cc574b CHANGELOG 2018-10-05 18:50:34 +02:00
Gwendal Roué 2ca049c2e4 Cleanup 2018-10-05 18:50:34 +02:00
Gwendal Roué 89054c8165 typo 2018-10-05 18:50:34 +02:00
Gwendal Roué 24e8ee2d00 Stabilize annotation aliases, and allow aggregate any expression 2018-10-05 18:50:34 +02:00
Gwendal Roué f69c79bc1a typo 2018-10-05 18:50:34 +02:00
Gwendal Roué 82765aba1d typo 2018-10-05 18:50:34 +02:00
Gwendal Roué bcc177ff7d typo 2018-10-05 18:50:34 +02:00
Gwendal Roué 3bfef630f9 typo 2018-10-05 18:50:34 +02:00
Gwendal Roué 6a6d58da6c typo 2018-10-05 18:50:34 +02:00
Gwendal Roué 6e7065de36 Annotation documentation 2018-10-05 18:50:34 +02:00
Gwendal Roué f60152ed2e Add Inflections.swift to GRDBWatchOS 2018-10-05 18:50:34 +02:00
Gwendal Roué f6b0c0cc65 Rename test 2018-10-05 18:50:34 +02:00
Gwendal Roué c16b2bcb57 The count annotation has to be distinct 2018-10-05 18:50:34 +02:00
Gwendal Roué 5d70ef93c8 Test that filter(key:), orderByPrimaryKey(), and groupByPrimaryKey() capture the table name 2018-10-05 18:50:34 +02:00
Gwendal Roué 68d76eca01 Annotations: avg, min, max, sum 2018-10-05 18:50:33 +02:00
Gwendal Roué 83453e1b11 Make private a test helper class 2018-10-05 18:50:33 +02:00
Gwendal Roué 903694d095 First annotation: HasManyAssociaton.count 2018-10-05 18:50:33 +02:00
Gwendal Roué 168d2850ab Introduce groupByPrimaryKey() 2018-10-05 18:50:33 +02:00
Gwendal Roué fc692bdb8a Merge pull request #427 from groue/feature/cursor-reset
Have cursors reset SQLite statements in deinit
2018-10-05 12:23:08 +02:00
Gwendal Roué d963e688be CHANGELOG 2018-10-05 08:24:34 +02:00
Gwendal Roué 6157ab0583 Have cursors reset their statement when they are deinitialized
This is the real fix for #424. GRDB used to keep unfinished SQLite statements around. Now cursors properly reset their statement when they are done. We no longer have to clear the statement cache before a backup.
2018-10-05 08:13:23 +02:00
Gwendal Roué ad61c72988 Remove two invalid tests that use cursor outside of their protected dispatch queue 2018-10-05 08:04:37 +02:00
Gwendal Roué dd4b651938 Merge pull request #425 from groue/feature/robust-backup
Fix "destination database is in use " error during database backup
2018-10-04 15:59:43 +02:00
Gwendal Roué 7cd50872cf Merge branch 'master' into development 2018-10-04 13:40:43 +02:00
Gwendal Roué fc5e92954b SQLCipher, too, can't erase a database if there are cached prepared statements. 2018-10-04 13:34:35 +02:00
Gwendal Roué 6c7ac25fb8 Remove Carthage from suggested contributions (#408 and #262 have helped a lot) 2018-10-04 13:20:51 +02:00
Gwendal Roué 86cff20f99 New suggested contribution: "Records: Splitting Database Encoding from Ability to Write in the Database" 2018-10-04 13:14:29 +02:00
Gwendal Roué 7a628bf23f Add minimal failing test for #424 2018-10-04 08:35:02 +02:00
Gwendal Roué 9e8d08f579 CHANGELOG 2018-10-04 07:59:50 +02:00
Gwendal Roué 8c3606fe4b Fix failing test for #424 2018-10-04 07:58:36 +02:00
Gwendal Roué 01c9e9e1e1 Failing test for #424 2018-10-03 13:55:55 +02:00
Gwendal Roué ff28c02f21 Merge branch 'master' into development 2018-10-03 13:00:02 +02:00
Gwendal Roué 1426c7fd38 New suggested contribution: Custom FTS5 Auxiliary Functions 2018-10-03 12:57:21 +02:00
Gwendal Roué 366460bc62 Merge pull request #422 from groue/feature/AssociationMerge
Refining Association Requests
2018-09-30 16:39:33 +02:00
Gwendal Roué 16c62999fa More merging tests (and fix a bug with ordering) 2018-09-30 15:10:54 +02:00
Gwendal Roué 2cd3a7e0c9 High-level test for association request refining
Here we test the sample code in AssociationBasics.md
2018-09-30 14:51:52 +02:00
Gwendal Roué 9958e7b96c Documentation and cleanup 2018-09-30 13:57:31 +02:00
Gwendal Roué 8319c70315 CHANGELOG 2018-09-30 13:32:44 +02:00
Gwendal Roué 45ff5f2fa1 One less known issue with associations :-) 2018-09-30 13:23:35 +02:00
Gwendal Roué df51d2887a Documentation tweaks 2018-09-30 13:22:05 +02:00
Gwendal Roué 9c37237f7b New "Refining Association Requests" documentation chapter 2018-09-30 13:16:57 +02:00
Gwendal Roué 6ecb7a40d0 associations are not merged when they don't have the same key 2018-09-30 06:48:20 +02:00
Gwendal Roué 52ec6c6cd2 Merge associations: 2018-09-30 06:35:15 +02:00
Gwendal Roué ba11d7be66 Merge associations: SQL tests 2018-09-30 05:46:44 +02:00
Gwendal Roué 4c58fd5111 Merge associations: scope tests WIP 2018-09-29 20:28:28 +02:00
Gwendal Roué 4bde81db4f Merge associations: scope tests WIP 2018-09-29 15:18:53 +02:00
Gwendal Roué 37a9999b35 Merge associations: including wins over joining 2018-09-29 14:37:53 +02:00
Gwendal Roué 33b40637a8 Merge associations 2018-09-29 14:16:56 +02:00
Gwendal Roué e7fd075936 Early detection of association key conflict 2018-09-29 12:40:11 +02:00
Gwendal Roué cc4a9fa2e2 Demo screenshot fixes 2018-09-23 15:48:41 +02:00
Gwendal Roué 56f3bdc390 Demo screenshot fixes 2018-09-23 15:48:08 +02:00
Gwendal Roué ba5537692f Demo screenshot fixes 2018-09-23 15:47:18 +02:00
Gwendal Roué 5595046341 Fix documentation 2018-09-23 12:39:21 +02:00
Gwendal Roué ad844f6ba5 Merge branch 'development' 2018-09-23 10:41:13 +02:00
Gwendal Roué baf8dbc881 v3.3.1 2018-09-23 10:39:55 +02:00
Gwendal Roué ad672395de Fix screenshot 2018-09-23 10:18:28 +02:00
Gwendal Roué 923fab769f final tweaks 2018-09-23 09:59:29 +02:00
Gwendal Roué 4e3dc03422 inner links 2018-09-23 07:09:37 +02:00
Gwendal Roué d96212ca59 CHANGELOG 2018-09-22 20:46:13 +02:00
Gwendal Roué d16022a33a README 2018-09-22 20:38:27 +02:00
Gwendal Roué 5cb22125aa README 2018-09-22 20:35:14 +02:00
Gwendal Roué 6ee77df2dd Layout 2018-09-22 20:31:03 +02:00
Gwendal Roué ea54b06e28 Layout 2018-09-22 20:30:27 +02:00
Gwendal Roué 6b33c08b26 Demo app README 2018-09-22 15:01:22 +02:00
Gwendal Roué cb16bf549f Demo app README 2018-09-22 14:57:22 +02:00
Gwendal Roué 9a8b60a8a7 PlayerEditionViewController saves in the database 2018-09-22 14:55:32 +02:00
Gwendal Roué dec965d610 Demo app README 2018-09-22 14:06:00 +02:00
Gwendal Roué adf3e65971 Demo app README 2018-09-22 14:01:45 +02:00
Gwendal Roué c437e4a2ef Demo app README 2018-09-22 13:47:38 +02:00
Gwendal Roué 4dd9d2e1fe Demo app README.md 2018-09-22 13:46:37 +02:00
Gwendal Roué 185c3cbbf9 Update documentation inner links 2018-09-22 13:41:46 +02:00
Gwendal Roué ffbf4d2c87 Layout 2018-09-22 13:34:41 +02:00
Gwendal Roué 464cd0db7d Layout 2018-09-22 13:32:53 +02:00
Gwendal Roué e2e00f9b40 Layout 2018-09-22 13:30:16 +02:00
Gwendal Roué 2c2c75b0f4 Layout 2018-09-22 13:29:47 +02:00
Gwendal Roué 8ef7547c8e Promote demo app in main README.md 2018-09-22 13:21:11 +02:00
Gwendal Roué d82daaa398 CHANGELOG 2018-09-22 13:00:34 +02:00
Gwendal Roué a5a8b2ac40 Fix failing test for custom FTS5 tokenizer in DatabasePool
Tokenizer are now added to new reader connections.
2018-09-22 13:00:34 +02:00
Gwendal Roué bdcbee37f4 Failing test for custom FTS5 tokenizer in DatabasePool 2018-09-22 13:00:34 +02:00
Gwendal Roué 70508f5daa Split long line 2018-09-22 12:59:50 +02:00
Gwendal Roué 3c44180c47 PlayerEditionViewController UI tweaks 2018-09-22 12:54:25 +02:00
Gwendal Roué 3d179acc00 Demo app code cleanup
- Make Player columns private
- Simplify view controllers relationships
2018-09-22 12:32:55 +02:00
Gwendal Roué dd9ca2317c More SQL generation ideas 2018-09-20 08:22:34 +02:00
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
Gwendal Roué 0dabd36123 v3.2.0 2018-07-08 13:23:40 +02:00
Gwendal Roué 8a83ee4599 Travis: use Xcode 9.4 2018-07-08 12:22:53 +02:00
Gwendal Roué 29e720c474 DONE: #378 2018-07-08 12:17:38 +02:00
Gwendal Roué 444f5b003f Merge branch 'master' of github.com:groue/GRDB.swift into development 2018-07-08 12:17:06 +02:00
Gwendal Roué 3e60b00bab Merge pull request #381 from groue/feature/378-nuking-db-during-development
Nuking db during development
2018-07-08 06:31:30 +02:00
Gwendal Roué fc2c2658b7 DatabaseWriterTests.testEraseAndVacuum: use auto increment so we can test database erasure with internal SQLite objects 2018-07-07 17:53:36 +02:00
Gwendal Roué fdef88d150 DatabaseWriterTests.testEraseAndVacuum: add a virtual table 2018-07-07 17:51:55 +02:00
Gwendal Roué 1a84a84bd1 Typo fix 2018-07-07 17:45:15 +02:00
Gwendal Roué 22006e2251 CHANGELOG 2018-07-07 17:43:42 +02:00
Gwendal Roué 3405585d60 Typo fix 2018-07-07 17:43:37 +02:00
Gwendal Roué 91d0a453da DatabaseWriter.erase(): more robust error handling 2018-07-07 17:43:26 +02:00
Gwendal Roué d814249c5a eraseDatabaseOnSchemaChange documentation 2018-07-07 17:34:44 +02:00
Gwendal Roué fc2d5419b3 CHANGELOG 2018-07-07 17:17:23 +02:00
Gwendal Roué 3593806685 Cleanup 2018-07-07 14:49:43 +02:00
Gwendal Roué e84b539de2 DatabaseWriter.erase(): don't mess with internal SQLite objects 2018-07-07 14:42:18 +02:00
Gwendal Roué fee4486d1b DatabaseMigrator.eraseDatabaseOnSchemaChange 2018-07-07 14:23:50 +02:00
Gwendal Roué a73be9c010 Fix databaseWriter.erase() with SQLCipher 2018-07-07 12:32:40 +02:00
Gwendal Roué 0bc25f8773 Tests for DatabaseQueue and DatabasePool erase and vacuum 2018-07-06 14:03:44 +02:00
Gwendal Roué a465f16ff7 databaseWriter.erase(), databaseWriter.vacuum() 2018-07-06 13:58:55 +02:00
Gwendal Roué 86d93b11dd Easier database backup invocation 2018-07-06 13:57:55 +02:00
Gwendal Roué f8aa5b7e21 Fix typo 2018-07-05 08:38:56 +02:00
Gwendal Roué 16184ae89b More documentation about invalid value conversions 2018-07-05 08:37:57 +02:00
Gwendal Roué af2a3ea827 More documentation about invalid value conversions 2018-07-05 08:31:58 +02:00
Gwendal Roué ca7df229fa Cleanup 2018-07-03 18:44:42 +02:00
Gwendal Roué f121c6b139 TODO.md: look at #378 2018-07-02 08:15:40 +02:00
Gwendal Roué 2a6f7b7588 Fix typo 2018-06-30 11:41:11 +02:00
Gwendal Roué a87d06d609 Add @bellebethcooper to the thank you notice 2018-06-30 11:40:16 +02:00
Gwendal Roué 7c85a973dc TODO (inspired by #377) 2018-06-30 11:22:50 +02:00
Gwendal Roué 97961f4374 Merge pull request #376 from bellebethcooper/patch-1
Typo fix
2018-06-30 07:11:24 +02:00
bellebethcooper 4436badbc8 Typo fix 2018-06-30 10:31:10 +10:00
Gwendal Roué 9060048044 PULL_REQUEST_TEMPLATE.md 2018-06-28 14:03:25 +02:00
Gwendal Roué 99566225f0 TODO.md 2018-06-28 13:38:09 +02:00
Gwendal Roué b4bd25decc Fix typo in GoodPracticesForDesigningRecordTypes.md 2018-06-25 13:35:52 +02:00
Gwendal Roué 0e94c7b44e Improve GoodPracticesForDesigningRecordTypes.md 2018-06-25 13:34:38 +02:00
Gwendal Roué c750fd7b1d v3.1.0 2018-06-17 15:23:53 +02:00
Gwendal Roué 0ed4491b46 Prepare for SE-0206 "Hashable Enhancements" 2018-06-17 15:23:23 +02:00
Gwendal Roué b4a3adafb1 Merge pull request #372 from groue/sqlite3.24.0
Upgrade custom SQLite builds to 3.24.0
2018-06-17 14:34:45 +02:00
Gwendal Roué 2e953221fa CHANGELOG 2018-06-15 08:26:13 +02:00
Gwendal Roué 1886ac5cfb Upgrade custom SQLite builds to 3.24.0 2018-06-15 08:21:52 +02:00
Gwendal Roué 7ed7196c48 Merge pull request #371 from groue/queueLabels
Database can have a label
2018-06-15 05:03:10 +02:00
Gwendal Roué 38b1e41aab Final tweaks to dispatch queue labels 2018-06-14 21:10:56 +02:00
Gwendal Roué 467819bdd5 Confiiguration.label documentation 2018-06-14 20:50:06 +02:00
Gwendal Roué e81e818305 Confiiguration.label documentation 2018-06-14 20:47:43 +02:00
Gwendal Roué 342dcc5094 Confiiguration.label is used to name dispatch queues 2018-06-14 20:26:34 +02:00
Gwendal Roué 8f89a2063e CHANGELOG 2018-06-14 13:45:44 +02:00
Gwendal Roué 2e80db8aed Database dispatch queues now have labels 2018-06-14 13:36:42 +02:00
Gwendal Roué 4e7fc83ad5 Add test for FTS4 compression/decompression (addresses #369) 2018-06-14 13:32:28 +02:00
Gwendal Roué 200f12a558 TODO 2018-06-13 07:48:56 +02:00
Gwendal Roué 5c1eea4c6f TODO 2018-06-13 07:48:56 +02:00
Gwendal Roué b73771fd6c Look for open issues first 2018-06-12 10:42:10 +02:00
Gwendal Roué a47f10cf07 Link to forums 2018-06-12 10:40:43 +02:00
Gwendal Roué 75d0643642 Improve AssociationsBasics.md 2018-06-11 08:20:05 +02:00
Gwendal Roué 732e0bd34b Improve AssociationsBasics.md 2018-06-11 08:15:09 +02:00
Gwendal Roué ac2cd485c8 Mini typo in GoodPracticesForDesigningRecordTypes.md 2018-06-08 05:54:27 +02:00
Gwendal Roué b967018390 Improve GoodPracticesForDesigningRecordTypes.md 2018-06-07 20:15:45 +02:00
Gwendal Roué df16c4856f Improve GoodPracticesForDesigningRecordTypes.md 2018-06-07 20:11:01 +02:00
Gwendal Roué 4e97b80274 Improve GoodPracticesForDesigningRecordTypes.md 2018-06-07 19:58:22 +02:00
Gwendal Roué 65b3e21e65 Another typo in GoodPracticesForDesigningRecordTypes.md 2018-06-07 19:54:59 +02:00
Gwendal Roué 5b97dea3c6 Mini typo in GoodPracticesForDesigningRecordTypes.md 2018-06-07 19:50:48 +02:00
Gwendal Roué 20322640c3 New Associations demo playground, and fix a few typos in GoodPracticesForDesigningRecordTypes.md 2018-06-07 19:37:31 +02:00
Gwendal Roué 89ce13c43c Documentation tweaks 2018-06-07 18:59:47 +02:00
Gwendal Roué 27e94c211d Upgrade SPM test app to v3.0.0 2018-06-07 13:53:16 +02:00
Gwendal Roué bca4af679e No more reference to the GRDB3 branch 2018-06-07 13:28:30 +02:00
Gwendal Roué cb7f827118 GRDB2MigrationGuide.md no longer refers to GRDB3 branch 2018-06-07 13:26:48 +02:00
Gwendal Roué 1bc4299bfc Fix bug in GRDBDemoiOS 2018-06-07 12:53:24 +02:00
Gwendal Roué 79c788e571 v3.0.0 2018-06-07 12:46:38 +02:00
Gwendal Roué 0125107855 Improve "Good Practices for Designing Record Types" 2018-06-07 11:42:45 +02:00
Gwendal Roué 24694b8b23 Merge branch 'GRDB3' into development 2018-06-07 08:49:36 +02:00
Gwendal Roué 0c79224209 Family gets bigger :-) 2018-06-07 08:39:55 +02:00
Gwendal Roué a88b5dc3df Append #334 to CHANGELOG 2018-06-07 08:36:29 +02:00
Gwendal Roué f259cac51f SQLiteDateParser: tighten vsscanf format 2018-06-07 08:36:29 +02:00
Gwendal Roué fe1146134b SQLiteDateParser: fix nanosecond parsing 2018-06-07 08:36:29 +02:00
Gwendal Roué 6dd4f1c666 More DatabaseDateComponents parsing tests 2018-06-07 08:36:29 +02:00
Gwendal Roué 4415681c92 SQLiteDateParser: don't parse garbage into nanoseconds 2018-06-07 08:36:29 +02:00
Gwendal Roué 5a0425a23c SQLiteDateParser: optimize nanoseconds parsing 2018-06-07 08:36:29 +02:00
Gwendal Roué 8729085528 Add a sanity check 2018-06-07 08:36:29 +02:00
Gwendal Roué 88cbbf5c5e Add missing imports (should fix travis issues) 2018-06-07 08:36:29 +02:00
Gwendal Roué 6816bceed0 No need for useScanfStrategy any longer 2018-06-07 08:36:29 +02:00
Gwendal Roué 76dc5e6b89 Cleanup 2018-06-07 08:36:29 +02:00
Gwendal Roué ee39a52069 New DateParsingTests in GRDBOSXPerformanceTests 2018-06-07 08:36:29 +02:00
Gwendal Roué 82482bdbf7 Date adopts StatementColumnConvertible 2018-06-07 08:36:29 +02:00
Gwendal Roué 062f916607 Documentation 2018-06-07 08:36:29 +02:00
Gwendal Roué 2b73c4f348 Check useScanfStrategy in DatabaseDateComponents.init(sqliteStatement:index:)
...so that we can eventually compare gains
2018-06-07 08:36:29 +02:00
Gwendal Roué 54b2135b74 DatabaseDateComponents adopts StatementColumnConvertible
We'll need benchmarks to evaluate the gain, here
2018-06-07 08:36:29 +02:00
Gwendal Roué bf3b4e7e02 SQLiteDateParser: parse C strings
Since the goal of this PR is efficiency, we'll soon parse Date and
DatabaseDateComponents right from raw SQLite buffers.
2018-06-07 08:36:29 +02:00
Gwendal Roué ad8b80bafd (whitespace) 2018-06-07 08:36:29 +02:00
Gwendal Roué 06476bc6fe SQLiteDateParser.components(from:) is not public 2018-06-07 08:36:29 +02:00
Gwendal Roué 0616209e58 SQLiteDateParser: no more static methods 2018-06-07 08:36:29 +02:00
Gwendal Roué 415f2971e5 SQLiteDateParser: use withUnsafeMutablePointer instead of allocations
OK, not really: the nanosecond components remains in the heap.
But we may find a way to put 11 chars on the stack.
2018-06-07 08:36:29 +02:00
Gwendal Roué 3a7b2cc4a2 SQLiteDateParser: get rid of the mutex 2018-06-07 08:36:29 +02:00
Gwendal Roué 726e40984a Add SQLiteDateParser.swift to GRDBCustom and GRDBCipher
... so that all GRDB flavors can use the new technique.
GRDB has three distinct projects since #282.
2018-06-07 08:36:29 +02:00
Matt Greenfield 63a68978f0 truncate nanosecond precision to 3 sig figs 2018-06-07 08:36:29 +02:00
Matt Greenfield 13d973dde4 Revert "fix the tests to expect less nanosecond precision loss"
This reverts commit eba5df1fcc.
2018-06-07 08:36:29 +02:00
Matt Greenfield 8f5ef76e7e Revert "permit precision loss down to 3 sig figs"
This reverts commit 3bcc5b8064.
2018-06-07 08:36:29 +02:00
Matt Greenfield 36ac5fa53e truncate date/time strings that include seconds precision beyond the nanosecond scale 2018-06-07 08:36:29 +02:00
Matt Greenfield cda891ca02 permit precision loss down to 3 sig figs 2018-06-07 08:36:29 +02:00
Matt Greenfield ff4447713a fix the tests to expect less nanosecond precision loss 2018-06-07 08:36:29 +02:00
Matt Greenfield 70190e2a23 not all nanosecond fractions have 3 sig figs, so can't hard code the acceptable string lengths 2018-06-07 08:36:29 +02:00
Matt Greenfield 2682dae34b 0.123 is not the same thing as 0.000123 2018-06-07 08:36:29 +02:00
Matt Greenfield 3a1e695a39 fractions of seconds are not the same thing as integer counts of nanoseconds 2018-06-07 08:36:29 +02:00
Matt Greenfield 604f80f6fa differentiate between SS and SS.SSS formats 2018-06-07 08:36:29 +02:00
Matt Greenfield 5c0b88eb82 return correct Format for partial date/time combinations 2018-06-07 08:36:29 +02:00
Matt Greenfield 7e39fbaba0 add SQLiteDateParser to project file 2018-06-07 08:36:29 +02:00
Matt Greenfield 815424770b initial scanf() based date string parser 2018-06-07 08:36:29 +02:00
Gwendal Roué 30fcd95f1d Change podspec description 2018-06-07 08:31:57 +02:00
Gwendal Roué 4637930027 Improve "Good Practices for Designing Record Types" 2018-06-06 17:09:03 +02:00
Gwendal Roué 729ec6714c Improve "Good Practices for Designing Record Types" 2018-06-06 17:08:42 +02:00
Gwendal Roué b2683eb864 Improve "Good Practices for Designing Record Types" 2018-06-06 17:04:42 +02:00
Gwendal Roué e7bcf7c7db Funny how time you have for tweaking stuff when you're waiting for a watch app to launch... 2018-06-06 16:15:44 +02:00
Gwendal Roué d1c47c3364 Improve "Good Practices for Designing Record Types" 2018-06-06 16:12:21 +02:00
Gwendal Roué 44140cb1db README.md 2018-06-06 15:01:59 +02:00
Gwendal Roué 4bc6a77588 README.md 2018-06-06 14:02:48 +02:00
Gwendal Roué edd294550f Revert "README.md"
This reverts commit 69c2077037.
2018-06-06 13:59:52 +02:00
Gwendal Roué 69c2077037 README.md 2018-06-06 13:59:07 +02:00
Gwendal Roué b3f1997049 README.md 2018-06-06 13:57:44 +02:00
Gwendal Roué c2e624c78d README.md 2018-06-06 13:52:55 +02:00
Gwendal Roué ff69d3fbc3 Merge pull request #365 from groue/GRDB3-DelayedOrdering
Delayed Request Ordering
2018-06-06 07:44:23 +02:00
Gwendal Roué 018fac8c57 CHANGELOG.md 2018-06-05 23:07:00 +02:00
Gwendal Roué 0b1bc80c41 Document orderByPrimaryKey 2018-06-05 22:53:05 +02:00
Gwendal Roué 7e6de4fbd0 Test TableRequest.orderByPrimaryKey() 2018-06-05 22:46:24 +02:00
Gwendal Roué fa31c484da OrderedRequest now waits for the database connection before ordering is computed 2018-06-05 22:46:02 +02:00
Gwendal Roué 2556fd041f Update Makefile for Xcode 9.4 2018-06-05 22:23:43 +02:00
Gwendal Roué e915d28cb2 Fix failing tests for Database.indexes(on:) and Database.foreignKeys(on:) 2018-06-05 14:38:59 +02:00
Gwendal Roué 60eb868fa5 Failing tests for Database.indexes(on:) and Database.foreignKeys(on:) 2018-06-05 14:38:47 +02:00
Gwendal Roué 6130c6f985 Who guessed String ordering would depend on Swift version? Fix a test so that it runs in both Swift 4.1 and Swift 4.2 2018-06-05 08:03:50 +02:00
Gwendal Roué b7f44785ec The SQL statement generated by record.update(db) lists columns in the same order as in the table definition (this fixes tests made flaky by SE-0206) 2018-06-05 08:02:54 +02:00
Gwendal Roué 8b44b0af7b Fix SerializedDatabase.reentrantSync check for unsafe transactions 2018-06-04 11:59:43 +02:00
Gwendal Roué caea11fbbb Database: a couple more asserts 2018-06-04 11:58:40 +02:00
Gwendal Roué c7f018c635 GoodPracticesForDesigningRecordTypes.md 2018-06-04 07:40:12 +02:00
Gwendal Roué b8328bd3bb GoodPracticesForDesigningRecordTypes.md 2018-06-03 18:37:00 +02:00
Gwendal Roué 0dd8fce854 GoodPracticesForDesigningRecordTypes.md 2018-06-03 18:34:27 +02:00
Gwendal Roué f8b7156b48 Simplify demo application 2018-06-03 13:23:31 +02:00
Gwendal Roué cfba53e586 Associations documentatiion 2018-05-31 22:54:13 +02:00
Gwendal Roué 003020dd29 Associations documentatiion 2018-05-31 22:52:32 +02:00
Gwendal Roué f2b46963bd minor 2018-05-31 22:35:58 +02:00
Gwendal Roué 62a434f898 Associations documentatiion 2018-05-31 22:21:00 +02:00
Gwendal Roué 16af4513d6 Associations documentatiion 2018-05-31 22:11:18 +02:00
Gwendal Roué ead89420c4 Avoid undefined behavior (UnsafePointer documentation is scary) 2018-05-31 17:37:46 +02:00
Gwendal Roué 88fac9e21d Merge pull request #362 from hartbit/scanf-buffer-overflow
Fix buffer overflow in vsscanf date parsing
2018-05-31 17:11:35 +02:00
David Hart d601e06f25 Fix buffer overflow in vsscanf date parsing 2018-05-31 17:07:23 +02:00
Gwendal Roué 6cdcd97912 Associations documentation 2018-05-31 08:21:07 +02:00
Gwendal Roué 8a4fbcc725 Associations documentation: avoid explicit databaseTableName when possible 2018-05-31 08:19:49 +02:00
Gwendal Roué e9cbbe2903 Documentation 2018-05-28 14:25:08 +02:00
Gwendal Roué 366e049ddf Bring GRDBDemo to GRDB 3 2018-05-25 07:26:15 +02:00
Gwendal Roué 4e73c31662 Fix documentation typo 2018-05-24 23:05:59 +02:00
Gwendal Roué 0d2079df42 keypath-based expressions? 2018-05-24 05:56:29 +02:00
Gwendal Roué 318e7455e7 Update Package.swift for Swift 4.1 2018-05-24 05:56:03 +02:00
Gwendal Roué eb7c98c510 Fix GRDB3 SPM doc 2018-05-23 12:11:43 +02:00
Gwendal Roué ac955873f2 Improve documentation for persistable protocol choice 2018-05-23 08:36:29 +02:00
Gwendal Roué 051f0416a4 Extend the "thank you" notice 2018-05-23 08:19:40 +02:00
Gwendal Roué c96ed597ed Merge pull request #356 from pocketpixels/patch-1
Fixing type used in 'Demographics BelongsTo Country' example
2018-05-23 08:16:57 +02:00
Gwendal Roué 5ccf87802e Merge pull request #355 from groue/GRDB3-AutomaticTableName
Automatic table name generation
2018-05-23 06:27:38 +02:00
pocketpixels c93f3cda06 Fixed type used in 'Demographics BelongsTo Country' example
I am reading this for the first time, so I might be wrong, but I strongly suspect the type in the belongsTo() call should be Country?
2018-05-22 23:18:18 -04:00
Gwendal Roué 2e477feb33 TableRecord documentation 2018-05-22 23:51:19 +02:00
Gwendal Roué dcb626b32b TableRecord documentation 2018-05-22 23:48:01 +02:00
Gwendal Roué ce03deeccc Change log for default implementation for TableRecord.databaseTableName 2018-05-22 23:31:37 +02:00
Gwendal Roué 1213fa0a43 Document default implementation for TableRecord.databaseTableName 2018-05-22 23:18:33 +02:00
Gwendal Roué 76299d9302 Document default implementation for TableRecord.databaseTableName in GRDB2 Migration Guide 2018-05-22 22:58:15 +02:00
Gwendal Roué 7b59c097c6 Test for default implementation for TableRecord.databaseTableName 2018-05-22 22:43:01 +02:00
Gwendal Roué af8971bcd8 Default implementation for TableRecord.databaseTableName 2018-05-22 22:14:18 +02:00
Gwendal Roué 5de7a5274e Remove useless #if swift(>=3.1) 2018-05-22 20:32:24 +02:00
Gwendal Roué e0a1ee4c10 Merge pull request #354 from fpillet/linux-support
Main framework compiles on Linux
2018-05-21 09:35:54 +02:00
Gwendal Roué cdf5462005 Harmonize fetching methods with CustomizedDecodingOfDatabaseRows playground 2018-05-21 08:39:48 +02:00
Gwendal Roué 86f084cb3e Fix DatabaseRegion inline documentation 2018-05-21 08:27:47 +02:00
Gwendal Roué 5d7245af2a Fix DatabaseRegion documentation formatting 2018-05-21 08:26:06 +02:00
Gwendal Roué cacc3e8456 Fix DatabasePool.makeSnapshot() documentation 2018-05-21 08:21:36 +02:00
Gwendal Roué 0620b1b513 Associations: inline documentation 2018-05-21 07:53:06 +02:00
Gwendal Roué 4eac0797fa Less TODO 2018-05-21 07:39:30 +02:00
Gwendal Roué 07176e941b Associations: inline documentation 2018-05-21 07:35:25 +02:00
Gwendal Roué dadece1b04 Associations: inline documentation 2018-05-20 19:35:18 +02:00
Gwendal Roué b98992eb18 Associations: inline documentation 2018-05-20 19:05:45 +02:00
Gwendal Roué 0191d64f56 Associations: inline documentation 2018-05-20 18:55:14 +02:00
Gwendal Roué 02d5b9c014 Associations: inline documentation 2018-05-20 18:13:34 +02:00
Gwendal Roué aa81b992c4 Associations: inline documentation 2018-05-20 17:48:22 +02:00
Gwendal Roué 9be001533c Fix inner link 2018-05-20 16:16:02 +02:00
Gwendal Roué 7be345521b Associations: new "DerivableRequest Protocol" documentation chapter 2018-05-20 16:14:23 +02:00
Gwendal Roué 67e48f8ad7 CustomizedDecodingOfDatabaseRows 2018-05-20 15:45:59 +02:00
Florent Pillet c0bd8ce917 Rolled back to previous NSUUID extension as compiler freaks out on a more modern implementation 2018-05-20 14:37:59 +02:00
Florent Pillet da65deec69 Removed LinuxMain.swift 2018-05-20 14:21:41 +02:00
Florent Pillet 34db8efea0 Added missing LinuxMain.swift 2018-05-20 00:44:59 +02:00
Florent Pillet df8887be05 Fix NSUUID compilation issue (now using more Swift code) 2018-05-20 00:27:02 +02:00
Florent Pillet 55472c2d7f Main framework compiles on Linux 2018-05-19 18:52:35 +02:00
Gwendal Roué 2a1c87f24a Link to "Customized Decoding of Database Rows" from the "Custom Requests" chapter 2018-05-19 18:45:13 +02:00
Gwendal Roué 88c4f02f5d Fix typo 2018-05-19 18:04:55 +02:00
Gwendal Roué 3017668ba2 Fix typo 2018-05-19 13:58:57 +02:00
Gwendal Roué 4f5fdf45e8 More reasons not to fear leaving FetchableRecord 2018-05-19 13:27:24 +02:00
Gwendal Roué 6037c418cb New "Customized Decoding of Database Rows" documentation chapter 2018-05-19 12:52:51 +02:00
Gwendal Roué 785853dd2b Move the Custom Value Types chapter 2018-05-19 12:28:52 +02:00
Gwendal Roué 2ce2b4885d Rename playground 2018-05-19 12:26:38 +02:00
Gwendal Roué 5637514dd6 AlternateRowDecoder playground 2018-05-19 12:25:35 +02:00
Gwendal Roué 0a3a8d738a AlternateRowDecoder playground 2018-05-18 19:20:03 +02:00
Gwendal Roué 1d1c7fc467 Merge branch 'GRDB3' of github.com:groue/GRDB.swift into GRDB3 2018-05-18 18:47:42 +02:00
Gwendal Roué 1f274f5c04 More AlternateRowDecoder playground 2018-05-18 18:47:12 +02:00
Gwendal Roué eddc078c2d Prepare AlternateRowDecoder playground 2018-05-18 14:29:03 +02:00
Gwendal Roué 5136142d83 Playgrounds documentation 2018-05-18 08:49:47 +02:00
Gwendal Roué 857798b939 Extend the "thank you" notice 2018-05-15 13:35:36 +02:00
Gwendal Roué 82d8fd65d0 Merge pull request #350 from fpillet/patch-1
Use `String(format: ...)`
2018-05-13 15:15:05 +02:00
Florent Pillet 2de040a6f1 Use String(format: ...)
... instead of `NSString(format: ...) as String`
2018-05-12 15:39:59 +02:00
Gwendal Roué aead6eec4a Sometimes you don't understand what you read because information is not given at the right time 2018-05-07 19:39:13 +02:00
Gwendal Roué 756863152c Fix documentation typos 2018-05-07 19:33:07 +02:00
Gwendal Roué c1c3233ba2 Remove two useless .init (thank you Xcode autocomplete) 2018-05-07 19:23:33 +02:00
Gwendal Roué 91ad986d0b Cleanup and add internal documentation for the non-trivial TableAlias 2018-05-07 19:17:19 +02:00
Gwendal Roué a35f012286 Cleanup 2018-05-07 17:50:27 +02:00
Gwendal Roué 56a0dab443 Typo 2018-05-07 09:10:50 +02:00
Gwendal Roué 69cf95e828 Typo 2018-05-06 20:03:28 +02:00
Gwendal Roué 56ae745851 Prepare v3.0.0-beta.1 release 2018-05-06 14:55:39 +02:00
Gwendal Roué 62f985469c Update WhyAdoptGRDB.md for GRDB3 2018-05-06 14:53:49 +02:00
Gwendal Roué a12bc2e90e Tweaks in GRDB2MigrationGuide.md 2018-05-06 14:44:32 +02:00
Gwendal Roué 402f9d3ba9 Tweaks in AssociationBasics.md 2018-05-06 14:43:44 +02:00
Gwendal Roué a360976e23 ForeignKey initializer accepts ColumnExpression 2018-05-06 14:15:12 +02:00
Gwendal Roué de6667a236 WIP: GRDB2MigrationGuide.md 2018-05-06 12:44:06 +02:00
Gwendal Roué 6db0831bfd fix links 2018-05-06 12:12:11 +02:00
Gwendal Roué 26607ba193 WIP: GRDB2MigrationGuide.md 2018-05-06 11:56:02 +02:00
Gwendal Roué 15299eaac0 WIP: GRDB2MigrationGuide.md 2018-05-06 11:53:19 +02:00
Gwendal Roué 9c9217727c WIP: GRDB2MigrationGuide.md 2018-05-06 11:10:42 +02:00
Gwendal Roué 6434f0cdb1 WIP: GRDB2MigrationGuide.md 2018-05-06 11:09:44 +02:00
Gwendal Roué 7a520f3269 WIP: GRDB2MigrationGuide.md 2018-05-06 10:55:39 +02:00
Gwendal Roué cc7cf597f3 WIP: GRDB2MigrationGuide.md 2018-05-06 10:50:14 +02:00
Gwendal Roué 0a6b34bb85 Merge pull request #348 from groue/GRDB3-RxGRDB
GRDB3 Support for RxGRDB
2018-05-06 10:08:44 +02:00
Gwendal Roué 175c96cd38 Update documentation of FetchRequest protocol 2018-05-06 10:03:07 +02:00
Gwendal Roué cce0e332e0 Update documentation of FetchRequest protocol 2018-05-06 10:01:10 +02:00
Gwendal Roué 214748fe5a DatabaseRegion.fullDatabase is public 2018-05-06 09:11:00 +02:00
Gwendal Roué dc7bdfed50 More fixits for DatabaseRegion 2018-05-05 12:02:50 +02:00
Gwendal Roué 2d008b8c54 Yet another request protocols update, in order to empower RxGRDB 2018-05-05 11:57:17 +02:00
Gwendal Roué 310c2637cb Merge pull request #347 from groue/GRDB3-DerivableRequest
Common API for requests and associations derivation
2018-05-05 11:56:59 +02:00
Gwendal Roué 264bceee2a Cleanup 2018-05-04 14:28:29 +02:00
Gwendal Roué cdad6fa313 Introduce DerivableRequest 2018-05-04 14:19:27 +02:00
Gwendal Roué babaefca8f WIP: GRDB2MigrationGuide.md 2018-05-04 10:48:56 +02:00
Gwendal Roué 6a4382c323 TODO 2018-05-04 08:32:51 +02:00
Gwendal Roué 231906e5ea WIP: GRDB2MigrationGuide.md 2018-05-03 10:17:38 +02:00
Gwendal Roué 1c9db9ec10 WIP: GRDB2MigrationGuide.md 2018-05-03 08:55:52 +02:00
Gwendal Roué 31e927f9da WIP: GRDB2MigrationGuide.md 2018-05-03 08:54:50 +02:00
Gwendal Roué 26b9030eaa WIP: GRDB2MigrationGuide.md 2018-05-03 08:53:19 +02:00
Gwendal Roué da38df6bd6 WIP: GRDB2MigrationGuide.md 2018-05-03 08:51:31 +02:00
Gwendal Roué ebb1eba96f WIP: GRDB2MigrationGuide.md 2018-05-03 08:34:02 +02:00
Gwendal Roué c7a1daa8e5 WIP: GRDB2MigrationGuide.md 2018-05-02 21:55:53 +02:00
Gwendal Roué 0aa75f418f WIP: GRDB2MigrationGuide.md 2018-05-02 21:27:03 +02:00
Gwendal Roué a5d56d38d6 WIP: GRDB2MigrationGuide.md 2018-05-02 20:03:56 +02:00
Gwendal Roué fa04627ece WIP: GRDB2MigrationGuide.md 2018-05-02 19:57:36 +02:00
Gwendal Roué 33ec30438d WIP: GRDB2MigrationGuide.md 2018-05-02 19:52:26 +02:00
Gwendal Roué e3ab3a991e WIP: GRDB2MigrationGuide.md 2018-05-02 18:47:34 +02:00
Gwendal Roué 287422f2f8 WIP: GRDB2MigrationGuide.md 2018-05-02 13:59:15 +02:00
Gwendal Roué e184963b8f WIP: GRDB2MigrationGuide.md 2018-05-02 13:40:33 +02:00
Gwendal Roué 06f9a4601c TODO 2018-05-02 07:43:16 +02:00
Gwendal Roué 7a30eb2613 Merge pull request #319 from groue/GRDB3-Associations
Associations & Joins
2018-05-01 21:48:06 +02:00
Gwendal Roué 5160b69c34 Merge branch 'GRDB3' into GRDB3-Associations 2018-05-01 21:47:44 +02:00
Gwendal Roué fa00b8ad99 Associations and Joins documentation 2018-05-01 21:44:43 +02:00
Gwendal Roué 1bf7f67008 Update inline documentation with singular table names 2018-05-01 20:32:18 +02:00
Gwendal Roué 872d6d21ac Update README.md with singular table names 2018-05-01 19:01:45 +02:00
Gwendal Roué ab36df6e0f Use "finalized" to describe queries that are ready for SQL generation 2018-05-01 17:42:39 +02:00
Gwendal Roué ffaabdfd62 Toward improved DatabaseRegion for joined requests 2018-05-01 17:20:37 +02:00
Gwendal Roué 8e2cdeebc3 Cleanup 2018-05-01 15:03:36 +02:00
Gwendal Roué a3189f79b6 StatementArguments: no more need for internal setters 2018-05-01 14:52:03 +02:00
Gwendal Roué 66a425f718 Thread-safe table name disambiguation, via SQLGenerationContext. Merge SQLTableQualifier into TableAlias. 2018-05-01 14:44:51 +02:00
Gwendal Roué 344eba821f Spot more qualifier/alias problems 2018-04-30 19:31:56 +02:00
Gwendal Roué 8d5e57873e Documentation 2018-04-30 15:33:16 +02:00
Gwendal Roué 9f78a758bd RowAdapter.addingScopes returns self if the scopes dictionary is empty 2018-04-30 14:04:07 +02:00
Gwendal Roué e6f084d397 Law of Demeter 2018-04-30 13:59:20 +02:00
Gwendal Roué 09458c1d37 Documentation, move asRequest(of:) to QueryInterfaceRequest in order to avoid AnyFetchRequest contamination 2018-04-30 13:41:20 +02:00
Gwendal Roué 9a379fc1bc Use DatabasePromise where relevant 2018-04-30 12:57:12 +02:00
Gwendal Roué a45d019472 Simplification
Rename AssociationMapping to JoinCondition
Replace AssociationMappingRequest enum with ForeignKeyJoinConditionRequest struct
Rename AssociationChainOperator to AssociationJoinOperator, and "chain" to "join"
2018-04-30 12:50:38 +02:00
Gwendal Roué 50dd846a36 Remove useless constraint on Association.LeftAssociated and Association.RightAssociated 2018-04-30 12:25:07 +02:00
Gwendal Roué dddeff458a none() is no longer a requirement of FilteredRequest 2018-04-30 09:02:05 +02:00
Gwendal Roué ae162a88c6 Upgrade .swift-version and Swift badge to 4.1 2018-04-30 08:57:10 +02:00
Gwendal Roué ccc259c25c Documentation 2018-04-30 08:55:16 +02:00
Gwendal Roué 5e7235307a Cleanup 2018-04-30 08:36:29 +02:00
Gwendal Roué 5747d1cff0 No more #if swift(>=4.1) 2018-04-30 08:26:23 +02:00
Gwendal Roué e05a64f1cb Cleanup 2018-04-30 08:11:16 +02:00
Gwendal Roué 83104769ef Conditional Conformance requires Swift 4.1 and Xcode 9.3+ 2018-04-29 19:21:10 +02:00
Gwendal Roué 39c5313738 Associations Documentation 2018-04-29 18:45:51 +02:00
Gwendal Roué d6f088609e Prevent chaining required association behind an optional one 2018-04-29 18:34:49 +02:00
Gwendal Roué 4586eb9a82 Associations Documentation 2018-04-29 18:27:59 +02:00
Gwendal Roué a16bd6b54e Associations Documentation 2018-04-29 18:18:33 +02:00
Gwendal Roué 3e46942f30 Associations 2018-04-29 18:16:39 +02:00
Gwendal Roué df79bb8ed8 whitespace 2018-04-28 10:36:58 +02:00
Gwendal Roué d6183a4745 Typo 2018-04-28 10:29:56 +02:00
Gwendal Roué bf470b5870 Documentation 2018-04-27 18:01:11 +02:00
Gwendal Roué 175656aa26 Documentation 2018-04-27 09:01:13 +02:00
Gwendal Roué 497295a0c6 Merge pull request #342 from groue/GRDB3-reversedCleanup
Reversing unordered requests
2018-04-26 19:45:27 +02:00
Gwendal Roué 0f21f886b4 Document that request.reversed() has no effect when request is not already ordered 2018-04-26 12:54:28 +02:00
Gwendal Roué f4382e6bcb Test that request.reversed() has no effect when request is not already ordered 2018-04-26 12:52:01 +02:00
Gwendal Roué 26108badd4 request.reversed() has no effect when request is not already ordered 2018-04-26 12:51:29 +02:00
Gwendal Roué 2ae93a2a0b Honor #337 2018-04-26 09:01:33 +02:00
Gwendal Roué d8860d2527 Typo 2018-04-26 08:27:37 +02:00
Gwendal Roué 40cfbd8c9c Update Documentation for the implicit transactions opened by the write method 2018-04-26 08:26:39 +02:00
Gwendal Roué 6dea09ec24 Typo 2018-04-26 08:05:57 +02:00
Gwendal Roué 8d84050f77 Typo 2018-04-26 07:58:06 +02:00
Gwendal Roué af8801c28a TODO 2018-04-26 07:45:16 +02:00
Gwendal Roué 58edfcbc99 Typo 2018-04-26 07:18:02 +02:00
Gwendal Roué 25748566ea No more obsolete string.characters in documentation 2018-04-26 07:14:57 +02:00
Gwendal Roué 66bd7cff77 Typo 2018-04-26 06:40:26 +02:00
Gwendal Roué d09afc8929 explicitely -> explicitly 2018-04-25 19:35:03 +02:00
Gwendal Roué 92f037eb74 Merge remote-tracking branch 'origin/master' into GRDB3 2018-04-25 19:32:44 +02:00
Gwendal Roué 7032bb6416 Typo 2018-04-25 11:28:43 +02:00
Gwendal Roué 433f4e828f TODO 2018-04-25 11:06:19 +02:00
Gwendal Roué 319baad70c Typo 2018-04-25 11:00:26 +02:00
Gwendal Roué 56d06d0889 Honor #337 2018-04-25 10:59:07 +02:00
Gwendal Roué 727491ca1a New usage section: database observation 2018-04-25 10:57:42 +02:00
Gwendal Roué bc57d67a91 Rewrite usage section with details HTML tags 2018-04-25 10:49:35 +02:00
Gwendal Roué 4754a9dbe0 Minor 2018-04-25 09:12:43 +02:00
Gwendal Roué c4bb84a88f Fix outdated documentation 2018-04-25 09:10:03 +02:00
Gwendal Roué 543c361f87 Enhance documentation 2018-04-25 09:06:29 +02:00
Gwendal Roué e5c4409ad4 Enhance documentation 2018-04-25 08:57:44 +02:00
Gwendal Roué 5fe609ae5c TODO 2018-04-24 09:32:07 +02:00
Gwendal Roué f1baa0503f #339 follow-up: extend the thank you notice :-) 2018-04-23 14:46:12 +02:00
Gwendal Roué 9d8015925d Merge pull request #339 from kluufger/patch-1
fix small typo in readme
2018-04-23 14:44:04 +02:00
Gwendal Roué 32ec7504e5 Merge pull request #340 from groue/GRDB3-SQLColumnExpression
ColumnExpression Protocol
2018-04-23 14:10:56 +02:00
kluufger 16513dc387 as -> at 2018-04-23 11:51:16 +00:00
kluufger 4804f78042 datase -> database 2018-04-23 11:20:47 +00:00
kluufger eae2c38e23 sharedApplication() -> shared 2018-04-23 11:06:17 +00:00
kluufger 7ffc2faa9a uppercase -> uppercased since later it's called as uppercased 2018-04-23 11:00:23 +00:00
kluufger 6f03d51390 fix link 2018-04-23 07:18:32 +00:00
Gwendal Roué 4409b07ef5 ColumnExpression documentation 2018-04-23 08:39:19 +02:00
Gwendal Roué 5ee390f0da No more support for CodingKey & ColumnExpression 2018-04-23 08:19:15 +02:00
kluufger 3aa5719600 identity -> identify 2018-04-22 21:01:12 +00:00
kluufger 70e6454c38 fix typo 2018-04-22 19:49:06 +00:00
Gwendal Roué d6f93afffe Update documentation in order to foster column enums 2018-04-22 19:10:10 +02:00
Gwendal Roué f2ae44384f Rename SQLColumnExpression to ColumnExpression 2018-04-22 18:13:47 +02:00
kluufger 3c290ed6e2 case-unsensitive -> case-insensitive 2018-04-22 15:59:17 +00:00
kluufger 85849a889f parent -> parents
not sure about this one, where do `(c, d)` come from?
2018-04-22 15:42:04 +00:00
kluufger 4993198266 no need for the ellipses 2018-04-22 15:38:05 +00:00
kluufger ee7b8f74d7 update db.create(table: "example") 2018-04-22 15:35:50 +00:00
kluufger 8fd321f823 add .unique() to email column 2018-04-22 15:12:46 +00:00
kluufger 0526994603 one more 2018-04-22 14:55:51 +00:00
kluufger 0688305f86 fix small typo in readme 2018-04-22 14:44:32 +00:00
Gwendal Roué e54ccdfc54 Tests for SQLColumnExpression 2018-04-22 14:56:51 +02:00
Gwendal Roué 29b364d5cb Introduce SQLColumnExpression 2018-04-22 14:56:40 +02:00
Gwendal Roué 71d602850e Typo 2018-04-22 13:49:13 +02:00
Gwendal Roué b590ee5444 Typo 2018-04-22 13:39:28 +02:00
Gwendal Roué db31a94461 Typo 2018-04-22 13:35:36 +02:00
Gwendal Roué 405b537ef2 Typo 2018-04-22 13:32:26 +02:00
Gwendal Roué 6722ea8676 Typo 2018-04-22 13:29:52 +02:00
Gwendal Roué d3879567c4 New "Examples of Record Definitions" chapter (addresses #338) 2018-04-22 13:26:40 +02:00
Gwendal Roué 4c6147fc37 Documentation 2018-04-22 12:05:11 +02:00
Gwendal Roué b2d2d17dda #330 follow-up: extract QualifiedAllColumns from AllColumns 2018-04-22 07:26:08 +02:00
Gwendal Roué 2dae6d945f #330 follow-up: extract QualifiedColumn from Column 2018-04-22 07:17:26 +02:00
Gwendal Roué ddc551626c Merge pull request #337 from groue/GRDB3-autoIncrementedPrimaryKey
Foster auto-incremented primary keys
2018-04-22 06:39:42 +02:00
Gwendal Roué 7aacaef2cd Foster autoIncrementedPrimaryKey in documentation 2018-04-21 20:11:34 +02:00
Gwendal Roué e80dab2ea9 Documentation for TableDefinition.autoIncrementedPrimaryKey 2018-04-21 19:42:27 +02:00
Gwendal Roué 822ff97050 Tests for TableDefinition.autoIncrementedPrimaryKey 2018-04-21 19:41:45 +02:00
Gwendal Roué 73e89f76aa Introduce TableDefinition.autoIncrementedPrimaryKey 2018-04-21 19:41:21 +02:00
Gwendal Roué c21a330dce Cleanup 2018-04-21 19:40:30 +02:00
Gwendal Roué b8fc762e11 Cleanup 2018-04-21 19:28:58 +02:00
Gwendal Roué e44249be1c Merge pull request #336 from groue/GRDB3-LogicalOperatorRefactoring
Enhancements to logical operators
2018-04-21 19:06:36 +02:00
Gwendal Roué f4ab65e399 Fix typo 2018-04-21 17:21:16 +02:00
Gwendal Roué d63565f191 Documentation for joined(operator:) 2018-04-21 17:17:46 +02:00
Gwendal Roué 729f6bdc6c Tests for joined(operator:) 2018-04-21 17:05:03 +02:00
Gwendal Roué c691625b15 Dedicated implementations for AND and OR sql operators. Introduce joined(operator:) 2018-04-21 16:53:44 +02:00
Gwendal Roué 4e57bf5a0e Fix a youth error: DatabaseDateComponents initializer from DateComponents is no longer failable 2018-04-21 15:27:21 +02:00
Gwendal Roué 223d0a3fd3 Merge remote-tracking branch 'origin/development' into GRDB3 2018-04-21 15:20:36 +02:00
Gwendal Roué 00fa47b6b7 Family gets bigger :-) 2018-04-21 15:04:54 +02:00
Gwendal Roué f52536f4ae Append #334 to CHANGELOG 2018-04-21 15:04:37 +02:00
Gwendal Roué 76e1d4381d Merge pull request #334 from sobri909/development
Improve date parsing performance and memory footprint
2018-04-21 14:49:13 +02:00
Gwendal Roué 6c5d6ba631 SQLiteDateParser: tighten vsscanf format 2018-04-21 10:37:03 +02:00
Gwendal Roué 1311f6c87c SQLiteDateParser: fix nanosecond parsing 2018-04-21 10:17:07 +02:00
Gwendal Roué 219f96a11a More DatabaseDateComponents parsing tests 2018-04-21 10:16:49 +02:00
Gwendal Roué 8b175280fa TODO 2018-04-21 07:40:11 +02:00
Gwendal Roué 632bce5521 SQLiteDateParser: don't parse garbage into nanoseconds 2018-04-20 19:41:34 +02:00
Gwendal Roué 316d28746b SQLiteDateParser: optimize nanoseconds parsing 2018-04-20 19:26:42 +02:00
Gwendal Roué 9efe4a6efa Add a sanity check 2018-04-20 19:18:46 +02:00
Gwendal Roué 85fbf64068 Add missing imports (should fix travis issues) 2018-04-20 19:17:24 +02:00
Gwendal Roué 282255b841 No need for useScanfStrategy any longer 2018-04-20 19:14:58 +02:00
Gwendal Roué 9e380e5fea Cleanup 2018-04-20 19:14:32 +02:00
Gwendal Roué f12495b24a New DateParsingTests in GRDBOSXPerformanceTests 2018-04-20 19:06:02 +02:00
Gwendal Roué 266040747e Date adopts StatementColumnConvertible 2018-04-20 18:42:12 +02:00
Gwendal Roué 11a4a6acbd Documentation 2018-04-20 18:41:58 +02:00
Gwendal Roué c70689fe54 Check useScanfStrategy in DatabaseDateComponents.init(sqliteStatement:index:)
...so that we can eventually compare gains
2018-04-20 18:34:19 +02:00
Gwendal Roué 936b31f1f0 DatabaseDateComponents adopts StatementColumnConvertible
We'll need benchmarks to evaluate the gain, here
2018-04-20 14:04:12 +02:00
Gwendal Roué 8915672ce5 SQLiteDateParser: parse C strings
Since the goal of this PR is efficiency, we'll soon parse Date and
DatabaseDateComponents right from raw SQLite buffers.
2018-04-20 13:51:20 +02:00
Gwendal Roué 0640f90fc1 (whitespace) 2018-04-20 13:32:50 +02:00
Gwendal Roué d1a0e8d906 SQLiteDateParser.components(from:) is not public 2018-04-20 13:31:57 +02:00
Gwendal Roué e9a668ca56 SQLiteDateParser: no more static methods 2018-04-20 13:31:35 +02:00
Gwendal Roué 27194c802d SQLiteDateParser: use withUnsafeMutablePointer instead of allocations
OK, not really: the nanosecond components remains in the heap.
But we may find a way to put 11 chars on the stack.
2018-04-20 13:30:26 +02:00
Gwendal Roué 7aabfeaeac SQLiteDateParser: get rid of the mutex 2018-04-20 13:09:22 +02:00
Gwendal Roué 6d9bce3a25 Add SQLiteDateParser.swift to GRDBCustom and GRDBCipher
... so that all GRDB flavors can use the new technique.
GRDB has three distinct projects since #282.
2018-04-20 13:08:17 +02:00
Gwendal Roué efa0e3850f GRDB3 TODO 2018-04-20 06:16:10 +02:00
Gwendal Roué 1e7e011a61 Merge pull request #335 from groue/GRDB3-RowLookup
Row scopes collection, breadth-first scope search
2018-04-20 06:00:52 +02:00
Gwendal Roué e45642b6c1 Cleanup 2018-04-19 21:48:12 +02:00
Gwendal Roué b550e2bfd5 Cleanup 2018-04-19 21:45:40 +02:00
Gwendal Roué 4b3854d05d Finally, the meat: perform breadth-first search in let record = row[key], and in FetchableRecord & Decodable 2018-04-19 20:46:58 +02:00
Gwendal Roué 0362ae76ea Rename Row.Scopes to Row.ScopesView. Move breadth-first lookup to a new view, row.scopesTree, of type Row.ScopesTreeView 2018-04-19 20:29:11 +02:00
Gwendal Roué 098c11baf2 Row.Scopes.lookup(_:) performs a breadth-first lookup of a scope name 2018-04-19 19:50:43 +02:00
Gwendal Roué 4e659c550e Rename RowScopes to Row.Scopes. Harmonize row derivation. 2018-04-19 19:18:02 +02:00
Gwendal Roué 9cb1bac2fc Update documentation for scoped rows 2018-04-19 14:46:23 +02:00
Gwendal Roué 33d65e85d8 Update documentation for scoped rows 2018-04-19 14:44:05 +02:00
Gwendal Roué 7e260cf537 Update tests for new Row.scopes view 2018-04-19 14:41:49 +02:00
Gwendal Roué 57932235ba Introduce RowScopes collection, a view of a row's scopes 2018-04-19 09:07:16 +02:00
Gwendal Roué 2daba261a2 GRDB3 TODO 2018-04-19 08:09:46 +02:00
Gwendal Roué 9a6daedd6d Cleanup 2018-04-18 07:31:11 +02:00
Matt Greenfield 3b546dedd8 truncate nanosecond precision to 3 sig figs 2018-04-17 15:17:09 +07:00
Matt Greenfield 7320f88066 Revert "fix the tests to expect less nanosecond precision loss"
This reverts commit eba5df1fcc.
2018-04-17 15:14:18 +07:00
Matt Greenfield bde72e562e Revert "permit precision loss down to 3 sig figs"
This reverts commit 3bcc5b8064.
2018-04-17 15:14:09 +07:00
Matt Greenfield 33066133fc truncate date/time strings that include seconds precision beyond the nanosecond scale 2018-04-17 14:32:33 +07:00
Matt Greenfield 3bcc5b8064 permit precision loss down to 3 sig figs 2018-04-17 13:20:11 +07:00
Matt Greenfield eba5df1fcc fix the tests to expect less nanosecond precision loss 2018-04-17 12:57:59 +07:00
Matt Greenfield dad163771f not all nanosecond fractions have 3 sig figs, so can't hard code the acceptable string lengths 2018-04-17 12:38:23 +07:00
Matt Greenfield bb59f5e6f7 0.123 is not the same thing as 0.000123 2018-04-17 11:05:47 +07:00
Matt Greenfield 7a1aa88edb fractions of seconds are not the same thing as integer counts of nanoseconds 2018-04-16 19:18:49 +07:00
Gwendal Roué a2c06c1bdb Cleanup 2018-04-16 14:05:36 +02:00
Gwendal Roué 2a2c5a772f Cleanup 2018-04-16 14:05:04 +02:00
Gwendal Roué 969fac5c4b Cleanup 2018-04-16 14:01:54 +02:00
Matt Greenfield b444d376f4 differentiate between SS and SS.SSS formats 2018-04-16 17:39:41 +07:00
Matt Greenfield 59d7909f50 return correct Format for partial date/time combinations 2018-04-16 17:21:00 +07:00
Matt Greenfield f5f8ab5971 add SQLiteDateParser to project file 2018-04-16 16:32:32 +07:00
Matt Greenfield 362c4baeca initial scanf() based date string parser 2018-04-16 14:02:15 +07:00
Gwendal Roué d39f02113c Restore T.fetchXXX(db, request) APIs which were removed in PR #311 2018-04-16 08:50:55 +02:00
Gwendal Roué c9dc1223dd Harmonize dbQueue.writer with dbPool.writer 2018-04-15 20:14:25 +02:00
Gwendal Roué ba848d2d53 Less TODO 2018-04-15 19:57:36 +02:00
Gwendal Roué 1c9c3d4399 Merge pull request #332 from groue/GRDB3-DatabaseWriterRobustness
Implicit transaction in DatabasePool.write and DatabaseQueue.write
2018-04-15 19:51:52 +02:00
Gwendal Roué 090f872e80 Update documentation: don't mention dbQueue.inDatabase unless necessary 2018-04-15 18:09:34 +02:00
Gwendal Roué 3d9c1a2739 Cleanup 2018-04-15 17:26:37 +02:00
Gwendal Roué c97c260613 Update documentation about transactions 2018-04-15 17:15:13 +02:00
Gwendal Roué a46505e907 Cleanup 2018-04-15 14:30:12 +02:00
Gwendal Roué ea3f22c8a4 Fix tests that were failing now that DatabaseQueue.inDatabase runs inside a transaction 2018-04-13 18:07:24 +02:00
Gwendal Roué d78479e4af [WIP] DatabaseQueue.inDatabase runs inside a transaction 2018-04-13 08:56:03 +02:00
Gwendal Roué 267371ba90 Tests that DatabasePool.write opens a transaction 2018-04-13 08:20:17 +02:00
Gwendal Roué cc136922e5 Typo 2018-04-12 14:07:38 +02:00
Gwendal Roué 02927106ca It looks like documentation wants that DatabaseQueue automatically opens transactions as well... 2018-04-12 14:06:13 +02:00
Gwendal Roué 1275ebc2b1 Layout 2018-04-12 14:02:31 +02:00
Gwendal Roué 2ac2a148c6 Typo 2018-04-12 14:00:19 +02:00
Gwendal Roué 1a5f432ee1 Update documentation for DatabasePool.writeWithoutTransaction 2018-04-12 13:59:10 +02:00
Gwendal Roué 5df4e713b6 GRDB3 TODO 2018-04-12 12:39:29 +02:00
Gwendal Roué 20d2c74f87 Update documentation for DatabasePool.writeWithoutTransaction 2018-04-12 12:02:25 +02:00
Gwendal Roué bc244802c0 Update tests for DatabasePool/Writer.writeWithoutTransaction 2018-04-12 07:58:23 +02:00
Gwendal Roué bd2f17ee10 Fixes needed by DatabasePool/Writer.writeWithoutTransaction 2018-04-12 07:58:01 +02:00
Gwendal Roué 563a4d5c71 Introduce DatabaseWriter.writeWithoutTransaction 2018-04-11 20:03:18 +02:00
Gwendal Roué 78e6241d16 DatabaseWriter.write now guarantees that eventual concurrent readers don't see any changes until all changes are executed. DatabasePool.write thus wraps changes in a transaction. 2018-04-11 20:03:18 +02:00
Gwendal Roué d08f630a2c Merge pull request #331 from groue/GRDB3-RowDescription
Improve Row descriptions
2018-04-11 20:02:31 +02:00
Gwendal Roué 26912e746b Update documentation for new Row description format 2018-04-11 15:49:16 +02:00
Gwendal Roué fa68b62be1 Improve Row.description & Row.debugDescription 2018-04-11 13:39:44 +02:00
Gwendal Roué 07a1d4d1b8 Database.rollback: add missing dispatch queue check 2018-04-11 13:21:56 +02:00
Gwendal Roué 9c6b48980c Database.isInsideTransaction: add missing dispatch queue check 2018-04-11 13:18:34 +02:00
Gwendal Roué 79c7dd03a5 [Whitespace] 2018-04-11 13:10:15 +02:00
Gwendal Roué b252c689df Merge pull request #330 from groue/GRDB3-RemovePATs
Expressions are no longer PATs
2018-04-11 13:08:46 +02:00
Gwendal Roué c34380cf5c SQLExpression and SQLSelectable are no longer PATs 2018-04-11 08:19:15 +02:00
Gwendal Roué 75ab9d615c Merge pull request #329 from groue/GRDB3-RequestDerivation
Introduce request derivation protocols
2018-04-11 08:04:30 +02:00
Gwendal Roué b9333fab34 Update a few tests that have been broken by 64899e5a39.
(Some expressions which were not safely wrapped inside parenthesis now are wrapped inside parenthesis)
2018-04-10 13:45:31 +02:00
Gwendal Roué 64899e5a39 Introduce SelectionRequest, FilteredRequest, AggregatingRequest, and OrderedRequest.
Those request protocols allow types that are not QueryInterfaceRequest to expose the same derivation API. This is a necessary step towards associations.
2018-04-10 13:44:23 +02:00
Gwendal Roué 80889dc9d2 Merge pull request #328 from groue/GRDB3-DatabaseRequest
Allow observation of complex fetching strategies
2018-04-10 12:50:37 +02:00
Gwendal Roué b7239c4b6f Document request protocols 2018-04-08 13:18:02 +02:00
Gwendal Roué 67ae1d4cf0 Document request protocols 2018-04-08 13:09:24 +02:00
Gwendal Roué 03f5a83cbf Introduce and DatabaseRequest and SelectStatementRequest on top of FetchRequest 2018-04-08 12:08:51 +02:00
Gwendal Roué 77bb2ecc82 Merge branch 'SQLite-3.22.0' of github.com:groue/GRDB.swift into GRDB3 2018-04-08 11:51:56 +02:00
Gwendal Roué 3160b65172 Upgrade SQLiteCustom to 3.22.0 2018-04-04 13:23:46 +02:00
Gwendal Roué 65b3ba1d12 TODO 2018-04-04 09:49:38 +02:00
Gwendal Roué ce919f0411 GRDB3 TODO 2018-03-31 16:00:34 +02:00
Gwendal Roué 2dfbe8e5f2 Prevent snapshot creation from within a transaction 2018-03-31 15:56:42 +02:00
Gwendal Roué e9d45b5435 GRDB3 TODO 2018-03-31 15:07:19 +02:00
Gwendal Roué c3f9c75b3c Rename databaseEqual to databaseEquals 2018-03-31 14:53:22 +02:00
Gwendal Roué d24f79ee4d Merge branch 'master' into GRDB3 2018-03-31 14:36:43 +02:00
Gwendal Roué 2992bd544e GRDB3 TODO 2018-03-30 10:49:43 +02:00
Gwendal Roué 31ed3ce277 GRDB3 TODO 2018-03-30 09:12:35 +02:00
Gwendal Roué 91b574e153 v2.10.0 2018-03-30 08:32:18 +02:00
Gwendal Roué 7966b43daf Merge pull request #295 from groue/Swift4.1
Xcode 9.3 & Swift 4.1
2018-03-30 08:31:30 +02:00
Gwendal Roué 17dfb0db9d CHANGELOG 2018-03-30 08:19:46 +02:00
Gwendal Roué 2c3a62abbc Update performance tests for Swift 4.1 2018-03-30 08:12:24 +02:00
Gwendal Roué f9a806d9aa Xcode 9.3 artifact: IDEWorkspaceChecks.plist 2018-03-30 07:51:34 +02:00
Gwendal Roué afd2d25e5e Makefile: add support for Xcode 9.3 2018-03-30 07:21:49 +02:00
Gwendal Roué 4ee9580d31 Remove redundant conformance of DatabaseValue to SQLExpressible 2018-03-29 15:31:22 +02:00
Gwendal Roué b35cf4afdc Record.save(_:) documents that is can't be overridden 2018-03-15 20:46:03 +01:00
Gwendal Roué 930246592a Cleanup TODO 2018-03-15 20:32:04 +01:00
Gwendal Roué 727be0a8ab Merge pull request #321 from groue/GRDB3-Testability
Improve testability
2018-03-15 20:25:18 +01:00
Gwendal Roué ebe1d93c3a Polish 2018-03-15 20:22:39 +01:00
Gwendal Roué c7ad3ef4a9 DatabaseMigrator.appliedMigrations(in:) doc & changelog 2018-03-15 20:15:23 +01:00
Gwendal Roué fa8ed89eae DatabaseMigrator.appliedMigrations(_:) 2018-03-15 20:10:59 +01:00
Gwendal Roué 0d7f392bcd Database.isGRDBInternalTable(_:) 2018-03-15 20:04:50 +01:00
Gwendal Roué d61551cedb Database.isSQLiteInternalTable(_:) doc 2018-03-15 19:57:03 +01:00
Gwendal Roué 07b944039c Database.isSQLiteInternalTable(_:) 2018-03-15 19:52:44 +01:00
Gwendal Roué 95933e93dd Fix SQLRequest inline documentation 2018-03-12 23:03:46 +01:00
Gwendal Roué 1cbe60a13f Better checks for Swift < 4.1 (thanks @hartbit!) 2018-03-12 18:33:06 +01:00
Gwendal Roué 9505ba1606 Replace flatMap with compactMap in README.md 2018-03-12 18:20:10 +01:00
Gwendal Roué bca1fe0d9b SE-0184: backport UnsafeMutablePointer.deallocate() 2018-03-12 18:20:10 +01:00
Gwendal Roué 1d28ca1fca TODO Swift 4.1 2018-03-12 18:20:10 +01:00
Gwendal Roué a75e519294 SE-0185: let Swift 4.1 generate as much Equatable and Hashable conformance as possible 2018-03-12 18:20:10 +01:00
Gwendal Roué 75d5c2a39f SE-0187: deprecate Cursor.flatMap in favor of Cursor.compactMap 2018-03-12 18:20:10 +01:00
Gwendal Roué 85d3c584ef Swift 4.1 compatibility (SE-0184 , SE-0187) 2018-03-12 18:20:10 +01:00
Gwendal Roué ad0f6de809 Fix Xcode9.3 warnings 2018-03-12 18:20:10 +01:00
Gwendal Roué 5defb058d3 TODO 2018-03-05 14:22:58 +01:00
Gwendal Roué f202ad5e3f TODO 2018-03-05 10:18:44 +01:00
Gwendal Roué 1cd8467b8f TODO 2018-03-05 09:59:01 +01:00
Gwendal Roué f2462d4270 Improve Record overview 2018-03-02 18:56:43 +01:00
Gwendal Roué 4a4f4e37ba Improve Record overview 2018-03-02 15:13:12 +01:00
Gwendal Roué 3a625157ff README typos 2018-02-28 09:02:48 +01:00
Gwendal Roué 3bbc17fe4a Rename "record changes tracking" to "record comparison" in order to avoid confusion with database changes tracking performed by database observation 2018-02-28 08:58:27 +01:00
Gwendal Roué 8cff147029 TODO.md 2018-02-28 08:41:46 +01:00
Gwendal Roué ce984783ec Intra-doc links 2018-02-28 08:36:58 +01:00
Gwendal Roué dbde432948 Remove deprecated APIs 2018-02-28 08:35:07 +01:00
Gwendal Roué 85f945dcba Merge pull request #314 from groue/GRDB3-RenameRecordProtocols
Rename record protocols
2018-02-27 20:42:10 +01:00
Gwendal Roué 487f4e220f Record protocols fixit 2018-02-27 20:10:13 +01:00
Gwendal Roué 6a8dec11ea Record protocols changelog 2018-02-27 20:10:06 +01:00
Gwendal Roué 1a91020a84 After all, FetchableRecord and PersistableRecord 2018-02-27 19:25:49 +01:00
Gwendal Roué 08a08cd74f Rename MutablePersistable to EncodableRecord 2018-02-27 18:46:32 +01:00
Gwendal Roué 639de6ca11 Rename TableMapping to TableRecord 2018-02-27 13:28:29 +01:00
Gwendal Roué ba6a026cdc Rename RowConvertible to DecodableRecord 2018-02-27 13:17:51 +01:00
Gwendal Roué 07634229f9 GRDB3 TODO 2018-02-27 12:44:34 +01:00
Gwendal Roué 619aeb4355 Merge pull request #312 from groue/GRDB3-DropIteratorCursor
Drop IteratorCursor, use AnyCursor instead
2018-02-27 12:39:37 +01:00
Gwendal Roué e8d0af93fc Cursor changelog 2018-02-27 08:17:55 +01:00
Gwendal Roué 4faa9964bd Make AnyCursor final 2018-02-27 08:15:49 +01:00
Gwendal Roué 15a0ea79b0 Drop IteratorCursor, use AnyCursor instead 2018-02-27 08:11:48 +01:00
Gwendal Roué d0a281e14f Merge pull request #311 from groue/GRDB3-FetchRequest
Rename TypedRequest to FetchRequest, drop Request
2018-02-27 07:53:23 +01:00
Gwendal Roué 49e624e532 Update WhyAdoptGRDB.md for FetchRequest 2018-02-27 07:47:05 +01:00
Gwendal Roué 3bbcb8151d Update JoinSupportTests for FetchRequest 2018-02-26 22:34:46 +01:00
Gwendal Roué c7b9358bc7 Documentation polish 2018-02-26 22:29:58 +01:00
Gwendal Roué a552e7d25c Update README.md for FetchRequest 2018-02-26 22:18:35 +01:00
Gwendal Roué c108094aa5 FetchRequest changelog 2018-02-26 19:34:29 +01:00
Gwendal Roué 769c67e7d3 FetchRequest.adapted(_:) in not experimental 2018-02-26 19:34:16 +01:00
Gwendal Roué f605e049fd Rename TypedRequest to FetchRequest, drop Request 2018-02-26 13:12:33 +01:00
Gwendal Roué e44201e0e3 Apply advice from @sobri909 2018-02-25 09:43:00 +01:00
Gwendal Roué 028093199b Replace flatMap with compactMap in README.md 2018-02-25 09:26:18 +01:00
Gwendal Roué 6043b4288e SE-0184: backport UnsafeMutablePointer.deallocate() 2018-02-25 09:24:23 +01:00
Gwendal Roué 11ec16494d TODO Swift 4.1 2018-02-25 09:24:23 +01:00
Gwendal Roué b4922f60a2 SE-0185: let Swift 4.1 generate as much Equatable and Hashable conformance as possible 2018-02-25 09:24:23 +01:00
Gwendal Roué b0e126f29d SE-0187: deprecate Cursor.flatMap in favor of Cursor.compactMap 2018-02-25 09:24:23 +01:00
Gwendal Roué d8c411ad52 Swift 4.1 compatibility (SE-0184 , SE-0187) 2018-02-25 09:24:23 +01:00
Gwendal Roué 4f8f0e0bf3 Fix Xcode9.3 warnings 2018-02-25 09:23:05 +01:00
Gwendal Roué dee6bf79d1 TODO 2018-02-25 08:41:34 +01:00
Gwendal Roué baeba0dea3 v2.9.0 2018-02-25 07:40:14 +01:00
Gwendal Roué 3dc31ad638 Typo 2018-02-25 00:00:25 +01:00
Gwendal Roué 4201e2a611 README 2018-02-24 21:24:18 +01:00
Gwendal Roué d9f6fa7de6 CHANGELOG 2018-02-24 21:12:53 +01:00
Gwendal Roué d0146762bc Differences between Database Queues and Pools 2018-02-24 21:06:07 +01:00
Gwendal Roué 7e8f2e2fbc Differences between Database Queues and Pools 2018-02-24 21:05:23 +01:00
Gwendal Roué 497f4b65ef Differences between Database Queues and Pools 2018-02-24 21:03:08 +01:00
Gwendal Roué 03c44778ba Differences between Database Queues and Pools 2018-02-24 20:57:27 +01:00
Gwendal Roué 0cc744ae16 Differences between Database Queues and Pools 2018-02-24 20:54:12 +01:00
Gwendal Roué fae3862547 Typo 2018-02-24 20:08:07 +01:00
Gwendal Roué 70a222f3c9 Typo 2018-02-24 20:07:21 +01:00
Gwendal Roué 5676adca99 TODO: Decode NSDecimalNumber from text database values
(Idea from @robertmryan at https://github.com/ccgus/fmdb/pull/647#issuecomment-368083101)
2018-02-24 18:18:41 +01:00
Gwendal Roué 3a77ca68c4 TODO 2018-02-24 17:58:02 +01:00
Gwendal Roué 248437d1d6 DatabaseSnapshot documentation 2018-02-24 17:55:34 +01:00
Gwendal Roué afcde4609e CHANGELOG 2018-02-24 17:49:39 +01:00
Gwendal Roué 2e98974373 Cursor doc 2018-02-24 17:46:01 +01:00
Gwendal Roué 086a33fd62 Cursor doc 2018-02-24 17:44:33 +01:00
Gwendal Roué 33359dd435 Markdown typo 2018-02-24 17:42:52 +01:00
Gwendal Roué 574d71b50c Cursor level 2018-02-24 17:41:29 +01:00
Gwendal Roué c806b706d4 Focus on Cursor specificities 2018-02-24 17:40:16 +01:00
Gwendal Roué c3b8c0f7e9 Explain why cursors are not sequences (addresses #303) 2018-02-24 17:37:00 +01:00
Gwendal Roué a1cd622892 Focus on Cursor specificities 2018-02-24 17:30:31 +01:00
Gwendal Roué dea3ee0b84 Focus on Cursor specificities 2018-02-24 17:29:29 +01:00
Gwendal Roué 5c64348ea8 Focus on Cursor specificities 2018-02-24 17:25:13 +01:00
Gwendal Roué 262ac2c476 Intra-doc links 2018-02-24 17:17:34 +01:00
Gwendal Roué dbfbe30749 DatabaseSnapshot RAII 2018-02-24 17:15:53 +01:00
Gwendal Roué 70437bd4cb Documentation typos 2018-02-24 17:14:30 +01:00
Gwendal Roué 2d30b5ea1c Documentation typos 2018-02-24 17:13:27 +01:00
Gwendal Roué 5414111bed Update changes tracking documentation, and changelog 2018-02-24 17:06:35 +01:00
Gwendal Roué 9168bac16e Deprecate RecordBox. Introduce changes API on MutablePersistable. Rename Record changes tracking methods. 2018-02-24 16:19:21 +01:00
Gwendal Roué 8760d36f6c Snapshot documentation 2018-02-24 07:59:44 +01:00
Gwendal Roué 141b870bc0 Typo 2018-02-24 07:55:15 +01:00
Gwendal Roué 5e4406e78c Improves documentation (addresses #306) 2018-02-24 07:54:42 +01:00
Gwendal Roué c5426bfcf7 CHANGELOG 2018-02-24 07:44:35 +01:00
Gwendal Roué 76561a567f Introduce DatabaseSnapshot 2018-02-24 07:37:26 +01:00
Gwendal Roué 8288f0c751 Add a real-life test for allowsUnsafeTransactions 2018-02-23 19:11:38 +01:00
Gwendal Roué 7dc008db8b Expose Database.beginTransaction(), commit(), rollback(). New Configuration.allowsUnsafeTransactions flag. New fatal error when a database access block ends with a transaction left opened. 2018-02-23 14:14:05 +01:00
Gwendal Roué 86bb4a27a4 CHANGELOG 2018-02-23 13:23:44 +01:00
Gwendal Roué f2d9f50930 CHANGELOG 2018-02-23 13:10:40 +01:00
Gwendal Roué b9af7e6a25 Update ColumnInfo.primaryKeyIndex documentation 2018-02-23 12:55:27 +01:00
Gwendal Roué 00825748ff Fix ColumnInfo test (it is different with SQLite < 3.7.16) 2018-02-23 12:53:41 +01:00
Gwendal Roué fe0edde4a9 TODO 2018-02-23 12:41:19 +01:00
Gwendal Roué edfea91920 TODO 2018-02-23 09:03:58 +01:00
Gwendal Roué 319e6bcdc8 Typo 2018-02-23 08:55:40 +01:00
Gwendal Roué 274f73e040 Cleanup 2018-02-23 08:55:03 +01:00
Gwendal Roué fab37838b2 Cleanup 2018-02-23 08:49:50 +01:00
Gwendal Roué a5a3610bf6 Cleanup 2018-02-23 08:49:27 +01:00
Gwendal Roué 07e600163c Splitting rows: documentation WIP 2018-02-23 08:35:32 +01:00
Gwendal Roué 14a5dc5489 Cleanup 2018-02-23 08:34:34 +01:00
Gwendal Roué 46c2b94425 Cleanup 2018-02-23 08:32:50 +01:00
Gwendal Roué 9a1dc7f292 Cleanup 2018-02-23 08:32:17 +01:00
Gwendal Roué c68fc37959 Cleanup 2018-02-23 08:17:15 +01:00
Gwendal Roué aa1f555e05 Drop init(leftJoinedRow:), and expose Row subscripts that return records 2018-02-23 08:08:00 +01:00
Gwendal Roué 699e64c610 Splitting rows: documentation WIP 2018-02-22 23:31:58 +01:00
Gwendal Roué e8c1392314 TODO 2018-02-22 23:30:48 +01:00
Gwendal Roué c1ae47d188 Splitting rows: documentation WIP 2018-02-22 23:26:37 +01:00
Gwendal Roué 13a9f1113a Splitting rows: documentation WIP 2018-02-22 23:07:19 +01:00
Gwendal Roué c4ad86863f Splitting rows: documentation WIP 2018-02-22 23:03:39 +01:00
Gwendal Roué 8300a618f8 Splitting rows: documentation WIP 2018-02-22 22:58:56 +01:00
Gwendal Roué 52f0038262 Splitting rows: documentation WIP 2018-02-22 22:58:05 +01:00
Gwendal Roué 31710ce91c Splitting rows: documentation WIP 2018-02-22 22:55:24 +01:00
Gwendal Roué a9c75652e1 Splitting rows: documentation WIP 2018-02-22 22:54:21 +01:00
Gwendal Roué 3e13e5be57 Splitting rows: documentation WIP 2018-02-22 22:48:52 +01:00
Gwendal Roué c27979a210 Splitting rows: documentation WIP 2018-02-22 22:37:42 +01:00
Gwendal Roué 37d7c84bc3 Splitting rows: documentation WIP 2018-02-22 22:30:13 +01:00
Gwendal Roué 62f5c8fc2f Splitting rows: documentation WIP 2018-02-22 22:18:12 +01:00
Gwendal Roué 289c449dff Splitting rows: documentation WIP 2018-02-22 22:13:29 +01:00
Gwendal Roué e7b7b603d2 Splitting rows: documentation WIP 2018-02-22 22:08:23 +01:00
Gwendal Roué e7e342600b Splitting rows: documentation WIP 2018-02-22 21:03:17 +01:00
Gwendal Roué db6e3b8371 Splitting rows: documentation WIP 2018-02-22 20:33:46 +01:00
Gwendal Roué 79ed15c38c Deprecate Database.columnCount(in:) in favor of Database.columns(in:). Update doc and changelog 2018-02-22 14:00:19 +01:00
Gwendal Roué 6f175dcafb Add ColumnInfoTests to GRDBCustom/GRDBCipher tests 2018-02-22 13:52:52 +01:00
Gwendal Roué ca70a10bd4 TODO 2018-02-22 13:37:49 +01:00
Gwendal Roué ae3319e9f9 Make ColumnInfo public (asked by @freak4pc) 2018-02-22 13:20:41 +01:00
Gwendal Roué 5112cb24f5 Expose EmptyRowAdapter, and ScopeAdapter(base:scopes:) 2018-02-22 12:38:03 +01:00
Gwendal Roué c6bbccc02e Have AdaptedRow go straight to SQLite when possible (avoid DatabaseValue initializer) 2018-02-22 12:23:19 +01:00
Gwendal Roué 93ec4d2515 Remove Row.hasNull(named:String) and Row.hasNull(Column) 2018-02-22 12:00:06 +01:00
Gwendal Roué 955dc6094b TODO 2018-02-22 09:24:30 +01:00
Gwendal Roué bd694cbc53 Cleanup 2018-02-22 08:50:35 +01:00
Gwendal Roué c115a035ec Row.hasNull(atIndex:) goes straight to sqlite3_column_type() when possible 2018-02-22 08:39:14 +01:00
Gwendal Roué 288144f347 splittingRowAdapters(columnCounts:), ScopeAdapter(nestedScopes:), RowConvertible?(leftJoinedRow:), TableMapping.numberOfSelectedColumns(_:), support for nested codable records 2018-02-21 23:15:13 +01:00
Gwendal Roué 3bdfdaa40a TableMapping.selectionSQL(_:) 2018-02-21 13:51:37 +01:00
Gwendal Roué 22949813af Row.hasNull(atIndex:), Row.hasNull(named:), Row.hasNull(_:), Row.hasNonNullValue 2018-02-20 14:43:06 +01:00
Gwendal Roué 5c98b01484 Update Record.updateChanges(_:) documentation 2018-02-20 13:20:50 +01:00
Gwendal Roué ea5e1cd0db CHANGELOG 2018-02-20 13:18:38 +01:00
Gwendal Roué b5d9955442 Tests: setup Database.logError only once (and avoid SQLite misuse) 2018-02-20 13:16:11 +01:00
Gwendal Roué feb5cb35b4 Record.updateChanges now returns whether the record had changes 2018-02-20 13:06:58 +01:00
Gwendal Roué 654c7083eb TODO 2018-02-17 17:44:03 +01:00
Gwendal Roué a0457928b3 TODO 2018-02-17 17:40:25 +01:00
Gwendal Roué 4df535a3a9 TODO 2018-02-17 17:32:15 +01:00
Gwendal Roué 0b251ec4e0 TODO 2018-01-31 19:54:37 +01:00
Gwendal Roué 7704a9ac41 v2.8.0 2018-01-29 08:12:29 +01:00
Gwendal Roué 59031893ff Merge pull request #297 from groue/MoreCursor
More sequence-like cursor methods
2018-01-29 07:19:58 +01:00
Gwendal Roué fcfa044320 Parts of Cursor implementation are derived from Swift.org 2018-01-28 18:56:40 +01:00
Gwendal Roué f95658e7ce Remove convenience cursor types from reference documentation
Those types bloat the documentation for no real value: DropFirstCursor, DropWhileCursor, EnumeratedCursor, FilterCursor, FlattenCursor, MapCursor, PrefixCursor, PrefixWhileCursor
2018-01-28 17:13:53 +01:00
Gwendal Roué 2c16fcaa99 Cursor cleanup 2018-01-28 17:13:52 +01:00
Gwendal Roué 4e638016e1 Cursor changelog 2018-01-28 17:13:52 +01:00
Gwendal Roué 5d811c0e68 Documentation for Cursor convenience methods 2018-01-28 17:13:52 +01:00
Gwendal Roué 9f1f51637a Tests for Cursor.joined(separator:String) 2018-01-28 17:13:52 +01:00
Gwendal Roué 7c16ffcdf8 Cursor.joined(separator:String) 2018-01-28 17:13:51 +01:00
Gwendal Roué 7ca582719b Tests for Cursor.reduce(into:_:) 2018-01-28 17:13:51 +01:00
Gwendal Roué e4b83baa53 Cursor.reduce(into:_:) 2018-01-28 17:13:51 +01:00
Gwendal Roué ac6b2933a8 Tests for Cursor.max(by:), max(), min(by:), min() 2018-01-28 17:13:50 +01:00
Gwendal Roué 92758fa51d Cursor.max(by:), max(), min(by:), min() 2018-01-28 17:13:50 +01:00
Gwendal Roué acd06a4f5a Tests for Cursor.dropLast() 2018-01-28 17:13:50 +01:00
Gwendal Roué eec6b17398 Cursor.dropLast() 2018-01-28 17:13:50 +01:00
Gwendal Roué 15fbf02647 Tests for Cursor.dropFirst() 2018-01-28 17:13:49 +01:00
Gwendal Roué c296be5057 Cursor.dropFirst() 2018-01-28 17:13:49 +01:00
Gwendal Roué 129e178ee0 Tests for Cursor.dropFirst(_:) 2018-01-28 17:13:49 +01:00
Gwendal Roué 1e5caa62a8 Tests for Cursor.prefix(while:) 2018-01-28 17:13:49 +01:00
Gwendal Roué 420ed0764b Tests for Cursor.drop(while:) 2018-01-28 17:13:49 +01:00
Gwendal Roué ce6bbb2885 Tests for Cursor.prefix(_:) 2018-01-28 17:13:48 +01:00
Gwendal Roué 87d6c5dd29 Cursor.prefix(_:) 2018-01-28 17:13:48 +01:00
Gwendal Roué dccd456497 Tests for Cursor.dropLast(_:) 2018-01-28 17:13:48 +01:00
Gwendal Roué 520bdd64e6 Tests for Cursor.dropFirst(_:) 2018-01-28 17:13:47 +01:00
Gwendal Roué 72608fd016 Cursor.dropLast(_:) 2018-01-28 17:13:47 +01:00
Gwendal Roué 69b51ffbd5 Tests for Cursor.dropFirst(_:) 2018-01-28 17:13:47 +01:00
Gwendal Roué c9044ea07b Cursor.dropFirst(_:) 2018-01-28 17:13:47 +01:00
Gwendal Roué 362c40326f Tests for Cursor.suffix(_:) 2018-01-28 17:13:47 +01:00
Gwendal Roué 28d0793688 Cursor.suffix(_:) 2018-01-28 17:13:46 +01:00
Gwendal Roué abdc2000c4 Tests for Cursor.prefix(while:) 2018-01-28 17:13:46 +01:00
Gwendal Roué 3d845b1e9f Cursor.prefix(while:) 2018-01-28 17:13:46 +01:00
Gwendal Roué bae8c97df4 Tests for Cursor.drop(while:) 2018-01-28 17:13:46 +01:00
Gwendal Roué 452c1d4b92 Cursor.drop(while:) 2018-01-28 17:13:46 +01:00
Gwendal Roué 9990e6e2a6 Less TODO 2018-01-28 17:13:16 +01:00
Gwendal Roué 8d0dc3eb78 Merge pull request #293 from groue/SQLite3.22.0
Upgrade SQLite version to 3.22.0
2018-01-27 09:33:54 +01:00
Gwendal Roué 0a2a3c75c1 Fix typo 2018-01-26 08:47:27 +01:00
Gwendal Roué 830e6acb4f Documentation and changelog 2018-01-26 08:44:18 +01:00
Gwendal Roué 1da85dff58 FTS5Pattern(matchingPrefixPhrase:) 2018-01-26 08:38:11 +01:00
Gwendal Roué dd40e3be5b Upgrade custom SQLite version in documentation 2018-01-26 08:00:50 +01:00
Gwendal Roué 224d6488a9 Upgrade swiftlyfalling/SQLiteLib to v3.22.0 2018-01-26 07:54:08 +01:00
Gwendal Roué cac31d3294 TODO: apply @hartbit's suggestion 2018-01-24 18:56:53 +01:00
Gwendal Roué 951d5fa58d TODO SQLite 3.22.0 2018-01-23 08:10:26 +01:00
Gwendal Roué 7a4f0778df Remove references to discarded GRDB Extension Guide 2018-01-21 17:31:45 +01:00
Gwendal Roué 5aff4d29fc CHANGELOG 2018-01-21 17:29:27 +01:00
Gwendal Roué 402b7001ee v2.7.0 2018-01-21 17:07:39 +01:00
Gwendal Roué f7d0979fb1 Remove ExtendingGRDB guide 2018-01-21 17:05:38 +01:00
Gwendal Roué 2289ed9d95 Cleanup Jazzy documentation from most redundant definitions and experimental APIs 2018-01-21 16:57:43 +01:00
Gwendal Roué dfcb44016f Enhance CHANGELOG 2018-01-21 15:19:55 +01:00
Gwendal Roué 37a434a615 Merge pull request #289 from groue/RecordBox
Bring changes tracking to any record type
2018-01-21 13:16:35 +01:00
Gwendal Roué 0ddcf1e401 RecordBox documentation 2018-01-21 13:14:14 +01:00
Gwendal Roué 0aa673f24e RecordBox consequence: more TODO 2018-01-21 12:05:41 +01:00
Gwendal Roué b3a24daa2f Documentation tweaks 2018-01-21 07:49:13 +01:00
Gwendal Roué 8c6954cd75 RecordBox documentation 2018-01-21 07:35:52 +01:00
Gwendal Roué 283f08de07 RecordBox changelog 2018-01-20 20:26:37 +01:00
Gwendal Roué d96543ddeb RecordBox documentation 2018-01-20 20:26:37 +01:00
Gwendal Roué 4b320f3cb5 RecordBox documentation 2018-01-20 20:26:37 +01:00
Gwendal Roué 69a6d3e3f3 RecordBox documentation 2018-01-20 20:26:36 +01:00
Gwendal Roué 93d4587732 RecordBox 2018-01-20 20:26:36 +01:00
Gwendal Roué 7481b9788a Run truncate optimization tests with and without transaction observer
This topic is sooo touchy...
2018-01-20 20:26:10 +01:00
Gwendal Roué acf3e0b397 TODO 2018-01-20 19:54:19 +01:00
Gwendal Roué 88ae0fa059 TODO 2018-01-20 17:59:54 +01:00
Gwendal Roué a1e63d9028 Fix management of current transaction observation broker (and discover a new SQLite oddity) 2018-01-20 16:11:05 +01:00
Gwendal Roué 2a1ad8d31c TODO 2018-01-20 09:09:32 +01:00
Gwendal Roué ba7cd2160f TODO 2018-01-20 06:09:44 +01:00
Gwendal Roué 8e50383371 v2.6.1 2018-01-19 16:24:09 +01:00
Gwendal Roué ffc5352840 Fix transaction observer crash 2018-01-19 16:17:38 +01:00
Gwendal Roué 53e849cbec v2.6.0 2018-01-18 13:05:07 +01:00
Gwendal Roué b71d57d7ec Merge pull request #288 from groue/TransactionObserverInvalidation
Enhance Database Observation
2018-01-18 13:04:41 +01:00
Gwendal Roué 4fe2b2542f Cleanup 2018-01-18 12:54:02 +01:00
Gwendal Roué 8c7895d8ab Have Makefile accept both Xcode9.0 and Xcode9.0.1 2018-01-18 12:47:29 +01:00
Gwendal Roué ad15f4dc59 Fix .travis.yml for Xcode9 2018-01-17 13:51:19 +01:00
Gwendal Roué c4ef161a83 Rename Statement.region and Request.region to fetchedRegion 2018-01-17 06:54:10 +01:00
Gwendal Roué bb48025947 Derived requests ought to preserve database region: fix failing tests 2018-01-16 20:39:19 +01:00
Gwendal Roué 389a7f28c4 Derived requests ought to preserve database region: failing tests 2018-01-16 20:39:13 +01:00
Gwendal Roué 714cc1c734 DatabaseRegion() is public 2018-01-16 19:57:30 +01:00
Gwendal Roué 8d0da7f870 DatabaseRegion documentation 2018-01-16 18:47:59 +01:00
Gwendal Roué e42e74103d DatabaseRegion documentation 2018-01-16 18:46:55 +01:00
Gwendal Roué 4bcdb91895 AnyRequest and all derived requests preserve database region, and counting method 2018-01-16 14:11:05 +01:00
Gwendal Roué 938977bbca Cleanup DatabaseRegion: no more public intersection, no more public way to specify rowids 2018-01-16 13:58:55 +01:00
Gwendal Roué 581c1c46e2 More TODO 2018-01-16 11:28:48 +01:00
Gwendal Roué 768b2ab620 More TODO 2018-01-16 09:30:12 +01:00
Gwendal Roué 4eff5ab357 More TODO 2018-01-16 09:06:53 +01:00
Gwendal Roué 888892b92f Cleanup 2018-01-16 09:04:06 +01:00
Gwendal Roué ba4f146c9c Cleanup 2018-01-16 08:55:48 +01:00
Gwendal Roué 8359dd2ae2 Cleanup 2018-01-16 08:54:12 +01:00
Gwendal Roué 0be80db8f9 Cleanup 2018-01-16 08:51:42 +01:00
Gwendal Roué 72de142519 Cleanup 2018-01-16 08:50:49 +01:00
Gwendal Roué 0a7468f56d Cleanup 2018-01-16 08:34:54 +01:00
Gwendal Roué 33b5c6c616 Rename DatabaseSelectionInfo to DatabaseRegion 2018-01-16 08:23:08 +01:00
Gwendal Roué 4003d7600d DatabaseSelectionInfo documentation WIP 2018-01-15 23:41:49 +01:00
Gwendal Roué a7122ba8bb Unit tests for DatabaseSelectionInfo.isModified methods 2018-01-15 23:09:52 +01:00
Gwendal Roué dc8c85d3db Odd failing tests for DatabaseSelectionInfo and the rowid column. Consequences not cleared out yet. 2018-01-15 22:44:09 +01:00
Gwendal Roué fc1b4a6f35 Complete refactoring of SelectStatement.SelectionInfo into DatabaseSelectionInfo 2018-01-15 22:28:43 +01:00
Gwendal Roué af42623654 Fix SPM tests 2018-01-15 07:22:01 +01:00
Gwendal Roué ab1a672336 Disable test that fails on iOS 8.1 (SQLite 3.7.13) 2018-01-14 23:31:19 +01:00
Gwendal Roué 4501d7dcde TransactionObserver: provide default implementation for rarely used and stabilized databaseWillChange() and databaseWillCommit() methods 2018-01-14 22:58:12 +01:00
Gwendal Roué 5d463d6bff Goal achieved! FetchedRecordsController uses ignoreDatabaseChangesUntilNextTransaction, and checks changed rowIds in order to avoid useless fetch requests 2018-01-14 22:41:27 +01:00
Gwendal Roué 9c8a9fbe32 SelectionInfo.rowIds contains the rowIds fetched by a request 2018-01-14 22:05:18 +01:00
Gwendal Roué 1a89b2eae5 Test that sqlite authorizer uses "ROWID" as the name of the rowid column 2018-01-14 20:15:55 +01:00
Gwendal Roué fd65e72bbb CHANGELOG 2018-01-14 19:41:05 +01:00
Gwendal Roué 33e8d0875d Remove update hook when no observer is active. Allow truncate optimization when deletions are not observed. 2018-01-14 19:34:11 +01:00
Gwendal Roué 19e75576a8 Documentation for TransactionObserver.ignoreDatabaseChangesUntilNextTransaction() 2018-01-14 17:36:51 +01:00
Gwendal Roué 980860b2e9 Documentation for TransactionObserver.ignoreDatabaseChangesUntilNextTransaction() 2018-01-14 17:35:17 +01:00
Gwendal Roué eee3e36238 Test TransactionObserver.ignoreDatabaseChangesUntilNextTransaction() 2018-01-14 17:08:53 +01:00
Gwendal Roué eaadd37e87 TransactionObserver.ignoreDatabaseChangesUntilNextTransaction() is public 2018-01-14 17:08:42 +01:00
Gwendal Roué a1e508b1df TransactionObserver.ignoreDatabaseChangesUntilNextTransaction() 2018-01-14 16:45:36 +01:00
Gwendal Roué 2c8f9dffdd TODO GRDB3 2018-01-12 10:06:26 +01:00
Gwendal Roué 92fd3bf8ae TODO: TransactionObserver.stopObservingUntilNextTransaction() 2018-01-12 09:48:57 +01:00
Gwendal Roué c940675bf3 Fix typo 2018-01-12 09:12:35 +01:00
Gwendal Roué 2a147d5029 Travis: test Xcode 9.2 and Xcode 9.0 2018-01-12 08:19:02 +01:00
Gwendal Roué 0d236ae32c Row adopts RandomAccessCollection 2018-01-12 08:18:50 +01:00
Gwendal Roué cf4654108e More doc for filter(key:) and filter(keys:) 2018-01-12 07:19:26 +01:00
Gwendal Roué 7e9eed9374 v2.5.0 2018-01-11 21:16:54 +01:00
Gwendal Roué 383581938a Cleanup 2018-01-11 20:14:01 +01:00
Gwendal Roué df50da9024 Cleanup 2018-01-11 20:12:02 +01:00
Gwendal Roué d3a65303a1 Cleanup 2018-01-11 20:06:59 +01:00
Gwendal Roué 9a2bf923d2 Update CHANGELOG and README for new key-filtering requests 2018-01-11 20:04:49 +01:00
Gwendal Roué 9b27c0c651 WIP TableMapping.filter(key: [:]) and TableMapping.filter(keys: [[:], ]) 2018-01-11 19:34:28 +01:00
Gwendal Roué 2af85e7347 WIP TableMapping.filter(key:1) and TableMapping.filter(keys: [1, 2, 3]) 2018-01-11 18:09:01 +01:00
Gwendal Roué 071f0f4443 Cleanup 2018-01-10 08:50:45 +01:00
Gwendal Roué 903e8c96aa '^foo' is no longer an invalid FTS5 pattern in upcoming SQLite 3.22.0 2018-01-10 07:40:02 +01:00
Gwendal Roué 79a5fb9c15 Cleanup 2018-01-08 08:44:42 +01:00
Gwendal Roué 46ef4b27bb Fix failing test 2018-01-07 15:29:24 +01:00
Gwendal Roué 1838797d38 CHANGELOG 2018-01-07 14:25:36 +01:00
Gwendal Roué c7d500b8ba Optimize database event notifications for simple statements without side effect 2018-01-07 14:25:29 +01:00
Gwendal Roué 95a09cb644 Only notify observed events to transaction observers 2018-01-07 13:33:35 +01:00
Gwendal Roué c6ab92e60a v2.4.2 2018-01-06 14:35:05 +01:00
Gwendal Roué c0d5f3019b generatePerformanceReport reads versions of tested libraries from info.plist files 2018-01-06 13:37:30 +01:00
Gwendal Roué b09d5c3833 Fix FMDB performance tests 2018-01-06 12:47:01 +01:00
Gwendal Roué 3eff1b48b1 Update copyright year 2018-01-06 12:33:32 +01:00
Gwendal Roué a12fffc4e7 Update documentation about readFromCurrentState 2018-01-06 10:04:41 +01:00
Gwendal Roué 94715130fc DatabaseWriter.readFromCurrentState(_:) now fails with a fatal error if a transaction is currently opened 2018-01-06 09:19:26 +01:00
Gwendal Roué 313188ca0e More TODO 2018-01-05 19:40:55 +01:00
Gwendal Roué 5a68b008c6 CHANGELOG 2018-01-02 13:34:23 +01:00
Gwendal Roué 6fe9098c76 Statement compilation cleanup 2018-01-02 13:10:11 +01:00
Gwendal Roué 631a914acd Fix failing test for schema cache shared between DatabasePool reader and writer (stop sharing cache) 2018-01-02 13:08:41 +01:00
Gwendal Roué d1f24c9722 More TODO 2017-12-28 17:48:15 +01:00
Gwendal Roué 7b76c9319a Failing test for schema cache shared between DatabasePool reader and writer 2017-12-28 14:16:36 +01:00
Gwendal Roué 63083c5d1e Less TODO 2017-12-28 13:56:54 +01:00
Gwendal Roué c51a3cd624 Statement compilation cleanup 2017-12-17 13:57:35 +01:00
Gwendal Roué 1fadb7485a Less TODO 2017-12-17 13:14:15 +01:00
Gwendal Roué 58e05d13d1 v2.4.1 2017-12-16 15:09:59 +01:00
Gwendal Roué d8c9692d4d Fix typo 2017-12-16 14:40:58 +01:00
Gwendal Roué f83ffd3a25 Remove unused file 2017-12-16 14:35:09 +01:00
Gwendal Roué d12ff2a92b Scripts that generate performance comparison report 2017-12-16 14:35:02 +01:00
Gwendal Roué 8709d6f9a9 FMDB 2.7.4 2017-12-16 14:25:24 +01:00
Gwendal Roué e2806c55ff Upgrade Makefile test_performance target for Xcode 9.2 and Swift 4.0.3 2017-12-16 13:44:19 +01:00
Gwendal Roué 08d6c843d6 Upgrade performance comparison tests for Xcode 9.2 and Swift 4.0.3 2017-12-16 13:42:53 +01:00
Gwendal Roué 0da3726a89 Realm 3.0.2 2017-12-16 13:36:13 +01:00
Gwendal Roué 36676bcad3 SQLite.swift 0.11.4 2017-12-16 13:33:36 +01:00
Gwendal Roué 1509e1e9a8 Clean up projects & workspace 2017-12-16 13:29:05 +01:00
Gwendal Roué 4c71dd9ebe Remove compiler warning 2017-12-16 13:14:07 +01:00
Gwendal Roué ef8d0d6334 TODO.md 2017-12-15 18:49:36 +01:00
Gwendal Roué 7477b7a173 CHANGELOG.md 2017-12-13 08:24:14 +01:00
Gwendal Roué 246f36821b Merge pull request #284 from groue/Issue283
Don't call sqlite3_config() unless explicitly required to do so
2017-12-13 08:10:57 +01:00
Gwendal Roué d567ee60bf Remove compiler warning 2017-12-08 10:51:31 +01:00
Gwendal Roué 3a157d2808 Test for global SQLite error log requires global variables 2017-12-08 10:51:20 +01:00
Gwendal Roué 7d0c2f9ef8 Fix tests for Database.logError 2017-12-08 10:03:27 +01:00
Gwendal Roué f356f8734a Update Database.logError documentation, and make it clear that it has to be called very very early. 2017-12-07 13:35:19 +01:00
Gwendal Roué 5b7f4a7ff5 Call sqlite3_config(SQLITE_CONFIG_LOG, ...) if and only if Database.logError is set. 2017-12-07 13:14:49 +01:00
Gwendal Roué e10efca17a Fix typo 2017-12-03 16:27:59 +01:00
Gwendal Roué 578b9a5275 v2.4.0 2017-12-03 16:04:07 +01:00
Gwendal Roué 63304b3d12 Merge pull request #281 from groue/DropSynchronizationTriggers
Drop full-text synchronization triggers
2017-12-03 15:57:08 +01:00
Gwendal Roué 39f6ca0035 Merge branch 'master' into DropSynchronizationTriggers 2017-12-03 15:56:23 +01:00
Gwendal Roué 5e3c62c963 Merge pull request #282 from groue/preventXcodeWarningsForMissingFiles
Prevent Xcode warnings for missing files
2017-12-03 15:55:14 +01:00
Gwendal Roué 6966600223 Fix scheme references to projects 2017-12-03 14:41:16 +01:00
Gwendal Roué e028cbb6d5 Declare new GRDBCipher.xcodeproj and GRDBCustom.xcodeproj in CHANGELOG.md 2017-12-03 14:37:21 +01:00
Gwendal Roué 8b3c3f48a8 Update documention for embedding GRDBCipher & GRDBCustom 2017-12-03 14:23:49 +01:00
Gwendal Roué 2d84e72097 Restore GRDBOSXPerformanceComparisonTests 2017-12-03 14:20:08 +01:00
Gwendal Roué d91fe7b633 Extract GRDBCipher.xcodeproj and GRDBCustom.xcodeproj from GRDB.xcodeproj 2017-12-03 14:07:05 +01:00
Gwendal Roué 090df10831 Revert attempt at preventing Xcode warnings with Run Script phases 2017-12-03 12:52:37 +01:00
Gwendal Roué f21037bb69 Run make preventXcodeWarningsForMissingFiles as a Run Script Phase in all targets except custom SQLite 2017-12-01 13:47:06 +01:00
Gwendal Roué f3041bcc9a Run make preventXcodeWarningsForMissingFiles as a Run Script Phase in the GRDBiOS target 2017-12-01 13:41:47 +01:00
Gwendal Roué 67b1225dfa make preventXcodeWarningsForMissingFiles 2017-12-01 13:37:02 +01:00
Gwendal Roué 23f2e0371e Fix documentation typo 2017-12-01 13:24:04 +01:00
Gwendal Roué a3d8df222f Fix documentation typo 2017-12-01 13:20:17 +01:00
Gwendal Roué 632ef3707c CHANGELOG.md 2017-12-01 13:17:58 +01:00
Gwendal Roué 79dc099e6d Documentation for Database.dropFTS4SynchronizationTriggers & Database.dropFTS5SynchronizationTriggers 2017-12-01 13:17:54 +01:00
Gwendal Roué 75035fb40c Documentation for Database.dropFTS4SynchronizationTriggers & Database.dropFTS5SynchronizationTriggers 2017-12-01 13:14:30 +01:00
Gwendal Roué b4887b661c Tests for Database.dropFTS4SynchronizationTriggers & Database.dropFTS5SynchronizationTriggers 2017-12-01 13:14:24 +01:00
Gwendal Roué e8835af363 Database.dropFTS4SynchronizationTriggers & Database.dropFTS5SynchronizationTriggers 2017-12-01 13:14:13 +01:00
Gwendal Roué 1fabe08332 Trust SQLite: don't assert anything about the remaining characters after a statement 2017-11-30 08:53:10 +01:00
Gwendal Roué c2e3638e8d More failing tests for Database.execute() 2017-11-30 08:50:42 +01:00
Gwendal Roué 71abced420 CHANGELOG.md 2017-11-30 08:09:15 +01:00
Gwendal Roué ac00046b07 CHANGELOG.md 2017-11-29 20:29:33 +01:00
Gwendal Roué 38b5204713 Merge pull request #280 from groue/AddUntypedColumn
Table alteration: add untyped column
2017-11-29 20:21:13 +01:00
Gwendal Roué 4b173dece5 Test for t.add(column:) without any explicit column type 2017-11-29 20:17:26 +01:00
Gwendal Roué 8ce2c09b52 TableAlteration.add(column:type:) accepts nil type 2017-11-29 20:11:28 +01:00
Gwendal Roué 8125574f8f Fix typo in ISSUE_TEMPLATE.md 2017-11-22 08:56:48 +01:00
Gwendal Roué 8974360cac ISSUE_TEMPLATE.md 2017-11-22 08:24:21 +01:00
Gwendal Roué 6e48cc1524 Reminder: enable sanitizers when running tests 2017-11-11 06:43:59 +01:00
Gwendal Roué a1ea75ca34 TODO.md 2017-11-10 12:58:04 +01:00
Gwendal Roué 81d2f21093 Cleanup 2017-11-10 08:45:05 +01:00
Gwendal Roué fd73a31abc Fix failing tests and faulty assert 2017-11-09 14:29:59 +01:00
Gwendal Roué 1583ac0c08 Add failing test for Database.execute() 2017-11-09 14:29:35 +01:00
Gwendal Roué cafbecd8af v2.3.1 2017-11-08 07:50:58 +01:00
Gwendal Roué 78c36612b7 Enhance documentation of Codable Records 2017-11-07 19:29:51 +01:00
Gwendal Roué a95385c740 Simplify TransactionObserverTests with Codable 2017-11-07 19:22:54 +01:00
Gwendal Roué a58ebf7c48 CHANGELOG.md 2017-11-07 17:47:24 +01:00
Gwendal Roué 13623575ff Fix encryption tests broken by 681460a415 2017-11-07 17:21:32 +01:00
Gwendal Roué 87c5f913b8 CHANGELOG.md 2017-11-07 14:56:51 +01:00
Gwendal Roué 41172d7967 Documentation: no more exception for empty deferred transactions 2017-11-07 14:42:58 +01:00
Gwendal Roué 820bc87cfe No more exception for empty deferred transactions 2017-11-07 14:42:02 +01:00
Gwendal Roué 2901acfb41 Refactor tests of observation of transaction completion. Make them fail for empty deferred transactions. 2017-11-07 13:55:17 +01:00
Gwendal Roué 681460a415 Tests: generate a unique database by default 2017-11-07 13:54:19 +01:00
Gwendal Roué 19b067405f v2.3.0 2017-11-05 13:56:10 +01:00
Gwendal Roué 3b494b5737 Update SQLite to 3.21.0 2017-11-05 11:21:46 +01:00
Gwendal Roué 5f11a19296 Travis: use Xcode 9.1 2017-11-01 13:19:12 +01:00
Gwendal Roué 3ff7675eb7 Makefile: add support for Xcode 9.1 and Xcode 9.2 beta 1 2017-11-01 13:13:05 +01:00
Gwendal Roué 3d06841eba Remove Xcode9.1 warnings about deprecated string.characters 2017-11-01 07:33:03 +01:00
Gwendal Roué 188c026c6b v2.2.0 2017-10-31 14:07:23 +01:00
Gwendal Roué caf051f19d Improve jazzy documentation layout 2017-10-31 13:37:48 +01:00
Gwendal Roué c4a3d934a9 Documentation 2017-10-31 13:06:37 +01:00
Gwendal Roué b19424aa23 CHANGELOG.md 2017-10-31 12:51:45 +01:00
Gwendal Roué bc229fa6fd Documentation 2017-10-31 08:48:05 +01:00
Gwendal Roué 9beb5b553b Document that empty deferred transactions are not notified 2017-10-31 08:46:33 +01:00
Gwendal Roué 667e6a8e06 Document that empty deferred transactions are not notified 2017-10-31 08:45:52 +01:00
Gwendal Roué 8f9b667c29 Document that empty deferred transactions are not notified 2017-10-31 08:45:06 +01:00
Gwendal Roué a8e0c76a30 CHANGELOG.md 2017-10-31 08:33:38 +01:00
Gwendal Roué 49609ff08e Fix failing tests for observation of empty deferred transactions 2017-10-31 08:17:48 +01:00
Gwendal Roué efe201e032 More tests for observation of empty deferred transactions 2017-10-31 08:17:30 +01:00
Gwendal Roué 28c903f7ea Failing tests for observation of empty deferred transactions 2017-10-31 08:11:12 +01:00
Gwendal Roué a5b45031d2 Failing tests for observation of empty deferred transactions 2017-10-31 07:31:15 +01:00
Gwendal Roué 42e178b41d Improve tests robustness 2017-10-30 18:21:02 +01:00
Gwendal Roué c3fe2c13f4 More tests for "DROP INDEX" and "DROP TRIGGER" (#267) 2017-10-30 18:15:54 +01:00
Gwendal Roué af8a6872d9 StatementCompilationAuthorizer never returns SQLITE_IGNORE for a "DROP XXX" statement (#267) 2017-10-30 18:12:57 +01:00
Gwendal Roué f40a5e68ea Database.triggerExists(_:) 2017-10-30 18:10:22 +01:00
Gwendal Roué c4ad98426c Pass failing tests for "DROP VIEW" statements (#267) 2017-10-30 17:57:57 +01:00
Gwendal Roué a0e3d4ad69 Failing tests for "DROP VIEW" statements (#267) 2017-10-30 17:39:35 +01:00
Gwendal Roué d64bfe1cec Database.viewExists(_:) 2017-10-30 17:38:52 +01:00
Gwendal Roué 8a213af2ab Cleanup & whitespace 2017-10-30 12:25:12 +01:00
Gwendal Roué f02659e5d7 Remove outdated documentation 2017-10-29 17:05:14 +01:00
Gwendal Roué bdf943c3d9 Fix SPM compilation error 2017-10-29 15:45:35 +01:00
Gwendal Roué 9f1d5bc631 Fix SPM compilation error 2017-10-29 15:28:45 +01:00
Gwendal Roué f2b46679a6 Fix SPM compilation error 2017-10-29 14:35:10 +01:00
Gwendal Roué c5f38af247 Simplify select statement validation 2017-10-29 14:34:53 +01:00
Gwendal Roué 2bfef4f02d Rename DatabaseObservation.swift to TransactionObserver.swift 2017-10-29 14:24:41 +01:00
Gwendal Roué 07ae50cbb0 Detailed documentation of DatabaseObservationBroker 2017-10-29 14:22:22 +01:00
Gwendal Roué 7f10bf4005 Cleanup 2017-10-29 13:27:38 +01:00
Gwendal Roué 9130fe7b38 Cleanup 2017-10-29 12:58:24 +01:00
Gwendal Roué 340dcd1748 Extract transaction observation in the new DatabaseObservationBroker class 2017-10-29 12:22:54 +01:00
Gwendal Roué 8919bb5810 Move transaction and savepoint methods 2017-10-29 11:24:30 +01:00
Gwendal Roué bea98db813 Common code for select & update statements compilation 2017-10-29 11:13:30 +01:00
Gwendal Roué 05a0130c1e More straightforward cached statements API 2017-10-29 10:56:49 +01:00
Gwendal Roué e486437865 Split Database.swift 2017-10-29 10:43:22 +01:00
Gwendal Roué 1043516fb7 Fix sample code in CHANGELOG.md 2017-10-24 19:22:12 +02:00
Gwendal Roué c9b8b81ffb fix version number 2017-10-24 14:06:28 +02:00
Gwendal Roué 99b143a55c v2.1.0 2017-10-24 08:34:10 +02:00
Gwendal Roué 8401f42f3e Documentation 2017-10-24 08:20:33 +02:00
Gwendal Roué f69949edea Explain why Carthage test is commented out in .travis.yml 2017-10-24 08:18:06 +02:00
Gwendal Roué 62e33f294e ReleaseProcess.md 2017-10-24 08:11:13 +02:00
Gwendal Roué 2a8e48ba63 Minor 2017-10-24 08:11:05 +02:00
Gwendal Roué 6372bf663f Update Carthage information 2017-10-23 20:27:46 +02:00
Gwendal Roué ac7cc09bfe CHANGELOG.md 2017-10-23 19:54:38 +02:00
Gwendal Roué c9f0d473cf New FAQ: How do I print a request as SQL? 2017-10-23 19:54:30 +02:00
Gwendal Roué 8a7ffdbb67 CHANGELOG.md 2017-10-23 19:21:38 +02:00
Gwendal Roué d30baaf16c Fix default cached argument value for Request.asSQLRequest(_:cached:) 2017-10-23 19:21:30 +02:00
Gwendal Roué 1981adeb22 Request.asSQLRequest(_:cached:) 2017-10-23 19:20:38 +02:00
Gwendal Roué 8427b8b668 Remove test_CarthageBuild from the test make target 2017-10-23 19:02:09 +02:00
Gwendal Roué 6db590a31b Remove Carthage test from .travis.yml 2017-10-23 19:01:07 +02:00
Gwendal Roué 22faa03a48 Update sample code that create databases
The Application Support directory should generally be preferred.
2017-10-23 18:58:32 +02:00
Gwendal Roué d3cd0ae85a TODO.md 2017-10-23 09:42:40 +02:00
Gwendal Roué b624955bf3 Merge branch 'master' of github.com:groue/GRDB.swift into development 2017-10-15 12:19:35 +02:00
Gwendal Roué 1b20cd14d1 Fix link to SQLite documentation for the "pre-update hook" 2017-10-14 17:54:38 +02:00
Gwendal Roué baf2f780c9 Document that FetchedRecordsController is not suited for large data sets (#263) 2017-10-13 13:16:46 +02:00
Gwendal Roué 9d1997b6cd Typo 2017-10-12 21:54:46 +02:00
Gwendal Roué 313baa0064 Typo 2017-10-12 21:52:51 +02:00
Gwendal Roué 006eee9f51 Document that Record subclasses have to override database methods 2017-10-12 21:51:15 +02:00
Gwendal Roué 2720caf945 Documentation 2017-10-12 20:51:14 +02:00
Gwendal Roué 62faa57bf0 Documentation 2017-10-12 20:50:36 +02:00
Gwendal Roué abbdb995e6 Documentation 2017-10-12 20:46:01 +02:00
Gwendal Roué fd2ae60a65 Fix sample code of conversion from Row to Dictionary 2017-10-12 20:41:48 +02:00
Gwendal Roué 2c4cf2d06b Improve documentation of Codable support, and decrease focus on the Record class. 2017-10-12 20:40:33 +02:00
Gwendal Roué 0f5ec15d47 Test for Carthage integration in an iOS app 2017-10-12 08:26:36 +02:00
Gwendal Roué 1c3dfb346f Travis: move make test_CarthageBuild to the "Test Installation" stage 2017-10-11 22:02:02 +02:00
Darren Clark b76013d60b Travis - re-enable Carthage 2017-10-11 21:45:53 +02:00
Gwendal Roué e3ed95571c Upgrade custom SQLite builds to v3.20.1 2017-10-11 21:43:41 +02:00
Gwendal Roué c749893858 Update sqlcipher from https://github.com/groue/sqlcipher/pull/1 2017-10-11 21:26:37 +02:00
Gwendal Roué 9135be3da6 CHANGELOG 2017-10-11 08:20:34 +02:00
Gwendal Roué 9930fd3938 Fix failing test for drop temporary table 2017-10-11 08:17:57 +02:00
Gwendal Roué c62c3df00d Failing test for drop temporary table 2017-10-11 08:10:22 +02:00
Gwendal Roué 0419d67533 More fiddling with the deadly truncate optimization 2017-10-10 09:01:50 +02:00
Gwendal Roué 32d69c5be0 TODO.md 2017-10-10 08:20:27 +02:00
Gwendal Roué c2fb23c69c Stop using String.characters view 2017-10-10 08:15:28 +02:00
Gwendal Roué 47611e14f7 v2.0.3 2017-10-09 08:11:06 +02:00
Gwendal Roué b90f876b5b Records that adopt Encodable encode null columns 2017-10-09 08:06:46 +02:00
Gwendal Roué 9037d51bc7 Failing test for Encodable+Persistable (null values are not encoded) 2017-10-09 08:03:43 +02:00
Gwendal Roué fb8c68f5e0 Fix compiler error 2017-10-07 07:41:17 +02:00
Gwendal Roué 4995b5bb8c Group truncate optimization tests together 2017-10-07 06:51:13 +02:00
Gwendal Roué c87ebfd4eb CHANGELOG.md 2017-10-07 05:49:46 +02:00
Gwendal Roué b9d0dae5ac v2.0.2 2017-10-05 19:55:13 +02:00
Gwendal Roué ab2a74285d Issue156.playground 2017-10-05 19:09:22 +02:00
Gwendal Roué e37ab72182 Fix compiler error 2017-10-05 15:55:20 +02:00
Gwendal Roué 891dec64a0 Cleanup fix for failing test for "DROP TABLE t" executed from a prepared statement. 2017-10-05 15:34:36 +02:00
Gwendal Roué 90086789c6 Fix failing test for "DROP TABLE t" executed from a prepared statement.
Refactor authorization and truncate optimization prevention around the StatementAuthorizer protocol.
2017-10-05 15:15:13 +02:00
Gwendal Roué 2cdcdb9cd6 Refactor Statement initializers 2017-10-05 14:01:12 +02:00
Gwendal Roué 9c6879bd97 Xcode 9 sometimes performs gratuitous changes to shared schemes 2017-10-05 13:56:38 +02:00
Gwendal Roué fc88acc782 Add failing test for "DROP TABLE t" executed from a prepared statement. 2017-10-05 13:55:51 +02:00
Gwendal Roué 1578dfe26b Cleanup 2017-10-05 13:50:31 +02:00
Gwendal Roué eb5e5a7069 WhyAdoptGRDB.md 2017-10-04 08:02:19 +02:00
Gwendal Roué b58cfefa13 Refactor database setup sample code so that database migrator can be tested 2017-10-03 08:40:44 +02:00
Gwendal Roué de4d395aea WhyAdoptGRDB.md 2017-10-01 06:10:19 +02:00
Gwendal Roué 7072bd9f36 WhyAdoptGRDB.md 2017-10-01 06:08:54 +02:00
Gwendal Roué 8e36bc64fd WhyAdoptGRDB.md 2017-10-01 05:55:35 +02:00
Gwendal Roué 4326a705f3 Typo 2017-09-30 22:05:17 +02:00
Gwendal Roué eb99e294ed Typo 2017-09-30 20:53:44 +02:00
Gwendal Roué 27acb2b967 WhyAdoptGRDB.md 2017-09-30 20:24:33 +02:00
Gwendal Roué 9cf5124a52 Documentation 2017-09-30 00:22:00 +02:00
Gwendal Roué d00282f077 Documentation 2017-09-28 06:47:19 +02:00
Gwendal Roué 2556bedcda Enhance versions table 2017-09-28 06:01:29 +02:00
Gwendal Roué a569acd12a Documentation 2017-09-26 19:25:47 +02:00
Gwendal Roué 5e6c462708 Documentation 2017-09-26 19:23:55 +02:00
Gwendal Roué 4e0900dffa Documentation 2017-09-26 19:21:52 +02:00
Gwendal Roué 5c61211522 Swift flags for enhancing compilation time (from @jessesquires' https://www.jessesquires.com/blog/measuring-compile-times-xcode9/) 2017-09-21 17:24:00 +02:00
Gwendal Roué 0747dc5cf6 Diff links 2017-09-17 12:04:32 +02:00
Gwendal Roué 85099c8ad6 v2.0.1 2017-09-17 11:44:31 +02:00
Gwendal Roué 72da91a8c7 Remove obsolete FAQ 2017-09-17 08:10:16 +02:00
Gwendal Roué 4aced858a8 Fix documentation typo 2017-09-17 08:04:13 +02:00
578 changed files with 99793 additions and 26517 deletions

No files matched your search

+2 -1
View File
@@ -1,4 +1,5 @@
source 'https://rubygems.org'
gem 'xcpretty'
gem 'xcpretty-travis-formatter'
gem 'xcpretty-travis-formatter'
gem 'cocoapods', '~> 1.7'
+31
View File
@@ -0,0 +1,31 @@
<!--
ℹ We use Github issues for bug reports, feature requests, general support, and questions about the library.
Please fill out this template when filing an issue.
-->
### What did you do?
<!-- Please replace this with what you did. -->
### What did you expect to happen?
<!-- Please replace this with what you expected to happen. -->
### What happened instead?
<!-- Please replace this with of what happened instead. -->
### Environment
**GRDB flavor(s):** (GRDB, SQLCipher, Custom SQLite build?)
**GRDB version:**
**Installation method:** (CocoaPods, SPM, manual?)
**Xcode version:**
**Swift version:**
**Platform(s) running GRDB:** (iOS, macOS, watchOS?)
**macOS version running Xcode:**
### Demo Project
<!-- Please link to or upload a project we can download that reproduces the issue. -->
+12
View File
@@ -0,0 +1,12 @@
<!-- Please describe your pull request here. -->
### Pull Request Checklist
<!--
Please verify that your pull request checks those boxes:
-->
- [ ] 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.
+1 -1
View File
@@ -101,8 +101,8 @@ SQLiteCustom/GRDBCustomSQLite-USER.h
SQLiteCustom/GRDBCustomSQLite-USER.xcconfig
# CocoaPods test
Podfile.lock
Pods
Podfile.lock
# SPM
.build
+1 -4
View File
@@ -7,9 +7,6 @@
[submodule "Tests/Performance/Realm"]
path = Tests/Performance/Realm
url = https://github.com/realm/realm-cocoa.git
[submodule "SQLCipher/src"]
path = SQLCipher/src
url = https://github.com/groue/sqlcipher.git
[submodule "SQLiteCustom/src"]
path = SQLiteCustom/src
url = https://github.com/swiftlyfalling/SQLiteLib
url = https://github.com/swiftlyfalling/SQLiteLib.git
-1
View File
@@ -1 +0,0 @@
4.0
+63
View File
@@ -0,0 +1,63 @@
included:
- GRDB
disabled_rules:
- cyclomatic_complexity
- file_length
- force_cast
- force_try
- function_body_length
- function_parameter_count
- identifier_name
- is_disjoint
- nesting
- opening_brace
- redundant_optional_initialization
- syntactic_sugar
- todo
- trailing_comma
- trailing_whitespace
- type_body_length
- type_name
- unused_setter_value
opt_in_rules:
- anyobject_protocol
- array_init
- attributes
- closure_spacing
- collection_alignment
- contains_over_filter_count
- contains_over_filter_is_empty
- contains_over_first_not_nil
- contains_over_range_nil_comparison
- convenience_type
- empty_collection_literal
- empty_count
- empty_string
- explicit_init
- fatal_error_message
- first_where
- flatmap_over_map_reduce
- identical_operands
- joined_default_parameter
- last_where
- legacy_multiple
- legacy_random
- lower_acl_than_parent
- modifier_order
- no_extension_access_modifier
- overridden_super_call
- pattern_matching_keywords
- prohibited_super_call
- reduce_into
- redundant_type_annotation
- sorted_first_last
- toggle_bool
- unused_declaration
- unused_import
- yoda_condition
vertical_whitespace:
max_empty_lines: 2
+386 -102
View File
@@ -1,6 +1,19 @@
# The OS X Build Environment
# https://docs.travis-ci.com/user/reference/osx/#xcode-version
language: objective-c
xcode_project: GRDB.xcodeproj
# Caches
cache:
- bundler
- cocoapods
# Custom CocoaPods installation so that Podfile.lock is honored
install:
- bundle install
- bundle exec pod repo update
# Disable the default Travis-CI submodule logic
# The various make commands ensure that the appropriate submodules are retrieved
git:
@@ -10,142 +23,413 @@ jobs:
include:
###########################################
## Test GRDB
# Test GRDBOSX (Xcode 9)
- stage: Test GRDB
## Test GRDB Xcode 11
- stage: Test GRDB Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode11
env:
- TID=GRDBOSX (Xcode 9, macOS 10.12)
script: make test_framework_GRDBOSX
# Test GRDBWatchOS (Xcode 9)
- stage: Test GRDB
- TID=GRDBOSX (Swift 5.1, macOS)
script: make test_framework_GRDBOSX_maxSwift
- stage: Test GRDB Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode11
env:
- TID=GRDBWatchOS (Xcode 9, watchOS)
- TID=GRDBOSX (Swift 4.2, macOS)
script: make test_framework_GRDBOSX_minSwift
- stage: Test GRDB Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode11
env:
- TID=GRDBWatchOS (watchOS)
script: make test_framework_GRDBWatchOS
# Test GRDBiOS (Xcode 9, iOS <MAXIMUM VERSION>)
- stage: Test GRDB
- stage: Test GRDB Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode11
env:
- TID=GRDBiOS (Xcode 9, iOS <MAX>)
script: make test_framework_GRDBiOS_maxTarget
# Test GRDBiOS (Xcode 9, iOS <MINIMUM VERSION>))
- stage: Test GRDB
- TID=GRDBiOS (Swift 5.1, iOS <MAX>)
script: make test_framework_GRDBiOS_maxTarget_maxSwift
- stage: Test GRDB Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode11
env:
- TID=GRDBiOS (Xcode 9, iOS <MIN>)
script: make test_framework_GRDBiOS_minTarget
# Test GRDB [SPM] (Xcode 9, macOS 10.12)
- stage: Test GRDB
- TID=GRDBiOS (Swift 4.2, iOS <MAX>)
script: make test_framework_GRDBiOS_maxTarget_minSwift
# - stage: Test GRDB Xcode 11
# gemfile: .ci/gemfiles/Gemfile.travis
# osx_image: xcode11
# env:
# - TID=GRDBiOS (Swift 5.1, iOS <MIN>)
# script: make test_framework_GRDBiOS_minTarget
- stage: Test GRDB Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode11
env:
- TID=GRDB [SPM] (Xcode 9, macOS 10.12)
- TID=GRDBtvOS (Swift 5.1, tvOS <MAX>)
script: make test_framework_GRDBtvOS_maxTarget_maxSwift
- stage: Test GRDB Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode11
env:
- TID=GRDBtvOS (Swift 4.2, tvOS <MAX>)
script: make test_framework_GRDBtvOS_maxTarget_minSwift
# - stage: Test GRDB Xcode 11
# gemfile: .ci/gemfiles/Gemfile.travis
# osx_image: xcode11
# env:
# - TID=GRDBtvOS (Swift 5.1, tvOS <MIN>)
# script: make test_framework_GRDBtvOS_minTarget
- stage: Test GRDB Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode11
env:
- TID=GRDB [SPM] (macOS)
script: make test_SPM
###########################################
## Test GRDB (Custom SQLite)
# Test GRDBCustomSQLiteOSX (Xcode 9)
- stage: Test GRDB + Custom SQLite
## Test GRDBCustom Xcode 11
- stage: Test GRDBCustom Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode11
env:
- TID=GRDBCustomSQLiteOSX (Xcode 9, macOS 10.12)
- TID=GRDBOSX (Swift 5.1, macOS)
script: make test_framework_GRDBCustomSQLiteOSX
# Test GRDBCustomSQLiteiOS (Xcode 9, iOS <MAXIMUM VERSION>)
- stage: Test GRDB + Custom SQLite
- stage: Test GRDBCustom Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode11
env:
- TID=GRDBCustomSQLiteiOS (Xcode 9, iOS <MAX>)
script: make test_framework_GRDBCustomSQLiteiOS_maxTarget
# Test GRDBCustomSQLiteiOS (Xcode 9, iOS <MINIMUM VERSION>))
- stage: Test GRDB + Custom SQLite
- TID=GRDBiOS (Swift 5.1, iOS <MAX>)
script: make test_framework_GRDBCustomSQLiteiOS_maxTarget_maxSwift
- stage: Test GRDBCustom Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode11
env:
- TID=GRDBCustomSQLiteiOS (Xcode 9, iOS <MIN>)
script: make test_framework_GRDBCustomSQLiteiOS_minTarget
- TID=GRDBiOS (Swift 4.2, iOS <MAX>)
script: make test_framework_GRDBCustomSQLiteiOS_maxTarget_minSwift
# - stage: Test GRDBCustom Xcode 11
# gemfile: .ci/gemfiles/Gemfile.travis
# osx_image: xcode11
# env:
# - TID=GRDBiOS (Swift 5.1, iOS <MIN>)
# script: make test_framework_GRDBCustomSQLiteiOS_minTarget
###########################################
## Test GRDB (SQLCipher)
# Test GRDBCipherOSX (Xcode 9)
- stage: Test GRDB + SQLCipher
## Test SQLCipher Xcode 11
- stage: Test SQLCipher Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode11
env:
- TID=GRDBCipherOSX (Xcode 9, macOS 10.12)
script: make test_framework_GRDBCipherOSX
# Test GRDBCipheriOS (Xcode 9, iOS <MAXIMUM VERSION>)
- stage: Test GRDB + SQLCipher
- TID=SQLCipher 3
script: make test_framework_SQLCipher3
- stage: Test SQLCipher Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode11
env:
- TID=GRDBCipheriOS (Xcode 9, iOS <MAX>)
script: make test_framework_GRDBCipheriOS_maxTarget
# Test GRDBCipheriOS (Xcode 9, iOS <MINIMUM VERSION>))
- stage: Test GRDB + SQLCipher
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
env:
- TID=GRDBCipheriOS (Xcode 9, iOS <MIN>)
script: make test_framework_GRDBCipheriOS_minTarget
- TID=SQLCipher 4
script: make test_framework_SQLCipher4
###########################################
## Test Installation Methods
## Test Installation Xcode 11
# Manual Install
- stage: Test Installation
- stage: Test Installation Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode11
env:
- TID=Manual Install
script: make test_install_manual
# Manual Install (GRDBCipher)
- stage: Test Installation
# CocoaPods Lint
- stage: Test Installation Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
osx_image: xcode11
env:
- TID=Manual Install (GRDBCipher)
script: make test_install_GRDBCipher
# Cocoapods Lint
- stage: Test Installation
osx_image: xcode9
install:
- gem install cocoapods # Since Travis is not always on latest version
- TID=CocoaPods Lint
script: make test_CocoaPodsLint_GRDB
# CocoaPods Install GRDB
- stage: Test Installation Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode11
env:
- TID=Cocoapods
script: make test_CocoaPodsLint
- TID=CocoaPods GRDB (framework)
script: make test_install_GRDB_CocoaPods_framework
# CocoaPods Install GRDB
- stage: Test Installation Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode11
env:
- TID=CocoaPods GRDB (static)
script: make test_install_GRDB_CocoaPods_static
# SPM Install
- stage: Test Installation
osx_image: xcode9
- stage: Test Installation Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode11
env:
- TID=SPM
script: make test_install_SPM
- TID=SPM Package
script: make test_install_SPM_Package
# SPM Install
- stage: Test Installation Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode11
env:
- TID=SPM Package in Xcode Project
script: make test_install_SPM_Project
# Custom SQLite Install
- stage: Test Installation Xcode 11
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode11
env:
- TID=Custom SQLite
script: make test_install_customSQLite
###########################################
## Test GRDB Xcode 10.3
- stage: Test GRDB Xcode 10.3
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.3
env:
- TID=GRDBOSX (Swift 5, macOS)
script: make test_framework_GRDBOSX_maxSwift
- stage: Test GRDB Xcode 10.3
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.3
env:
- TID=GRDBWatchOS (watchOS)
script: make test_framework_GRDBWatchOS
- stage: Test GRDB Xcode 10.3
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.3
env:
- TID=GRDBiOS (Swift 5, iOS <MAX>)
script: make test_framework_GRDBiOS_maxTarget_maxSwift
- stage: Test GRDB Xcode 10.3
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.3
env:
- TID=GRDBiOS (Swift 5, iOS <MIN>)
script: make test_framework_GRDBiOS_minTarget
- stage: Test GRDB Xcode 10.3
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.3
env:
- TID=GRDBtvOS (Swift 5, tvOS <MAX>)
script: make test_framework_GRDBtvOS_maxTarget_maxSwift
- stage: Test GRDB Xcode 10.3
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.3
env:
- TID=GRDBtvOS (Swift 5, tvOS <MIN>)
script: make test_framework_GRDBtvOS_minTarget
- stage: Test GRDB Xcode 10.3
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.3
env:
- TID=GRDB [SPM] (macOS)
script: make test_SPM
###########################################
## Test GRDB Xcode 10.2
- stage: Test GRDB Xcode 10.2
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.2
env:
- TID=GRDBOSX (Swift 5, macOS)
script: make test_framework_GRDBOSX_maxSwift
- stage: Test GRDB Xcode 10.2
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.2
env:
- TID=GRDBWatchOS (watchOS)
script: make test_framework_GRDBWatchOS
- stage: Test GRDB Xcode 10.2
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.2
env:
- TID=GRDBiOS (Swift 5, iOS <MAX>)
script: make test_framework_GRDBiOS_maxTarget_maxSwift
- stage: Test GRDB Xcode 10.2
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.2
env:
- TID=GRDBiOS (Swift 5, iOS <MIN>)
script: make test_framework_GRDBiOS_minTarget
- stage: Test GRDB Xcode 10.2
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.2
env:
- TID=GRDBtvOS (Swift 5, tvOS <MAX>)
script: make test_framework_GRDBtvOS_maxTarget_maxSwift
- stage: Test GRDB Xcode 10.2
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.2
env:
- TID=GRDBtvOS (Swift 5, tvOS <MIN>)
script: make test_framework_GRDBtvOS_minTarget
- stage: Test GRDB Xcode 10.2
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.2
env:
- TID=GRDB [SPM] (macOS)
script: make test_SPM
###########################################
## Test GRDB Xcode 10.1
- stage: Test GRDB Xcode 10.1
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.1
env:
- TID=GRDBOSX (Swift 4.2, macOS)
script: make test_framework_GRDBOSX_maxSwift
- stage: Test GRDB Xcode 10.1
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.1
env:
- TID=GRDBWatchOS (watchOS)
script: make test_framework_GRDBWatchOS
- stage: Test GRDB Xcode 10.1
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.1
env:
- TID=GRDBiOS (Swift 4.2, iOS <MAX>)
script: make test_framework_GRDBiOS_maxTarget_maxSwift
- stage: Test GRDB Xcode 10.1
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.1
env:
- TID=GRDBiOS (Swift 4.2, iOS <MIN>)
script: make test_framework_GRDBiOS_minTarget
- stage: Test GRDB Xcode 10.1
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.1
env:
- TID=GRDBtvOS (Swift 4.2, tvOS <MAX>)
script: make test_framework_GRDBtvOS_maxTarget_maxSwift
- stage: Test GRDB Xcode 10.1
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.1
env:
- TID=GRDBtvOS (Swift 4.2, tvOS <MIN>)
script: make test_framework_GRDBtvOS_minTarget
- stage: Test GRDB Xcode 10.1
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10.1
env:
- TID=GRDB [SPM] (macOS)
script: make test_SPM
###########################################
## Test GRDB Xcode 10
- stage: Test GRDB Xcode 10
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=GRDBOSX (Swift 4.2, macOS)
script: make test_framework_GRDBOSX_maxSwift
- stage: Test GRDB Xcode 10
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=GRDBWatchOS (watchOS)
script: make test_framework_GRDBWatchOS
- stage: Test GRDB Xcode 10
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=GRDBiOS (Swift 4.2, iOS <MAX>)
script: make test_framework_GRDBiOS_maxTarget_maxSwift
- stage: Test GRDB Xcode 10
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=GRDBiOS (Swift 4.2, iOS <MIN>)
script: make test_framework_GRDBiOS_minTarget
- stage: Test GRDB Xcode 10
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=GRDBtvOS (Swift 4.2, tvOS <MAX>)
script: make test_framework_GRDBtvOS_maxTarget_maxSwift
- stage: Test GRDB Xcode 10
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=GRDBtvOS (Swift 4.2, tvOS <MIN>)
script: make test_framework_GRDBtvOS_minTarget
- stage: Test GRDB Xcode 10
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=GRDB [SPM] (macOS)
script: make test_SPM
# CocoaPods Install GRDB
- stage: Test Installation Xcode 10
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=CocoaPods GRDB (framework)
script: make test_install_GRDB_CocoaPods_framework
# CocoaPods Install GRDB
- stage: Test Installation Xcode 10
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=CocoaPods GRDB (static)
script: make test_install_GRDB_CocoaPods_static
## The following doesn’t work, as `make test_CarthageBuild` does not yet work.
## Carthage Build
#- stage: Carthage
# osx_image: xcode9
# before_install:
# - brew update
# - brew outdated carthage || brew upgrade carthage
# script: make test_CarthageBuild
# Custom SQLite Install
- stage: Test Installation Xcode 10
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode10
env:
- TID=Custom SQLite
script: make test_install_customSQLite
+2009 -12
View File
File diff suppressed because it is too large. Load diff
+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/
+339
View File
@@ -0,0 +1,339 @@
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]
- [CloudKit]
- [Concurrency]
- [Custom FTS5 Auxiliary Functions]
- [Date and Time Functions]
- [Decode NSDecimalNumber from Text Columns]
- [Documentation]
- [Full Text Search Demo Application]
- [JSON]
- [Linux]
- [More SQL Generation]
- [Reactive Database Observation]
- [SQL Console in the Debugger]
- [SQLCipher in a Shared App Container]
- [Typed Expressions]
### Associations
:bowtie: Public API Challenge :muscle: Hard :fire: Experimental
Associations can be enhanced in several ways. See the "Known Issues" chapter of the [Associations Guide](Documentation/AssociationsBasics.md)
### 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.
### Custom FTS5 Auxiliary Functions
:question: Unknown Difficulty
The SQLite documentation provides [this description](https://www.sqlite.org/fts5.html) of FTS5 auxiliary functions:
> An application may use FTS5 auxiliary functions to retrieve extra information regarding the matched row. For example, an auxiliary function may be used to retrieve a copy of a column value for a matched row with all instances of the matched term surrounded by html <b></b> tags.
Applications can define their own [custom FTS5 auxiliary functions](https://www.sqlite.org/fts5.html#custom_auxiliary_functions) with SQLite, but GRDB does not yet provide any Swift API for that.
See issue [#421](https://github.com/groue/GRDB.swift/issues/421) for more information.
### 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.
### 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:
- [ALTER TABLE ... RENAME COLUMN ... TO ...](https://www.sqlite.org/lang_altertable.html)
- [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)
- [Windows Functions](https://www.sqlite.org/windowfunctions.html)
- [More ideas](https://www.sqlite.org/lang.html)
See [issue #575](https://github.com/groue/GRDB.swift/issues/575) for more information and guidance about the implementation of extra table alterations.
### Reactive Database Observation
:baby: Starter Task
We already have the [GRDBCombine](http://github.com/groue/GRDBCombine) and [RxGRDB] companion libraries.
More choices of reactive engines would help more developers enjoy GRDB.
### 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).
### 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
[CloudKit]: #cloudkit
[Codable Records]: README.md#codable-records
[Custom FTS5 Auxiliary Functions]: #custom-fts5-auxiliary-functions
[Database Observation]: #database-observation
[Date and Time Functions]: #date-and-time-functions
[Decode NSDecimalNumber from Text Columns]: #decode-nsdecimalnumber-from-text-columns
[Documentation]: #documentation
[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
[Reactive Database Observation]: #reactive-database-observation
[Records: Splitting Database Encoding from Ability to Write in the Database]: #records-splitting-database-encoding-from-ability-to-write-in-the-database
[Non-Goals]: #non-goals
[Report Bugs]: #report-bugs
[RxGRDB]: http://github.com/RxSwiftCommunity/RxGRDB
[Concurrency]: #concurrency
[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
[persistence methods]: README.md#persistence-methods
[PersistableRecord]: README.md#persistablerecord-protocol
[Record Comparison]: README.md#record-comparison
[Requesting Associated Records]: Documentation/AssociationsBasics.md#requesting-associated-records
[ValueObservation]: README.md#valueobservation
@@ -1,11 +0,0 @@
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
try! setupDatabase(application)
return true
}
}
@@ -1,310 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11129.15" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="UAh-8N-CM8">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11103.10"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Hall Of Fame-->
<scene sceneID="8jG-C9-QsI">
<objects>
<tableViewController id="cyv-nk-Plb" customClass="SimplePersonsViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="oON-zg-8kO">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="Person" textLabel="XIE-DF-pSO" detailTextLabel="vyz-CH-eMb" style="IBUITableViewCellStyleValue1" id="V5t-oJ-KD9">
<frame key="frameInset" minY="92" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="V5t-oJ-KD9" id="Coo-th-ywF">
<frame key="frameInset" width="342" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="XIE-DF-pSO">
<frame key="frameInset" minX="15" minY="12" width="31.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="vyz-CH-eMb">
<frame key="frameInset" minX="298.5" minY="12" width="41.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="iNr-Oe-muq" kind="show" identifier="EditPerson" id="czF-1h-sYn"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="cyv-nk-Plb" id="uBb-Bn-Lhg"/>
<outlet property="delegate" destination="cyv-nk-Plb" id="nLb-Ak-ZXS"/>
</connections>
</tableView>
<toolbarItems/>
<navigationItem key="navigationItem" title="Hall Of Fame" id="YLU-iz-PGw"/>
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
<connections>
<segue destination="ein-Sr-i8w" kind="presentation" identifier="NewPerson" id="zii-bJ-cOA"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="PrM-ex-2C8" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="630" y="640"/>
</scene>
<!--Person Edition View Controller-->
<scene sceneID="Juk-Ad-tZ2">
<objects>
<tableViewController id="iNr-Oe-muq" customClass="PersonEditionViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="vlV-lc-eQA">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<sections>
<tableViewSection id="Nzq-eO-jT3">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="2gb-gB-918">
<rect key="frame" x="0.0" y="64" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2gb-gB-918" id="iyM-TJ-JB4">
<frame key="frameInset" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" horizontalCompressionResistancePriority="250" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Name" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="m5m-Zs-j0z">
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<textInputTraits key="textInputTraits" autocapitalizationType="words" autocorrectionType="no" spellCheckingType="no" returnKeyType="next"/>
<connections>
<outlet property="delegate" destination="iNr-Oe-muq" id="K2p-7d-teD"/>
</connections>
</textField>
</subviews>
<constraints>
<constraint firstItem="m5m-Zs-j0z" firstAttribute="leading" secondItem="iyM-TJ-JB4" secondAttribute="leadingMargin" constant="10" id="9cK-nj-70V"/>
<constraint firstAttribute="trailingMargin" secondItem="m5m-Zs-j0z" secondAttribute="trailing" id="JsE-8v-XAS"/>
<constraint firstItem="m5m-Zs-j0z" firstAttribute="centerY" secondItem="iyM-TJ-JB4" secondAttribute="centerY" id="psG-tW-QrM"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="vp3-Ft-Gth">
<rect key="frame" x="0.0" y="108" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="vp3-Ft-Gth" id="ccO-0O-u72">
<frame key="frameInset" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" horizontalCompressionResistancePriority="250" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Score" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="rZ9-Fa-cyr">
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="numberPad" returnKeyType="done"/>
</textField>
</subviews>
<constraints>
<constraint firstAttribute="trailingMargin" secondItem="rZ9-Fa-cyr" secondAttribute="trailing" id="Gso-FU-Ct1"/>
<constraint firstItem="rZ9-Fa-cyr" firstAttribute="centerY" secondItem="ccO-0O-u72" secondAttribute="centerY" id="UqA-ea-emb"/>
<constraint firstItem="rZ9-Fa-cyr" firstAttribute="leading" secondItem="ccO-0O-u72" secondAttribute="leadingMargin" constant="10" id="WrY-St-72v"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
</cells>
</tableViewSection>
</sections>
<connections>
<outlet property="dataSource" destination="iNr-Oe-muq" id="67O-XE-MeV"/>
<outlet property="delegate" destination="iNr-Oe-muq" id="vLD-QQ-zR2"/>
</connections>
</tableView>
<toolbarItems/>
<navigationItem key="navigationItem" id="U4g-xG-W8b">
<barButtonItem key="leftBarButtonItem" systemItem="cancel" id="VIN-Hi-Twt">
<connections>
<segue destination="lTz-K0-aRY" kind="unwind" unwindAction="cancelPersonEdition:" id="fOs-ol-qJL"/>
</connections>
</barButtonItem>
<barButtonItem key="rightBarButtonItem" systemItem="done" id="2um-u5-BhV">
<connections>
<segue destination="lTz-K0-aRY" kind="unwind" identifier="" unwindAction="commitPersonEdition:" id="Y1E-dI-wcl"/>
</connections>
</barButtonItem>
</navigationItem>
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
<connections>
<outlet property="cancelBarButtonItem" destination="VIN-Hi-Twt" id="dET-mF-ZXe"/>
<outlet property="commitBarButtonItem" destination="2um-u5-BhV" id="Jym-us-zdP"/>
<outlet property="nameCell" destination="2gb-gB-918" id="ch2-MB-uRm"/>
<outlet property="nameTextField" destination="m5m-Zs-j0z" id="A6a-pw-q8s"/>
<outlet property="scoreCell" destination="vp3-Ft-Gth" id="b8A-42-8Dw"/>
<outlet property="scoreTextField" destination="rZ9-Fa-cyr" id="4kw-gV-uih"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="fNC-Ls-uRw" userLabel="First Responder" sceneMemberID="firstResponder"/>
<exit id="lTz-K0-aRY" userLabel="Exit" sceneMemberID="exit"/>
</objects>
<point key="canvasLocation" x="1450" y="1435"/>
</scene>
<!--GRDB Demo-->
<scene sceneID="XjB-aQ-v94">
<objects>
<tableViewController id="9kw-c5-KTk" customClass="DemoViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="f4Y-o2-7VW">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<sections>
<tableViewSection id="dCg-qU-h2X">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="clL-nG-zPX" style="IBUITableViewCellStyleDefault" id="kJB-sX-YAb">
<rect key="frame" x="0.0" y="64" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="kJB-sX-YAb" id="f5l-ob-3DG">
<frame key="frameInset" width="342" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Simple TableView" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="clL-nG-zPX">
<frame key="frameInset" minX="15" width="325" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="cyv-nk-Plb" kind="show" id="Bgq-9t-jRc"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="I78-c5-0kp" style="IBUITableViewCellStyleDefault" id="q4C-mT-5mi">
<rect key="frame" x="0.0" y="108" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="q4C-mT-5mi" id="2Cu-K1-hiz">
<frame key="frameInset" width="342" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="FetchedRecordsController" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="I78-c5-0kp">
<frame key="frameInset" minX="15" width="325" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="PJp-Eq-ZjA" kind="show" id="1fk-ZR-6XN"/>
</connections>
</tableViewCell>
</cells>
</tableViewSection>
</sections>
<connections>
<outlet property="dataSource" destination="9kw-c5-KTk" id="IK7-Os-Odc"/>
<outlet property="delegate" destination="9kw-c5-KTk" id="U7E-yB-s8d"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="GRDB Demo" id="z0z-02-Ucy"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="OhY-4B-BcJ" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-190" y="1435"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="2KX-IU-Z5Q">
<objects>
<navigationController id="ein-Sr-i8w" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="zIT-dB-Mfo">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="iNr-Oe-muq" kind="relationship" relationship="rootViewController" id="e5b-3U-9Vz"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="kNr-vk-I5l" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="630" y="1435"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="N1X-4j-Re4">
<objects>
<navigationController id="UAh-8N-CM8" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="U7d-1C-GnL">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="9kw-c5-KTk" kind="relationship" relationship="rootViewController" id="qDW-qI-Hyg"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="sVt-e9-ghQ" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1006" y="1435"/>
</scene>
<!--Hall Of Fame-->
<scene sceneID="9su-ms-vdJ">
<objects>
<tableViewController id="PJp-Eq-ZjA" customClass="PersonsViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="tX0-ON-WSI">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="Person" textLabel="G8y-VE-YRu" detailTextLabel="NNc-J4-xiE" style="IBUITableViewCellStyleValue1" id="bFj-Hd-fwd">
<frame key="frameInset" minY="92" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="bFj-Hd-fwd" id="kDf-TZ-xhb">
<frame key="frameInset" width="342" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="G8y-VE-YRu">
<frame key="frameInset" minX="15" minY="12" width="31.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="NNc-J4-xiE">
<frame key="frameInset" minX="298.5" minY="12" width="41.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.5568627451" green="0.5568627451" blue="0.57647058819999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="iNr-Oe-muq" kind="show" identifier="EditPerson" id="Lgu-Yd-HSy"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="PJp-Eq-ZjA" id="MkQ-WQ-sTh"/>
<outlet property="delegate" destination="PJp-Eq-ZjA" id="quj-Sp-DuL"/>
</connections>
</tableView>
<toolbarItems>
<barButtonItem title="Item" id="hMF-Rv-dAe"/>
</toolbarItems>
<navigationItem key="navigationItem" title="Hall Of Fame" id="QIv-M6-kT1">
<barButtonItem key="rightBarButtonItem" systemItem="add" id="2bK-Fl-55Q"/>
</navigationItem>
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
<connections>
<segue destination="ein-Sr-i8w" kind="presentation" identifier="NewPerson" id="7PC-xN-zD4"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="af5-Qo-AkD" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="630" y="2254"/>
</scene>
</scenes>
<inferredMetricsTieBreakers>
<segue reference="7PC-xN-zD4"/>
<segue reference="czF-1h-sYn"/>
</inferredMetricsTieBreakers>
</document>
@@ -1,56 +0,0 @@
import GRDB
import UIKit
// The shared database queue
var dbQueue: DatabaseQueue!
func setupDatabase(_ application: UIApplication) throws {
// Connect to the database
// See https://github.com/groue/GRDB.swift/#database-connections
let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first! as NSString
let databasePath = documentsPath.appendingPathComponent("db.sqlite")
dbQueue = try DatabaseQueue(path: databasePath)
// Be a nice iOS citizen, and don't consume too much memory
// See https://github.com/groue/GRDB.swift/#memory-management
dbQueue.setupMemoryManagement(in: application)
// Use DatabaseMigrator to setup the database
// See https://github.com/groue/GRDB.swift/#migrations
var migrator = DatabaseMigrator()
migrator.registerMigration("createPersons") { db in
// Create a table
// See https://github.com/groue/GRDB.swift#create-tables
try db.create(table: "persons") { t in
// An integer primary key auto-generates unique IDs
t.column("id", .integer).primaryKey()
// Sort person names in a localized case insensitive fashion by default
// See https://github.com/groue/GRDB.swift/#unicode
t.column("name", .text).notNull().collate(.localizedCaseInsensitiveCompare)
t.column("score", .integer).notNull()
}
// Populate the persons table with random data
for _ in 0..<8 {
try Person(name: Person.randomName(), score: Person.randomScore()).insert(db)
}
}
// // Migrations for future application versions will be inserted here:
// migrator.registerMigration(...) { db in
// ...
// }
try migrator.migrate(dbQueue)
}
@@ -1,10 +0,0 @@
import UIKit
class DemoViewController: UITableViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(true)
navigationController?.isToolbarHidden = true
navigationItem.backBarButtonItem = UIBarButtonItem(title: "Demo", style: .plain, target: nil, action: nil)
}
}
Binary file not shown.
@@ -1,49 +0,0 @@
import GRDB
class Person: Record {
var id: Int64?
var name: String
var score: Int
init(name: String, score: Int) {
self.name = name
self.score = score
super.init()
}
// MARK: Record overrides
override class var databaseTableName: String {
return "persons"
}
required init(row: Row) {
id = row["id"]
name = row["name"]
score = row["score"]
super.init(row: row)
}
override func encode(to container: inout PersistenceContainer) {
container["id"] = id
container["name"] = name
container["score"] = score
}
override func didInsert(with rowID: Int64, for column: String?) {
id = rowID
}
// MARK: Random
private static let names = ["Arthur", "Anita", "Barbara", "Bernard", "Craig", "Chiara", "David", "Dean", "Éric", "Elena", "Fatima", "Frederik", "Gilbert", "Georgette", "Henriette", "Hassan", "Ignacio", "Irene", "Julie", "Jack", "Karl", "Kristel", "Louis", "Liz", "Masashi", "Mary", "Noam", "Nicole", "Ophelie", "Oleg", "Pascal", "Patricia", "Quentin", "Quinn", "Raoul", "Rachel", "Stephan", "Susie", "Tristan", "Tatiana", "Ursule", "Urbain", "Victor", "Violette", "Wilfried", "Wilhelmina", "Yvon", "Yann", "Zazie", "Zoé"]
class func randomName() -> String {
return names[Int(arc4random_uniform(UInt32(names.count)))]
}
class func randomScore() -> Int {
return 10 * Int(arc4random_uniform(101))
}
}
@@ -1,234 +0,0 @@
import UIKit
import GRDB
class PersonsViewController: UITableViewController {
var personsController: FetchedRecordsController<Person>!
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.rightBarButtonItems = [
UIBarButtonItem(barButtonSystemItem: .add, target: self, action: .addPerson),
editButtonItem
]
personsController = try! FetchedRecordsController(dbQueue, request: personsSortedByScore)
personsController.trackChanges(
willChange: { [unowned self] _ in
self.tableView.beginUpdates()
},
onChange: { [unowned self] (controller, record, change) in
switch change {
case .insertion(let indexPath):
self.tableView.insertRows(at: [indexPath], with: .fade)
case .deletion(let indexPath):
self.tableView.deleteRows(at: [indexPath], with: .fade)
case .update(let indexPath, _):
if let cell = self.tableView.cellForRow(at: indexPath) {
self.configure(cell, at: indexPath)
}
case .move(let indexPath, let newIndexPath, _):
// Actually move cells around for more demo effect :-)
let cell = self.tableView.cellForRow(at: indexPath)
self.tableView.moveRow(at: indexPath, to: newIndexPath)
if let cell = cell {
self.configure(cell, at: newIndexPath)
}
// A quieter animation:
// self.tableView.deleteRows(at: [indexPath], with: .fade)
// self.tableView.insertRows(at: [newIndexPath], with: .fade)
}
},
didChange: { [unowned self] _ in
self.tableView.endUpdates()
})
try! personsController.performFetch()
configureToolbar()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.isToolbarHidden = false
}
}
// MARK: - Navigation
extension PersonsViewController : PersonEditionViewControllerDelegate {
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "EditPerson" {
let person = personsController.record(at: tableView.indexPathForSelectedRow!)
let controller = segue.destination as! PersonEditionViewController
controller.title = person.name
controller.person = person
controller.delegate = self // we will save person when back button is tapped
controller.cancelButtonHidden = true
controller.commitButtonHidden = true
}
else if segue.identifier == "NewPerson" {
setEditing(false, animated: true)
let navigationController = segue.destination as! UINavigationController
let controller = navigationController.viewControllers.first as! PersonEditionViewController
controller.title = "New Person"
controller.person = Person(name: "", score: 0)
}
}
@IBAction func addPerson(_ sender: AnyObject?) {
performSegue(withIdentifier: "NewPerson", sender: sender)
}
@IBAction func cancelPersonEdition(_ segue: UIStoryboardSegue) {
// Person creation: cancel button was tapped
}
@IBAction func commitPersonEdition(_ segue: UIStoryboardSegue) {
// Person creation: commit button was tapped
let controller = segue.source as! PersonEditionViewController
controller.applyChanges()
let person = controller.person!
if !person.name.isEmpty {
try! dbQueue.inDatabase { db in
try person.save(db)
}
}
}
func personEditionControllerDidComplete(_ controller: PersonEditionViewController) {
// Person edition: back button was tapped
controller.applyChanges()
let person = controller.person!
if !person.name.isEmpty {
try! dbQueue.inDatabase { db in
try person.save(db)
}
}
}
}
// MARK: - UITableViewDataSource
extension PersonsViewController {
func configure(_ cell: UITableViewCell, at indexPath: IndexPath) {
let person = personsController.record(at: indexPath)
cell.textLabel?.text = person.name
cell.detailTextLabel?.text = abs(person.score) > 1 ? "\(person.score) points" : "0 point"
}
override func numberOfSections(in tableView: UITableView) -> Int {
return personsController.sections.count
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return personsController.sections[section].numberOfRecords
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Person", for: indexPath)
configure(cell, at: indexPath)
return cell
}
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
// Delete the person
let person = personsController.record(at: indexPath)
try! dbQueue.inDatabase { db in
_ = try person.delete(db)
}
}
}
// MARK: - FetchedRecordsController Demo
extension PersonsViewController {
fileprivate func configureToolbar() {
toolbarItems = [
UIBarButtonItem(title: "Name ⬆︎", style: .plain, target: self, action: .sortByName),
UIBarButtonItem(title: "Score ⬇︎", style: .plain, target: self, action: .sortByScore),
UIBarButtonItem(title: "Randomize", style: .plain, target: self, action: .randomizeScores),
UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil),
UIBarButtonItem(title: "💣", style: .plain, target: self, action: .stressTest)
]
}
@IBAction func sortByName() {
setEditing(false, animated: true)
try! personsController.setRequest(personsSortedByName)
}
@IBAction func sortByScore() {
setEditing(false, animated: true)
try! personsController.setRequest(personsSortedByScore)
}
@IBAction func randomizeScores() {
setEditing(false, animated: true)
try! dbQueue.inTransaction { db in
for person in try Person.fetchAll(db) {
person.score = Person.randomScore()
try person.update(db)
}
return .commit
}
}
@IBAction func stressTest() {
setEditing(false, animated: true)
for _ in 0..<50 {
DispatchQueue.global().async {
try! dbQueue.inTransaction { db in
if try Person.fetchCount(db) == 0 {
// Insert persons
for _ in 0..<8 {
try Person(name: Person.randomName(), score: Person.randomScore()).insert(db)
}
} else {
// Insert a person
if arc4random_uniform(2) == 0 {
let person = Person(name: Person.randomName(), score: Person.randomScore())
try person.insert(db)
}
// Delete a person
if arc4random_uniform(2) == 0 {
if let person = try Person.order(sql: "RANDOM()").fetchOne(db) {
try person.delete(db)
}
}
// Update some persons
for person in try Person.fetchAll(db) {
if arc4random_uniform(2) == 0 {
person.score = Person.randomScore()
try person.update(db)
}
}
}
return .commit
}
}
}
}
}
// https://medium.com/swift-programming/swift-selector-syntax-sugar-81c8a8b10df3
private extension Selector {
static let addPerson = #selector(PersonsViewController.addPerson(_:))
static let sortByName = #selector(PersonsViewController.sortByName)
static let sortByScore = #selector(PersonsViewController.sortByScore)
static let randomizeScores = #selector(PersonsViewController.randomizeScores)
static let stressTest = #selector(PersonsViewController.stressTest)
}
private let personsSortedByName = Person.order(Column("name"))
private let personsSortedByScore = Person.order(Column("score").desc, Column("name"))
@@ -1,114 +0,0 @@
import UIKit
import GRDB
class SimplePersonsViewController: UITableViewController {
var persons: [Person]!
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.rightBarButtonItems = [
UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(SimplePersonsViewController.addPerson(_:))),
editButtonItem
]
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
loadPersons()
tableView.reloadData()
}
private func loadPersons() {
persons = try! dbQueue.inDatabase { db in
try Person.order(Column("score").desc, Column("name")).fetchAll(db)
}
}
}
// MARK: - Navigation
extension SimplePersonsViewController : PersonEditionViewControllerDelegate {
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "EditPerson" {
let person = persons[tableView.indexPathForSelectedRow!.row]
let controller = segue.destination as! PersonEditionViewController
controller.title = person.name
controller.person = person
controller.delegate = self // we will save person when back button is tapped
controller.cancelButtonHidden = true
controller.commitButtonHidden = true
}
else if segue.identifier == "NewPerson" {
setEditing(false, animated: true)
let navigationController = segue.destination as! UINavigationController
let controller = navigationController.viewControllers.first as! PersonEditionViewController
controller.title = "New Person"
controller.person = Person(name: "", score: 0)
}
}
@IBAction func addPerson(_ sender: AnyObject?) {
performSegue(withIdentifier: "NewPerson", sender: sender)
}
@IBAction func cancelPersonEdition(_ segue: UIStoryboardSegue) {
// Person creation: cancel button was tapped
}
@IBAction func commitPersonEdition(_ segue: UIStoryboardSegue) {
// Person creation: commit button was tapped
let controller = segue.source as! PersonEditionViewController
controller.applyChanges()
let person = controller.person!
if !person.name.isEmpty {
try! dbQueue.inDatabase { db in
try person.save(db)
}
}
}
func personEditionControllerDidComplete(_ controller: PersonEditionViewController) {
// Person edition: back button was tapped
controller.applyChanges()
let person = controller.person!
if !person.name.isEmpty {
try! dbQueue.inDatabase { db in
try person.save(db)
}
}
}
}
// MARK: - UITableViewDataSource
extension SimplePersonsViewController {
func configure(_ cell: UITableViewCell, at indexPath: IndexPath) {
let person = persons[indexPath.row]
cell.textLabel?.text = person.name
cell.detailTextLabel?.text = abs(person.score) > 1 ? "\(person.score) points" : "0 point"
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return persons.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Person", for: indexPath)
configure(cell, at: indexPath)
return cell
}
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
// Delete the person
let person = persons[indexPath.row]
try! dbQueue.inDatabase { db in
_ = try person.delete(db)
}
persons.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: .fade)
}
}
File diff suppressed because it is too large. Load diff
+8 -6
View File
@@ -3,7 +3,7 @@ Custom SQLite Builds
By default, GRDB uses the version of SQLite that ships with the target operating system.
**You can build GRDB with a custom build of [SQLite 3.20.0](https://www.sqlite.org/changes.html).**
**You can build GRDB with a custom build of [SQLite 3.28.0](https://www.sqlite.org/changes.html).**
A custom SQLite build can activate extra SQLite features, and extra GRDB features as well, such as support for the [FTS5 full-text search engine](../../../#full-text-search), and [SQLite Pre-Update Hooks](../../../#support-for-sqlite-pre-update-hooks).
@@ -11,13 +11,13 @@ GRDB builds SQLite with [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfal
**To install GRDB with a custom SQLite build:**
1. Clone the GRDB git repository, checkout the latest tagged version, and download SQLite sources:
1. Clone the GRDB git repository, checkout the latest tagged version:
```sh
cd [GRDB directory]
git checkout v2.0
git checkout [latest tag]
git submodule update --init SQLiteCustom/src
````
```
2. Choose your [extra compilation options](https://www.sqlite.org/compile.html). For example, `SQLITE_ENABLE_FTS5` and `SQLITE_ENABLE_PREUPDATE_HOOK`.
@@ -60,7 +60,7 @@ GRDB builds SQLite with [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfal
# !! MODIFY THESE TO MATCH YOUR PROJECT HIERARCHY !!
#######################################################
# The path to the folder containing GRDB.xcodeproj:
# The path to the folder containing GRDBCustom.xcodeproj:
GRDB_SOURCE_PATH="${PROJECT_DIR}/GRDB"
# The path to your custom "SQLiteLib-USER.xcconfig":
@@ -107,7 +107,7 @@ GRDB builds SQLite with [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfal
Modify the top of `GRDBCustomSQLite-INSTALL.sh` file so that it contains correct paths.
5. Embed the `GRDB.xcodeproj` project in your own project.
5. Embed the `GRDBCustom.xcodeproj` project in your own project.
6. Add the `GRDBCustomSQLiteOSX` or `GRDBCustomSQLiteiOS` target in the **Target Dependencies** section of the **Build Phases** tab of your **application target**.
@@ -120,6 +120,8 @@ GRDB builds SQLite with [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfal
```
The path should be the path to your `GRDBCustomSQLite-INSTALL.sh` file.
Select your application target in the "Provide build settings from" menu.
9. Check the "Shared" checkbox of your application scheme (this lets you commit the pre-action in your Version Control System).
@@ -25,7 +25,7 @@
<key>NSExtensionAttributes</key>
<dict>
<key>WKAppBundleIdentifier</key>
<string>com.github.groue.GRDBDemoiOS.watchkitapp</string>
<string>com.github.groue.GRDBDemoiOS2.watchkitapp</string>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.watchkit</string>
@@ -26,7 +26,7 @@
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>WKCompanionAppBundleIdentifier</key>
<string>com.github.groue.GRDBDemoiOS</string>
<string>com.github.groue.GRDBDemoiOS2</string>
<key>WKWatchKitApp</key>
<true/>
</dict>
@@ -7,6 +7,10 @@
objects = {
/* Begin PBXBuildFile section */
56606D202355938A00185962 /* GRDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 56606D142355931F00185962 /* GRDB.framework */; };
56606D212355938A00185962 /* GRDB.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 56606D142355931F00185962 /* GRDB.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
56606D24235593AB00185962 /* GRDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 56606D182355931F00185962 /* GRDB.framework */; };
56606D25235593AB00185962 /* GRDB.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 56606D182355931F00185962 /* GRDB.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
568E5FC31E926430002582E0 /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 568E5FC11E926430002582E0 /* Interface.storyboard */; };
568E5FC51E926430002582E0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 568E5FC41E926430002582E0 /* Assets.xcassets */; };
568E5FCC1E926430002582E0 /* GRDBDemoWatchOS Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 568E5FCB1E926430002582E0 /* GRDBDemoWatchOS Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
@@ -14,23 +18,101 @@
568E5FD31E926430002582E0 /* ExtensionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 568E5FD21E926430002582E0 /* ExtensionDelegate.swift */; };
568E5FD51E926430002582E0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 568E5FD41E926430002582E0 /* Assets.xcassets */; };
568E5FD91E926430002582E0 /* GRDBDemoWatchOS.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = 568E5FBF1E926430002582E0 /* GRDBDemoWatchOS.app */; };
568E5FE41E926547002582E0 /* GRDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 56B0365B1E8D9F79003B6DA4 /* GRDB.framework */; };
568E5FE51E926547002582E0 /* GRDB.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 56B0365B1E8D9F79003B6DA4 /* GRDB.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
56B036071E8D9EBE003B6DA4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B036061E8D9EBE003B6DA4 /* AppDelegate.swift */; };
56B0360C1E8D9EBE003B6DA4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 56B0360A1E8D9EBE003B6DA4 /* Main.storyboard */; };
56B0360E1E8D9EBE003B6DA4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 56B0360D1E8D9EBE003B6DA4 /* Assets.xcassets */; };
56B036111E8D9EBE003B6DA4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 56B0360F1E8D9EBE003B6DA4 /* LaunchScreen.storyboard */; };
56B0361B1E8D9F38003B6DA4 /* Database.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B036191E8D9F38003B6DA4 /* Database.swift */; };
56B0361C1E8D9F38003B6DA4 /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B0361A1E8D9F38003B6DA4 /* Person.swift */; };
56B036221E8D9F4C003B6DA4 /* DemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B0361E1E8D9F4C003B6DA4 /* DemoViewController.swift */; };
56B036231E8D9F4C003B6DA4 /* PersonEditionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B0361F1E8D9F4C003B6DA4 /* PersonEditionViewController.swift */; };
56B036241E8D9F4C003B6DA4 /* PersonsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B036201E8D9F4C003B6DA4 /* PersonsViewController.swift */; };
56B036251E8D9F4C003B6DA4 /* SimplePersonsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B036211E8D9F4C003B6DA4 /* SimplePersonsViewController.swift */; };
56B0365E1E8D9FB1003B6DA4 /* GRDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 56B0364D1E8D9F79003B6DA4 /* GRDB.framework */; };
56B0365F1E8D9FB1003B6DA4 /* GRDB.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 56B0364D1E8D9F79003B6DA4 /* GRDB.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
56B0361B1E8D9F38003B6DA4 /* AppDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B036191E8D9F38003B6DA4 /* AppDatabase.swift */; };
56B0361C1E8D9F38003B6DA4 /* Player.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B0361A1E8D9F38003B6DA4 /* Player.swift */; };
56B036231E8D9F4C003B6DA4 /* PlayerEditionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B0361F1E8D9F4C003B6DA4 /* PlayerEditionViewController.swift */; };
56B036241E8D9F4C003B6DA4 /* PlayersViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B036201E8D9F4C003B6DA4 /* PlayersViewController.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
56606D092355931F00185962 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = DC3773F319C8CBB3004FCF85;
remoteInfo = GRDBOSX;
};
56606D0B2355931F00185962 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56E5D7F91B4D422D00430942;
remoteInfo = GRDBOSXTests;
};
56606D0D2355931F00185962 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 560C981A1C0E22D300BF8471;
remoteInfo = GRDBOSXPerformanceTests;
};
56606D0F2355931F00185962 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56439B501F4CA1DC0066043F;
remoteInfo = GRDBOSXPerformanceComparisonTests;
};
56606D112355931F00185962 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56553C181C3E906C00522B5C;
remoteInfo = GRDBOSXCrashTests;
};
56606D132355931F00185962 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56E5D7CA1B4D3FED00430942;
remoteInfo = GRDBiOS;
};
56606D152355931F00185962 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56E5D7D31B4D3FEE00430942;
remoteInfo = GRDBiOSTests;
};
56606D172355931F00185962 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 565490A01D5A4798005622CB;
remoteInfo = GRDBWatchOS;
};
56606D192355931F00185962 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = AAA4DCFE230F1E0600C74B15;
remoteInfo = GRDBtvOS;
};
56606D1B2355931F00185962 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = AAA4DDD4230F262000C74B15;
remoteInfo = GRDBtvOSTests;
};
56606D1D2355937900185962 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 56E5D7C91B4D3FED00430942;
remoteInfo = GRDBiOS;
};
56606D22235593A300185962 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 5654909F1D5A4798005622CB;
remoteInfo = GRDBWatchOS;
};
568E5FCD1E926430002582E0 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B035FB1E8D9EBE003B6DA4 /* Project object */;
@@ -45,153 +127,6 @@
remoteGlobalIDString = 568E5FBE1E926430002582E0;
remoteInfo = GRDBDemoWatchOS;
};
568E5FE21E926535002582E0 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 5654909F1D5A4798005622CB;
remoteInfo = GRDBWatchOS;
};
568E5FE61E926547002582E0 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 5654909F1D5A4798005622CB;
remoteInfo = GRDBWatchOS;
};
56B0363A1E8D9F79003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = DC3773F319C8CBB3004FCF85;
remoteInfo = GRDBOSX;
};
56B0363C1E8D9F79003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56E5D7F91B4D422D00430942;
remoteInfo = GRDBOSXTests;
};
56B0363E1E8D9F79003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 560C981A1C0E22D300BF8471;
remoteInfo = GRDBOSXPerformanceTests;
};
56B036401E8D9F79003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56553C181C3E906C00522B5C;
remoteInfo = GRDBOSXCrashTests;
};
56B036421E8D9F79003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 560FC54D1CB003810014AA8E;
remoteInfo = GRDBCipherOSX;
};
56B036441E8D9F79003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 560FC5B01CB00B880014AA8E;
remoteInfo = GRDBCipherOSXTests;
};
56B036461E8D9F79003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 5671566C1CB16729007DC145;
remoteInfo = GRDBCipherOSXEncryptedTests;
};
56B036481E8D9F79003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F3BA805A1CFB2BB2003DC1BA;
remoteInfo = GRDBCustomSQLiteOSX;
};
56B0364A1E8D9F79003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F3BA809B1CFB2F6F003DC1BA;
remoteInfo = GRDBCustomSQLiteOSXTests;
};
56B0364C1E8D9F79003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56E5D7CA1B4D3FED00430942;
remoteInfo = GRDBiOS;
};
56B0364E1E8D9F79003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56E5D7D31B4D3FEE00430942;
remoteInfo = GRDBiOSTests;
};
56B036501E8D9F79003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56AFCA231CB1A8BB00F48B96;
remoteInfo = GRDBCipheriOS;
};
56B036521E8D9F79003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56AFCA7F1CB1AA9900F48B96;
remoteInfo = GRDBCipheriOSTests;
};
56B036541E8D9F79003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56AFCAD71CB1ABC800F48B96;
remoteInfo = GRDBCipheriOSEncryptedTests;
};
56B036561E8D9F79003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F3BA7FFE1CFB25E4003DC1BA;
remoteInfo = GRDBCustomSQLiteiOS;
};
56B036581E8D9F79003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F3BA80411CFB2AD7003DC1BA;
remoteInfo = GRDBCustomSQLiteiOSTests;
};
56B0365A1E8D9F79003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 565490A01D5A4798005622CB;
remoteInfo = GRDBWatchOS;
};
56B0365C1E8D9F8F003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 56E5D7C91B4D3FED00430942;
remoteInfo = GRDBiOS;
};
56B036601E8D9FB1003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 56E5D7C91B4D3FED00430942;
remoteInfo = GRDBiOS;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -223,7 +158,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
568E5FE51E926547002582E0 /* GRDB.framework in Embed Frameworks */,
56606D25235593AB00185962 /* GRDB.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
@@ -234,7 +169,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
56B0365F1E8D9FB1003B6DA4 /* GRDB.framework in Embed Frameworks */,
56606D212355938A00185962 /* GRDB.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
@@ -257,13 +192,11 @@
56B0360D1E8D9EBE003B6DA4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
56B036101E8D9EBE003B6DA4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
56B036121E8D9EBE003B6DA4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
56B036191E8D9F38003B6DA4 /* Database.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Database.swift; sourceTree = "<group>"; };
56B0361A1E8D9F38003B6DA4 /* Person.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Person.swift; sourceTree = "<group>"; };
56B0361E1E8D9F4C003B6DA4 /* DemoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DemoViewController.swift; sourceTree = "<group>"; };
56B0361F1E8D9F4C003B6DA4 /* PersonEditionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PersonEditionViewController.swift; sourceTree = "<group>"; };
56B036201E8D9F4C003B6DA4 /* PersonsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PersonsViewController.swift; sourceTree = "<group>"; };
56B036211E8D9F4C003B6DA4 /* SimplePersonsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimplePersonsViewController.swift; sourceTree = "<group>"; };
56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = GRDB.xcodeproj; path = ../../GRDB.xcodeproj; sourceTree = "<group>"; };
56B036191E8D9F38003B6DA4 /* AppDatabase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDatabase.swift; sourceTree = "<group>"; };
56B0361A1E8D9F38003B6DA4 /* Player.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Player.swift; sourceTree = "<group>"; };
56B0361F1E8D9F4C003B6DA4 /* PlayerEditionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlayerEditionViewController.swift; sourceTree = "<group>"; };
56B036201E8D9F4C003B6DA4 /* PlayersViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlayersViewController.swift; sourceTree = "<group>"; };
56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = GRDB.xcodeproj; path = ../../../GRDB.xcodeproj; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -271,7 +204,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
568E5FE41E926547002582E0 /* GRDB.framework in Frameworks */,
56606D24235593AB00185962 /* GRDB.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -279,13 +212,37 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
56B0365E1E8D9FB1003B6DA4 /* GRDB.framework in Frameworks */,
56606D202355938A00185962 /* GRDB.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
56606CFD2355931F00185962 /* Products */ = {
isa = PBXGroup;
children = (
56606D0A2355931F00185962 /* GRDB.framework */,
56606D0C2355931F00185962 /* GRDBOSXTests.xctest */,
56606D0E2355931F00185962 /* GRDBOSXPerformanceTests.xctest */,
56606D102355931F00185962 /* GRDBOSXPerformanceComparisonTests.xctest */,
56606D122355931F00185962 /* GRDBOSXCrashTests.xctest */,
56606D142355931F00185962 /* GRDB.framework */,
56606D162355931F00185962 /* GRDBiOSTests.xctest */,
56606D182355931F00185962 /* GRDB.framework */,
56606D1A2355931F00185962 /* GRDB.framework */,
56606D1C2355931F00185962 /* GRDBtvOSTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
56606D1F2355938A00185962 /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
568E5FC01E926430002582E0 /* GRDBDemoWatchOS */ = {
isa = PBXGroup;
children = (
@@ -315,6 +272,7 @@
568E5FC01E926430002582E0 /* GRDBDemoWatchOS */,
568E5FCF1E926430002582E0 /* GRDBDemoWatchOS Extension */,
56B036041E8D9EBE003B6DA4 /* Products */,
56606D1F2355938A00185962 /* Frameworks */,
);
sourceTree = "<group>";
};
@@ -332,9 +290,10 @@
isa = PBXGroup;
children = (
56B036061E8D9EBE003B6DA4 /* AppDelegate.swift */,
56B036191E8D9F38003B6DA4 /* Database.swift */,
56B0361A1E8D9F38003B6DA4 /* Person.swift */,
56B0361D1E8D9F3D003B6DA4 /* Controllers */,
56B036191E8D9F38003B6DA4 /* AppDatabase.swift */,
56B0361A1E8D9F38003B6DA4 /* Player.swift */,
56B0361F1E8D9F4C003B6DA4 /* PlayerEditionViewController.swift */,
56B036201E8D9F4C003B6DA4 /* PlayersViewController.swift */,
56B0360A1E8D9EBE003B6DA4 /* Main.storyboard */,
56B0360D1E8D9EBE003B6DA4 /* Assets.xcassets */,
56B0360F1E8D9EBE003B6DA4 /* LaunchScreen.storyboard */,
@@ -343,41 +302,6 @@
path = GRDBDemoiOS;
sourceTree = "<group>";
};
56B0361D1E8D9F3D003B6DA4 /* Controllers */ = {
isa = PBXGroup;
children = (
56B0361E1E8D9F4C003B6DA4 /* DemoViewController.swift */,
56B0361F1E8D9F4C003B6DA4 /* PersonEditionViewController.swift */,
56B036201E8D9F4C003B6DA4 /* PersonsViewController.swift */,
56B036211E8D9F4C003B6DA4 /* SimplePersonsViewController.swift */,
);
name = Controllers;
sourceTree = "<group>";
};
56B036271E8D9F79003B6DA4 /* Products */ = {
isa = PBXGroup;
children = (
56B0363B1E8D9F79003B6DA4 /* GRDB.framework */,
56B0363D1E8D9F79003B6DA4 /* GRDBOSXTests.xctest */,
56B0363F1E8D9F79003B6DA4 /* GRDBOSXPerformanceTests.xctest */,
56B036411E8D9F79003B6DA4 /* GRDBOSXCrashTests.xctest */,
56B036431E8D9F79003B6DA4 /* GRDBCipher.framework */,
56B036451E8D9F79003B6DA4 /* GRDBCipherOSXTests.xctest */,
56B036471E8D9F79003B6DA4 /* GRDBCipherOSXEncryptedTests.xctest */,
56B036491E8D9F79003B6DA4 /* GRDBCustomSQLite.framework */,
56B0364B1E8D9F79003B6DA4 /* GRDBCustomSQLiteOSXTests.xctest */,
56B0364D1E8D9F79003B6DA4 /* GRDB.framework */,
56B0364F1E8D9F79003B6DA4 /* GRDBiOSTests.xctest */,
56B036511E8D9F79003B6DA4 /* GRDBCipher.framework */,
56B036531E8D9F79003B6DA4 /* GRDBCipheriOSTests.xctest */,
56B036551E8D9F79003B6DA4 /* GRDBCipheriOSEncryptedTests.xctest */,
56B036571E8D9F79003B6DA4 /* GRDBCustomSQLite.framework */,
56B036591E8D9F79003B6DA4 /* GRDBCustomSQLiteiOSTests.xctest */,
56B0365B1E8D9F79003B6DA4 /* GRDB.framework */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -410,8 +334,7 @@
buildRules = (
);
dependencies = (
568E5FE31E926535002582E0 /* PBXTargetDependency */,
568E5FE71E926547002582E0 /* PBXTargetDependency */,
56606D23235593A300185962 /* PBXTargetDependency */,
);
name = "GRDBDemoWatchOS Extension";
productName = "GRDBDemoWatchOS Extension";
@@ -431,8 +354,7 @@
buildRules = (
);
dependencies = (
56B0365D1E8D9F8F003B6DA4 /* PBXTargetDependency */,
56B036611E8D9FB1003B6DA4 /* PBXTargetDependency */,
56606D1E2355937900185962 /* PBXTargetDependency */,
568E5FD81E926430002582E0 /* PBXTargetDependency */,
);
name = GRDBDemoiOS;
@@ -447,7 +369,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Gwendal Roué";
TargetAttributes = {
568E5FBE1E926430002582E0 = {
@@ -458,18 +380,20 @@
568E5FCA1E926430002582E0 = {
CreatedOnToolsVersion = 8.3;
DevelopmentTeam = AMD8W895CT;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
56B036021E8D9EBE003B6DA4 = {
CreatedOnToolsVersion = 8.3;
DevelopmentTeam = AMD8W895CT;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
};
};
buildConfigurationList = 56B035FE1E8D9EBE003B6DA4 /* Build configuration list for PBXProject "GRDBDemoiOS" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
@@ -480,7 +404,7 @@
projectDirPath = "";
projectReferences = (
{
ProductGroup = 56B036271E8D9F79003B6DA4 /* Products */;
ProductGroup = 56606CFD2355931F00185962 /* Products */;
ProjectRef = 56B036261E8D9F79003B6DA4 /* GRDB.xcodeproj */;
},
);
@@ -494,123 +418,74 @@
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
56B0363B1E8D9F79003B6DA4 /* GRDB.framework */ = {
56606D0A2355931F00185962 /* GRDB.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDB.framework;
remoteRef = 56B0363A1E8D9F79003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56606D092355931F00185962 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B0363D1E8D9F79003B6DA4 /* GRDBOSXTests.xctest */ = {
56606D0C2355931F00185962 /* GRDBOSXTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBOSXTests.xctest;
remoteRef = 56B0363C1E8D9F79003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56606D0B2355931F00185962 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B0363F1E8D9F79003B6DA4 /* GRDBOSXPerformanceTests.xctest */ = {
56606D0E2355931F00185962 /* GRDBOSXPerformanceTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBOSXPerformanceTests.xctest;
remoteRef = 56B0363E1E8D9F79003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56606D0D2355931F00185962 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B036411E8D9F79003B6DA4 /* GRDBOSXCrashTests.xctest */ = {
56606D102355931F00185962 /* GRDBOSXPerformanceComparisonTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBOSXPerformanceComparisonTests.xctest;
remoteRef = 56606D0F2355931F00185962 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56606D122355931F00185962 /* GRDBOSXCrashTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBOSXCrashTests.xctest;
remoteRef = 56B036401E8D9F79003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56606D112355931F00185962 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B036431E8D9F79003B6DA4 /* GRDBCipher.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDBCipher.framework;
remoteRef = 56B036421E8D9F79003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B036451E8D9F79003B6DA4 /* GRDBCipherOSXTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBCipherOSXTests.xctest;
remoteRef = 56B036441E8D9F79003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B036471E8D9F79003B6DA4 /* GRDBCipherOSXEncryptedTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBCipherOSXEncryptedTests.xctest;
remoteRef = 56B036461E8D9F79003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B036491E8D9F79003B6DA4 /* GRDBCustomSQLite.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDBCustomSQLite.framework;
remoteRef = 56B036481E8D9F79003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B0364B1E8D9F79003B6DA4 /* GRDBCustomSQLiteOSXTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBCustomSQLiteOSXTests.xctest;
remoteRef = 56B0364A1E8D9F79003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B0364D1E8D9F79003B6DA4 /* GRDB.framework */ = {
56606D142355931F00185962 /* GRDB.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDB.framework;
remoteRef = 56B0364C1E8D9F79003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56606D132355931F00185962 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B0364F1E8D9F79003B6DA4 /* GRDBiOSTests.xctest */ = {
56606D162355931F00185962 /* GRDBiOSTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBiOSTests.xctest;
remoteRef = 56B0364E1E8D9F79003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56606D152355931F00185962 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B036511E8D9F79003B6DA4 /* GRDBCipher.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDBCipher.framework;
remoteRef = 56B036501E8D9F79003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B036531E8D9F79003B6DA4 /* GRDBCipheriOSTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBCipheriOSTests.xctest;
remoteRef = 56B036521E8D9F79003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B036551E8D9F79003B6DA4 /* GRDBCipheriOSEncryptedTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBCipheriOSEncryptedTests.xctest;
remoteRef = 56B036541E8D9F79003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B036571E8D9F79003B6DA4 /* GRDBCustomSQLite.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDBCustomSQLite.framework;
remoteRef = 56B036561E8D9F79003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B036591E8D9F79003B6DA4 /* GRDBCustomSQLiteiOSTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBCustomSQLiteiOSTests.xctest;
remoteRef = 56B036581E8D9F79003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B0365B1E8D9F79003B6DA4 /* GRDB.framework */ = {
56606D182355931F00185962 /* GRDB.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDB.framework;
remoteRef = 56B0365A1E8D9F79003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56606D172355931F00185962 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56606D1A2355931F00185962 /* GRDB.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDB.framework;
remoteRef = 56606D192355931F00185962 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56606D1C2355931F00185962 /* GRDBtvOSTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBtvOSTests.xctest;
remoteRef = 56606D1B2355931F00185962 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
@@ -659,19 +534,27 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
56B0361C1E8D9F38003B6DA4 /* Person.swift in Sources */,
56B0361B1E8D9F38003B6DA4 /* Database.swift in Sources */,
56B0361C1E8D9F38003B6DA4 /* Player.swift in Sources */,
56B0361B1E8D9F38003B6DA4 /* AppDatabase.swift in Sources */,
56B036071E8D9EBE003B6DA4 /* AppDelegate.swift in Sources */,
56B036241E8D9F4C003B6DA4 /* PersonsViewController.swift in Sources */,
56B036231E8D9F4C003B6DA4 /* PersonEditionViewController.swift in Sources */,
56B036251E8D9F4C003B6DA4 /* SimplePersonsViewController.swift in Sources */,
56B036221E8D9F4C003B6DA4 /* DemoViewController.swift in Sources */,
56B036241E8D9F4C003B6DA4 /* PlayersViewController.swift in Sources */,
56B036231E8D9F4C003B6DA4 /* PlayerEditionViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
56606D1E2355937900185962 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = GRDBiOS;
targetProxy = 56606D1D2355937900185962 /* PBXContainerItemProxy */;
};
56606D23235593A300185962 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = GRDBWatchOS;
targetProxy = 56606D22235593A300185962 /* PBXContainerItemProxy */;
};
568E5FCE1E926430002582E0 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 568E5FCA1E926430002582E0 /* GRDBDemoWatchOS Extension */;
@@ -682,26 +565,6 @@
target = 568E5FBE1E926430002582E0 /* GRDBDemoWatchOS */;
targetProxy = 568E5FD71E926430002582E0 /* PBXContainerItemProxy */;
};
568E5FE31E926535002582E0 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = GRDBWatchOS;
targetProxy = 568E5FE21E926535002582E0 /* PBXContainerItemProxy */;
};
568E5FE71E926547002582E0 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = GRDBWatchOS;
targetProxy = 568E5FE61E926547002582E0 /* PBXContainerItemProxy */;
};
56B0365D1E8D9F8F003B6DA4 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = GRDBiOS;
targetProxy = 56B0365C1E8D9F8F003B6DA4 /* PBXContainerItemProxy */;
};
56B036611E8D9FB1003B6DA4 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = GRDBiOS;
targetProxy = 56B036601E8D9FB1003B6DA4 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
@@ -736,10 +599,11 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication;
CLANG_ENABLE_OBJC_WEAK = YES;
DEVELOPMENT_TEAM = AMD8W895CT;
INFOPLIST_FILE = "GRDBDemoWatchOS Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOS.watchkitapp.watchkitextension;
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOS2.watchkitapp.watchkitextension;
PRODUCT_NAME = "${TARGET_NAME}";
SDKROOT = watchos;
SKIP_INSTALL = YES;
@@ -752,10 +616,11 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication;
CLANG_ENABLE_OBJC_WEAK = YES;
DEVELOPMENT_TEAM = AMD8W895CT;
INFOPLIST_FILE = "GRDBDemoWatchOS Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOS.watchkitapp.watchkitextension;
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOS2.watchkitapp.watchkitextension;
PRODUCT_NAME = "${TARGET_NAME}";
SDKROOT = watchos;
SKIP_INSTALL = YES;
@@ -769,10 +634,11 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_OBJC_WEAK = YES;
DEVELOPMENT_TEAM = AMD8W895CT;
IBSC_MODULE = GRDBDemoWatchOS_Extension;
INFOPLIST_FILE = GRDBDemoWatchOS/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOS.watchkitapp;
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOS2.watchkitapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = watchos;
SKIP_INSTALL = YES;
@@ -786,10 +652,11 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_OBJC_WEAK = YES;
DEVELOPMENT_TEAM = AMD8W895CT;
IBSC_MODULE = GRDBDemoWatchOS_Extension;
INFOPLIST_FILE = GRDBDemoWatchOS/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOS.watchkitapp;
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOS2.watchkitapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = watchos;
SKIP_INSTALL = YES;
@@ -802,6 +669,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
@@ -812,6 +680,7 @@
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;
@@ -819,6 +688,7 @@
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;
@@ -850,7 +720,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -858,6 +728,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
@@ -868,6 +739,7 @@
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;
@@ -875,6 +747,7 @@
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;
@@ -898,7 +771,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
@@ -908,10 +781,11 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_OBJC_WEAK = YES;
DEVELOPMENT_TEAM = AMD8W895CT;
INFOPLIST_FILE = GRDBDemoiOS/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOS;
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOS2;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
@@ -921,10 +795,11 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_OBJC_WEAK = YES;
DEVELOPMENT_TEAM = AMD8W895CT;
INFOPLIST_FILE = GRDBDemoiOS/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOS;
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOS2;
PRODUCT_NAME = "$(TARGET_NAME)";
};
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>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1030"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1030"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
@@ -38,8 +36,8 @@
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
@@ -61,8 +59,6 @@
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
@@ -0,0 +1,56 @@
import GRDB
/// A type responsible for initializing the application database.
///
/// See AppDelegate.setupDatabase()
struct AppDatabase {
/// Creates a fully initialized database at path
static func openDatabase(atPath path: String) throws -> DatabaseQueue {
// Connect to the database
// See https://github.com/groue/GRDB.swift/blob/master/README.md#database-connections
let dbQueue = try DatabaseQueue(path: path)
// Define the database schema
try migrator.migrate(dbQueue)
return dbQueue
}
/// The DatabaseMigrator that defines the database schema.
///
/// See https://github.com/groue/GRDB.swift/blob/master/README.md#migrations
static var migrator: DatabaseMigrator {
var migrator = DatabaseMigrator()
migrator.registerMigration("createPlayer") { db in
// Create a table
// See https://github.com/groue/GRDB.swift#create-tables
try db.create(table: "player") { t in
t.autoIncrementedPrimaryKey("id")
// Sort player names in a localized case insensitive fashion by default
// See https://github.com/groue/GRDB.swift/blob/master/README.md#unicode
t.column("name", .text).notNull().collate(.localizedCaseInsensitiveCompare)
t.column("score", .integer).notNull()
}
}
migrator.registerMigration("fixtures") { db in
// Populate the players table with random data
for _ in 0..<8 {
var player = Player(id: nil, name: Player.randomName(), score: Player.randomScore())
try player.insert(db)
}
}
// // Migrations for future application versions will be inserted here:
// migrator.registerMigration(...) { db in
// ...
// }
return migrator
}
}
@@ -0,0 +1,26 @@
import UIKit
import GRDB
// The shared database queue
var dbQueue: DatabaseQueue!
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
try! setupDatabase(application)
return true
}
private func setupDatabase(_ application: UIApplication) throws {
let databaseURL = try FileManager.default
.url(for: .applicationSupportDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
.appendingPathComponent("db.sqlite")
dbQueue = try AppDatabase.openDatabase(atPath: databaseURL.path)
// Be a nice iOS citizen, and don't consume too much memory
// See https://github.com/groue/GRDB.swift/blob/master/README.md#memory-management
dbQueue.setupMemoryManagement(in: application)
}
}
@@ -1,15 +1,5 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
@@ -42,16 +32,6 @@
"filename" : "Icon-60@3x.png",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
File renamed without changes.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

@@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="UAh-8N-CM8">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Player Edition View Controller-->
<scene sceneID="Juk-Ad-tZ2">
<objects>
<tableViewController id="iNr-Oe-muq" customClass="PlayerEditionViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" dataMode="static" style="plain" separatorStyle="none" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="vlV-lc-eQA">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<sections>
<tableViewSection id="Nzq-eO-jT3">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="2gb-gB-918">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2gb-gB-918" id="iyM-TJ-JB4">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" horizontalCompressionResistancePriority="250" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Name" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="m5m-Zs-j0z">
<rect key="frame" x="16" y="12" width="343" height="20"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<textInputTraits key="textInputTraits" autocapitalizationType="words" autocorrectionType="no" spellCheckingType="no" returnKeyType="next"/>
<connections>
<outlet property="delegate" destination="iNr-Oe-muq" id="K2p-7d-teD"/>
</connections>
</textField>
</subviews>
<constraints>
<constraint firstItem="m5m-Zs-j0z" firstAttribute="leading" secondItem="iyM-TJ-JB4" secondAttribute="leadingMargin" id="9cK-nj-70V"/>
<constraint firstAttribute="trailingMargin" secondItem="m5m-Zs-j0z" secondAttribute="trailing" id="JsE-8v-XAS"/>
<constraint firstItem="m5m-Zs-j0z" firstAttribute="centerY" secondItem="iyM-TJ-JB4" secondAttribute="centerY" id="psG-tW-QrM"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="vp3-Ft-Gth">
<rect key="frame" x="0.0" y="44" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="vp3-Ft-Gth" id="ccO-0O-u72">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" horizontalCompressionResistancePriority="250" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Score" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="rZ9-Fa-cyr">
<rect key="frame" x="16" y="12" width="343" height="20"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="numberPad" returnKeyType="done"/>
</textField>
</subviews>
<constraints>
<constraint firstAttribute="trailingMargin" secondItem="rZ9-Fa-cyr" secondAttribute="trailing" id="Gso-FU-Ct1"/>
<constraint firstItem="rZ9-Fa-cyr" firstAttribute="centerY" secondItem="ccO-0O-u72" secondAttribute="centerY" id="UqA-ea-emb"/>
<constraint firstItem="rZ9-Fa-cyr" firstAttribute="leading" secondItem="ccO-0O-u72" secondAttribute="leadingMargin" id="WrY-St-72v"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
</cells>
</tableViewSection>
</sections>
<connections>
<outlet property="dataSource" destination="iNr-Oe-muq" id="67O-XE-MeV"/>
<outlet property="delegate" destination="iNr-Oe-muq" id="vLD-QQ-zR2"/>
</connections>
</tableView>
<toolbarItems/>
<navigationItem key="navigationItem" id="U4g-xG-W8b">
<barButtonItem key="leftBarButtonItem" systemItem="cancel" id="VIN-Hi-Twt">
<connections>
<segue destination="lTz-K0-aRY" kind="unwind" unwindAction="cancelPlayerEdition:" id="fOs-ol-qJL"/>
</connections>
</barButtonItem>
<barButtonItem key="rightBarButtonItem" style="done" systemItem="done" id="2um-u5-BhV">
<connections>
<segue destination="lTz-K0-aRY" kind="unwind" identifier="Commit" unwindAction="commitPlayerEdition:" id="Y1E-dI-wcl"/>
</connections>
</barButtonItem>
</navigationItem>
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
<connections>
<outlet property="cancelBarButtonItem" destination="VIN-Hi-Twt" id="dET-mF-ZXe"/>
<outlet property="commitBarButtonItem" destination="2um-u5-BhV" id="Jym-us-zdP"/>
<outlet property="nameCell" destination="2gb-gB-918" id="ch2-MB-uRm"/>
<outlet property="nameTextField" destination="m5m-Zs-j0z" id="A6a-pw-q8s"/>
<outlet property="scoreCell" destination="vp3-Ft-Gth" id="b8A-42-8Dw"/>
<outlet property="scoreTextField" destination="rZ9-Fa-cyr" id="4kw-gV-uih"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="fNC-Ls-uRw" userLabel="First Responder" sceneMemberID="firstResponder"/>
<exit id="lTz-K0-aRY" userLabel="Exit" sceneMemberID="exit"/>
</objects>
<point key="canvasLocation" x="1134" y="2891"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="2KX-IU-Z5Q">
<objects>
<navigationController id="ein-Sr-i8w" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="zIT-dB-Mfo">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="iNr-Oe-muq" kind="relationship" relationship="rootViewController" id="e5b-3U-9Vz"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="kNr-vk-I5l" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1134" y="2071"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="N1X-4j-Re4">
<objects>
<navigationController id="UAh-8N-CM8" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="U7d-1C-GnL">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="PJp-Eq-ZjA" kind="relationship" relationship="rootViewController" id="klT-ZP-gtX"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="sVt-e9-ghQ" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-459" y="2071"/>
</scene>
<!--Hall Of Fame-->
<scene sceneID="9su-ms-vdJ">
<objects>
<tableViewController id="PJp-Eq-ZjA" customClass="PlayersViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="tX0-ON-WSI">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="Player" textLabel="G8y-VE-YRu" detailTextLabel="NNc-J4-xiE" style="IBUITableViewCellStyleValue1" id="bFj-Hd-fwd">
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="bFj-Hd-fwd" id="kDf-TZ-xhb">
<rect key="frame" x="0.0" y="0.0" width="341" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="G8y-VE-YRu">
<rect key="frame" x="16" y="12" width="31.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="NNc-J4-xiE">
<rect key="frame" x="298.5" y="12" width="41.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.5568627451" green="0.5568627451" blue="0.57647058819999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="iNr-Oe-muq" kind="show" identifier="Edit" id="Lgu-Yd-HSy"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="PJp-Eq-ZjA" id="MkQ-WQ-sTh"/>
<outlet property="delegate" destination="PJp-Eq-ZjA" id="quj-Sp-DuL"/>
</connections>
</tableView>
<toolbarItems>
<barButtonItem title="Item" id="hMF-Rv-dAe"/>
</toolbarItems>
<navigationItem key="navigationItem" title="Hall Of Fame" id="QIv-M6-kT1">
<barButtonItem key="leftBarButtonItem" systemItem="add" id="2bK-Fl-55Q">
<connections>
<segue destination="ein-Sr-i8w" kind="presentation" identifier="New" id="ehP-ZN-Nt4"/>
</connections>
</barButtonItem>
</navigationItem>
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
<connections>
<outlet property="newPlayerButtonItem" destination="2bK-Fl-55Q" id="O9m-8s-oRL"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="af5-Qo-AkD" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="348" y="2071"/>
</scene>
</scenes>
<inferredMetricsTieBreakers>
<segue reference="Lgu-Yd-HSy"/>
</inferredMetricsTieBreakers>
</document>
@@ -16,6 +16,8 @@
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
@@ -0,0 +1,66 @@
import GRDB
// A plain Player struct
struct Player {
// Prefer Int64 for auto-incremented database ids
var id: Int64?
var name: String
var score: Int
}
// Hashable conformance supports tableView diffing
extension Player: Hashable { }
// MARK: - Persistence
// Turn Player into a Codable Record.
// See https://github.com/groue/GRDB.swift/blob/master/README.md#records
extension Player: Codable, FetchableRecord, MutablePersistableRecord {
// Define database columns from CodingKeys
private enum Columns {
static let id = Column(CodingKeys.id)
static let name = Column(CodingKeys.name)
static let score = Column(CodingKeys.score)
}
// Update a player id after it has been inserted in the database.
mutating func didInsert(with rowID: Int64, for column: String?) {
id = rowID
}
}
// MARK: - Database access
// Define some useful player requests.
// See https://github.com/groue/GRDB.swift/blob/master/README.md#requests
extension Player {
static func orderedByName() -> QueryInterfaceRequest<Player> {
return Player.order(Columns.name)
}
static func orderedByScore() -> QueryInterfaceRequest<Player> {
return Player.order(Columns.score.desc, Columns.name)
}
}
// MARK: - Player Randomization
extension Player {
private static let names = [
"Arthur", "Anita", "Barbara", "Bernard", "Craig", "Chiara", "David",
"Dean", "Éric", "Elena", "Fatima", "Frederik", "Gilbert", "Georgette",
"Henriette", "Hassan", "Ignacio", "Irene", "Julie", "Jack", "Karl",
"Kristel", "Louis", "Liz", "Masashi", "Mary", "Noam", "Nicole",
"Ophelie", "Oleg", "Pascal", "Patricia", "Quentin", "Quinn", "Raoul",
"Rachel", "Stephan", "Susie", "Tristan", "Tatiana", "Ursule", "Urbain",
"Victor", "Violette", "Wilfried", "Wilhelmina", "Yvon", "Yann",
"Zazie", "Zoé"]
static func randomName() -> String {
return names.randomElement()!
}
static func randomScore() -> Int {
return 10 * Int.random(in: 0...100)
}
}
@@ -1,14 +1,16 @@
import UIKit
protocol PersonEditionViewControllerDelegate: class {
func personEditionControllerDidComplete(_ controller: PersonEditionViewController)
}
class PersonEditionViewController: UITableViewController {
weak var delegate: PersonEditionViewControllerDelegate?
var person: Person! { didSet { configureView() } }
var cancelButtonHidden: Bool = false { didSet { configureView() } }
var commitButtonHidden: Bool = false { didSet { configureView() } }
class PlayerEditionViewController: UITableViewController {
enum Presentation {
/// Modal presentation: edition ends with the "Commit" segue.
case modal
/// Push presentation: edition ends when user hits the back button.
case push
}
var player: Player! { didSet { configureView() } }
var presentation: Presentation! { didSet { configureView() } }
@IBOutlet fileprivate weak var cancelBarButtonItem: UIBarButtonItem!
@IBOutlet fileprivate weak var commitBarButtonItem: UIBarButtonItem!
@@ -17,38 +19,29 @@ class PersonEditionViewController: UITableViewController {
@IBOutlet fileprivate weak var scoreCell: UITableViewCell!
@IBOutlet fileprivate weak var scoreTextField: UITextField!
func applyChanges() {
if let name = nameTextField.text, !name.isEmpty {
person.name = name
}
person.score = scoreTextField.text.flatMap { Int($0) } ?? 0
}
override func viewDidLoad() {
super.viewDidLoad()
configureView()
}
private func configureView() {
fileprivate func configureView() {
guard isViewLoaded else { return }
nameTextField.text = person.name
if person.score == 0 && person.id == nil {
nameTextField.text = player.name
if player.score == 0 && player.id == nil {
scoreTextField.text = ""
} else {
scoreTextField.text = "\(person.score)"
scoreTextField.text = "\(player.score)"
}
if cancelButtonHidden {
navigationItem.leftBarButtonItem = nil
} else {
switch presentation! {
case .modal:
navigationItem.leftBarButtonItem = cancelBarButtonItem
}
if cancelButtonHidden {
navigationItem.rightBarButtonItem = nil
} else {
navigationItem.rightBarButtonItem = commitBarButtonItem
case .push:
navigationItem.leftBarButtonItem = nil
navigationItem.rightBarButtonItem = nil
}
}
}
@@ -56,7 +49,7 @@ class PersonEditionViewController: UITableViewController {
// MARK: - Navigation
extension PersonEditionViewController {
extension PlayerEditionViewController {
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
// Force keyboard to dismiss early
@@ -64,12 +57,23 @@ extension PersonEditionViewController {
return true
}
override func willMove(toParentViewController parent: UIViewController?) {
super.willMove(toParentViewController: parent)
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "Commit" {
saveChanges()
}
}
override func willMove(toParent parent: UIViewController?) {
super.willMove(toParent: parent)
if parent == nil {
// Self is popping from its navigation controller
delegate?.personEditionControllerDidComplete(self)
switch presentation! {
case .modal:
break
case .push:
if parent == nil {
// Self is popping from its navigation controller
saveChanges()
}
}
}
@@ -78,7 +82,7 @@ extension PersonEditionViewController {
// MARK: - Form
extension PersonEditionViewController: UITextFieldDelegate {
extension PlayerEditionViewController: UITextFieldDelegate {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
@@ -101,4 +105,17 @@ extension PersonEditionViewController: UITextFieldDelegate {
}
return false
}
private func saveChanges() {
guard var player = self.player else {
return
}
player.name = nameTextField.text ?? ""
player.score = scoreTextField.text.flatMap { Int($0) } ?? 0
self.player = player
try! dbQueue.inDatabase { db in
try player.save(db)
}
}
}
@@ -0,0 +1,266 @@
import UIKit
import GRDB
/// PlayersViewController displays the list of players.
class PlayersViewController: UITableViewController {
private enum PlayerOrdering {
case byName
case byScore
}
@IBOutlet private weak var newPlayerButtonItem: UIBarButtonItem!
private var players: [Player] = []
private var playersObserver: TransactionObserver?
private var playerCountObserver: TransactionObserver?
private var playerOrdering: PlayerOrdering = .byScore {
didSet {
configureOrderingBarButtonItem()
configureTableView()
}
}
private var playersRequest: QueryInterfaceRequest<Player> {
switch playerOrdering {
case .byName:
return Player.orderedByName()
case .byScore:
return Player.orderedByScore()
}
}
override func viewDidLoad() {
super.viewDidLoad()
configureToolbar()
configureNavigationItem()
configureTableView()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.isToolbarHidden = false
}
private func configureToolbar() {
toolbarItems = [
UIBarButtonItem(barButtonSystemItem: .trash, target: self, action: #selector(deletePlayers)),
UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil),
UIBarButtonItem(barButtonSystemItem: .refresh, target: self, action: #selector(refresh)),
UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil),
UIBarButtonItem(title: "💣", style: .plain, target: self, action: #selector(stressTest)),
]
}
private func configureNavigationItem() {
navigationItem.leftBarButtonItems = [editButtonItem, newPlayerButtonItem]
configureOrderingBarButtonItem()
configureTitle()
}
private func configureOrderingBarButtonItem() {
switch playerOrdering {
case .byScore:
navigationItem.rightBarButtonItem = UIBarButtonItem(
title: "Score ⬇︎",
style: .plain,
target: self, action: #selector(sortByName))
case .byName:
navigationItem.rightBarButtonItem = UIBarButtonItem(
title: "Name ⬆︎",
style: .plain,
target: self, action: #selector(sortByScore))
}
}
private func configureTitle() {
// Track changes in the number of players
let observation = ValueObservation.tracking { db in
try Player.fetchCount(db)
}
playerCountObserver = observation.start(
in: dbQueue,
onError: { error in
fatalError("Unexpected error: \(error)")
},
onChange: { [weak self] count in
guard let self = self else { return }
switch count {
case 0: self.navigationItem.title = "No Player"
case 1: self.navigationItem.title = "1 Player"
default: self.navigationItem.title = "\(count) Players"
}
})
}
private func configureTableView() {
// Track changes in the list of players
let request = self.playersRequest
let observation = ValueObservation.tracking { db in
try request.fetchAll(db)
}
playersObserver = observation.start(
in: dbQueue,
onError: { error in
fatalError("Unexpected error: \(error)")
},
onChange: { [weak self] players in
guard let self = self else { return }
// Compute difference between current and new list of players
let difference = players
.difference(from: self.players)
.inferringMoves()
// Apply those changes to the table view
self.tableView.performBatchUpdates({
self.players = players
for change in difference {
switch change {
case let .remove(offset, _, associatedWith):
if let associatedWith = associatedWith {
self.tableView.moveRow(
at: IndexPath(row: offset, section: 0),
to: IndexPath(row: associatedWith, section: 0))
} else {
self.tableView.deleteRows(
at: [IndexPath(row: offset, section: 0)],
with: .fade)
}
case let .insert(offset, _, associatedWith):
if associatedWith == nil {
self.tableView.insertRows(
at: [IndexPath(row: offset, section: 0)],
with: .fade)
}
}
}
}, completion: nil)
})
}
}
// MARK: - Navigation
extension PlayersViewController {
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "Edit" {
let player = players[tableView.indexPathForSelectedRow!.row]
let controller = segue.destination as! PlayerEditionViewController
controller.title = player.name
controller.player = player
controller.presentation = .push
}
else if segue.identifier == "New" {
setEditing(false, animated: true)
let navigationController = segue.destination as! UINavigationController
let controller = navigationController.viewControllers.first as! PlayerEditionViewController
controller.title = "New Player"
controller.player = Player(id: nil, name: "", score: 0)
controller.presentation = .modal
}
}
@IBAction func cancelPlayerEdition(_ segue: UIStoryboardSegue) {
// Player creation cancelled
}
@IBAction func commitPlayerEdition(_ segue: UIStoryboardSegue) {
// Player creation committed
}
}
// MARK: - UITableViewDataSource
extension PlayersViewController {
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return players.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Player", for: indexPath)
configure(cell, at: indexPath)
return cell
}
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
// Delete the player
let player = players[indexPath.row]
try! dbQueue.write { db in
_ = try player.delete(db)
}
}
private func configure(_ cell: UITableViewCell, at indexPath: IndexPath) {
let player = players[indexPath.row]
if player.name.isEmpty {
cell.textLabel?.text = "-"
} else {
cell.textLabel?.text = player.name
}
cell.detailTextLabel?.text = abs(player.score) > 1 ? "\(player.score) points" : "0 point"
}
}
// MARK: - Actions
extension PlayersViewController {
@IBAction func sortByName() {
setEditing(false, animated: true)
playerOrdering = .byName
}
@IBAction func sortByScore() {
setEditing(false, animated: true)
playerOrdering = .byScore
}
@IBAction func deletePlayers() {
setEditing(false, animated: true)
try! dbQueue.write { db in
_ = try Player.deleteAll(db)
}
}
@IBAction func refresh() {
setEditing(false, animated: true)
refreshPlayers()
}
@IBAction func stressTest() {
setEditing(false, animated: true)
for _ in 0..<50 {
DispatchQueue.global().async {
self.refreshPlayers()
}
}
}
private func refreshPlayers() {
try! dbQueue.write { db in
if try Player.fetchCount(db) == 0 {
// Insert new random players
for _ in 0..<8 {
var player = Player(id: nil, name: Player.randomName(), score: Player.randomScore())
try player.insert(db)
}
} else {
// Insert a player
if Bool.random() {
var player = Player(id: nil, name: Player.randomName(), score: Player.randomScore())
try player.insert(db)
}
// Delete a random player
if Bool.random() {
try Player.order(sql: "RANDOM()").limit(1).deleteAll(db)
}
// Update some players
for var player in try Player.fetchAll(db) where Bool.random() {
player.score = Player.randomScore()
try player.update(db)
}
}
}
}
}
@@ -0,0 +1,32 @@
Demo Application
================
<img align="right" src="https://github.com/groue/GRDB.swift/raw/master/Documentation/Images/GRDBDemoScreenshot.png" width="50%">
**This demo application shows you:**
- how to setup a database in an iOS app
- how to define a simple [Codable Record](../../README.md#codable-records)
- how to track database changes and animate a table view with [ValueObservation](../../README.md#valueobservation).
**Files of interest:**
- [AppDelegate.swift](GRDBDemoiOS/AppDelegate.swift)
`AppDelegate` creates, on application startup, a unique instance of [DatabaseQueue](../../README.md#database-queues) available for the whole application.
- [AppDatabase.swift](GRDBDemoiOS/AppDatabase.swift)
`AppDatabase` defines the database for the whole application. It uses [DatabaseMigrator](../../README.md#migrations) in order to setup the database schema.
- [Player.swift](GRDBDemoiOS/Player.swift)
`Player` is a [Record](../../README.md#records) type, able to read and write in the database. It conforms to the standard Codable protocol in order to gain all advantages of [Codable Records](../../README.md#codable-records).
- [PlayersViewController.swift](GRDBDemoiOS/PlayersViewController.swift)
`PlayersViewController` displays a list of players. It keeps its view up-to-date with [ValueObservation](../../README.md#valueobservation).
- [PlayerEditionViewController.swift](GRDBDemoiOS/PlayerEditionViewController.swift)
`PlayerEditionViewController` can create or edit a player, and save it in the database.
-591
View File
@@ -1,591 +0,0 @@
GRDB Extension Guide
====================
**Some parts of GRDB are extensible, so that you can make it better fit your needs.**
This guide is a step-by-step tour of GRDB extensibility, around a few topics:
- **[Add a value type](#add-a-value-type)**
You'll learn how to turn UIColor into a value type that you can store, fetch, and use in your records:
```swift
let rows = try Row.fetchCursor(db, "SELECT name, color FROM clothes")
while let row = try rows.next() {
let name: String = row["name"]
let color: UIColor = row["color"] // <-- New! UIColor as value
}
```
- **[Add an SQLite function or operator](#add-an-sqlite-function-or-operator)**
You'll learn how to add support for the [STRFTIME](https://www.sqlite.org/lang_datefunc.html) function, and the [GLOB](https://www.sqlite.org/lang_expr.html#like) operator:
```swift
Books.select(strftime("%Y", Column("publishedDate"))) // <-- New! strftime function
Books.filter(Column("body").glob("*Moby-Dick*")) // <-- New! glob method
```
- **[Add a new kind of SQLite expression](#add-a-new-kind-of-sqlite-expression)**
You'll learn how to add support for [CAST expressions](https://www.sqlite.org/lang_expr.html#castexpr):
```swift
let jsonString = Column("jsonString")
let request = Books.select(cast(jsonString, as: .blob)) // <-- New! cast function
let rows = try Row.fetchCursor(db, request)
while let row = try rows.next() {
let data = row.dataNoCopy(atIndex: 0)
}
```
- **Extend the query interface requests**
You may need to extend the [query interface requests](../../../#requests) so that their SELECT queries could embed recursive clauses, table joins, etc.
Pull requests are welcome. Open issues if you have questions.
Meanwhile, you can build your own [custom requests](../../../#custom-requests).
- **[Add a custom FTS5 full-text tokenizer](FTS5Tokenizers.md)**
Custom tokenizers can leverage extra full-text features such as synonyms or stop words.
- **Support a new kind of SQL query**
For example, you may need to generate SQL triggers, or create specific kinds of virtual tables.
Pull requests are welcome. Open issues if you have questions.
## Add a Value Type
**All value types adopt the [DatabaseValueConvertible protocol](../../../#custom-value-types).**
```swift
protocol DatabaseValueConvertible {
/// Returns a value that can be stored in the database.
var databaseValue: DatabaseValue { get }
/// Returns a value initialized from databaseValue, if possible.
static func fromDatabaseValue(_ databaseValue: DatabaseValue) -> Self?
}
```
The `databaseValue` property returns [DatabaseValue](../../../#databasevalue), a type that wraps the five values supported by SQLite: NULL, Int64, Double, String and Data. Since DatabaseValue has no public initializer, use `DatabaseValue.null`, or another type that already adopts the protocol: `1.databaseValue`, `"foo".databaseValue`, etc. Conversion to DatabaseValue *must not* fail.
The `fromDatabaseValue()` factory method returns an instance of your custom type if the databaseValue contains a suitable value. If the databaseValue does not contain a suitable value, such as "foo" for Date, `fromDatabaseValue` *must* return nil (GRDB will interpret this nil result as a conversion error, and react accordingly).
**What does the DatabaseValueConvertible protocol bring to a type like UIColor?**
Well, you will be able to use UIColor like all other [value types](../../../#values) (Bool, Int, String, Date, Swift enums, etc.):
- Use UIColor as [statement arguments](../../../#executing-updates):
```swift
try db.execute(
"INSERT INTO clothes (name, color) VALUES (?, ?)",
arguments: ["Shirt", UIColor.red])
```
- UIColor can be [extracted from rows](../../../#column-values):
```swift
let rows = try Row.fetchCursor(db, "SELECT * FROM clothes")
while let row = try rows.next() {
let name: String = row["name"]
let color: UIColor = row["color"]
}
```
- UIColor can be [directly fetched](../../../#value-queries):
```swift
let colors = try UIColor.fetchAll(db, "SELECT DISTINCT color FROM clothes") // [UIColor]
```
- Use UIColor in [Records](../../../#records):
```swift
class ClothingItem : Record {
var name: String
var color: UIColor
required init(row: Row) {
name = row["name"]
color = row["color"]
super.init(row: row)
}
override func encode(to container: inout PersistenceContainer) {
container["name"] = name
container["color"] = color
}
}
```
- Use UIColor in the [query interface](../../../#the-query-interface):
```swift
let redClothes = try ClothingItem.filter(colorColumn == UIColor.red).fetchAll(db)
```
**Let's have UIColor adopt DatabaseValueConvertible**
In order to preserve as most information as possible, we'll archive UIColor as a data blob using the NSCoding protocol. But YMMV.
```swift
extension UIColor : DatabaseValueConvertible {
/// Encode UIColor as a data blob
var databaseValue: DatabaseValue {
// Use NSKeyedArchiver to build Data
let data = NSKeyedArchiver.archivedData(withRootObject: self)
// Data is already DatabaseValueConvertible
return data.databaseValue
}
/// Returns a UIColor if databaseValue contains suitable data, and
/// nil otherwise.
static func fromDatabaseValue(_ databaseValue: DatabaseValue) -> Self? {
// Only Data blobs can contain a UIColor
guard let data = Data.fromDatabaseValue(databaseValue) else {
return nil
}
// We're looking for an archived object
guard let color = NSKeyedUnarchiver.unarchiveObject(with: data) else {
return nil
}
// The cast function will return nil if the unarchived object doesn't
// have the correct type
return cast(color) // Converts Any to Self?
}
}
```
Use the `cast` utility function when you want *non-final classes* to implement DatabaseValueConvertible. It avoids compiler errors that are not easy to deal with. Note that final classes and value types won't need it.
```swift
// Workaround Swift inconvenience around factories methods of non-final classes
func cast<T, U>(_ value: T) -> U? {
return value as? U
}
```
## Add an SQLite Function or Operator
**When an SQLite [function](https://www.sqlite.org/lang_corefunc.html) or [operator](https://www.sqlite.org/lang_expr.html) is missing from GRDB**, this usually means that there hasn't been a [feature request](http://github.com/groue/GRDB.swift/issues) yet.
But you don't have to wait: you can extend GRDB and the query interface to add support for the missing syntax element (and eventually submit a pull request later).
Let's remind our goal: we'll add the [STRFTIME](https://www.sqlite.org/lang_datefunc.html) function, and the [GLOB](https://www.sqlite.org/lang_expr.html#like) operator.
Their SQL usage is the following:
```sql
-- Publication years of books
SELECT STRFTIME('%Y', publishedOn) FROM books;
-- Books that talk about Moby Dick
SELECT * FROM books WHERE body GLOB '*Moby-Dick*';
```
Translated in the query interface, this gives:
```swift
Books.select(strftime("%Y", Column("publishedDate")))
Books.filter(Column("body").glob("*Moby-Dick*"))
```
`strftime` is a top-level Swift function because this is how GRDB usually imports SQLite functions which do not have matching standard Swift counterpart, like AVG, LEGNTH, SUM. It helps the Swift code looking like SQL when it is relevant.
In the same fashion, we expose the GLOB SQL operator as the `glob` Swift method, just because `value.glob(pattern)` reads like `value GLOB pattern`.
Whenever you import a SQL feature to Swift, you'll have to decide: should you preserve the SQL look and feel, or adopt a well-established swiftism? It's really up to you.
### STRFTIME
[**:fire: EXPERIMENTAL**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
The [STRFTIME](https://www.sqlite.org/lang_datefunc.html) SQL function accepts many arguments. We'll simplify it to `strftime(format, date)`, so that we can write:
```sql
// Publication years of books
// SELECT STRFTIME('%Y', publishedOn) FROM books
Books.select(strftime("%Y", Column("publishedDate")))
```
The signature of the Swift `strftime` function is:
```swift
func strftime(_ format: String, _ date: SQLSpecificExpressible) -> SQLExpression
```
SQLSpecificExpressible and SQLExpression are types of the [query interface](../../../#the-query-interface) that you do not usually see. We have moved down one floor, closer to the SQL guts of GRDB. We'll see more new types and protocols below.
The return value is SQLExpression. All GRDB functions and operators that build [query interface expressions](../../../#expressions) return values of this type. It represents actual [SQLite expressions](https://www.sqlite.org/lang_expr.html).
SQLExpression is a protocol, so that you can build your own [custom expressions](#add-a-new-kind-of-sqlite-expression). But GRDB ships with a variety of [built-in expressions](#built-in-expressions) that are ready-made, and here we'll use SQLExpressionFunction that is dedicated to function calls:
```swift
struct SQLExpressionFunction : SQLExpression {
/// Creates an SQL function call
///
/// // ABS(-1)
/// SQLExpressionFunction(.abs, arguments: -1)
init(_ functionName: SQLFunctionName, arguments: SQLExpressible...)
}
```
So here is the code that defines our `strftime` function:
```swift
// Add a SQLFunctionName just like we add NSNotification.Name since
// the release of Swift 3.
extension SQLFunctionName {
/// The `STRFTIME` SQL function
static let strftime = SQLFunctionName("STRFTIME")
}
/// Returns an expression that evaluates the `STRFTIME` SQL function.
///
/// // STRFTIME('%Y', date)
/// strftime("%Y", Column("date"))
func strftime(_ format: String, _ date: SQLSpecificExpressible) -> SQLExpression {
return SQLExpressionFunction(.strftime, arguments: format, date)
}
```
The `strftime` function is now complete, ready to be used. We haven't yet described the SQLSpecificExpressible type of the `date` argument:
SQLSpecificExpressible is the protocol for all types that can be turned into a SQL expression, but types like Int, Date, or UIColor that exist outside of GRDB and the query interface. Having `strftime` accept a SQLSpecificExpressible date prevents it from polluting the global space. It is *specific* to GRDB:
```swift
strftime("%Y", Date()) // Compiler error
strftime("%Y", Column("date")) // SQLExpression: STRFTIME('%Y', date)
```
You may want to compare it to another protocol, SQLExpressible, which will be described [below](#add-a-new-kind-of-sqlite-expression), when we add support for CAST SQL expressions.
> :point_up: **Note**: whenever you extend GRDB with a Swift function, method, or operator, you should generally make sure that its signature contains at least one GRDB-specific type. In the `strftime` function, it is the SQLSpecificExpressible protocol.
### GLOB
[**:fire: EXPERIMENTAL**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
For the [GLOB](https://www.sqlite.org/lang_expr.html#like) operator, we want to define the glob Swift method:
```swift
// Books that talk about Moby Dick
// SELECT * FROM books WHERE body GLOB '*Moby-Dick*'
Books.filter(Column("body").glob("*Moby-Dick*"))
```
This time we can't use the SQLExpressionFunction type, because it can't generate the SQL for a binary operator. Instead, we'll use another [built-in expression](#built-in-expressions), SQLExpressionBinary:
```swift
struct SQLExpressionBinary : SQLExpression {
/// Creates an expression made of two expressions joined with a binary operator.
///
/// // length * width
/// SQLExpressionBinary(.multiply, Column("length"), Column("width"))
init(_ op: SQLBinaryOperator, _ lhs: SQLExpressible, _ rhs: SQLExpressible)
}
```
Now we have to find the signature of our Swift method. The GLOB operator accepts any value on both sides. However, what kind of Swift code should we accept?
```swift
// 1) body GLOB '*Moby-Dick*' -- Yes, of course
Column("body").glob("*Moby-Dick*")
// 2) body GLOB pattern -- Sure, why not?
Column("body").glob(Column("pattern"))
// 3) 'Some Swift String' GLOB pattern - Not sure, but OK
"Some Swift String".glob(Column("pattern"))
// 4) 'Some Swift String' GLOB 'Another Swift String' -- NO
"Some Swift String".glob("Another Swift String")
```
We don't want the form 4, because this is an unacceptable pollution of the Swift global namespace. A good GRDB extension limits its scope to database-related code.
We thus have two overloaded definitions of the `glob` method:
```swift
extension SQLSpecificExpressible {
func glob(_ pattern: SQLExpressible) -> SQLExpression
}
extension SQLExpressible {
func glob(_ pattern: SQLSpecificExpressible) -> SQLExpression
}
```
SQLExpressible is the protocol for all types that can be turned into a SQL expression. This includes all expressions, and all [value types](../../../#values) (including String).
SQLSpecificExpressible is a sub protocol of SQLExpressible protocol, restricted to all types that can be turned into a SQL expression, but types like Int, Date, or String that exist outside of GRDB and the query interface.
By extending both, we can define the GLOB operators for any pair that contains at least one type that is specific to GRDB - and leave the global Swift space clean.
The final implementation follows:
```swift
// Add a SQLBinaryOperator just like we add NSNotification.Name since
// the release of Swift 3.
extension SQLBinaryOperator {
/// The `GLOB` binary operator
static let glob = SQLBinaryOperator("GLOB")
}
extension SQLSpecificExpressible {
/// Returns an SQL `GLOB` expression.
///
/// // body GLOB '*Moby-Dick*'
/// Column("body").glob("*Moby-Dick*")
func glob(_ pattern: SQLExpressible) -> SQLExpression {
return SQLExpressionBinary(.glob, self, pattern)
}
}
extension SQLExpressible {
/// Returns an SQL `GLOB` expression.
///
/// // 'Some Swift String' GLOB pattern
/// "Some Swift String".glob(Column("pattern"))
func glob(_ pattern: SQLSpecificExpressible) -> SQLExpression {
return SQLExpressionBinary(.glob, self, pattern)
}
}
```
### Built-in Expressions
When you extend GRDB with a new function, method, or operator that generates an [SQL expression](https://www.sqlite.org/lang_expr.html), you have to return a value the adopts the SQLExpression protocol.
We have already seen in our [previous](#strftime) [examples](#glob) two concrete types that generate SQL function calls and binary operators: SQLExpressionFunction and SQLExpressionBinary.
This section of the documentation lists all built-in expressions. Adding a custom SQLExpression type will be documented [below](#add-a-new-kind-of-sqlite-expression).
#### Column and DatabaseValue
The [Column](../../../#the-query-interface) type from the query interface, and [DatabaseValue](../../../#databasevalue), the type that wraps the five values supported by SQLite (NULL, Int64, Double, String and Data) are expressions. They are rather trivial, and it is unlikely that you use them in your GRDB extensions.
#### SQLExpressionLiteral
Use SQLExpressionLiteral when you need to go fast:
```swift
struct SQLExpressionLiteral : SQLExpression {
/// Creates an SQL literal expression.
///
/// SQLExpressionLiteral("1 + 2")
/// SQLExpressionLiteral("? + ?", arguments: [1, 2])
init(_ sql: String, arguments: StatementArguments? = nil)
}
```
For an example of use, see the [Add a new kind of SQLite expression](#add-a-new-kind-of-sqlite-expression) chapter.
#### SQLExpressionUnary
[**:fire: EXPERIMENTAL**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
SQLExpressionUnary builds an expression by prefixing another expression with an unary operator:
```swift
struct SQLExpressionUnary : SQLExpression {
/// Creates an expression made of an unary operator and
/// an operand expression.
///
/// // NOT favorite
/// SQLExpressionUnary(.not, Column("favorite"))
init(_ op: SQLUnaryOperator, _ value: SQLExpressible)
}
```
You add missing SQLite unary operators by extending SQLUnaryOperator:
```swift
extension SQLUnaryOperator {
/// The `+` unary operator
static let plus = SQLUnaryOperator("+", needsRightSpace: false)
}
```
#### SQLExpressionBinary
[**:fire: EXPERIMENTAL**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
SQLExpressionBinary builds an expression by joining two expressions with a binary operator:
```swift
struct SQLExpressionBinary : SQLExpression {
/// Creates an expression made of two expressions joined with a binary operator.
///
/// // length * width
/// SQLExpressionBinary(.multiply, Column("length"), Column("width"))
init(_ op: SQLBinaryOperator, _ lhs: SQLExpressible, _ rhs: SQLExpressible)
}
```
You add missing SQLite binary operators by extending SQLBinaryOperator:
```swift
extension SQLBinaryOperator {
/// The `GLOB` binary operator
static let glob = SQLBinaryOperator("GLOB")
}
```
#### SQLExpressionFunction
[**:fire: EXPERIMENTAL**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
SQLExpressionFunction builds an SQL function call:
```swift
struct SQLExpressionFunction : SQLExpression {
/// Creates an SQL function call
///
/// // ABS(-1)
/// SQLExpressionFunction(.abs, arguments: -1)
init(_ functionName: SQLFunctionName, arguments: SQLExpressible...)
}
```
You add missing SQLite function names by extending SQLFunctionName:
```swift
extension SQLFunctionName {
/// The `STRFTIME` SQL function
static let strftime = SQLFunctionName("STRFTIME")
}
```
#### The IN Operator
Build a `value IN (...)` expression from any sequence of [values](../../../#values):
```swift
// SQLExpression: id IN (1, 2, 3)
[1,2,3].contains(Column("id"))
// SQLExpression: id NOT IN (1, 2, 3)
![1,2,3].contains(Column("id"))
```
#### The BETWEEN Operator
Build a `value BETWEEN min AND max` expression from Swift ranges:
```swift
// SQLExpression: id BETWEEN 1 AND 10
1...10.contains(Column("id")
```
#### The COUNT Function
Build a `COUNT(...)` expression from the [count](http://groue.github.io/GRDB.swift/docs/2.0/Functions.html) and [count(distinct:)](http://groue.github.io/GRDB.swift/docs/2.0/Functions.html) functions:
```swift
// SQLExpression: COUNT(email)
count(Column("email"))
// SQLExpression: COUNT(DISTINCT email)
count(distinct: Column("email"))
```
#### The COLLATE Operator
Build a `expression COLLATE collation` expression with the `collating` method:
```swift
// SQLExpression: name = 'Arthur' COLLATE NOCASE
Column("name").collating(.nocase) == "Arthur"
```
## Add a New Kind of SQLite Expression
GRDB does not have built-in support for the full range of the SQLite [expression grammar](https://www.sqlite.org/lang_expr.html).
For example, [CAST expressions](https://www.sqlite.org/lang_expr.html#castexpr) are not ready-made. They can be useful, though: a CAST expression can efficiently convert json strings to UTF-8 data blobs for you:
```sql
SELECT CAST(jsonString AS BLOB) FROM books
```
We'll add below a Swift `cast` function:
```swift
let request = Books.select(cast(Column("jsonString"), as: .blob))
let jsonDatas = try Data.fetchAll(db, request) // [Data]
```
`cast` is a top-level Swift function because this is how GRDB usually imports SQLite features which do not have matching standard Swift counterpart. It helps the Swift code looking like SQL when it is relevant. But YMMV.
The signature of the `cast` function is:
```swift
func cast(_ value: SQLExpressible, as type: Database.ColumnType) -> SQLExpression
```
Database.ColumnType is a String-based enumeration of all database column types (.integer, .text, .blob, etc.) You have already used if you have [created tables](../../../#create-tables) using the query interface.
The return type SQLExpression is the type returned by all GRDB functions and operators that build [query interface expressions](../../../#expressions).
SQLExpression is a protocol. But GRDB ships with a variety of [built-in expressions](#built-in-expressions) that are ready-made, so that you generally don't have to write your custom expression type. Here we need something new. So we'll use the most versatile of all, SQLExpressionLiteral:
```swift
struct SQLExpressionLiteral : SQLExpression {
/// Creates an SQL literal expression.
///
/// SQLExpressionLiteral("1 + 2")
/// SQLExpressionLiteral("? + ?", arguments: [1, 2])
init(_ sql: String, arguments: StatementArguments? = nil)
}
```
Here is the code that defines our `cast` function:
```swift
func cast(_ value: SQLExpressible, as type: Database.ColumnType) -> SQLExpression {
// Turn the value into a literal expression
let literal: SQLExpressionLiteral = value.sqlExpression.literal
// Build our "CAST(value AS type)" sql snippet
let sql = "CAST(\(literal.sql) AS \(type.rawValue))"
// And return a new literal expression, preserving input arguments
return SQLExpressionLiteral(sql, arguments: literal.arguments)
}
```
We haven't yet described the SQLExpressible type of the `value` argument:
SQLExpressible is the protocol for all types that can be turned into a SQL expression. This includes all [value types](../../../#values) (Bool, Int, String, Date, Swift enums, etc.):
```swift
cast("foo", as: .blob) // SQLExpression: CAST('foo' AS BLOB)
cast(Column("name"), as: .blob) // SQLExpression: CAST(name AS BLOB)
```
You may want to compare it to another protocol, SQLSpecificExpressible, which has been described [above](#strftime), when we were adding support for the STRFTIME SQL function.
> :point_up: **Note**: whenever you extend GRDB with a Swift function, method, or operator, you should generally make sure that its signature contains at least one GRDB-specific type. In the `cast` function, it is Database.ColumnType.
**If SQLExpressionLiteral reveals too limited for your purpose**, you may have to implement a new type that adopts the [SQLExpression](http://groue.github.io/GRDB.swift/docs/2.0/Protocols/SQLExpression.html) protocol.
+1 -1
View File
@@ -81,7 +81,7 @@ try db.create(virtualTable: "documents", using: FTS5()) { t in
The full-text table can be fed and queried in [a regular way](../../../#full-text-search):
```swift
try db.execute("INSERT INTO documents VALUES (?)", arguments: ["..."])
try db.execute(sql: "INSERT INTO documents VALUES (?)", arguments: ["..."])
try Document(content: "...").insert(db)
let pattern = FTS5Pattern(matchingAnyTokenIn:"...")
+347
View File
@@ -0,0 +1,347 @@
# FetchedRecordsController
**FetchedRecordsController is a sunsetted GRDB API.**
It is not deprecated. But FetchedRecordsController has known limitations which are not planned to be lifted.
You are advised to use [ValueObservation] instead of FetchedRecordsController.
---
**FetchedRecordsController tracks changes in the results of a request, feeds table views and collection views, and animates cells when the results of the request change.**
It looks and behaves very much like [Core Data's NSFetchedResultsController](https://developer.apple.com/library/ios/documentation/CoreData/Reference/NSFetchedResultsController_Class/).
Given a fetch request, and a type that adopts the [FetchableRecord] protocol, such as a subclass of the [Record](../README.md#record-class) class, a FetchedRecordsController is able to track changes in the results of the fetch request, notify of those changes, and return the results of the request in a form that is suitable for a table view or a collection view, with one cell per fetched record.
- [Creating the Fetched Records Controller](#creating-the-fetched-records-controller)
- [Responding to Changes](#responding-to-changes)
- [The Changes Notifications](#the-changes-notifications)
- [Modifying the Fetch Request](#modifying-the-fetch-request)
- [Table and Collection Views](#table-and-collection-views)
- [Implementing the Table View Datasource Methods](#implementing-the-table-view-datasource-methods)
- [Implementing Table View Updates](#implementing-table-view-updates)
- [FetchedRecordsController Concurrency](#fetchedrecordscontroller-concurrency)
## Creating the Fetched Records Controller
When you initialize a fetched records controller, you provide the following mandatory information:
- A [database connection](../README.md#database-connections)
- The type of the fetched records. It must be a type that adopts the [FetchableRecord] protocol, such as a subclass of the [Record](../README.md#record-class) class
- A fetch request
```swift
class Player : Record { ... }
let dbQueue = DatabaseQueue(...) // or DatabasePool
// Using a Request from the Query Interface:
let controller = FetchedRecordsController(
dbQueue,
request: Player.order(Column("name")))
// Using SQL, and eventual arguments:
let controller = FetchedRecordsController<Player>(
dbQueue,
sql: "SELECT * FROM player ORDER BY name WHERE countryCode = ?",
arguments: ["FR"])
```
The fetch request can involve several database tables. The fetched records controller will only track changes in the columns and tables used by the fetch request.
```swift
let controller = FetchedRecordsController<Author>(
dbQueue,
sql: """
SELECT author.name, COUNT(book.id) AS bookCount
FROM author
LEFT JOIN book ON book.authorId = author.id
GROUP BY author.id
ORDER BY author.name
""")
```
After creating an instance, you invoke `performFetch()` to actually execute
the fetch.
```swift
try controller.performFetch()
```
## Responding to Changes
In general, FetchedRecordsController is designed to respond to changes at *the database layer*, by [notifying](#the-changes-notifications) when *database rows* change location or values.
Changes are not reflected until they are applied in the database by a successful [transaction](../README.md#transactions-and-savepoints):
```swift
// One transaction
try dbQueue.write { db in // or dbPool.write
try player1.insert(db)
try player2.insert(db)
}
// One transaction
try dbQueue.inTransaction { db in // or dbPool.writeInTransaction
try player1.insert(db)
try player2.insert(db)
return .commit
}
// Two transactions
try dbQueue.inDatabase { db in // or dbPool.writeWithoutTransaction
try player1.insert(db)
try player2.insert(db)
}
```
When you apply several changes to the database, you should group them in a single explicit transaction. The controller will then notify of all changes together.
## The Changes Notifications
An instance of FetchedRecordsController notifies that the controller’s fetched records have been changed by the mean of *callbacks*:
```swift
let controller = try FetchedRecordsController(...)
controller.trackChanges(
// controller's records are about to change:
willChange: { controller in ... },
// notification of individual record changes:
onChange: { (controller, record, change) in ... },
// controller's records have changed:
didChange: { controller in ... })
try controller.performFetch()
```
See [Implementing Table View Updates](#implementing-table-view-updates) for more detail on table view updates.
**All callbacks are optional.** When you only need to grab the latest results, you can omit the `didChange` argument name:
```swift
controller.trackChanges { controller in
let newPlayers = controller.fetchedRecords // [Player]
}
```
> :warning: **Warning**: notification of individual record changes (the `onChange` callback) has FetchedRecordsController use a diffing algorithm that has a high complexity, a high memory consumption, and is thus **not suited for large result sets**. One hundred rows is probably OK, but one thousand is probably not. If your application experiences problems with large lists, see [Issue 263](https://github.com/groue/GRDB.swift/issues/263) for more information.
Callbacks have the fetched record controller itself as an argument: use it in order to avoid memory leaks:
```swift
// BAD: memory leak
controller.trackChanges { _ in
let newPlayers = controller.fetchedRecords
}
// GOOD
controller.trackChanges { controller in
let newPlayers = controller.fetchedRecords
}
```
**Callbacks are invoked asynchronously.** See [FetchedRecordsController Concurrency](#fetchedrecordscontroller-concurrency) for more information.
**Values fetched from inside callbacks may be inconsistent with the controller's records.** This is because after database has changed, and before the controller had the opportunity to invoke callbacks in the main thread, other database changes can happen.
To avoid inconsistencies, provide a `fetchAlongside` argument to the `trackChanges` method, as below:
```swift
controller.trackChanges(
fetchAlongside: { db in
// Fetch any extra value, for example the number of fetched records:
return try Player.fetchCount(db)
},
didChange: { (controller, count) in
// The extra value is the second argument.
let recordsCount = controller.fetchedRecords.count
assert(count == recordsCount) // guaranteed
})
```
Whenever the fetched records controller can not look for changes after a transaction has potentially modified the tracked request, an error handler is called. The request observation is not stopped, though: future transactions may successfully be handled, and the notified changes will then be based on the last successful fetch.
```swift
controller.trackErrors { (controller, error) in
print("Missed a transaction because \(error)")
}
```
## Modifying the Fetch Request
You can change a fetched records controller's fetch request or SQL query.
```swift
controller.setRequest(Player.order(Column("name")))
controller.setRequest(sql: "SELECT ...", arguments: ...)
```
The [notification callbacks](#the-changes-notifications) are notified of eventual changes if the new request fetches a different set of records.
> :point_up: **Note**: This behavior differs from Core Data's NSFetchedResultsController, which does not notify of record changes when the fetch request is replaced.
**Change callbacks are invoked asynchronously.** This means that modifying the request from the main thread does *not* immediately triggers callbacks. When you need to take immediate action, force the controller to refresh immediately with its `performFetch` method. In this case, changes callbacks are *not* called:
```swift
// Change request on the main thread:
controller.setRequest(Player.order(Column("name")))
// Here callbacks have not been called yet.
// You can cancel them, and refresh records immediately:
try controller.performFetch()
```
## Table and Collection Views
FetchedRecordsController let you feed table and collection views, and keep them up-to-date with the database content.
For nice animated updates, a fetched records controller needs to recognize identical records between two different result sets. When records adopt the [TableRecord] protocol, they are automatically compared according to their primary key:
```swift
class Player : TableRecord { ... }
let controller = FetchedRecordsController(
dbQueue,
request: Player.all())
```
For other types, the fetched records controller needs you to be more explicit:
```swift
let controller = FetchedRecordsController(
dbQueue,
request: ...,
isSameRecord: { (player1, player2) in player1.id == player2.id })
```
### Implementing the Table View Datasource Methods
The table view data source asks the fetched records controller to provide relevant information:
```swift
func numberOfSections(in tableView: UITableView) -> Int {
return fetchedRecordsController.sections.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return fetchedRecordsController.sections[section].numberOfRecords
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = ...
let record = fetchedRecordsController.record(at: indexPath)
// Configure the cell
return cell
}
```
> :point_up: **Note**: In its current state, FetchedRecordsController does not support grouping table view rows into custom sections: it generates a unique section.
### Implementing Table View Updates
When changes in the fetched records should reload the whole table view, you can simply tell so:
```swift
controller.trackChanges { [unowned self] _ in
self.tableView.reloadData()
}
```
Yet, FetchedRecordsController can notify that the controller’s fetched records have been changed due to some add, remove, move, or update operations, and help applying animated changes to a UITableView.
#### Typical Table View Updates
For animated table view updates, use the `willChange` and `didChange` callbacks to bracket events provided by the fetched records controller, as illustrated in the following example:
```swift
// Assume self has a tableView property, and a cell configuration
// method named configure(_:at:).
controller.trackChanges(
// controller's records are about to change:
willChange: { [unowned self] _ in
self.tableView.beginUpdates()
},
// notification of individual record changes:
onChange: { [unowned self] (controller, record, change) in
switch change {
case .insertion(let indexPath):
self.tableView.insertRows(at: [indexPath], with: .fade)
case .deletion(let indexPath):
self.tableView.deleteRows(at: [indexPath], with: .fade)
case .update(let indexPath, _):
if let cell = self.tableView.cellForRow(at: indexPath) {
self.configure(cell, at: indexPath)
}
case .move(let indexPath, let newIndexPath, _):
self.tableView.deleteRows(at: [indexPath], with: .fade)
self.tableView.insertRows(at: [newIndexPath], with: .fade)
// // Alternate technique which actually moves cells around:
// let cell = self.tableView.cellForRow(at: indexPath)
// self.tableView.moveRow(at: indexPath, to: newIndexPath)
// if let cell = cell {
// self.configure(cell, at: newIndexPath)
// }
}
},
// controller's records have changed:
didChange: { [unowned self] _ in
self.tableView.endUpdates()
})
```
> :warning: **Warning**: notification of individual record changes (the `onChange` callback) has FetchedRecordsController use a diffing algorithm that has a high complexity, a high memory consumption, and is thus **not suited for large result sets**. One hundred rows is probably OK, but one thousand is probably not. If your application experiences problems with large lists, see [Issue 263](https://github.com/groue/GRDB.swift/issues/263) for more information.
>
> :point_up: **Note**: our sample code above uses `unowned` references to the table view controller. This is a safe pattern as long as the table view controller owns the fetched records controller, and is deallocated from the main thread (this is usually the case). In other situations, prefer weak references.
## FetchedRecordsController Concurrency
**A fetched records controller *can not* be used from any thread.**
When the database itself can be read and modified from [any thread](../README.md#database-connections), fetched records controllers **must** be used from the main thread. Record changes are also [notified](#the-changes-notifications) on the main thread.
**Change callbacks are invoked asynchronously.** This means that changes made from the main thread are *not* immediately notified. When you need to take immediate action, force the controller to refresh immediately with its `performFetch` method. In this case, changes callbacks are *not* called:
```swift
// Change database on the main thread:
try dbQueue.write { db in
try Player(...).insert(db)
}
// Here callbacks have not been called yet.
// You can cancel them, and refresh records immediately:
try controller.performFetch()
```
> :point_up: **Note**: when the main thread does not fit your needs, give a serial dispatch queue to the controller initializer: the controller must then be used from this queue, and record changes are notified on this queue as well.
>
> ```swift
> let queue = DispatchQueue()
> queue.async {
> let controller = try FetchedRecordsController(..., queue: queue)
> controller.trackChanges { /* in queue */ }
> try controller.performFetch()
> }
> ```
[ValueObservation]: ../README.md#valueobservation
[GRDBCombine]: http://github.com/groue/GRDBCombine
[RxGRDB]: http://github.com/RxSwiftCommunity/RxGRDB
[FetchableRecord]: ../README.md#fetchablerecord-protocol
[TableRecord]: ../README.md#tablerecord-protocol
+688
View File
@@ -0,0 +1,688 @@
Full-Text Search
================
**Full-Text Search is an efficient way to search a corpus of textual documents.**
```swift
// Create full-text tables
try db.create(virtualTable: "book", using: FTS4()) { t in // or FTS3(), or FTS5()
t.column("author")
t.column("title")
t.column("body")
}
// Populate full-text table with records or SQL
try Book(...).insert(db)
try db.execute(
sql: "INSERT INTO book (author, title, body) VALUES (?, ?, ?)",
arguments: [...])
// Build search patterns
let pattern = FTS3Pattern(matchingPhrase: "Moby-Dick")
// Search with the query interface or SQL
let books = try Book.matching(pattern).fetchAll(db)
let books = try Book.fetchAll(db,
sql: "SELECT * FROM book WHERE book MATCH ?",
arguments: [pattern])
```
- **[Choosing the Full-Text Engine](#choosing-the-full-text-engine)**
- **[Enabling FTS5 Support](#enabling-fts5-support)**
- **Create Full-Text Virtual Tables**: [FTS3/4](#create-fts3-and-fts4-virtual-tables), [FTS5](#create-fts5-virtual-tables)
- **Choosing a Tokenizer**: [FTS3/4](#fts3-and-fts4-tokenizers), [FTS5](#fts5-tokenizers)
- **Search Patterns**: [FTS3/4](#fts3pattern), [FTS5](#fts5pattern)
- **Sorting by Relevance**: [FTS5](#fts5-sorting-by-relevance)
- **External Content Full-Text Tables**: [FTS4/5](#external-content-full-text-tables)
- **Full-Text Record**s: [FTS3/4/5](#full-text-records)
- **Unicode Full-Text Gotchas**: [FTS3/4/5](#unicode-full-text-gotchas). Unicorns don't exist.
- **Custom Tokenizers**: [FTS5](FTS5Tokenizers.md). Leverage extra full-text features such as synonyms or stop words. Avoid [unicode gotchas](#unicode-full-text-gotchas).
- **Sample Code**: [WWDC Companion](https://github.com/groue/WWDCCompanion), an iOS app that stores, displays, and lets the user search the WWDC 2016 sessions.
## Choosing the Full-Text Engine
**SQLite supports three full-text engines: [FTS3, FTS4](https://www.sqlite.org/fts3.html) and [FTS5](https://www.sqlite.org/fts5.html).**
Generally speaking, FTS5 is better than FTS4 which improves on FTS3. But this does not really tell which engine to choose for your application. Instead, make your choice depend on:
- **The full-text features needed by the application**:
| Full-Text Needs | FTS3 | FTS4 | FTS5 |
| -------------------------------------------------------------------------- | :--: | :--: | :--: |
| :question: Queries | | | |
| **Words searches** (documents that contain "database") | X | X | X |
| **Prefix searches** (documents that contain a word starting with "data") | X | X | X |
| **Phrases searches** (documents that contain the phrase "SQLite database") | X | X | X |
| **Boolean searches** (documents that contain "SQLite" or "database") | X | X | X |
| **Proximity search** (documents that contain "SQLite" near "database") | X | X | X |
| :scissors: Tokenization | | | |
| **Ascii case insensitivity** (have "DATABASE" match "database") | X | X | X |
| **Unicode case insensitivity** (have "ÉLÉGANCE" match "élégance") | X | X | X |
| **Latin diacritics insensitivity** (have "elegance" match "élégance") | X | X | X |
| **English Stemming** (have "frustration" match "frustrated") | X | X | X |
| **English Stemming and Ascii case insensitivity** | X | X | X |
| **English Stemming and Unicode case insensitivity** | | | X |
| **English Stemming and Latin diacritics insensitivity** | | | X |
| **Synonyms** (have "1st" match "first") | ¹ | ¹ | X ² |
| **Pinyin and Romaji** (have "romaji" match "ローマ字") | ¹ | ¹ | X ² |
| **Stop words** (don't index, and don't match words like "and" and "the") | ¹ | ¹ | X ² |
| **Spell checking** (have "alamaba" match "alabama") | ¹ | ¹ | ¹ |
| :bowtie: Other Features | | | |
| **Ranking** (sort results by relevance) | ¹ | ¹ | X |
| **Snippets** (display a few words around a match) | X | X | X |
¹ Requires extra setup, possibly hard to implement.
² Requires a [custom tokenizer](FTS5Tokenizers.md).
For a full feature list, read the SQLite documentation. Some missing features can be achieved with extra application code.
- **The speed versus disk space constraints.** Roughly speaking, FTS4 and FTS5 are faster than FTS3, but use more space. FTS4 only supports content compression.
- **The location of the indexed text in your database schema.** Only FTS4 and FTS5 support "contentless" and "external content" tables.
- **The SQLite library integrated in your application.** The version of SQLite that ships with iOS, macOS, tvOS and watchOS supports FTS3 and FTS4 out of the box, but not always FTS5. To use FTS5, see [Enabling FTS5 Support](#enabling-fts5-support).
- See [FST3 vs. FTS4](https://www.sqlite.org/fts3.html#differences_between_fts3_and_fts4) and [FTS5 vs. FTS3/4](https://www.sqlite.org/fts5.html#appendix_a) for more differences.
> :point_up: **Note**: In case you were still wondering, it is recommended to read the SQLite documentation: [FTS3 & FTS4](https://www.sqlite.org/fts3.html) and [FTS5](https://www.sqlite.org/fts5.html).
## Create FTS3 and FTS4 Virtual Tables
**FTS3 and FTS4 full-text tables store and index textual content.**
Create tables with the `create(virtualTable:using:)` method:
```swift
// CREATE VIRTUAL TABLE document USING fts3(content)
try db.create(virtualTable: "document", using: FTS3()) { t in
t.column("content")
}
// CREATE VIRTUAL TABLE document USING fts4(content)
try db.create(virtualTable: "document", using: FTS4()) { t in
t.column("content")
}
```
**All columns in a full-text table contain text.** If you need to index a table that contains other kinds of values, you need an ["external content" full-text table](#external-content-full-text-tables).
You can specify a [tokenizer](#fts3-and-fts4-tokenizers):
```swift
// CREATE VIRTUAL TABLE book USING fts4(
// tokenize=porter,
// author,
// title,
// body
// )
try db.create(virtualTable: "book", using: FTS4()) { t in
t.tokenizer = .porter
t.column("author")
t.column("title")
t.column("body")
}
```
FTS4 supports [options](https://www.sqlite.org/fts3.html#fts4_options):
```swift
// CREATE VIRTUAL TABLE book USING fts4(
// content,
// uuid,
// content="",
// compress=zip,
// uncompress=unzip,
// prefix="2,4",
// notindexed=uuid,
// languageid=lid
// )
try db.create(virtualTable: "document", using: FTS4()) { t in
t.content = ""
t.compress = "zip"
t.uncompress = "unzip"
t.prefixes = [2, 4]
t.column("content")
t.column("uuid").notIndexed()
t.column("lid").asLanguageId()
}
```
The `content` option is involved in "contentless" and "external content" full-text tables. GRDB can help you defining full-text tables that automatically synchronize with their content table. See [External Content Full-Text Tables](#external-content-full-text-tables).
See [SQLite documentation](https://www.sqlite.org/fts3.html) for more information.
## FTS3 and FTS4 Tokenizers
**A tokenizer defines what "matching" means.** Depending on the tokenizer you choose, full-text searches won't return the same results.
SQLite ships with three built-in FTS3/4 tokenizers: `simple`, `porter` and `unicode61` that use different algorithms to match queries with indexed content:
```swift
try db.create(virtualTable: "book", using: FTS4()) { t in
// Pick one:
t.tokenizer = .simple // default
t.tokenizer = .porter
t.tokenizer = .unicode61(...)
}
```
See below some examples of matches:
| content | query | simple | porter | unicode61 |
| ----------- | ---------- | :----: | :----: | :-------: |
| Foo | Foo | X | X | X |
| Foo | FOO | X | X | X |
| Jérôme | Jérôme | X ¹ | X ¹ | X ¹ |
| Jérôme | JÉRÔME | | | X ¹ |
| Jérôme | Jerome | | | X ¹ |
| Database | Databases | | X | |
| Frustration | Frustrated | | X | |
¹ Don't miss [Unicode Full-Text Gotchas](#unicode-full-text-gotchas)
- **simple**
```swift
try db.create(virtualTable: "book", using: FTS4()) { t in
t.tokenizer = .simple // default
}
```
The default "simple" tokenizer is case-insensitive for ASCII characters. It matches "foo" with "FOO", but not "Jérôme" with "JÉRÔME".
It does not provide stemming, and won't match "databases" with "database".
It does not strip diacritics from latin script characters, and won't match "jérôme" with "jerome".
- **porter**
```swift
try db.create(virtualTable: "book", using: FTS4()) { t in
t.tokenizer = .porter
}
```
The "porter" tokenizer compares English words according to their roots: it matches "database" with "databases", and "frustration" with "frustrated".
It does not strip diacritics from latin script characters, and won't match "jérôme" with "jerome".
- **unicode61**
```swift
try db.create(virtualTable: "book", using: FTS4()) { t in
t.tokenizer = .unicode61()
t.tokenizer = .unicode61(diacritics: .keep)
}
```
The "unicode61" tokenizer is case-insensitive for unicode characters. It matches "Jérôme" with "JÉRÔME".
It strips diacritics from latin script characters by default, and matches "jérôme" with "jerome". This behavior can be disabled, as in the example above.
It does not provide stemming, and won't match "databases" with "database".
See [SQLite tokenizers](https://www.sqlite.org/fts3.html#tokenizer) for more information.
## FTS3Pattern
**Full-text search in FTS3 and FTS4 tables is performed with search patterns:**
- `database` matches all documents that contain "database"
- `data*` matches all documents that contain a word starting with "data"
- `SQLite database` matches all documents that contain both "SQLite" and "database"
- `SQLite OR database` matches all documents that contain "SQLite" or "database"
- `"SQLite database"` matches all documents that contain the "SQLite database" phrase
**Not all search patterns are valid**: they must follow the [Full-Text Index Queries Grammar](https://www.sqlite.org/fts3.html#full_text_index_queries).
The FTS3Pattern type helps you validating patterns, and building valid patterns from untrusted strings (such as strings typed by users):
```swift
struct FTS3Pattern {
init(rawPattern: String) throws
init?(matchingAnyTokenIn string: String)
init?(matchingAllTokensIn string: String)
init?(matchingPhrase string: String)
}
```
The first initializer validates your raw patterns against the query grammar, and may throw a [DatabaseError](../README.md#databaseerror):
```swift
// OK: FTS3Pattern
let pattern = try FTS3Pattern(rawPattern: "sqlite AND database")
// DatabaseError: malformed MATCH expression: [AND]
let pattern = try FTS3Pattern(rawPattern: "AND")
```
The three other initializers don't throw. They build a valid pattern from any string, **including strings provided by users of your application**. They let you find documents that match all given words, any given word, or a full phrase, depending on the needs of your application:
```swift
let query = "SQLite database"
// Matches documents that contain "SQLite" or "database"
let pattern = FTS3Pattern(matchingAnyTokenIn: query)
// Matches documents that contain both "SQLite" and "database"
let pattern = FTS3Pattern(matchingAllTokensIn: query)
// Matches documents that contain "SQLite database"
let pattern = FTS3Pattern(matchingPhrase: query)
```
They return nil when no pattern could be built from the input string:
```swift
let pattern = FTS3Pattern(matchingAnyTokenIn: "") // nil
let pattern = FTS3Pattern(matchingAnyTokenIn: "*") // nil
```
FTS3Pattern are regular [values](../README.md#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/4.5/Structs/StatementArguments.html):
```swift
let documents = try Document.fetchAll(db,
sql: "SELECT * FROM document WHERE content MATCH ?",
arguments: [pattern])
```
Use them in the [query interface](../README.md#the-query-interface):
```swift
// Search in all columns
let documents = try Document.matching(pattern).fetchAll(db)
// Search in a specific column:
let documents = try Document.filter(Column("content").match(pattern)).fetchAll(db)
```
## Enabling FTS5 Support
When the FTS3 and FTS4 full-text engines don't suit your needs, you may want to use FTS5. See [Choosing the Full-Text Engine](#choosing-the-full-text-engine) to help you make a decision.
The version of SQLite that ships with iOS, macOS, tvOS and watchOS does not always support the FTS5 engine. To enable FTS5 support, you'll need to install GRDB with one of those installation techniques:
1. Use the GRDB.swift CocoaPod with a custom compilation option, as below. It uses the system SQLite, which is compiled with FTS5 support, but only on iOS 11.4+ / macOS 10.13+ / tvOS 11.4+ / watchOS 4.3+:
```ruby
pod 'GRDB.swift'
platform :ios, '11.4' # or above
post_install do |installer|
installer.pods_project.targets.select { |target| target.name == "GRDB.swift" }.each do |target|
target.build_configurations.each do |config|
config.build_settings['OTHER_SWIFT_FLAGS'] = "$(inherited) -D SQLITE_ENABLE_FTS5"
end
end
end
```
> :warning: **Warning**: make sure you use the right platform version! You will get runtime errors on devices with a lower version.
> :point_up: **Note**: there used to be a GRDBPlus CocoaPod with pre-enabled FTS5 support. This CocoaPod is deprecated: please switch to the above technique.
2. Use the GRDB.swift/SQLCipher CocoaPod subspec (see [encryption](../README.md#encryption)):
```ruby
pod 'GRDB.swift/SQLCipher'
```
3. Use a [custom SQLite build] and activate the `SQLITE_ENABLE_FTS5` compilation option.
## Create FTS5 Virtual Tables
**FTS5 full-text tables store and index textual content.**
To use FTS5, you'll need a [custom SQLite build] that activates the `SQLITE_ENABLE_FTS5` compilation option.
Create FTS5 tables with the `create(virtualTable:using:)` method:
```swift
// CREATE VIRTUAL TABLE document USING fts5(content)
try db.create(virtualTable: "document", using: FTS5()) { t in
t.column("content")
}
```
**All columns in a full-text table contain text.** If you need to index a table that contains other kinds of values, you need an ["external content" full-text table](#external-content-full-text-tables).
You can specify a [tokenizer](#fts5-tokenizers):
```swift
// CREATE VIRTUAL TABLE book USING fts5(
// tokenize='porter',
// author,
// title,
// body
// )
try db.create(virtualTable: "book", using: FTS5()) { t in
t.tokenizer = .porter()
t.column("author")
t.column("title")
t.column("body")
}
```
FTS5 supports [options](https://www.sqlite.org/fts5.html#fts5_table_creation_and_initialization):
```swift
// CREATE VIRTUAL TABLE book USING fts5(
// content,
// uuid UNINDEXED,
// content='table',
// content_rowid='id',
// prefix='2 4',
// columnsize=0,
// detail=column
// )
try db.create(virtualTable: "document", using: FTS5()) { t in
t.column("content")
t.column("uuid").notIndexed()
t.content = "table"
t.contentRowID = "id"
t.prefixes = [2, 4]
t.columnSize = 0
t.detail = "column"
}
```
The `content` and `contentRowID` options are involved in "contentless" and "external content" full-text tables. GRDB can help you defining full-text tables that automatically synchronize with their content table. See [External Content Full-Text Tables](#external-content-full-text-tables).
See [SQLite documentation](https://www.sqlite.org/fts5.html) for more information.
## FTS5 Tokenizers
**A tokenizer defines what "matching" means.** Depending on the tokenizer you choose, full-text searches won't return the same results.
SQLite ships with three built-in FTS5 tokenizers: `ascii`, `porter` and `unicode61` that use different algorithms to match queries with indexed content.
```swift
try db.create(virtualTable: "book", using: FTS5()) { t in
// Pick one:
t.tokenizer = .unicode61() // default
t.tokenizer = .unicode61(...)
t.tokenizer = .ascii
t.tokenizer = .porter(...)
}
```
See below some examples of matches:
| content | query | ascii | unicode61 | porter on ascii | porter on unicode61 |
| ----------- | ---------- | :----: | :-------: | :-------------: | :-----------------: |
| Foo | Foo | X | X | X | X |
| Foo | FOO | X | X | X | X |
| Jérôme | Jérôme | X ¹ | X ¹ | X ¹ | X ¹ |
| Jérôme | JÉRÔME | | X ¹ | | X ¹ |
| Jérôme | Jerome | | X ¹ | | X ¹ |
| Database | Databases | | | X | X |
| Frustration | Frustrated | | | X | X |
¹ Don't miss [Unicode Full-Text Gotchas](#unicode-full-text-gotchas)
- **unicode61**
```swift
try db.create(virtualTable: "book", using: FTS5()) { t in
t.tokenizer = .unicode61()
t.tokenizer = .unicode61(diacritics: .keep)
}
```
The default "unicode61" tokenizer is case-insensitive for unicode characters. It matches "Jérôme" with "JÉRÔME".
It strips diacritics from latin script characters by default, and matches "jérôme" with "jerome". This behavior can be disabled, as in the example above.
It does not provide stemming, and won't match "databases" with "database".
- **ascii**
```swift
try db.create(virtualTable: "book", using: FTS5()) { t in
t.tokenizer = .ascii
}
```
The "ascii" tokenizer is case-insensitive for ASCII characters. It matches "foo" with "FOO", but not "Jérôme" with "JÉRÔME".
It does not provide stemming, and won't match "databases" with "database".
It does not strip diacritics from latin script characters, and won't match "jérôme" with "jerome".
- **porter**
```swift
try db.create(virtualTable: "book", using: FTS5()) { t in
t.tokenizer = .porter() // porter wrapping unicode61 (the default)
t.tokenizer = .porter(.ascii) // porter wrapping ascii
t.tokenizer = .porter(.unicode61(diacritics: .keep)) // porter wrapping unicode61 without diacritics stripping
}
```
The porter tokenizer is a wrapper tokenizer which compares English words according to their roots: it matches "database" with "databases", and "frustration" with "frustrated".
It strips diacritics from latin script characters if it wraps unicode61, and does not if it wraps ascii (see the example above).
See [SQLite tokenizers](https://www.sqlite.org/fts5.html#tokenizers) for more information, and [custom FTS5 tokenizers](FTS5Tokenizers.md) in order to add your own tokenizers.
## FTS5Pattern
**Full-text search in FTS5 tables is performed with search patterns:**
- `database` matches all documents that contain "database"
- `data*` matches all documents that contain a word starting with "data"
- `SQLite database` matches all documents that contain both "SQLite" and "database"
- `SQLite OR database` matches all documents that contain "SQLite" or "database"
- `"SQLite database"` matches all documents that contain the "SQLite database" phrase
**Not all search patterns are valid**: they must follow the [Full-Text Query Syntax](https://www.sqlite.org/fts5.html#full_text_query_syntax).
The FTS5Pattern type helps you validating patterns, and building valid patterns from untrusted strings (such as strings typed by users):
```swift
extension Database {
func makeFTS5Pattern(rawPattern: String, forTable table: String) throws -> FTS5Pattern
}
struct FTS5Pattern {
init?(matchingAnyTokenIn string: String)
init?(matchingAllTokensIn string: String)
init?(matchingPhrase string: String)
}
```
The `Database.makeFTS5Pattern(rawPattern:forTable:)` method validates your raw patterns against the query grammar and the columns of the targeted table, and may throw a [DatabaseError](../README.md#databaseerror):
```swift
// OK: FTS5Pattern
try db.makeFTS5Pattern(rawPattern: "sqlite", forTable: "book")
// DatabaseError: syntax error near \"AND\"
try db.makeFTS5Pattern(rawPattern: "AND", forTable: "book")
// DatabaseError: no such column: missing
try db.makeFTS5Pattern(rawPattern: "missing: sqlite", forTable: "book")
```
The FTS5Pattern initializers don't throw. They build a valid pattern from any string, **including strings provided by users of your application**. They let you find documents that match all given words, any given word, or a full phrase, depending on the needs of your application:
```swift
let query = "SQLite database"
// Matches documents that contain "SQLite" or "database"
let pattern = FTS5Pattern(matchingAnyTokenIn: query)
// Matches documents that contain both "SQLite" and "database"
let pattern = FTS5Pattern(matchingAllTokensIn: query)
// Matches documents that contain "SQLite database"
let pattern = FTS5Pattern(matchingPhrase: query)
// Matches documents that start with "SQLite database"
let pattern = FTS5Pattern(matchingPrefixPhrase: query)
```
They return nil when no pattern could be built from the input string:
```swift
let pattern = FTS5Pattern(matchingAnyTokenIn: "") // nil
let pattern = FTS5Pattern(matchingAnyTokenIn: "*") // nil
```
FTS5Pattern are regular [values](../README.md#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/4.5/Structs/StatementArguments.html):
```swift
let documents = try Document.fetchAll(db,
sql: "SELECT * FROM document WHERE document MATCH ?",
arguments: [pattern])
```
Use them in the [query interface](../README.md#the-query-interface):
```swift
let documents = try Document.matching(pattern).fetchAll(db)
```
## FTS5: Sorting by Relevance
**FTS5 can sort results by relevance** (most to least relevant):
```swift
// SQL
let documents = try Document.fetchAll(db,
sql: "SELECT * FROM document WHERE document MATCH ? ORDER BY rank",
arguments: [pattern])
// Query Interface
let documents = try Document.matching(pattern).order(Column.rank).fetchAll(db)
```
For more information about the ranking algorithm, as well as extra options, read [Sorting by Auxiliary Function Results](https://www.sqlite.org/fts5.html#sorting_by_auxiliary_function_results)
GRDB does not provide any ranking for FTS3 and FTS4. See SQLite's [Search Application Tips](https://www.sqlite.org/fts3.html#appendix_a) if you really need it.
## External Content Full-Text Tables
**An external content table does not store the indexed text.** Instead, it indexes the text stored in another table.
This is very handy when you want to index a table that can not be declared as a full-text table (because it contains non-textual values, for example). You just have to define an external content full-text table that refers to the regular table.
The two tables must be kept up-to-date, so that the full-text index matches the content of the regular table. This synchronization happens automatically if you use the `synchronize(withTable:)` method in your full-text table definition:
```swift
// A regular table
try db.create(table: "book") { t in
t.column("author", .text)
t.column("title", .text)
t.column("content", .text)
...
}
// A full-text table synchronized with the regular table
try db.create(virtualTable: "book_ft", using: FTS4()) { t in // or FTS5()
t.synchronize(withTable: "book")
t.column("author")
t.column("title")
t.column("content")
}
```
The eventual content already present in the regular table is indexed, and every insert, update or delete that happens in the regular table is automatically applied to the full-text index.
For more information, see the SQLite documentation about external content tables: [FTS4](https://www.sqlite.org/fts3.html#_external_content_fts4_tables_), [FTS5](https://sqlite.org/fts5.html#external_content_tables).
See also [WWDC Companion](https://github.com/groue/WWDCCompanion), a sample app that uses external content tables to store, display, and let the user search the WWDC sessions.
### Deleting Synchronized Full-Text Tables
Synchronization of full-text tables with their content table happens by the mean of SQL triggers.
SQLite automatically deletes those triggers when the content (not full-text) table is dropped.
However, those triggers remain after the full-text table has been dropped. Unless they are dropped too, they will prevent future insertion, updates, and deletions in the content table, and the creation of a new full-text table.
To drop those triggers, use the `dropFTS4SynchronizationTriggers` or `dropFTS5SynchronizationTriggers` methods:
```swift
// Create tables
try db.create(table: "book") { t in
...
}
try db.create(virtualTable: "book_ft", using: FTS4()) { t in
t.synchronize(withTable: "book")
...
}
// Drop full-text table
try db.drop(table: "book_ft")
try db.dropFTS4SynchronizationTriggers(forTable: "book_ft")
```
> :warning: **Warning**: there was a bug in GRDB up to version 2.3.1 included, which created triggers with a wrong name. If it is possible that the full-text table was created by an old version of GRDB, then delete the synchronization triggers **twice**: once with the name of the deleted full-text table, and once with the name of the content table:
>
> ```swift
> // Drop full-text table
> try db.drop(table: "book_ft")
> try db.dropFTS4SynchronizationTriggers(forTable: "book_ft")
> try db.dropFTS4SynchronizationTriggers(forTable: "book") // Support for GRDB <= 2.3.1
> ```
### Querying External Content Full-Text Tables
When you need to perform a full-text search, and the external content table contains all the data you need, you can simply query the full-text table.
But if you need to load columns from the regular table, and in the same time perform a full-text search, then you will need to query both tables at the same time.
That is because SQLite will throw an error when you try to perform a full-text search on a regular table:
```swift
// SQLite error 1: unable to use function MATCH in the requested context
// SELECT * FROM book WHERE book MATCH '...'
let books = Book.matching(pattern).fetchAll(db)
```
The solution is to perform a joined request, using raw SQL:
```swift
let sql = """
SELECT book.*
FROM book
JOIN book_ft
ON book_ft.rowid = book.rowid
AND book_ft MATCH ?
"""
let books = Book.fetchAll(db, sql: sql, arguments: [pattern])
```
## Full-Text Records
**You can define [record](../README.md#records) types around the full-text virtual tables.**
However these tables don't have any explicit primary key. Instead, they use the [implicit rowid primary key](../README.md#the-implicit-rowid-primary-key): a special hidden column named `rowid`.
You will have to [expose this hidden column](../README.md#exposing-the-rowid-column) in order to fetch, delete, and update full-text records by primary key.
## Unicode Full-Text Gotchas
The SQLite built-in tokenizers for [FTS3, FTS4](#fts3-and-fts4-tokenizers) and [FTS5](#fts5-tokenizers) are generally unicode-aware, with a few caveats, and limitations.
Generally speaking, matches may fail when content and query don't use the same [unicode normalization](http://unicode.org/reports/tr15/). SQLite actually exhibits inconsistent behavior in this regard.
For example, for "aimé" to match "aimé", they better have the same normalization: the NFC "aim\u{00E9}" form may not match its NFD "aime\u{0301}" equivalent. Most strings that you get from Swift, UIKit and Cocoa use NFC, so be careful with NFD inputs (such as strings from the HFS+ file system, or strings that you can't trust like network inputs). Use [String.precomposedStringWithCanonicalMapping](https://developer.apple.com/reference/swift/string/1407210-precomposedstringwithcanonicalma) to turn a string into NFC.
Besides, if you want "fi" to match the ligature "&#xfb01;" (U+FB01), then you need to normalize your indexed contents and inputs to NFKC or NFKD. Use [String.precomposedStringWithCompatibilityMapping](https://developer.apple.com/reference/swift/string/1407834-precomposedstringwithcompatibili) to turn a string into NFKC.
Unicode normalization is not the end of the story, because it won't help "Encyclopaedia" match "Encyclopædia", "Mueller", "Müller", "Grossmann", "Großmann", or "Diyarbakır", "DIYARBAKIR". The [String.applyingTransform](https://developer.apple.com/reference/swift/string/1643133-applyingtransform) method can help.
GRDB lets you write [custom FTS5 tokenizers](FTS5Tokenizers.md) that can transparently deal with all these issues. For FTS3 and FTS4, you'll need to pre-process your strings before injecting them in the full-text engine.
Happy indexing!
+522
View File
@@ -0,0 +1,522 @@
Migrating From GRDB 2 to GRDB 3
===============================
GRDB 3 comes with new features, but also a few breaking changes, and a set of updated good practices. This guide aims at helping you upgrading your applications.
**For all users**
- [Swift 4.1 Required]
- [iOS 8 Sunsetting]
- [Database Schema Recommendations]
- [Record Protocols Renaming]
- [Columns Definition]
**By topic**
- [If You Use Database Queues]
- [If You Use Database Pools]
- [If You Use Database Snapshots]
- [If You Use Record Types]
- [If You Use Custom Requests]
- [If You Use RxGRDB]
- [Notable Documentation Updates]
## Swift 4.1 Required
GRDB 3 uses [conditional conformances], introduced in Swift 4.1. It can only be built on Xcode 9.3+.
## iOS 8 Sunsetting
GRDB 3 is only tested on iOS 9+, due to a limitation in Xcode 9.3. Code that targets older versions of SQLite and iOS is still there, but is not supported.
## Database Schema Recommendations
GRDB 2 was totally schema-agnostic, and would gladly accept any database.
GRDB 3 still accepts any database, but brings two schema recommendations:
- :bulb: Integer primary keys should be auto-incremented, in order to avoid any row id to be reused.
When ids can be reused, your app and [database observation tools] may think that a row was updated, when it was actually deleted, then replaced. Depending on your application needs, this may be OK. Or not.
GRDB 3 thus comes with a new good practice: use the `autoIncrementedPrimaryKey` method when you create a database table with an integer primary key:
```diff
try db.create(table: "author") { t in
- t.column("id", .integer).primaryKey() // GRDB 2
+ t.autoIncrementedPrimaryKey("id") // GRDB 3 recommendation
t.column("name", .text).notNull()
}
```
- :bulb: Database table names should be singular, and camel-cased. Make them look like Swift identifiers: `place`, `country`, `postalAddress`, 'httpRequest'.
This will help you using the new [Associations] feature when you need it. Database table names that follow another naming convention are totally OK, but you will need to perform extra configuration.
This convention is applied by the default implementation of the `TableRecord.databaseTableName`: see [If You Use Record Types] below.
Since you are reading this guide, your application has already defined its database schema. You can migrate it in order to apply the new recommendations, if needed. Below is a sample code that uses [DatabaseMigrator], the recommended tool for managing your database schema:
```swift
var migrator = DatabaseMigrator()
// Existing GRDB 2 migration:
migrator.registerMigration("initial") { db in
try db.create(table: "authors") { t in
t.column("id", .integer).primaryKey()
t.column("name", .text).notNull()
}
try db.create(table: "books") { t in
t.column("id", .integer).primaryKey()
t.column("authorId", .integer).notNull().references("authors")
t.column("title", .text).notNull()
}
}
// New GRDB 3 migration:
// - Rename tables so that they look like Swift identifiers (singular and camelCased)
// - Make integer primary keys auto-incremented
//
// Since several tables are recreated from scratch, referential integrity
// constraints may break during the process. The
// registerMigrationWithDeferredForeignKeyCheck method makes sure that foreign
// key checks are temporarily disabled, and checked at the end:
migrator.registerMigrationWithDeferredForeignKeyCheck("GRDB3") { db in
try db.create(table: "author") { t in
t.autoIncrementedPrimaryKey("id")
t.column("name", .text).notNull()
}
try db.create(table: "book") { t in
t.autoIncrementedPrimaryKey("id")
t.column("authorId", .integer).notNull().references("author")
t.column("title", .text).notNull()
}
try db.execute("""
INSERT INTO author SELECT * FROM authors;
INSERT INTO book SELECT * FROM books;
""")
try db.drop(table: "authors")
try db.drop(table: "books")
}
```
## Record Protocols Renaming
GRDB 3 has renamed the [record protocols]:
- `RowConvertible` -> `FetchableRecord`
- `TableMapping` -> `TableRecord`
- `Persistable` -> `PersistableRecord`
- `MutablePersistable` -> `MutablePersistableRecord`
After upgrading, build your project: the compiler will guide you through the renaming by the way of fixits.
## Columns Definition
GRDB 2 has you define columns of the query interface with the Column type:
```swift
// GRDB 2
let nameColumn = Column("name")
let arthur = try Player.filter(nameColumn == "Arthur").fetchOne(db)
```
A recommended practice was to define enum namespaces in record types:
```swift
// GRDB 2
struct Player: RowConvertible, TableMapping {
enum Columns {
static let id = Column("id")
static let name = Column("name")
static let score = Column("score")
}
init(row: Row) {
id = row[Columns.id]
name = row[Columns.name]
score = row[Columns.score]
}
}
```
In GRDB 3, `Column` is still there, but a new `ColumnExpression` protocol has been introduced in order to streamline column enums:
```swift
// GRDB 3
struct Player: FetchableRecord, TableRecord {
enum Columns: String, ColumnExpression {
case id, name, score
}
init(row: Row) {
id = row[Columns.id]
name = row[Columns.name]
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)
}
}
```
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) to safely define database columns:
```swift
// GRDB 3
struct Player: Codable {
var id: Int64
var name: String
var score: Int
}
extension Player: FetchableRecord, PersistableRecord {
enum Columns {
static let id = Column(CodingKeys.id.stringValue)
static let name = Column(CodingKeys.name.stringValue)
static let score = Column(CodingKeys.score.stringValue)
}
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)
}
}
```
## If You Use Database Queues
With GRDB 2, you used to access the database through the `inDatabase` or `inTransaction` [DatabaseQueue] methods:
```swift
// GRDB 2
let players = try dbQueue.inDatabase { db in
try Player.fetchAll(db)
}
try dbQueue.inDatabase { db in
try player.updateChanges(db)
}
var balance: Amount! = nil
try dbQueue.inTransaction { db in
try Credit(destinationAccout, amount).insert(db)
try Debit(sourceAccount, amount).insert(db)
balance = try sourceAccount.fetchBalance(db)
return .commit
}
```
The code above still runs, unchanged, in GRDB 3.
Yet it is now recommended that you use the `read` and `write` methods instead:
```swift
// GRDB 3
let players = try dbQueue.read { db in
try Player.fetchAll(db)
}
try dbQueue.write { db in
try player.updateChanges(db)
}
let balance = try dbQueue.write { db in
try Credit(destinationAccout, amount).insert(db)
try Debit(sourceAccount, amount).insert(db)
return try sourceAccount.fetchBalance(db)
}
```
The purpose of the new `read` and `write` methods is to soothe the "transaction mental load" of previous versions of GRDB, a legacy of the [FMDB] heritage. All developers can *forget* to open transactions, with the unfortunate consequence that the database may end up containing inconsistent values. Experienced developers may *wonder* whether they should open transactions or not, even when this doesn't matter a lot.
With GRDB 3, use `read` when you need to read values. It's impossible to write within a `read` block, which means that you can be sure that no unwanted side effect can happen.
When you need to write, use `write`: your database changes are automatically wrapped in a transaction, with the guarantee that all changes are written to disk, or, should any error happen, none at all.
Of course, precise transaction handling sometimes matter. Check the updated [Transactions and Savepoints] chapter.
## If You Use Database Pools
With GRDB 2, you used to access the database through the `read`, `write` or `writeInTransaction` [DatabasePool] methods:
```swift
// GRDB 2
let players = try dbPool.read { db in
try Player.fetchAll(db)
}
try dbPool.write { db in
try player.updateChanges(db)
}
var balance: Amount! = nil
try dbPool.writeInTransaction { db in
try Credit(destinationAccout, amount).insert(db)
try Debit(sourceAccount, amount).insert(db)
balance = try sourceAccount.fetchBalance(db)
return .commit
}
```
In GRDB 3, the `write` method has changed: it now automatically wraps your database changes in a transaction, which means that the last block can be rewritten as below:
```swift
// GRDB 3
let balance = try dbPool.write { db in
try Credit(destinationAccout, amount).insert(db)
try Debit(sourceAccount, amount).insert(db)
return try sourceAccount.fetchBalance(db)
}
```
Side effect: you can no longer open explicit transactions inside a `write` block:
```swift
// GRDB 2: OK
// GRDB 3: SQLite error 1 with statement `BEGIN DEFERRED TRANSACTION`:
// cannot start a transaction within a transaction
try dbPool.write { db in
try db.inTransaction { ... }
}
```
When precise transaction handling is needed, check the updated [Transactions and Savepoints] chapter.
The purpose of this change is to prevent an easy misuse of database pools in previous GRDB versions. Unless writes were wrapped inside an explicit transactions, concurrent reads could see an inconsistent state of the database:
```swift
// GRDB 2: unsafe
// GRDB 3: safe
try dbPool.write { db in
try Credit(destinationAccout, amount).insert(db)
try Debit(sourceAccount, amount).insert(db)
}
```
Since `write` now wraps your changes in a transaction, you have the guarantee that concurrent reads can't see them until they are all written to disk.
## If You Use Database Snapshots
With GRDB 2, you used to create [database snapshots] with the `makeSnaphot` [DatabasePool] method. For example:
```swift
// GRDB 2
let snapshot: DatabaseSnapshot = try dbPool.write { db in
try Player.deleteAll()
return dbPool.makeSnapshot()
}
// Guaranteed to be zero
let count = try snapshot.read { db in
try Player.fetchCount(db)
}
```
GRDB 3 will crash the above code on the `makeSnapshot()` line, with a fatal error: "makeSnapshot() must not be called from inside a transaction."
To avoid this error, you will need [precise transaction handling]:
```swift
// GRDB 3
let snapshot: DatabaseSnapshot = try dbPool.writeWithoutTransaction { db in
try Player.deleteAll()
return dbPool.makeSnapshot()
}
```
## If You Use Record Types
Record types that adopt the former TableMapping protocol, renamed TableRecord, used to declare their table name:
```swift
// GRDB 2
struct Place: TableMapping {
static let databaseTableName = "place"
}
print(Place.databaseTableName) // print "place"
```
With GRDB 3, the `databaseTableName` property gets a default implementation:
```swift
// GRDB 3
struct Place: TableRecord { }
print(Place.databaseTableName) // print "place"
```
That default name follows the [Database Schema Recommendations]: it is singular, camel-cased, and looks like a Swift identifier:
- Place: `place`
- Country: `country`
- PostalAddress: `postalAddress`
- HTTPRequest: `httpRequest`
- TOEFL: `toefl`
When you subclass the Record class, the Swift compiler won't let you profit from this default name: you have to keep on providing an explicit table name:
```swift
// GRDB 2 and GRDB 3
class Place: Record {
override var databaseTableName: String {
return "place"
}
}
```
## If You Use Custom Requests
[Custom requests] let you escape the limitations of the [query interface], when it can not generate the requests you need.
You may, for example, use `SQLRequest`:
```swift
// GRDB 2
extension Player {
static func filter(color: Color) -> AnyTypedRequest<Player> {
let sql = "SELECT * FROM players WHERE color = ?"
let request = SQLRequest(sql, arguments: [color])
return request.asRequest(of: Player.self)
}
}
let players = try Player.filter(color: .red).fetchAll(db)
```
The `AnyTypedRequest` type is no longer available, and `SQLRequest` is now a generic type:
```swift
// GRDB 3
extension Player {
static func filter(color: Color) -> SQLRequest<Player> {
let sql = "SELECT * FROM players WHERE color = ?"
return SQLRequest(sql, arguments: [color])
}
}
let players = try Player.filter(color: .red).fetchAll(db)
```
See the updated [Custom Requests](../README.md#custom-requests) chapter for more information.
## If You Use RxGRDB
Some RxGRDB APIs have slighly changed. Did you track multiple requests at the same time with "fetch tokens"?
```swift
// GRDB 2
dbQueue.rx
.fetchTokens(in: [request, ...])
.mapFetch { db in try fetchResult(db) }
.subscribe(...)
```
Now you'll write instead:
```swift
// GRDB 3
ValueObservation
.tracking([request, ...], fetch: { db in try fetchResult(db) })
.rx
.fetch(in: dbQueue)
.subscribe(...)
```
It's just a syntactic change, without any impact on the runtime.
GRDB 3.6 also introduces a new protocol, [DatabaseRegionConvertible], that allows a better encapsulation of complex requests, and a streamlined observable definition.
For example:
```swift
// GRDB 2: Track a team and its players
let teamId = 1
let teamRequest = Team.filter(key: teamId)
let playersRequest = Player.filter(teamId: teamId)
dbQueue.rx
.fetchTokens(in: [teamRequest, playersRequest])
.mapFetch { db -> TeamInfo? in
guard let team = try teamRequest.fetchOne(db) else {
return nil
}
let players = try playersRequest.fetchAll(db)
return TeamInfo(team: team, players: players)
}
.subscribe(onNext: { teamInfo: TeamInfo? in
...
})
// GRDB 3: Track a team and its players
struct TeamInfoRequest: DatabaseRegionConvertible { ... }
let request = TeamInfoRequest(teamId: 1)
ValueObservation.tracking(request, fetch: { try request.fetchOne($0) })
.rx
.fetch(in: dbQueue)
.subscribe(onNext: { teamInfo: TeamInfo? in
...
})
```
## Notable Documentation Updates
If you have time, you may dig deeper in GRDB 3 with those updated documentation chapter:
- [Database Queues](../README.md#database-queues): focus on the new `read` and `write` methods.
- [Transactions and Savepoints](../README.md#transactions-and-savepoints): the chapter has been rewritten in order to introduce transactions as a power-user feature.
- [ScopeAdapter](../README.md#scopeadapter): do you use row adapters? If so, have a look.
- [Examples of Record Definitions](../README.md#examples-of-record-definitions): this new chapter provides a handy reference of the three main ways to define record types (Codable, plain struct, Record subclass).
- [SQL Operators](../README.md#sql-operators): the chapter introduces the new `joined(operator:)` method that lets you join a chain of expressions with `AND` or `OR` without nesting: `[cond1, cond2, ...].joined(operator: .and)`.
- [Custom Requests](../README.md#custom-requests): the old `Request` and `TypedRequest` protocols have been replaced with `FetchRequest`. If you want to know more about custom requests, check this chapter.
- [Migrations](../README.md#migrations): learn how to check if a migration has been applied (very useful for migration tests).
[How To Upgrade]: #how-to-upgrade
[Database Schema Recommendations]: #database-schema-recommendations
[Record Protocols Renaming]: #record-protocols-renaming
[Columns Definition]: #columns-definition
[Swift 4.1 Required]: #swift-41-required
[iOS 8 Sunsetting]: #ios-8-sunsetting
[If You Use Database Queues]: #if-you-use-database-queues
[If You Use Database Pools]: #if-you-use-database-pools
[If You Use Database Snapshots]: #if-you-use-database-snapshots
[If You Use Record Types]: #if-you-use-record-types
[If You Use Custom Requests]: #if-you-use-custom-requests
[If You Use RxGRDB]: #if-you-use-rxgrdb
[Notable Documentation Updates]: #notable-documentation-updates
[RxGRDB]: http://github.com/RxSwiftCommunity/RxGRDB
[Associations]: AssociationsBasics.md
[DatabaseMigrator]: ../README.md#migrations
[database observation tools]: ../README.md#database-changes-observation
[Transactions and Savepoints]: ../README.md#transactions-and-savepoints
[precise transaction handling]: ../README.md#transactions-and-savepoints
[DatabaseQueue]: ../README.md#database-queues
[DatabasePool]: ../README.md#database-pools
[database snapshots]: ../README.md#database-snapshots
[FMDB]: http://github.com/ccgus/fmdb
[record protocols]: ../README.md#record-protocols-overview
[Custom requests]: ../README.md#custom-requests
[query interface]: ../README.md#the-query-interface
[DatabaseRegionConvertible]: https://github.com/groue/GRDB.swift#the-databaseregionconvertible-protocol
[conditional conformances]: https://github.com/apple/swift-evolution/blob/master/proposals/0143-conditional-conformances.md
+187
View File
@@ -0,0 +1,187 @@
Migrating From GRDB 3 to GRDB 4
===============================
GRDB 4 comes with new features, but also a few breaking changes. This guide aims at helping you upgrading your applications.
- [New requirements](#new-requirements)
- [Raw SQL](#raw-sql)
- [ValueObservation](#valueobservation)
- [Associations](#associations)
- [Good Practices for Designing Record Types](GoodPracticesForDesigningRecordTypes.md)
- [SQLCipher](#sqlcipher)
- [PersistenceError.recordNotFound](#persistenceerrorrecordnotfound)
### New requirements
GRDB now requires Swift 4.2+ and Xcode 10+. Swift 4.0 and 4.1 are no longer supported. Xcode 9 is no longer supported.
iOS 8 is no longer supported. The minimum iOS target is now iOS 9.
### Raw SQL
Whenever your application uses raw SQL queries or snippets, you will now always have to use the `sql` argument label:
```swift
// GRDB 3
try db.execute("INSERT INTO player (name) VALUES (?)", arguments: ["Arthur"])
let playerCount = try Int.fetchOne(db, "SELECT COUNT(*) FROM player")
// GRDB 4
try db.execute(sql: "INSERT INTO player (name) VALUES (?)", arguments: ["Arthur"])
let playerCount = try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM player")
```
This change was made necessary by the introduction of [SQL Interpolation].
### ValueObservation
[ValueObservation] has been refreshed in GRDB 4.
To guarantee asynchronous notifications, and never ever block your main thread, use the `.async(onQueue:startImmediately:)` scheduling:
```swift
// On main queue
var observation = Player.observationForAll()
observation.scheduling = .async(onQueue: .main, startImmediately: true)
let observer = try observation.start(
in: dbQueue,
onError: { error in ... },
onChange: { (players: [Player]) in
// On main queue
print("fresh players: \(players)")s
})
// <- here "fresh players" is not printed yet.
```
In GRDB 3, this scheduling used to be named `.queue(_: startImmediately:)`.
The second breaking change is `ValueObservation.extent`, which was removed in GRDB 4. Now all observations last until the observer returned by the `start` method is deallocated.
### Associations
GRDB 4 brought a few new [associations] features:
- **Indirect associations** [HasOneThrough] and [HasManyThrough] let you define associations from a record to another through a third one. For example, they let you easily express many-to-many relations such as "a country has many citizens through its passports":
```swift
struct Country: TableRecord, EncodableRecord {
static let passports = hasMany(Passport.self)
// New!
static let citizens = hasMany(Citizen.self, through: passports, using: Passport.citizen)
var citizens: QueryInterfaceRequest<Citizen> {
return request(for: Country.citizens)
}
}
struct Passport: TableRecord {
static let citizen = belongsTo(Citizen.self)
}
struct Citizen: TableRecord {
}
let country: Country = ...
let citizens: [Citizen] = try dbQueue.read { db in
try country.citizens.fetchAll(db)
}
```
![HasManyThroughSchema](https://cdn.rawgit.com/groue/GRDB.swift/master/Documentation/Images/Associations2/HasManyThroughSchema.svg)
- **Eager loading of HasMany associations**: The new `including(all:)` method lets you load arrays or sets of associated records in a single request:
```swift
// All authors with their respective books
let request = Author.including(all: Author.books)
// This request can feed the following record:
struct AuthorInfo: FetchableRecord, Decodable {
var author: Author
var books: [Book] // all associated books
}
let authorInfos: [AuthorInfo] = try AuthorInfo.fetchAll(db, request)
```
See [Joining And Prefetching Associated Records] for more information.
- **Automatic pluralization and singularization** of association identifiers.
GRDB will automatically **pluralize** or **singularize** names in order to help you easily associate records.
For example, the Book and Author records will automatically feed properties named `books`, `author`, or `bookCount` in your decoded records, without any explicit configuration, as long as the names of the backing database tables are "book" and "author".
The GRDB pluralization mechanisms are very powerful, being capable of pluralizing and singularizing both regular and irregular words (it's directly inspired from the battle-tested [Ruby on Rails inflections](https://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-pluralize)).
However, this change may have introduced some incompatibilities with GRDB 3 associations. Check [The Structure of a Joined Request] for more information.
### SQLCipher
The integration of GRDB with SQLCipher has changed.
1. With GRDB 3, it was possible to perform a manual installation, or to use CocoaPods and the GRDBCipher pod.
With GRDB 4, CocoaPods is the only supported installation method. And the GRDBCipher pod is discontinued, replaced with GRDB.swift/SQLCipher:
```diff
-pod 'GRDBCipher'
+pod 'GRDB.swift/SQLCipher'
```
In your Swift code, you no longer import the GRDBCipher module, but GRDB:
```diff
-import GRDBCipher
+import GRDB
```
2. The default SQLCipher version which comes with GRDB 4 is now SQLCipher 4, which is incompatible with SQLCipher 3. SQLCipher 3 is still supported, though. See [Encryption] for more details.
3. The `cipherPageSize` and `kdfIterations` configuration properties are discontinued. With GRDB 4, run sql pragmas in the `prepareDatabase` property of the configuration:
```swift
var configuration = Configuration()
configuration.passphrase = "secret"
configuration.prepareDatabase = { db in
try db.execute(sql: "PRAGMA cipher_page_size = 4096")
try db.execute(sql: "PRAGMA kdf_iter = 128000")
}
let dbQueue = try DatabaseQueue(path: "...", configuration: configuration)
```
### PersistenceError.recordNotFound
PersistenceError.recordNotFound is thrown whenever a record update method does not find any database row to update. It was refactored in GRDB 4:
```swift
public enum PersistenceError: Error {
case recordNotFound(databaseTableName: String, key: [String: DatabaseValue])
}
do {
try player.updateChanges {
$0.score += 1000
}
} catch let error as PersistenceError.recordNotFound {
// Update failed because player does not exist in the database
print(error)
// prints "Key not found in table player: [id:42]"
}
```
[SQL Interpolation]: SQLInterpolation.md
[ValueObservation]: ../README.md#valueobservation
[Encryption]: ../README.md#encryption
[HasOneThrough]: AssociationsBasics.md#hasonethrough
[HasManyThrough]: AssociationsBasics.md#hasmanythrough
[PersistableRecord]: ../README.md#persistablerecord-protocol
[associations]: AssociationsBasics.md
[EncodableRecord]: ../README.md#persistablerecord-protocol
[The Structure of a Joined Request]: AssociationsBasics.md#the-structure-of-a-joined-request
[Joining And Prefetching Associated Records]: AssociationsBasics.md#joining-and-prefetching-associated-records
@@ -0,0 +1,729 @@
Good Practices for Designing Record Types
=========================================
This guide aims at helping you leverage the best of GRDB [records] and [associations].
Since GRDB sits right between low-level libraries like SQLite itself or [FMDB], and high-level ORM like [Core Data] or [Realm], you may face questions when designing the model layer of your application.
To support this guide, we'll design a simple library application that lets the user crawl through books and their authors.
- [Trust SQLite More Than Yourself]
- [Persistable Record Types are Responsible for Their Tables]
- [Define Record Requests]
- [Compose Records]
- [How to Design Database Managers]
- [Observe the Database and Refetch when Needed]
## Trust SQLite More Than Yourself
It is important to put things in the right order. An SQLite database stored on one of your user's device is more important than the Swift code that accesses it. When a user installs a new version of your application, all the code may change, but the database remains the same.
This is why we recommend defining a **robust database schema** even before playing with record types.
SQLite is a battle-tested database. Even if you don't know it well, and aren't familiar with the SQL language, you are able to take profit from its solid foundation. It is very difficult to corrupt an SQLite database file. And it can make sure that only valid information is persisted on disk.
This is important because we developers write bugs, and some of them will ship in the wild, affecting the users of our applications. But SQLite will prevent many of those bugs from corrupting our precious users' data.
For example, if we were to define a [migration] that sets up our library database, made of books and their authors, we could write:
```swift
var migrator = DatabaseMigrator()
migrator.registerMigration("createLibrary") { db in
try db.create(table: "author") { t in // (1)
t.autoIncrementedPrimaryKey("id") // (2)
t.column("name", .text).notNull() // (3)
t.column("country", .text) // (4)
}
try db.create(table: "book") { t in
t.autoIncrementedPrimaryKey("id")
t.column("title", .text).notNull() // (5)
t.column("authorId", .integer) // (6)
.notNull() // (7)
.indexed() // (8)
.references("author", onDelete: .cascade) // (9)
}
}
try migrator.migrate(dbQueue)
```
1. Our database table names follow the [recommended convention]: they are English, singular, and camelCased. They look like Swift identifiers: `author`, `book`, `postalAddress`, `httpRequest`.
2. Each author has a unique id.
3. An author must have a name.
4. The country of an author is not always known.
5. A book must have a title.
6. The `book.authorId` column is used to link a book to the author it belongs to.
7. The `book.authorId` column is not null so that SQLite guarantees that all books have an author.
8. The `book.authorId` column is indexed in order to ease the selection of an author's books.
9. We define a foreign key from `book.authorId` column to `authors.id`, so that SQLite guarantees that no book can refer to a missing author. On top of that, the `onDelete: .cascade` option has SQLite automatically delete all of an author's books when that author is deleted. See [Foreign Key Actions] for more information.
Thanks to this database schema, you can be confident that no matter how wrong our application goes, it will always process *consistent data*. Even after a hard crash, application will always find the author of any book, all books will have a non-nil title, etc.
> :bulb: **Tip**: Don't look at your local SQLite database as you look at the JSON you load from a remote server. You can't control the JSON, its format and content: your application must defend itself against wacky servers. But you can control the database. Put the database on your side, make it trustable. Learn about relational databases, and how they can help you guarantee the quality of your application data. Put as much energy as you can in the proper definition of your database schema.
>
> :bulb: **Tip**: Plan early for future versions of your application, and use [migrations].
>
> :bulb: **Tip**: In the definition of your migrations, define tables and their columns with **strings**:
>
> ```swift
> migrator.registerMigration("createLibrary") { db in
> // RECOMMENDED
> try db.create(table: "author") { t in
> t.autoIncrementedPrimaryKey("id")
> ...
> }
>
> // NOT RECOMMENDED
> try db.create(table: Author.databaseTableName) { t in
> t.autoIncrementedPrimaryKey(Author.Columns.id.name)
> ...
> }
> }
> ```
>
> By using strings, you make sure that you will not have to change the Swift code of your migrations in the future. Even if author columns eventually change. Even if the Author type eventually gets replaced with another type. Even when your startup eventually pivots and starts selling pet food. A good migration that never changes is easy to test once and for good. A good migration that never changes will run smoothly on all devices in the wild, even if a user upgrades straight from version 1.0 to version 5.0 of your application.
>
> So make sure that migrations don't use application types and values: migrations should talk to the database, only to the database, and use the database language: **strings**.
## Persistable Record Types are Responsible for Their Tables
Define one record type per database table, and make it adopt a [PersistableRecord] protocol.
In this sample code, we'll use Codable structs, but there are [other ways](../README.md#examples-of-record-definitions) to define records.
```swift
struct Author: Codable {
var id: Int64?
var name: String
var country: String?
}
struct Book: Codable {
var id: Int64?
var authorId: Int64
var title: String
}
// Add Database access
extension Author: FetchableRecord, MutablePersistableRecord {
// Update auto-incremented id upon successful insertion
mutating func didInsert(with rowID: Int64, for column: String?) {
id = rowID
}
}
extension Book: FetchableRecord, MutablePersistableRecord {
// Update auto-incremented id upon successful insertion
mutating func didInsert(with rowID: Int64, for column: String?) {
id = rowID
}
}
```
That's it. The `Author` type can read and write in the `author` database table. `Book` as well, in `book`. See [record protocols] for more information.
> :bulb: **Tip**: When a column of a database table can't be NULL, store it in a non-optional property of your record type. On the other side, when the database may contain NULL, define an optional property.
>
> :bulb: **Tip**: When a database table uses an auto-incremented identifier, make the `id` property optional (so that you can instantiate a record before it gets inserted and gains an id), and implement the `didInsert(with:for:)` method:
>
> ```swift
> try dbQueue.write { db in
> var author = Author(id: nil, name: "Hermann Melville", country: "United States")
> try author.insert(db)
> print(author.id!) // Guaranteed non-nil id
> }
> ```
Since `Author` and `Book` can insert, update, and delete rows in the `author` and `book` database tables, they are *responsible for modifying those database tables*.
Applying the **[Single Responsibility Principle]** has a consequence: don't even try to have an author responsible for its books. Don't add a `books: [Book]` property in Author. Don't let Author write in the `book` table. When a new fellow coworker joins your team and asks you "who is saving books in the database?", you don't want to answer "it depends." You want to confidently answer: "the Book type".
> :bulb: **Tip**: Make sure each record type deals with one database table, and only one database table.
## Define Record Requests
Now that we have record types that are able to read and write in the database, we'd like to put them to good use.
> :bulb: **Tip**: Define an enumeration of columns that you will use in order to filter, sort, etc.
When your record type is a [Codable Record], derive columns from the [CodingKeys] enum:
```swift
// For a codable record
extension Author {
// Define database columns from CodingKeys
enum Columns {
static let id = Column(CodingKeys.id)
static let name = Column(CodingKeys.name)
static let country = Column(CodingKeys.country)
}
}
```
Otherwise, declare a plain String enum that conforms to the ColumnExpression protocol:
```swift
// For a non-codable record
extension Author {
// Define database columns as an enum
enum Columns: String, ColumnExpression {
case id, name, country
}
}
```
> :bulb: **Tip**: Define commonly used requests in a constrained extension of the `DerivableRequest` protocol.
The `DerivableRequest` protocol generally lets you filter, sort, and join or include associations (we'll talk about associations in the [Compose Records] chapter below).
Here is how you define those requests:
```swift
// Some requests of Author --------------------v
extension DerivableRequest where RowDecoder == Author {
/// Returns a request for all authors ordered by name, in a localized
/// case-insensitive fashion
func orderByName() -> Self {
let name = Author.Columns.name
return order(name.collating(.localizedCaseInsensitiveCompare))
}
/// Returns a request for all authors from a country
func filter(country: String) -> Self {
return filter(Author.Columns.country == country)
}
}
```
Those methods defined on the `DerivableRequest` protocol hide intimate database details. They allow you to compose database requests in a fluent style:
```swift
try dbQueue.read { db in
let sortedAuthors: [Author] = try Author.all()
.orderByName()
.fetchAll(db)
let frenchAuthors: [Author] = try Author.all()
.filter(country: "France")
.fetchAll(db)
let sortedSpanishAuthors: [Author] = try Author.all()
.filter(country: "Spain")
.orderByName()
.fetchAll(db)
}
```
Those customized request methods are also available on record associations, because associations conform to the `DerivableRequest` protocol:
```swift
// Some requests of Book
extension DerivableRequest where RowDecoder == Book {
/// Returns a request for all books from a country
func filter(authorCountry: String) -> Self {
// A book is from a country if it can be
// joined with an author from that country:
// ---------------------------------v
return joining(required: Book.author.filter(country: authorCountry))
}
}
try dbQueue.read { db in
let italianBooks = try Book.all()
.filter(authorCountry: "Italy")
.fetchAll(db)
}
```
Not *every requests* can be expressed on `DerivableRequest`. For example, [Association Aggregates] are out of scope. When this happens, define your requests in a constrained extension to `QueryInterfaceRequest`:
```swift
// More requests of Author -------------------------v
extension QueryInterfaceRequest where RowDecoder == Author {
/// Returns a request for all authors with at least one book
func havingBooks() -> QueryInterfaceRequest<Author> {
return having(Author.books.isEmpty == false)
}
}
```
Those requests defined on `QueryInterfaceRequest` still compose fluently:
```swift
try dbQueue.read { db in
let sortedFrenchAuthorsHavingBooks = try Author.all()
.filter(country: "France")
.havingBooks() // <-
.orderByName()
.fetchAll(db)
}
```
Finally, when it happens that a request only makes sense when defined on the Record type itself, just go ahead and define a static method or property of your Record type:
```swift
extension MySingletonRecord {
/// The one any only record stored in the database
static let shared = all().limit(1)
}
let singleton = try dbQueue.read { db
try MySingletonRecord.shared.fetchOne(db)
}
```
## Compose Records
We'd like to navigate from books to authors and vice-versa: we may want to know an author's books, or a book's author.
GRDB can help you do this with [associations]. In our case, each author **has many** books, and each book **belongs to** its author. Here is how you define those associations:
```swift
extension Author {
static let books = hasMany(Book.self)
}
extension Book {
static let author = belongsTo(Author.self)
}
```
Thanks to this setup, you can fetch associated records, or compute aggregated values from associated records. For example:
```swift
// Fetch all authors and their number of books
struct AuthorInfo: Decodable, FetchableRecord {
var author: Author
var bookCount: Int
}
let authorInfos: [AuthorInfo] = try dbQueue.read { db in
let request = Author.annotated(with: Author.books.count)
return try AuthorInfo.fetchAll(db, request)
}
// Fetch all Colombian books and their authors:
struct Authorship: Decodable, FetchableRecord {
var book: Book
var author: Author
}
let authorships: [Authorship] = try dbQueue.read { db in
let request = Book.including(required: Book.author.filter(country: "Colombia"))
return try Authorship.fetchAll(db, request)
}
```
As in the sample code above, requests which feed from several associated records will often have you define extra record types, such as `AuthorInfo` and `Authorship`. Those extra record types are designed to be able to decode database requests. The names and types of their properties follow the conventions defined by [associations]. Make them conform to the Decodable and FetchableRecord protocols so that they can decode database rows in a breeze.
Unlike the primitive persistable record types `Author` and `Book`, those records can not write in the database. They are simple data types, passive views on the database content. Remember, only [Persistable Record Types are Responsible for Their Tables].
> :question: **Note**: The example `AuthorInfo` and `Authorship` types above may look superfluous to you. After all, other ORMs out there are able to navigate in complex graphs of records without much fuss, aren't they?
>
> That is because other ORMs perform lazy loading:
>
> ```ruby
> # Ruby's Active Record
> author = Author.find(123) # fetch author
> book_count = author.books.count # lazily counts books on demand
> ```
>
> GRDB does not perform lazy loading. Lazy loading either requires records to be *managed* (as in [Core Data] and [Realm]), or that all data processing happens in a *single function* (think of an HTTP request handled with a web-oriented ORM like [Active Record] and [Django]). The underlying issue is *data consistency*: you always want your memory objects to accurately represent your application data, without any glitch, ever. This involves the subtle database concept of [isolation] against concurrent changes. In a GUI application, this can't be achieved without a very complex record management, and non-trivial pain points for the application developer.
>
> This is why GRDB has removed lazy loading from the list of desirable features. Instead, it provides the tooling needed to fetch data, even complex ones, in a single and safe stroke. See the "Solving Problems" chapter of [Why Adopt GRDB?](WhyAdoptGRDB.md#solving-problems) for more information.
Granted with primitive and derived record types, your application will load the data it needs, at the moment it needs it, as below:
1. Prepare the application screen that lists all authors:
```swift
let authors: [Author] = try dbQueue.read { db in
try Author.all().orderByName().fetchAll(db)
}
```
2. Prepare the application screen that displays an author and her books:
```swift
struct AuthorInfo: Codable, FetchableRecord {
var author: Author
var books: [Book]
}
let authorId = 123
let authorInfo: AuthorInfo? = try dbQueue.read { db in
let request = Author
.filter(key: authorId)
.including(all: Author.books)
return try AuthorInfo.fetchOne(db, request)
}
```
3. Prepare the application screen that displays a book information:
```swift
struct BookInfo: Decodable, FetchableRecord {
var book: Book
var author: Author
}
let bookId = 123
let bookInfo: BookInfo? = try dbQueue.read { db in
let request = Book
.filter(key: bookId)
.including(required: Book.author)
return try BookInfo.fetchOne(db, request)
}
```
> :bulb: **Tip**: Identify the various **graph of objects** needed by the various parts of your application. Design them independently, by composing primitive record types linked by associations. Fetch the data your application needs, at the moment it needs it, no more, no less.
A last extension on your record types will further help navigation from records to associated ones:
```swift
extension Author {
/// The request for the author's books
var books: QueryInterfaceRequest<Book> {
return request(for: Author.books)
}
}
extension Book {
/// The request for the author of the book
var author: QueryInterfaceRequest<Author> {
return request(for: Book.author)
}
}
```
Those properties provide an alternative way to feed our application:
1. Prepare the application screen that displays an author and her books:
```swift
struct AuthorInfo {
var author: Author
var books: [Book]
}
let authorId = 123
let authorInfo: AuthorInfo? = try dbQueue.read { db in
guard let author = try Author.fetchOne(db, key: authorId) else {
return nil
}
let books = try author.books.fetchAll(db)
return AuthorInfo(
author: author,
books: books)
}
```
2. Prepare the application screen that displays a book information:
```swift
struct BookInfo {
var book: Book
var author: Author
}
let bookId = 123
let bookInfo: BookInfo? = try dbQueue.read { db in
guard let book = try Book.fetchOne(db, key: bookId) else {
return nil
}
guard let author = try book.author.fetchOne(db) else {
return nil
}
return BookInfo(book: book, author: author)
}
```
## How to Design Database Managers
Many developpers want to hide GRDB database queues and pools inside "database managers":
```swift
// LibraryManager grants access to the library database.
class LibraryManager {
private let dbQueue: DatabaseQueue
init(dbQueue: DatabaseQueue) {
self.dbQueue = dbQueue
}
}
```
> :bulb: **Tip**: Don't let your database managers create their own databases. Instead, give them a database created by, say, the ApplicationDelegate. This will allow you to efficiently test the database manager with an in-memory database, for example.
Design your database managers with the [GRDB concurrency rules] in mind.
Practically, let's start with a naive example, and gradually improve it:
```swift
// A naive manager that we will improve
class NaiveLibraryManager {
private let dbQueue: DatabaseQueue
init(dbQueue: DatabaseQueue) {
self.dbQueue = dbQueue
}
func author(id: Int64) -> Author? {
do {
return try dbQueue.read { db in
try Author.fetchOne(db, key: id)
}
} catch {
return nil
}
}
func book(id: Int64) -> Book? {
do {
return try dbQueue.read { db in
try Book.fetchOne(db, key: id)
}
} catch {
return nil
}
}
func books(writtenBy author: Author) -> [Book] {
do {
return try dbQueue.read { db in
try author.books.fetchAll(db)
}
} catch {
return []
}
}
}
```
**This manager can be improved in two ways.**
- [Embrace Errors]
- [Thread-Safety is also an Application Concern]
### Embrace Errors
Have database managers throw database errors instead of catching them.
Consider Apple's [CNContactStore](https://developer.apple.com/documentation/contacts/cncontactstore), for example. Does it hide errors when you fetch or save address book contacts? No it does not. Keychain, Media assets, File system, Core Data? No they do not hide errors either. Follow the practices of Apple engineers: do not hide errors :muscle:
Exposing errors will help you building your application:
- You will be able to inspect errors during development, and fix bugs. `do { ... } catch { print(error) }` will save you hours of clueless questioning.
- You will be able to opt in for advanced OS features like [data protection].
> :bulb: **Tip**: Don't hide database errors. Let the application handle them, because only application can decide how to handle them.
This gives the improved manager below. And it has less code, which means less bugs :bowtie:
```swift
// An improved manager that does not hide errors
class ImprovedLibraryManager {
private let dbQueue: DatabaseQueue
init(dbQueue: DatabaseQueue) {
self.dbQueue = dbQueue
}
func author(id: Int64) throws -> Author? {
return try dbQueue.read { db in
try Author.fetchOne(db, key: id)
}
}
func book(id: Int64) throws -> Book? {
return try dbQueue.read { db in
try Book.fetchOne(db, key: id)
}
}
func books(writtenBy author: Author) throws -> [Book] {
return try dbQueue.read { db in
try author.books.fetchAll(db)
}
}
}
```
### Thread-Safety is also an Application Concern
Now, let's make our database manager **thread-safe**.
This one is more subtle. In order to understand what is wrong in our naive manager, one has to consider how it is used by the application.
For example, in the screen that displays an author and her books, we would write:
```swift
let authorId = 123
if let author = libraryManager.author(id: authorId) {
let books = libraryManager.books(writtenBy: author)
// Use author and books
}
```
This code is not thread-safe, because other application threads may have modified the database between the two database accesses. You may end up with an author without any book, and this sure does not make a pretty application screen.
Such bugs are uneasy to reproduce. Sometimes your application will refresh the library content from the network, and delete an author right at the wrong time. The more users your application has, the more users will see weird screens. And of course, you'll be bitten right on the day of the demo in front of the boss.
Fortunately, GRDB has all the tools you need to prevent such nasty data races:
> :bulb: **Tip**: Make sure you fetch all the data your application needs at a given moment of time, in a **single database read**.
This gives a much safer manager:
```swift
// A manager that actually manages
class LibraryManager {
private let dbQueue: DatabaseQueue
init(dbQueue: DatabaseQueue) {
self.dbQueue = dbQueue
}
}
// Feeds the list of authors
extension LibraryManager {
struct AuthorListItem: Decodable, FetchableRecord {
let author: Author
let bookCount: Int
}
func authorList() throws -> [AuthorListItem] {
return try dbQueue.read { db in
let request = Author
.annotated(with: Author.books.count)
.orderByName()
return try AuthorListItem.fetchAll(db, request)
}
}
}
// Feeds a book screen
extension LibraryManager {
struct BookInfo {
var book: Book
var author: Author
}
func bookInfo(bookId: Int64) throws -> BookInfo? {
return try dbQueue.read { db in
guard let book = try Book.fetchOne(db, key: bookId) else {
return nil
}
guard let author = try book.author.fetchOne(db) else {
return nil
}
return BookInfo(book: book, author: author)
}
}
}
// Feeds an author screen
extension LibraryManager {
struct AuthorInfo {
var author: Author
var books: [Book]
}
func authorInfo(authorId: Int64) throws -> AuthorInfo? {
return try dbQueue.read { db in
guard let author = try Author.fetchOne(db, key: authorId) else {
return nil
}
let books = try author.books.fetchAll(db)
return AuthorInfo(author: author, books: books)
}
}
}
```
The `AuthorListItem`, `BookInfo`, `AuthorInfo` types returned by the manager are designed to feed your views.
When a new screen is added to your application, and you want to make sure it displays **consistent data** free from any data race, make sure you update the manager if needed. The rule is very simple: consumed data must come from a **single** database access method (`dbQueue.read`, `write`, etc.), or [ValueObservation].
In other words: since GRDB is an unmanaged ORM, some amount of management must be imported into your application in order to make it fully thread-safe.
> :question: **Note**: Wrapping several fetches in a single `read` method may look like an inconvenience to you. After all, other ORMs don't require that much ceremony:
>
> ```ruby
> # Ruby's Active Record
> book = Book.find(123) # fetch book
> author = book.author # fetch author
> # use book and author
> ```
>
> The problem is that it is very hard to guarantee that you will surely fetch an author after you have fetched a book, despite the constraints of the database schema. One has to perform subsequent fetches in the proper [isolation] level, so that eventual concurrent writes that modify the database are unable to mess with subsequent requests.
>
> This isolation can be achieved with record management, as in [Core Data] or [Realm], that target long-running multi-threaded applications. On the other side, most web-oriented ORMs rely on short-lived database transactions, so that each HTTP request can be processed independently of others.
>
> GRDB is not a managed ORM. It thus has to use the same isolation techniques as web-oriented ORMs. But unlike web-oriented ORMs, GRDB can't provide implicit isolation: the application must decide when it wants to safely read information in the database, and this decision is made explicit, in your application code, with database access methods such as `dbQueue.read`.
>
> See the [Concurrency Guide] for detailed information, and the "Solving Problems" chapter of [Why Adopt GRDB?](WhyAdoptGRDB.md#solving-problems) for more rationale.
## Observe the Database and Refetch when Needed
We have seen above that the primitive Author and Book record types are [responsible](#persistable-record-types-are-responsible-for-their-tables) for their own database tables. Later we built [requests](#define-record-requests) and [composed](#compose-records) records into more complex ones such as BookInfo or AuthorInfo. We have shown how [database managers](#how-to-design-database-managers) should expose database content to the rest of the application.
Database content which has been fetched into memory eventually becomes obsoleted, as the application modifies the database content.
It is up to the application to decide how long it should keep fetched information in memory. Very often though, the application will want to keep memory information synchronized with the database content.
This synchronization is not automatic with GRDB: records do not "auto-update". That is because applications do not always want this feature, and because it is difficult to write correct multi-threaded applications when values can change in unexpected ways.
Instead, have a look at [Database Observation]:
> :bulb: **Tip**: [ValueObservation] performs automated tracking of database changes.
>
> :bulb: **Tip**: [GRDBCombine] performs automated tracking of database changes, in the [Combine](https://developer.apple.com/documentation/combine) way.
>
> :bulb: **Tip**: [RxGRDB] performs automated tracking of database changes, in the [RxSwift](https://github.com/ReactiveX/RxSwift) way.
>
> :bulb: **Tip**: [TransactionObserver] provides low-level database observation, for your most advanced needs.
>
> :bulb: **Tip**: Don't try to write complex methods that both modify the database and the values in memory at the same time. Instead, modify the database with plain record types, and rely on database observation for automatically refreshing values, even complex ones.
[records]: ../README.md#records
[associations]: AssociationsBasics.md
[FMDB]: https://github.com/ccgus/fmdb
[Core Data]: https://developer.apple.com/documentation/coredata
[Realm]: https://realm.io
[Active Record]: http://guides.rubyonrails.org/active_record_basics.html
[Django]: https://docs.djangoproject.com/en/2.0/topics/db/
[record protocols]: ../README.md#record-protocols-overview
[Separation of Concerns]: https://en.wikipedia.org/wiki/Separation_of_concerns
[Single Responsibility Principle]: https://en.wikipedia.org/wiki/Single_responsibility_principle
[Single Source of Truth]: https://en.wikipedia.org/wiki/Single_source_of_truth
[Divide and Conquer]: https://en.wikipedia.org/wiki/Divide_and_rule
[Why Adopt GRDB?]: WhyAdoptGRDB.md
[isolation]: https://en.wikipedia.org/wiki/Isolation_(database_systems)
[migrations]: ../README.md#migrations
[migration]: ../README.md#migrations
[Foreign Key Actions]: https://sqlite.org/foreignkeys.html#fk_actions
[Concurrency Guide]: ../README.md#concurrency
[GRDB concurrency rules]: ../README.md#concurrency
[PersistableRecord]: ../README.md#persistablerecord-protocol
[Database Observation]: ../README.md#database-changes-observation
[ValueObservation]: ../README.md#valueobservation
[RxGRDB]: http://github.com/RxSwiftCommunity/RxGRDB
[GRDBCombine]: http://github.com/groue/GRDBCombine
[TransactionObserver]: ../README.md#transactionobserver-protocol
[Trust SQLite More Than Yourself]: #trust-sqlite-more-than-yourself
[Persistable Record Types are Responsible for Their Tables]: #persistable-record-types-are-responsible-for-their-tables
[Define Record Requests]: #define-record-requests
[Compose Records]: #compose-records
[How to Design Database Managers]: #how-to-design-database-managers
[Observe the Database and Refetch when Needed]: #observe-the-database-and-refetch-when-needed
[query interface]: ../README.md#the-query-interface
[observe database changes]: ../README.md#database-changes-observation
[data protection]: ../README.md#data-protection
[Embrace Errors]: #embrace-errors
[Thread-Safety is also an Application Concern]: #thread-safety-is-also-an-application-concern
[recommended convention]: AssociationsBasics.md#associations-and-the-database-schema
[Association Aggregates]: AssociationsBasics.md#association-aggregates
[Codable Record]: ../README.md#codable-records
[CodingKeys]: https://developer.apple.com/documentation/foundation/archives_and_serialization/encoding_and_decoding_custom_types
@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="468px" height="145px" viewBox="0 0 468 145" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->
<title>AmbiguousForeignKeys</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="200" height="127" rx="10"></rect>
<filter x="-7.2%" y="-9.1%" width="114.5%" height="122.8%" 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="200" height="103" rx="10"></rect>
<filter x="-7.2%" y="-11.2%" width="114.5%" height="128.2%" 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>
<circle id="path-8" cx="3.5" cy="28.5" r="3.5"></circle>
<path d="M57.4068802,4.62378409 L50.4819187,0.815055312 C49.9979981,0.548898936 49.3899405,0.725431787 49.1237841,1.20935247 C49.0425794,1.35699745 49,1.52276825 49,1.69127122 L49,9.30872878 C49,9.86101353 49.4477153,10.3087288 50,10.3087288 C50.168503,10.3087288 50.3342738,10.2661494 50.4819187,10.1849447 L57.4068802,6.37621591 C57.8908008,6.11005953 58.0673337,5.50200193 57.8011773,5.01808125 C57.7097895,4.85192153 57.5730399,4.71517193 57.4068802,4.62378409 Z" id="path-9"></path>
<circle id="path-10" cx="3.5" cy="47.5" r="3.5"></circle>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="AmbiguousForeignKeys" transform="translate(9.000000, 6.000000)">
<g id="Table">
<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>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-2"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="201" height="128" rx="10"></rect>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 31.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">id</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 55.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">authorId</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 79.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">translatorId</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 103.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">title</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">text</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<text id="book" mask="url(#mask-3)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="82.9443359" y="21">book</tspan>
</text>
</g>
<g id="Table-Copy-2" transform="translate(250.000000, 0.000000)">
<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>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-5"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="201" height="104" rx="10"></rect>
</g>
<g id="Field" mask="url(#mask-6)">
<g transform="translate(0.000000, 31.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">id</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-6)">
<g transform="translate(0.000000, 55.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">name</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">text</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-6)">
<g transform="translate(0.000000, 79.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500"></text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal"></text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<text id="person" mask="url(#mask-6)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="76.2109375" y="21">person</tspan>
</text>
</g>
<g id="Group-3" transform="translate(197.000000, 39.000000)">
<g id="Oval">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-8"></use>
<circle stroke="#FFFFFF" stroke-width="1" cx="3.5" cy="28.5" r="4"></circle>
</g>
<g id="Path-3">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-9"></use>
<path stroke="#FFFFFF" stroke-width="1" d="M57.6478395,4.18567614 C57.8970791,4.3227579 58.1022035,4.5278823 58.2392853,4.77712188 C58.6385198,5.5030029 58.3737206,6.4150893 57.6478395,6.81432386 L50.7228781,10.6230526 C50.5014107,10.7448598 50.2527545,10.8087288 50,10.8087288 C49.1715729,10.8087288 48.5,10.1371559 48.5,9.30872878 L48.5,1.69127122 C48.5,1.43851677 48.563869,1.18986057 48.6856761,0.968393096 C49.0849107,0.242512071 49.9969971,-0.0222872062 50.7228781,0.376947358 L57.6478395,4.18567614 Z"></path>
</g>
<path d="M2.5,28.5 C2.5,28.5 2.5,28.5 16.5,28.5 C30.5,28.5 27.5,5.5 40.5,5.5 C49.1666667,5.5 53.5,5.5 53.5,5.5" id="Path-2" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</g>
<g id="Group-3" transform="translate(197.000000, 44.000000)">
<g id="Oval">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-10"></use>
<circle stroke="#FFFFFF" stroke-width="1" cx="3.5" cy="47.5" r="4"></circle>
</g>
<path d="M2.5,47.5 C2.5,47.5 2.5,47.5 16.5,47.5 C30.5,47.5 27.5,0.5 40.5,0.5 C49.1666667,0.5 53.5,0.5 53.5,0.5" id="Path-2" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="468px" height="121px" viewBox="0 0 468 121" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->
<title>BelongsToSchema</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="200" height="103" rx="10"></rect>
<filter x="-7.2%" y="-11.2%" width="114.5%" height="128.2%" 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="200" height="103" rx="10"></rect>
<filter x="-7.2%" y="-11.2%" width="114.5%" height="128.2%" 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>
<circle id="path-8" cx="200.5" cy="67.5" r="3.5"></circle>
<path d="M254.40688,43.6237841 L247.481919,39.8150553 C246.997998,39.5488989 246.38994,39.7254318 246.123784,40.2093525 C246.042579,40.3569975 246,40.5227683 246,40.6912712 L246,48.3087288 C246,48.8610135 246.447715,49.3087288 247,49.3087288 C247.168503,49.3087288 247.334274,49.2661494 247.481919,49.1849447 L254.40688,45.3762159 C254.890801,45.1100595 255.067334,44.5020019 254.801177,44.0180813 C254.709789,43.8519215 254.57304,43.7151719 254.40688,43.6237841 Z" id="path-9"></path>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="BelongsToSchema" transform="translate(9.000000, 6.000000)">
<g id="Table">
<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>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-2"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="201" height="104" rx="10"></rect>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 31.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">id</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 55.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">authorId</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 79.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">title</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">text</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<text id="book" mask="url(#mask-3)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="82.9443359" y="21">book</tspan>
</text>
</g>
<g id="Table-Copy-2" transform="translate(250.000000, 0.000000)">
<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>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-5"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="201" height="104" rx="10"></rect>
</g>
<g id="Field" mask="url(#mask-6)">
<g transform="translate(0.000000, 31.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">id</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-6)">
<g transform="translate(0.000000, 55.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">name</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">text</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-6)">
<g transform="translate(0.000000, 79.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500"></text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal"></text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<text id="author" mask="url(#mask-6)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="77.3867188" y="21">author</tspan>
</text>
</g>
<g id="Oval">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-8"></use>
<circle stroke="#FFFFFF" stroke-width="1" cx="200.5" cy="67.5" r="4"></circle>
</g>
<g id="Path-3">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-9"></use>
<path stroke="#FFFFFF" stroke-width="1" d="M254.64784,43.1856761 C254.897079,43.3227579 255.102204,43.5278823 255.239285,43.7771219 C255.63852,44.5030029 255.373721,45.4150893 254.64784,45.8143239 L247.722878,49.6230526 C247.501411,49.7448598 247.252754,49.8087288 247,49.8087288 C246.171573,49.8087288 245.5,49.1371559 245.5,48.3087288 L245.5,40.6912712 C245.5,40.4385168 245.563869,40.1898606 245.685676,39.9683931 C246.084911,39.2425121 246.996997,38.9777128 247.722878,39.3769474 L254.64784,43.1856761 Z"></path>
</g>
<path d="M199.5,67.5 C199.5,67.5 199.5,67.5 213.5,67.5 C227.5,67.5 224.5,44.5 237.5,44.5 C246.166667,44.5 250.5,44.5 250.5,44.5" id="Path-2" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 10 KiB

@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="468px" height="121px" viewBox="0 0 468 121" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->
<title>HasManySchema</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="200" height="103" rx="10"></rect>
<filter x="-7.2%" y="-11.2%" width="114.5%" height="128.2%" 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="200" height="103" rx="10"></rect>
<filter x="-7.2%" y="-11.2%" width="114.5%" height="128.2%" 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>
<circle id="path-8" cx="3.5" cy="28.5" r="3.5"></circle>
<path d="M57.4068802,4.62378409 L50.4819187,0.815055312 C49.9979981,0.548898936 49.3899405,0.725431787 49.1237841,1.20935247 C49.0425794,1.35699745 49,1.52276825 49,1.69127122 L49,9.30872878 C49,9.86101353 49.4477153,10.3087288 50,10.3087288 C50.168503,10.3087288 50.3342738,10.2661494 50.4819187,10.1849447 L57.4068802,6.37621591 C57.8908008,6.11005953 58.0673337,5.50200193 57.8011773,5.01808125 C57.7097895,4.85192153 57.5730399,4.71517193 57.4068802,4.62378409 Z" id="path-9"></path>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="HasManySchema" transform="translate(9.000000, 6.000000)">
<g id="Table" transform="translate(250.000000, 0.000000)">
<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>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-2"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="201" height="104" rx="10"></rect>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 31.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">id</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 55.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">authorId</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 79.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">title</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">text</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<text id="book" mask="url(#mask-3)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="82.9443359" y="21">book</tspan>
</text>
</g>
<g id="Table-Copy-2">
<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>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-5"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="201" height="104" rx="10"></rect>
</g>
<g id="Field" mask="url(#mask-6)">
<g transform="translate(0.000000, 31.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">id</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-6)">
<g transform="translate(0.000000, 55.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">name</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">text</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-6)">
<g transform="translate(0.000000, 79.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500"></text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal"></text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<text id="author" mask="url(#mask-6)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="77.3867188" y="21">author</tspan>
</text>
</g>
<g id="Group" transform="translate(224.000000, 55.000000) scale(-1, 1) translate(-224.000000, -55.000000) translate(195.000000, 39.000000)">
<g id="Oval">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-8"></use>
<circle stroke="#FFFFFF" stroke-width="1" cx="3.5" cy="28.5" r="4"></circle>
</g>
<g id="Path-3">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-9"></use>
<path stroke="#FFFFFF" stroke-width="1" d="M57.6478395,4.18567614 C57.8970791,4.3227579 58.1022035,4.5278823 58.2392853,4.77712188 C58.6385198,5.5030029 58.3737206,6.4150893 57.6478395,6.81432386 L50.7228781,10.6230526 C50.5014107,10.7448598 50.2527545,10.8087288 50,10.8087288 C49.1715729,10.8087288 48.5,10.1371559 48.5,9.30872878 L48.5,1.69127122 C48.5,1.43851677 48.563869,1.18986057 48.6856761,0.968393096 C49.0849107,0.242512071 49.9969971,-0.0222872062 50.7228781,0.376947358 L57.6478395,4.18567614 Z"></path>
</g>
<path d="M2.5,28.5 C2.5,28.5 2.5,28.5 16.5,28.5 C30.5,28.5 27.5,5.5 40.5,5.5 C49.1666667,5.5 53.5,5.5 53.5,5.5" id="Path-2" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 10 KiB

@@ -0,0 +1,185 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="468px" height="200px" viewBox="0 0 468 200" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->
<title>HasManyThroughSchema</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="200" height="103" rx="10"></rect>
<filter x="-7.2%" y="-11.2%" width="114.5%" height="128.2%" 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="200" height="79" rx="10"></rect>
<filter x="-7.2%" y="-14.6%" width="114.5%" height="136.7%" 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="200" height="79" rx="10"></rect>
<filter x="-7.2%" y="-14.6%" width="114.5%" height="136.7%" 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>
<circle id="path-11" cx="3.5" cy="44.5" r="3.5"></circle>
<path d="M57.4068802,4.62378409 L50.4819187,0.815055312 C49.9979981,0.548898936 49.3899405,0.725431787 49.1237841,1.20935247 C49.0425794,1.35699745 49,1.52276825 49,1.69127122 L49,9.30872878 C49,9.86101353 49.4477153,10.3087288 50,10.3087288 C50.168503,10.3087288 50.3342738,10.2661494 50.4819187,10.1849447 L57.4068802,6.37621591 C57.8908008,6.11005953 58.0673337,5.50200193 57.8011773,5.01808125 C57.7097895,4.85192153 57.5730399,4.71517193 57.4068802,4.62378409 Z" id="path-12"></path>
<circle id="path-13" cx="3.5" cy="3.5" r="3.5"></circle>
<path d="M57.4068802,42.6237841 L50.4819187,38.8150553 C49.9979981,38.5488989 49.3899405,38.7254318 49.1237841,39.2093525 C49.0425794,39.3569975 49,39.5227683 49,39.6912712 L49,47.3087288 C49,47.8610135 49.4477153,48.3087288 50,48.3087288 C50.168503,48.3087288 50.3342738,48.2661494 50.4819187,48.1849447 L57.4068802,44.3762159 C57.8908008,44.1100595 58.0673337,43.5020019 57.8011773,43.0180813 C57.7097895,42.8519215 57.5730399,42.7151719 57.4068802,42.6237841 Z" id="path-14"></path>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="HasManyThroughSchema" transform="translate(9.000000, 6.000000)">
<g id="Table" transform="translate(250.000000, 40.000000)">
<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>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-2"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="201" height="104" rx="10"></rect>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 31.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">countryCode</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">text</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 55.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">citizenId</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 79.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">issueDate</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">date</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<text id="passport" mask="url(#mask-3)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="69.3613281" y="21">passport</tspan>
</text>
</g>
<g id="Table-Copy-2">
<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>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-5"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="201" height="80" rx="10"></rect>
</g>
<g id="Field" mask="url(#mask-6)">
<g transform="translate(0.000000, 31.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">code</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">text</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-6)">
<g transform="translate(0.000000, 55.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">name</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">text</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<text id="country" mask="url(#mask-6)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="73.3740234" y="21">country</tspan>
</text>
</g>
<g id="Table-Copy-2" transform="translate(0.000000, 103.000000)">
<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="#005CC5" fill-rule="evenodd" xlink:href="#path-8"></use>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-8"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="201" height="80" rx="10"></rect>
</g>
<g id="Field" mask="url(#mask-9)">
<g transform="translate(0.000000, 31.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">id</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-9)">
<g transform="translate(0.000000, 55.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">name</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">text</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<text id="citizen" mask="url(#mask-9)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="77.1782227" y="21">citizen</tspan>
</text>
</g>
<g id="Group" transform="translate(224.000000, 63.000000) scale(-1, 1) translate(-224.000000, -63.000000) translate(195.000000, 39.000000)">
<g id="Oval">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-11"></use>
<circle stroke="#FFFFFF" stroke-width="1" cx="3.5" cy="44.5" r="4"></circle>
</g>
<g id="Path-3">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-12"></use>
<path stroke="#FFFFFF" stroke-width="1" d="M57.6478395,4.18567614 C57.8970791,4.3227579 58.1022035,4.5278823 58.2392853,4.77712188 C58.6385198,5.5030029 58.3737206,6.4150893 57.6478395,6.81432386 L50.7228781,10.6230526 C50.5014107,10.7448598 50.2527545,10.8087288 50,10.8087288 C49.1715729,10.8087288 48.5,10.1371559 48.5,9.30872878 L48.5,1.69127122 C48.5,1.43851677 48.563869,1.18986057 48.6856761,0.968393096 C49.0849107,0.242512071 49.9969971,-0.0222872062 50.7228781,0.376947358 L57.6478395,4.18567614 Z"></path>
</g>
<path d="M2.5,44.5 C2.5,44.5 2.5,44.5 16.5,44.5 C30.5,44.5 27.5,5.5 40.5,5.5 C49.1666667,5.5 53.5,5.5 53.5,5.5" id="Path-2" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</g>
<g id="Group" transform="translate(224.000000, 128.500000) scale(-1, 1) translate(-224.000000, -128.500000) translate(195.000000, 104.000000)">
<g id="Oval">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-13"></use>
<circle stroke="#FFFFFF" stroke-width="1" cx="3.5" cy="3.5" r="4"></circle>
</g>
<g id="Path-3">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-14"></use>
<path stroke="#FFFFFF" stroke-width="1" d="M57.6478395,42.1856761 C57.8970791,42.3227579 58.1022035,42.5278823 58.2392853,42.7771219 C58.6385198,43.5030029 58.3737206,44.4150893 57.6478395,44.8143239 L50.7228781,48.6230526 C50.5014107,48.7448598 50.2527545,48.8087288 50,48.8087288 C49.1715729,48.8087288 48.5,48.1371559 48.5,47.3087288 L48.5,39.6912712 C48.5,39.4385168 48.563869,39.1898606 48.6856761,38.9683931 C49.0849107,38.2425121 49.9969971,37.9777128 50.7228781,38.3769474 L57.6478395,42.1856761 Z"></path>
</g>
<path d="M2.5,3.5 C2.5,3.5 2.5,3.5 16.5,3.5 C30.5,3.5 27.5,43.5 40.5,43.5 C49.1666667,43.5 53.5,43.5 53.5,43.5" id="Path-2" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 15 KiB

@@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="468px" height="145px" viewBox="0 0 468 145" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->
<title>HasOneSchema</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="200" height="127" rx="10"></rect>
<filter x="-7.2%" y="-9.1%" width="114.5%" height="122.8%" 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="200" height="127" rx="10"></rect>
<filter x="-7.2%" y="-9.1%" width="114.5%" height="122.8%" 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>
<circle id="path-8" cx="3.5" cy="28.5" r="3.5"></circle>
<path d="M57.4068802,4.62378409 L50.4819187,0.815055312 C49.9979981,0.548898936 49.3899405,0.725431787 49.1237841,1.20935247 C49.0425794,1.35699745 49,1.52276825 49,1.69127122 L49,9.30872878 C49,9.86101353 49.4477153,10.3087288 50,10.3087288 C50.168503,10.3087288 50.3342738,10.2661494 50.4819187,10.1849447 L57.4068802,6.37621591 C57.8908008,6.11005953 58.0673337,5.50200193 57.8011773,5.01808125 C57.7097895,4.85192153 57.5730399,4.71517193 57.4068802,4.62378409 Z" id="path-9"></path>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="HasOneSchema" transform="translate(9.000000, 6.000000)">
<g id="Table" transform="translate(250.000000, 0.000000)">
<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>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-2"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="201" height="128" rx="10"></rect>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 31.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">id</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 55.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">countryCode</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">text</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 79.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">population</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 103.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">density</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">double</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<text id="demographics" mask="url(#mask-3)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="50.894043" y="21">demographics</tspan>
</text>
</g>
<g id="Table-Copy-2">
<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>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-5"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="201" height="128" rx="10"></rect>
</g>
<g id="Field" mask="url(#mask-6)">
<g transform="translate(0.000000, 31.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">code</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">text</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-6)">
<g transform="translate(0.000000, 55.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">name</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">text</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-6)">
<g transform="translate(0.000000, 79.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500"></text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal"></text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-6)">
<g transform="translate(0.000000, 103.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500"></text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal"></text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<text id="country" mask="url(#mask-6)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="73.3740234" y="21">country</tspan>
</text>
</g>
<g id="Group" transform="translate(224.000000, 55.000000) scale(-1, 1) translate(-224.000000, -55.000000) translate(195.000000, 39.000000)">
<g id="Oval">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-8"></use>
<circle stroke="#FFFFFF" stroke-width="1" cx="3.5" cy="28.5" r="4"></circle>
</g>
<g id="Path-3">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-9"></use>
<path stroke="#FFFFFF" stroke-width="1" d="M57.6478395,4.18567614 C57.8970791,4.3227579 58.1022035,4.5278823 58.2392853,4.77712188 C58.6385198,5.5030029 58.3737206,6.4150893 57.6478395,6.81432386 L50.7228781,10.6230526 C50.5014107,10.7448598 50.2527545,10.8087288 50,10.8087288 C49.1715729,10.8087288 48.5,10.1371559 48.5,9.30872878 L48.5,1.69127122 C48.5,1.43851677 48.563869,1.18986057 48.6856761,0.968393096 C49.0849107,0.242512071 49.9969971,-0.0222872062 50.7228781,0.376947358 L57.6478395,4.18567614 Z"></path>
</g>
<path d="M2.5,28.5 C2.5,28.5 2.5,28.5 16.5,28.5 C30.5,28.5 27.5,5.5 40.5,5.5 C49.1666667,5.5 53.5,5.5 53.5,5.5" id="Path-2" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

@@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="468px" height="247px" viewBox="0 0 468 247" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->
<title>HasOneThroughSchema</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="200" height="79" rx="10"></rect>
<filter x="-7.2%" y="-14.6%" width="114.5%" height="136.7%" 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="200" height="103" rx="10"></rect>
<filter x="-7.2%" y="-11.2%" width="114.5%" height="128.2%" 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="200" height="102" rx="10"></rect>
<filter x="-7.2%" y="-11.3%" width="114.5%" height="128.4%" 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>
<circle id="path-11" cx="3.5" cy="56.5" r="3.5"></circle>
<path d="M57.4068802,4.62378409 L50.4819187,0.815055312 C49.9979981,0.548898936 49.3899405,0.725431787 49.1237841,1.20935247 C49.0425794,1.35699745 49,1.52276825 49,1.69127122 L49,9.30872878 C49,9.86101353 49.4477153,10.3087288 50,10.3087288 C50.168503,10.3087288 50.3342738,10.2661494 50.4819187,10.1849447 L57.4068802,6.37621591 C57.8908008,6.11005953 58.0673337,5.50200193 57.8011773,5.01808125 C57.7097895,4.85192153 57.5730399,4.71517193 57.4068802,4.62378409 Z" id="path-12"></path>
<circle id="path-13" cx="3.5" cy="3.5" r="3.5"></circle>
<path d="M57.4068802,54.6237841 L50.4819187,50.8150553 C49.9979981,50.5488989 49.3899405,50.7254318 49.1237841,51.2093525 C49.0425794,51.3569975 49,51.5227683 49,51.6912712 L49,59.3087288 C49,59.8610135 49.4477153,60.3087288 50,60.3087288 C50.168503,60.3087288 50.3342738,60.2661494 50.4819187,60.1849447 L57.4068802,56.3762159 C57.8908008,56.1100595 58.0673337,55.5020019 57.8011773,55.0180813 C57.7097895,54.8519215 57.5730399,54.7151719 57.4068802,54.6237841 Z" id="path-14"></path>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="HasOneThroughSchema" transform="translate(9.000000, 6.000000)">
<g id="Table" transform="translate(250.000000, 75.000000)">
<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>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-2"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="201" height="80" rx="10"></rect>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 31.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">id</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 55.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">name</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">text</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<text id="library" mask="url(#mask-3)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="77.800293" y="21">library</tspan>
</text>
</g>
<g id="Group-2">
<g id="Table-Copy-2">
<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>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-5"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="201" height="104" rx="10"></rect>
</g>
<g id="Field" mask="url(#mask-6)">
<g transform="translate(0.000000, 31.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">id</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-6)">
<g transform="translate(0.000000, 55.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">libraryId</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-6)">
<g transform="translate(0.000000, 79.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">title</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">text</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<text id="book" mask="url(#mask-6)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="82.9443359" y="21">book</tspan>
</text>
</g>
<g id="Table-Copy-2" transform="translate(0.000000, 127.000000)">
<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="#005CC5" fill-rule="evenodd" xlink:href="#path-8"></use>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-8"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="201" height="103" rx="10"></rect>
</g>
<g id="Field" mask="url(#mask-9)">
<g transform="translate(0.000000, 31.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">libraryId</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-9)">
<g transform="translate(0.000000, 55.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">street</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">text</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-9)">
<g transform="translate(0.000000, 78.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">city</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">text</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<text id="address" mask="url(#mask-9)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="72.4545898" y="21">address</tspan>
</text>
</g>
</g>
<g id="Group" transform="translate(226.000000, 93.500000) scale(1, -1) translate(-226.000000, -93.500000) translate(197.000000, 63.000000)">
<g id="Oval">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-11"></use>
<circle stroke="#FFFFFF" stroke-width="1" cx="3.5" cy="56.5" r="4"></circle>
</g>
<g id="Path-3">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-12"></use>
<path stroke="#FFFFFF" stroke-width="1" d="M57.6478395,4.18567614 C57.8970791,4.3227579 58.1022035,4.5278823 58.2392853,4.77712188 C58.6385198,5.5030029 58.3737206,6.4150893 57.6478395,6.81432386 L50.7228781,10.6230526 C50.5014107,10.7448598 50.2527545,10.8087288 50,10.8087288 C49.1715729,10.8087288 48.5,10.1371559 48.5,9.30872878 L48.5,1.69127122 C48.5,1.43851677 48.563869,1.18986057 48.6856761,0.968393096 C49.0849107,0.242512071 49.9969971,-0.0222872062 50.7228781,0.376947358 L57.6478395,4.18567614 Z"></path>
</g>
<path d="M2.5,56.5 C2.5,56.5 2.5,56.5 16.5,56.5 C30.5,56.5 27.5,5.5 40.5,5.5 C49.1666667,5.5 53.5,5.5 53.5,5.5" id="Path-2" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</g>
<g id="Group" transform="translate(226.000000, 143.500000) scale(1, -1) translate(-226.000000, -143.500000) translate(197.000000, 113.000000)">
<g id="Oval">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-13"></use>
<circle stroke="#FFFFFF" stroke-width="1" cx="3.5" cy="3.5" r="4"></circle>
</g>
<g id="Path-3">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-14"></use>
<path stroke="#FFFFFF" stroke-width="1" d="M57.6478395,54.1856761 C57.8970791,54.3227579 58.1022035,54.5278823 58.2392853,54.7771219 C58.6385198,55.5030029 58.3737206,56.4150893 57.6478395,56.8143239 L50.7228781,60.6230526 C50.5014107,60.7448598 50.2527545,60.8087288 50,60.8087288 C49.1715729,60.8087288 48.5,60.1371559 48.5,59.3087288 L48.5,51.6912712 C48.5,51.4385168 48.563869,51.1898606 48.6856761,50.9683931 C49.0849107,50.2425121 49.9969971,49.9777128 50.7228781,50.3769474 L57.6478395,54.1856761 Z"></path>
</g>
<path d="M2.5,3.5 C2.5,3.5 2.5,3.5 16.5,3.5 C30.5,3.5 27.5,55.5 40.5,55.5 C49.1666667,55.5 53.5,55.5 53.5,55.5" id="Path-2" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 16 KiB

@@ -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
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="233px" height="121px" viewBox="0 0 233 121" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->
<title>RecursiveSchema</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="200" height="103" rx="10"></rect>
<filter x="-7.2%" y="-11.2%" width="114.5%" height="128.2%" 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>
<circle id="path-5" cx="22.5" cy="28.5" r="3.5"></circle>
<path d="M27.4068802,4.62378409 L20.4819187,0.815055312 C19.9979981,0.548898936 19.3899405,0.725431787 19.1237841,1.20935247 C19.0425794,1.35699745 19,1.52276825 19,1.69127122 L19,9.30872878 C19,9.86101353 19.4477153,10.3087288 20,10.3087288 C20.168503,10.3087288 20.3342738,10.2661494 20.4819187,10.1849447 L27.4068802,6.37621591 C27.8908008,6.11005953 28.0673337,5.50200193 27.8011773,5.01808125 C27.7097895,4.85192153 27.5730399,4.71517193 27.4068802,4.62378409 Z" id="path-6"></path>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="RecursiveSchema" transform="translate(9.000000, 6.000000)">
<g id="Table-Copy-2">
<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>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-2"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="201" height="104" rx="10"></rect>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 31.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">id</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 55.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">managerId</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">integer</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 79.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500">
<tspan x="10" y="17" fill="#000000">name</tspan>
</text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal">
<tspan x="110" y="17" fill="#000000">text</tspan>
</text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<g id="Field" mask="url(#mask-3)">
<g transform="translate(0.000000, 79.000000)">
<text id="name" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="500"></text>
<text id="type" fill="none" font-family="-apple-system,sans-serif" font-size="14" font-weight="normal"></text>
<rect id="Rectangle" fill-opacity="0.12" fill="#000000" fill-rule="evenodd" x="0" y="0" width="200" height="1"></rect>
</g>
</g>
<text id="employee" mask="url(#mask-3)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="66.8730469" y="21">employee</tspan>
</text>
</g>
<g id="Group" transform="translate(209.000000, 55.000000) scale(-1, 1) translate(-209.000000, -55.000000) translate(195.000000, 39.000000)">
<g id="Oval">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-5"></use>
<circle stroke="#FFFFFF" stroke-width="1" cx="22.5" cy="28.5" r="4"></circle>
</g>
<g id="Path-3">
<use fill="#000000" fill-rule="evenodd" xlink:href="#path-6"></use>
<path stroke="#FFFFFF" stroke-width="1" d="M27.6478395,4.18567614 C27.8970791,4.3227579 28.1022035,4.5278823 28.2392853,4.77712188 C28.6385198,5.5030029 28.3737206,6.4150893 27.6478395,6.81432386 L20.7228781,10.6230526 C20.5014107,10.7448598 20.2527545,10.8087288 20,10.8087288 C19.1715729,10.8087288 18.5,10.1371559 18.5,9.30872878 L18.5,1.69127122 C18.5,1.43851677 18.563869,1.18986057 18.6856761,0.968393096 C19.0849107,0.242512071 19.9969971,-0.0222872062 20.7228781,0.376947358 L27.6478395,4.18567614 Z"></path>
</g>
<path d="M23.5,28.5 C23.5,28.5 19.1666667,28.5 10.5,28.5 C-2.5,28.5 -2.5,5.5 10.5,5.5 C19.1666667,5.5 23.5,5.5 23.5,5.5" id="Path-2" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.1 KiB

@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="292px" height="166px" viewBox="0 0 292 166" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->
<title>TreeOfAssociationKeys</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="119" height="28" rx="10"></rect>
<filter x="-12.2%" y="-41.1%" width="124.4%" height="203.6%" 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="119" height="28" rx="10"></rect>
<filter x="-12.2%" y="-41.1%" width="124.4%" height="203.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="119" height="28" rx="10"></rect>
<filter x="-12.2%" y="-41.1%" width="124.4%" height="203.6%" 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="119" height="28" rx="10"></rect>
<filter x="-12.2%" y="-41.1%" width="124.4%" height="203.6%" 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>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="TreeOfAssociationKeys" transform="translate(9.000000, 6.000000)">
<path d="M60,78 L60,114" id="Line" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path>
<path id="Line-decoration-1" d="M57,103.2 L60,114 L63,103.2" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path>
<path d="M139,14 L77,57" id="Line" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path>
<path id="Line-decoration-1" d="M84.1648227,48.3799469 L77,57 L87.5842165,53.3102356" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path>
<path d="M140,14 L206,57" id="Line-Copy" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path>
<path id="Line-Copy-decoration-1" d="M195.313438,53.61808 L206,57 L198.58872,48.5909017" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path>
<g id="Table-Copy-2" transform="translate(80.000000, 0.000000)">
<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>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-2"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="120" height="29" rx="10"></rect>
</g>
<text id="root" mask="url(#mask-3)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="45.390625" y="19">root</tspan>
</text>
</g>
<g id="Table-Copy-3" transform="translate(0.000000, 62.000000)">
<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="#417505" fill-rule="evenodd" xlink:href="#path-5"></use>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-5"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="120" height="29" rx="10"></rect>
</g>
<text id="&quot;author&quot;" mask="url(#mask-6)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="30.2421875" y="19">"author"</tspan>
</text>
</g>
<g id="Table-Copy-5" transform="translate(155.000000, 62.000000)">
<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="#9013FE" fill-rule="evenodd" xlink:href="#path-8"></use>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-8"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="120" height="29" rx="10"></rect>
</g>
<text id="&quot;coverImage&quot;" mask="url(#mask-9)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="12.8037109" y="19">"coverImage"</tspan>
</text>
</g>
<g id="Table-Copy-4" transform="translate(0.000000, 120.000000)">
<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="#D0021B" fill-rule="evenodd" xlink:href="#path-11"></use>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-11"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="120" height="29" rx="10"></rect>
</g>
<text id="&quot;country&quot;" mask="url(#mask-12)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="26.2294922" y="19">"country"</tspan>
</text>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.5 KiB

@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="421px" height="227px" viewBox="0 0 421 227" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 49 (51002) - http://www.bohemiancoding.com/sketch -->
<title>TreeOfAssociationKeysMapping</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="119" height="28" rx="10"></rect>
<filter x="-12.2%" y="-41.1%" width="124.4%" height="203.6%" 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="119" height="28" rx="10"></rect>
<filter x="-12.2%" y="-41.1%" width="124.4%" height="203.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="119" height="28" rx="10"></rect>
<filter x="-12.2%" y="-41.1%" width="124.4%" height="203.6%" 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="119" height="28" rx="10"></rect>
<filter x="-12.2%" y="-41.1%" width="124.4%" height="203.6%" 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>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="TreeOfAssociationKeysMapping" transform="translate(0.000000, 6.000000)">
<g id="Group-4">
<path d="M83,36 L83,186" id="Line-Copy-2" stroke="#727272" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="4,8"></path>
<path d="M159,96 L159,186" id="Line-Copy-3" stroke="#727272" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="4,8"></path>
<path d="M246,156 L246,186" id="Line-Copy-4" stroke="#727272" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="4,8"></path>
<path d="M352,96 L352,186" id="Line-Copy-5" stroke="#727272" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="4,8"></path>
<path d="M85,14 L136,57" id="Line" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path>
<path id="Line-decoration-1" d="M125.809367,52.3319166 L136,57 L129.676951,47.7447827" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path>
<path d="M85,14 L292,57" id="Line" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path>
<path id="Line-decoration-1" d="M280.815576,57.7407092 L292,57 L282.035901,51.8661193" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path>
<path d="M156,72 L207,115" id="Line" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path>
<path id="Line-decoration-1" d="M196.809367,110.331917 L207,115 L200.676951,105.744783" stroke="#000000" stroke-linecap="round" stroke-linejoin="round"></path>
<g id="Table-Copy-6" transform="translate(23.000000, 0.000000)">
<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>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-2"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="120" height="29" rx="10"></rect>
</g>
<text id="root" mask="url(#mask-3)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="45.390625" y="19">root</tspan>
</text>
</g>
<g id="Table-Copy-7" transform="translate(100.000000, 62.000000)">
<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="#417505" fill-rule="evenodd" xlink:href="#path-5"></use>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-5"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="120" height="29" rx="10"></rect>
</g>
<text id="&quot;author&quot;" mask="url(#mask-6)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="30.2421875" y="19">"author"</tspan>
</text>
</g>
<g id="Table-Copy-8" transform="translate(293.000000, 62.000000)">
<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="#9013FE" fill-rule="evenodd" xlink:href="#path-8"></use>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-8"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="120" height="29" rx="10"></rect>
</g>
<text id="&quot;coverImage&quot;" mask="url(#mask-9)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="12.8037109" y="19">"coverImage"</tspan>
</text>
</g>
<g id="Table-Copy-9" transform="translate(187.000000, 120.000000)">
<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="#D0021B" fill-rule="evenodd" xlink:href="#path-11"></use>
<use fill="url(#linearGradient-1)" fill-rule="evenodd" xlink:href="#path-11"></use>
<rect stroke-opacity="0.25" stroke="#000000" stroke-width="1" x="-0.5" y="-0.5" width="120" height="29" rx="10"></rect>
</g>
<text id="&quot;country&quot;" mask="url(#mask-12)" font-family="-apple-system,sans-serif" font-size="14" font-weight="500" fill="#000000">
<tspan x="26.2294922" y="19">"country"</tspan>
</text>
</g>
<g id="Group-5" transform="translate(0.000000, 191.000000)" font-family="Menlo-Regular, Menlo" font-size="14" font-weight="normal">
<text id="SELECT-book.*,-autho">
<tspan x="0" y="13" fill="#404040">SELECT </tspan>
<tspan x="59.0009766" y="13" fill="#4A90E2">book.*</tspan>
<tspan x="109.573242" y="13" fill="#404040">, </tspan>
<tspan x="126.430664" y="13" fill="#417505">author.*</tspan>
<tspan x="193.860352" y="13" fill="#404040">, </tspan>
<tspan x="210.717773" y="13" fill="#D0021B">country.*</tspan>
<tspan x="286.576172" y="13" fill="#404040">, </tspan>
<tspan x="303.433594" y="13" fill="#9013FE">coverImage.*</tspan>
<tspan x="404.578125" y="13" fill="#404040"></tspan>
<tspan x="0" y="29" fill="#404040">FROM …</tspan>
</text>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 10 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

@@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 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
@@ -0,0 +1,149 @@
//: To run this playground:
//:
//: - Open GRDB.xcworkspace
//: - Select the GRDBOSX scheme: menu Product > Scheme > GRDBOSX
//: - Build: menu Product > Build
//: - Select the playground in the Playgrounds Group
//: - Run the playground
import GRDB
//: Open a database connection
var config = Configuration()
config.trace = { print("SQL > \($0)") }
let dbQueue = DatabaseQueue(configuration: config)
//: Use a migrator to define the database schema
var migrator = DatabaseMigrator()
migrator.registerMigration("createLibrary") { db in
try db.create(table: "author") { t in
t.autoIncrementedPrimaryKey("id")
t.column("name", .text).notNull()
}
try db.create(table: "book") { t in
t.autoIncrementedPrimaryKey("id")
t.column("title", .text).notNull()
t.column("authorId", .integer)
.notNull()
.indexed()
.references("author", onDelete: .cascade)
}
}
try migrator.migrate(dbQueue)
//: Define Record types
struct Author: Codable, FetchableRecord, MutablePersistableRecord {
var id: Int64?
var name: String
mutating func didInsert(with rowID: Int64, for column: String?) {
id = rowID
}
}
struct Book: Codable, FetchableRecord, MutablePersistableRecord {
var id: Int64?
var authorId: Int64
var title: String
mutating func didInsert(with rowID: Int64, for column: String?) {
id = rowID
}
}
//: Define Associations
extension Author {
static let books = hasMany(Book.self)
var books: QueryInterfaceRequest<Book> {
return request(for: Author.books)
}
}
extension Book {
static let author = belongsTo(Author.self)
var author: QueryInterfaceRequest<Author> {
return request(for: Book.author)
}
}
//: Populate the database
print("----------")
print("Populate the database")
try dbQueue.write { db in
var melville = Author(id: nil, name: "Hermann Melville")
try melville.insert(db)
var mobyDick = Book(id: nil, authorId: melville.id!, title: "Moby-Dick")
try mobyDick.insert(db)
var genet = Author(id: nil, name: "Jean Genet")
try genet.insert(db)
var querelle = Book(id: nil, authorId: genet.id!, title: "Querelle de Brest")
try querelle.insert(db)
var lesBonnes = Book(id: nil, authorId: genet.id!, title: "Les Bonnes")
try lesBonnes.insert(db)
}
//: Fetch author information
print("----------")
print("Fetch author information")
struct AuthorInfo {
var author: Author
var books: [Book]
}
let authorId = 2
let authorInfo: AuthorInfo? = try dbQueue.read { db in
guard let author = try Author.fetchOne(db, key: authorId) else { return nil }
let books = try author.books.fetchAll(db)
return AuthorInfo(author: author, books: books)
}
if let authorInfo = authorInfo {
print("\(authorInfo.author.name) has written:")
for book in authorInfo.books {
print("- \(book.title)")
}
}
//: Fetch book information
print("----------")
print("Fetch book information")
struct BookInfo: FetchableRecord, Codable {
var book: Book
var author: Author
}
let bookId = 1
let bookInfo: BookInfo? = try dbQueue.read { db in
let request = Book
.filter(key: bookId)
.including(required: Book.author)
return try BookInfo.fetchOne(db, request)
}
if let bookInfo = bookInfo {
print("\(bookInfo.book.title) was written by \(bookInfo.author.name)")
}
//: Fetch all authorships
print("----------")
print("Fetch all authorships")
struct Authorship: Decodable, FetchableRecord {
var book: Book
var author: Author
}
let authorships: [Authorship] = try dbQueue.read { db in
let request = Book.including(required: Book.author)
return try Authorship.fetchAll(db, request)
}
for authorship in authorships {
print("\(authorship.book.title) was written by \(authorship.author.name)")
}
@@ -0,0 +1,467 @@
//: # Customized Decoding of Database Rows
//:
//: To run this playground:
//:
//: - Open GRDB.xcworkspace
//: - Select the GRDBOSX scheme: menu Product > Scheme > GRDBOSX
//: - Build: menu Product > Build
//: - Select the playground in the Playgrounds Group
//: - Run the playground
import GRDB
//: This playground demonstrates how one can implement **customized decoding of
//: database rows**.
//:
//: Customized row decoding allows you to go beyong the built-in support for
//: requests of raw rows, values, or types that adopt the
//: FetchableRecord protocol.
//:
//: For example:
//:
//: - Your application needs polymorphic row decoding: it decodes some class or
//: another, depending on the values contained in a database row.
//:
//: - Your application needs to decode rows with a context: each decoded value
//: should be initialized with some extra value that does not come from
//: the database.
//:
//: - Your application needs a record type that supports untrusted databases,
//: and may fail at decoding database rows (throw an error when a row contains
//: invalid values).
//:
//: None of those use cases can be handled by the built-in `FetchableRecord`
//: protocol and its `init(row:)` initializer. They need *customized
//: row decoding*.
//:
//: ## An Example: Polymorphic Decoding
//:
//: In this playground, we will provide some sample code that performs
//: polymorphic row decoding. Given a base class, `Base`, and two subclasses
//: `Foo` and `Bar`, we'd like to fetch Foo or Bar instances, depending on the
//: value found in the `type` column of the `base` database table.
//:
//: From this sample code, we hope that you will be able to derive your own
//: customized decoding.
//:
//: Everything starts from our class hierarchy:
class Base {
var description: String { return "Base" }
init() { }
}
class Foo: Base {
var name: String
override var description: String { return "Foo: \(name)" }
init(name: String) {
self.name = name
super.init()
}
}
class Bar: Base {
var score: Int
override var description: String { return "Bar: \(score)" }
init(score: Int) {
self.score = score
super.init()
}
}
//: We need a database, a table, and a few values so that we can do a real demo:
// An in-memory database is good enough
let dbQueue = DatabaseQueue()
try dbQueue.write { db in
// Database table
try db.create(table: "base") { t in
t.column("type", .text).notNull() // Contains "Foo" or "Bar"
t.column("fooName", .text) // Contains a Foo's name
t.column("barScore", .integer) // Contains a Bar's score
}
// Demo values: two Foo and one Bar
try db.execute(
sql: """
INSERT INTO base (type, fooName, barScore) VALUES (?, ?, ?);
INSERT INTO base (type, fooName, barScore) VALUES (?, ?, ?);
INSERT INTO base (type, fooName, barScore) VALUES (?, ?, ?);
""",
arguments: [
"Foo", "Arthur", nil,
"Bar", nil, 100,
"Foo", "Barbara", nil,
])
}
//: We also need a method that decodes database rows into `Foo` or `Bar`
//: instances: let's call it `Base.decode(row:)`:
extension Base {
static func decode(row: Row) -> Base {
switch row["type"] as String {
case "Foo":
return Foo(name: row["fooName"])
case "Bar":
return Bar(score: row["barScore"])
case let type:
fatalError("Unknown Base type: \(type)")
}
}
}
//: Now we are able to express the kind of request we'd like to write. For
//: example, we could fetch all Base values from the database:
//:
//: try dbQueue.read { db in
//: // An array [Base] that constains Foo and Bar instances
//: let bases = try Base.fetchAll(db)
//: }
//:
//: But so far, we have a compiler error:
// Compiler error: Type 'Base' has no member 'fetchAll'
//try dbQueue.read { db in
// let bases = try Base.fetchAll(db)
//}
//: We'll see that this goal can be achieved by declaring a protocol, writing a
//: few extensions that guarantee the most efficient use of GRDB, and have the
//: Base class adopt this protocol.
//:
//: ### Keep It Simple, Stupid!
//:
//: But first, let's see how polymorphic decoding can be done as simply as
//: possible. After all, it is useless to design a full-fledged protocol unless
//: we need to use this protocol several times, or write code that is as
//: streamlined as possible.
//:
//: Can we fetch Foo and Bar values from an SQL request? Sure:
try dbQueue.read { db in
print("> KISS: Fetch from SQL")
let rows = try Row.fetchAll(db, sql: "SELECT * FROM base") // Fetch database rows
let bases = rows.map { row in // Decode database rows
Base.decode(row: row)
}
for base in bases { // Use fetched values
print(base.description)
}
}
//: Can we have GRDB generate SQL for us? Sure, we just need to adopt the
//: `TableRecord` protocol:
extension Base: TableRecord {
static let databaseTableName = "base"
}
try dbQueue.read { db in
print("> KISS: Fetch from query interface request")
let request = Base.filter(Column("type") == "Foo") // Define a request
let rows = try Row.fetchAll(db, request) // Fetch database rows
let bases = rows.map { row in // Decode database rows
Base.decode(row: row)
}
for base in bases { // Use fetched values
print(base.description)
}
}
//: As seen above, we can perform polymorphic requests with the standard GRDB,
//: by fetching raw rows and mapping them through a decoding method.
//:
//: The resulting code is not as streamlined as usual GRDB code, but we could
//: already do what we needed without much effort.
//:
//: ### Custom Protocol: MyDatabaseDecoder
//:
//: In the rest of this playground, we will define a **new realm of requests**.
//:
//: GRDB ships with three built-in realms of requests: requests of raw rows,
//: requests of values, and requests of record types that adopt the
//: `FetchableRecord` protocol.
//:
//: We'll define requests of record types that adopt the custom
//: `MyDatabaseDecoder` protocol:
protocol MyDatabaseDecoder {
associatedtype DecodedType
static func decode(row: Row) -> DecodedType
}
//: Types that adopt the MyDatabaseDecoder protocol are able, among other
//: things, to perform polymorphic decoding. Our Base class, for example:
extension Base: MyDatabaseDecoder {
// Already declared above:
// static func decode(row: Row) -> Base { ... }
}
//: Now let's see how we can define a new realm of requests based on the
//: `MyDatabaseDecoder` protocol. Our goal is to make them just as powerful as
//: ready-made requests of rows, values and FetchableRecord.
//:
//: All we need is a set of *extensions* that define the classic GRDB fetching
//: methods: `fetchOne`, `fetchAll`, and `fetchCursor`. The most fundamental one
//: is `fetchCursor`, because from it we can derive the two others.
//:
//: The first extension is the most low-level one: fetching from SQLite
//: **prepared statement**:
//:
//: try dbQueue.read { db in
//: let statement = try db.makeSelectStatement(sql: "SELECT ...")
//: try Base.fetchCursor(statement) // Cursor of Base
//: try Base.fetchAll(statement) // [Base]
//: try Base.fetchOne(statement) // Base?
//: }
extension MyDatabaseDecoder {
// MARK: - Fetch from SelectStatement
// SelectStatement, StatementArguments, and RowAdapter are the fundamental
// fetching parameters of GRDB. Make sure to accept them all:
static func fetchCursor(_ statement: SelectStatement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws -> MapCursor<RowCursor, DecodedType> {
// Turn the cursor of raw rows into a cursor of decoded rows
return try Row.fetchCursor(statement, arguments: arguments, adapter: adapter).map {
self.decode(row: $0)
}
}
static func fetchAll(_ statement: SelectStatement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws -> [DecodedType] {
// Turn the cursor into an Array
return try Array(fetchCursor(statement, arguments: arguments, adapter: adapter))
}
static func fetchOne(_ statement: SelectStatement, arguments: StatementArguments? = nil, adapter: RowAdapter? = nil) throws -> DecodedType? {
// Consume the first value of the cursor
return try fetchCursor(statement, arguments: arguments, adapter: adapter).next()
}
}
try dbQueue.read { db in
print("> Fetch from prepared statement")
let statement = try db.makeSelectStatement(sql: "SELECT * FROM base")
let bases = try Base.fetchAll(statement)
for base in bases {
print(base.description)
}
}
//: Now that we can fetch from prepared statements, we can fetch when given a
//: **request**, as defined by the `FetchRequest` protocol. This is the
//: protocol for query interface requests such as `Base.all()`, or
//: `SQLRequest`, etc.
//:
//: try dbQueue.read { db in
//: let request = Base.all()
//: try Base.fetchCursor(db, request) // Cursor of Base
//: try Base.fetchAll(db, request) // [Base]
//: try Base.fetchOne(db, request) // Base?
//: }
extension MyDatabaseDecoder {
// MARK: - Fetch from FetchRequest
static func fetchCursor<R: FetchRequest>(_ db: Database, _ request: R) throws -> MapCursor<RowCursor, DecodedType> {
let (statement, adapter) = try request.prepare(db)
return try fetchCursor(statement, adapter: adapter)
}
static func fetchAll<R: FetchRequest>(_ db: Database, _ request: R) throws -> [DecodedType] {
let (statement, adapter) = try request.prepare(db)
return try fetchAll(statement, adapter: adapter)
}
static func fetchOne<R: FetchRequest>(_ db: Database, _ request: R) throws -> DecodedType? {
let (statement, adapter) = try request.prepare(db)
return try fetchOne(statement, adapter: adapter)
}
}
try dbQueue.read { db in
print("> Fetch given a request")
let request = Base.all()
let bases = try Base.fetchAll(db, request)
for base in bases {
print(base.description)
}
}
//: When it's fine to fetch given a request, it's even better when requests can
//: fetch, too:
//:
//: try dbQueue.read { db in
//: let request = Base.all()
//: try request.fetchCursor(db) // Cursor of Base
//: try request.fetchAll(db) // [Base]
//: try request.fetchOne(db) // Base?
//: }
extension FetchRequest where RowDecoder: MyDatabaseDecoder {
// MARK: - FetchRequest fetching methods
func fetchCursor(_ db: Database) throws -> MapCursor<RowCursor, RowDecoder.DecodedType> {
return try RowDecoder.fetchCursor(db, self)
}
func fetchAll(_ db: Database) throws -> [RowDecoder.DecodedType] {
return try RowDecoder.fetchAll(db, self)
}
func fetchOne(_ db: Database) throws -> RowDecoder.DecodedType? {
return try RowDecoder.fetchOne(db, self)
}
}
try dbQueue.read { db in
print("> Fetch from request")
let request = Base.all()
let bases = try request.fetchAll(db)
for base in bases {
print(base.description)
}
}
//: Types that adopt both FetchableRecord and TableRecord are able to fetch
//: right from the base type. Let's allow this as well for MyDatabaseDecoder:
//:
//: try dbQueue.read { db in
//: try Base.fetchCursor(db) // Cursor of Base
//: try Base.fetchAll(db) // [Base]
//: try Base.fetchOne(db) // Base?
//: }
extension MyDatabaseDecoder where Self: TableRecord {
// MARK: - Static fetching methods
static func fetchCursor(_ db: Database) throws -> MapCursor<RowCursor, DecodedType> {
return try all().fetchCursor(db)
}
static func fetchAll(_ db: Database) throws -> [DecodedType] {
return try all().fetchAll(db)
}
static func fetchOne(_ db: Database) throws -> DecodedType? {
return try all().fetchOne(db)
}
}
try dbQueue.read { db in
print("> Fetch from base type")
let bases = try Base.fetchAll(db)
for base in bases {
print(base.description)
}
}
//: Finally, you can support raw SQL as well:
//:
//: try dbQueue.read { db in
//: try Base.fetchAll(db,
//: sql: "SELECT ... WHERE name = ?",
//: arguments: ["O'Brien"]) // [Base]
//: }
extension MyDatabaseDecoder {
// MARK: - Fetch from SQL
static func fetchCursor(_ db: Database, sql: String, arguments: StatementArguments = StatementArguments(), adapter: RowAdapter? = nil) throws -> MapCursor<RowCursor, DecodedType> {
return try fetchCursor(db, SQLRequest<Void>(sql: sql, arguments: arguments, adapter: adapter))
}
static func fetchAll(_ db: Database, sql: String, arguments: StatementArguments = StatementArguments(), adapter: RowAdapter? = nil) throws -> [DecodedType] {
return try fetchAll(db, SQLRequest<Void>(sql: sql, arguments: arguments, adapter: adapter))
}
static func fetchOne(_ db: Database, sql: String, arguments: StatementArguments = StatementArguments(), adapter: RowAdapter? = nil) throws -> DecodedType? {
return try fetchOne(db, SQLRequest<Void>(sql: sql, arguments: arguments, adapter: adapter))
}
}
try dbQueue.read { db in
print("> Fetch from SQL")
let bases = try Base.fetchAll(db, sql: "SELECT * FROM base")
for base in bases {
print(base.description)
}
}
//: Voilà! Our `MyDatabaseDecoder` protocol is now as able as the built-in
//: `FetchableRecord` protocol.
//:
//: To sum up, you have learned:
//:
//: - how to keep things simple: as long as you can fetch rows, you can decode
//: them the way you want.
//: - how to define a whole new realm of requests based on a custom protocol.
//: This involves writing a few extensions that give your protocol the same
//: fluent interface that is ready-made for the built-in FetchableRecord
//: protocol. This is more work, but you are granted with the full
//: customization freedom.
//:
//: To end this tour, let's quickly look at two other possible customized
//: row decoding strategies.
//:
//: ## An Example: Contextualized Records
//:
//: Your application needs to decode rows with a context: each decoded value
//: should be initialized with some extra value that does not come from
//: the database.
//:
//: In this case, you may define a `ContextFetchableRecord` protocol, and
//: derive all other fetching methods from the most fundamental one, which
//: fetches a cursor from a prepared statement (as we did for the
//: MyDatabaseDecoder protocol, above):
protocol ContextFetchableRecord {
associatedtype Context
init(row: Row, context: Context)
}
extension ContextFetchableRecord {
static func fetchCursor(
_ statement: SelectStatement,
arguments: StatementArguments? = nil,
adapter: RowAdapter? = nil,
context: Context)
throws -> MapCursor<RowCursor, Self>
{
// Turn the cursor of raw rows into a cursor of decoded rows
return try Row.fetchCursor(statement, arguments: arguments, adapter: adapter).map {
self.init(row: $0, context: context)
}
}
// Define fetchAll, fetchOne, and other extensions...
}
//: ## An Example: Failable Records
//:
//: Your application needs a record type that supports untrusted databases,
//: and may fail at decoding database rows (throw an error when a row contains
//: invalid values).
//:
//: In this case, you may define a `FailableFetchableRecord` protocol, and
//: derive all other fetching methods from the most fundamental one, which
//: fetches a cursor from a prepared statement (as we did for the
//: MyDatabaseDecoder protocol, above):
protocol FailableFetchableRecord {
init(row: Row) throws
}
extension FailableFetchableRecord {
static func fetchCursor(
_ statement: SelectStatement,
arguments: StatementArguments? = nil,
adapter: RowAdapter? = nil)
throws -> MapCursor<RowCursor, Self>
{
// Turn the cursor of raw rows into a cursor of decoded rows
return try Row.fetchCursor(statement, arguments: arguments, adapter: adapter).map {
try self.init(row: $0)
}
}
// Define fetchAll, fetchOne, and other extensions...
}
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='macos' display-mode='rendered'>
<timeline fileName='timeline.xctimeline'/>
</playground>
@@ -0,0 +1,101 @@
// Issue156
//
// This playground exists as a test of issue #156, for which I'm not sure we
// have a test today.
import Foundation
import GRDB
import PlaygroundSupport
class TestDeleteAll: NSObject {
let databasePool: DatabasePool
let fetchedRecordsController: FetchedRecordsController<MyRecord>
override init() {
// Init a databasePool & a fetchedRecordsController
let databasePath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] + "/myDatabase.sqlite"
databasePool = try! DatabasePool(path: databasePath)
var migrator = DatabaseMigrator()
migrator.registerMigration("1") { db in
try! db.create(table: MyRecord.databaseTableName) { t in
t.column(MyRecord.MyColumn.name, .text)
}
}
try! migrator.migrate(databasePool)
fetchedRecordsController = try! FetchedRecordsController<MyRecord>(databasePool, request: MyRecord.all())
try! fetchedRecordsController.performFetch()
fetchedRecordsController.trackChanges { controller in
print("RecordsDidChange triggered: number of records = \(controller.fetchedRecords.count)\n")
}
super.init()
run()
}
func run() {
insertThreeRecords()
perform(#selector(deleteAllWithFilter), with: nil, afterDelay: 1)
perform(#selector(insertThreeRecords), with: nil, afterDelay: 2)
perform(#selector(deleteAll), with: nil, afterDelay: 3)
perform(#selector(insertThreeRecords), with: nil, afterDelay: 4)
}
@objc
func insertThreeRecords() {
print("Insert 3 records")
let myRecord1 = MyRecord(myColumn: "1")
let myRecord2 = MyRecord(myColumn: "2")
let myRecord3 = MyRecord(myColumn: "3")
try! databasePool.writeInTransaction { db in
try myRecord1.save(db)
try myRecord2.save(db)
try myRecord3.save(db)
return .commit
}
}
@objc
func deleteAllWithFilter() {
print("Delete all records with filter(1 == 1).deleteAll(db)")
_ = try! databasePool.write { db in
try MyRecord.filter(1 == 1).deleteAll(db)
}
}
@objc
func deleteAll() {
print("Delete all records with deleteAll(db)")
_ = try! databasePool.write { db in
try MyRecord.deleteAll(db)
}
}
}
struct MyRecord: FetchableRecord, TableRecord, PersistableRecord {
static let MyColumn = Column("MyColumn")
static var databaseTableName: String { return String(describing: self) }
let myColumn: String
init(myColumn: String) {
self.myColumn = myColumn
}
init(row: Row) {
self.myColumn = row[MyRecord.MyColumn]
}
func encode(to container: inout PersistenceContainer) {
container[MyRecord.MyColumn] = myColumn
}
}
TestDeleteAll()
PlaygroundPage.current.needsIndefiniteExecution = true
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='osx'>
<playground version='5.0' target-platform='macos'>
<timeline fileName='timeline.xctimeline'/>
</playground>
@@ -0,0 +1,142 @@
//: To run this playground:
//:
//: - Open GRDB.xcworkspace
//: - Select the GRDBOSX scheme: menu Product > Scheme > GRDBOSX
//: - Build: menu Product > Build
//: - Select the playground in the Playgrounds Group
//: - Run the playground
//:
//: This sample code shows how to use GRDB to synchronize a database table
//: with a JSON payload. We use as few SQL queries as possible:
//:
//: - Only one SELECT query.
//: - One query per insert, delete, and update.
//: - Useless UPDATE statements are avoided.
import Foundation
import GRDB
// Open an in-memory database that logs all its SQL statements
var configuration = Configuration()
configuration.trace = { print($0) }
let dbQueue = DatabaseQueue(configuration: configuration)
// Create the database table to store the players
try dbQueue.inDatabase { db in
try db.create(table: "player") { t in
t.column("id", .integer).primaryKey()
t.column("name", .text)
t.column("score", .integer)
}
}
// Define the Player `Codable` that is a `FetchableRecord` and `MutablePersistableRecord`.
struct Player: Codable, FetchableRecord, MutablePersistableRecord {
var id: Int64
var name: String
var score: Int
// Define database columns from CodingKeys
private enum Columns {
static let id = Column(CodingKeys.id)
static let name = Column(CodingKeys.name)
static let score = Column(CodingKeys.score)
}
// Update a player id after it has been inserted in the database.
mutating func didInsert(with rowID: Int64, for column: String?) {
id = rowID
}
}
extension Player {
static func orderedById() -> QueryInterfaceRequest<Player> {
return order(Columns.id)
}
}
// This is just the container of our incoming JSON
struct PlayersToSync: Codable {
let players: [Player]
}
// Synchronizes the players table with a JSON payload
func synchronizePlayers(with jsonString: String, in db: Database) throws {
let jsonData = jsonString.data(using: .utf8)!
let dataToSync = try JSONDecoder().decode(PlayersToSync.self, from: jsonData)
// Sort new players to sync by id:
let playersToSync = dataToSync.players.sorted { $0.id < $1.id }
// Sort database players by id:
let players = try Player.orderedById().fetchAll(db)
// Now that both lists are sorted by id, we can compare them with
// the sortedMerge() function (see https://gist.github.com/groue/7e8510849ded36f7d770).
//
// We'll delete, insert or update players, depending on their presence
// in either lists.
for mergeStep in sortedMerge(
left: players, // Database players
right: playersToSync, // PlayersToSync players (Decoded)
leftKey: { $0.id }, // The id of a database player
rightKey: { $0.id }) // The id of a PlayersToSync player
{
switch mergeStep {
case .left(let player):
// Delete database player without matching JSON player:
try player.delete(db)
case .right(var playerToSync):
// Insert the Codable player without matching database player:
try playerToSync.insert(db)
case .common(let player, let playerToSync):
// Update database player with its JSON counterpart:
try playerToSync.updateChanges(db, from: player)
}
}
}
do {
let jsonString1 = """
{
"players": [
{ "id": 1, "name": "Arthur", "score": 1000},
{ "id": 2, "name": "Barbara", "score": 2000},
{ "id": 3, "name": "Craig", "score": 500},
]
}
"""
print("---\nImport \(jsonString1)")
try dbQueue.inDatabase { db in
// SELECT * FROM player ORDER BY id
// INSERT INTO "player" ("id", "name", "score") VALUES (1,'Arthur',1000)
// INSERT INTO "player" ("id", "name", "score") VALUES (2,'Barbara',2000)
// INSERT INTO "player" ("id", "name", "score") VALUES (3,'Craig',500)
try synchronizePlayers(with: jsonString1, in: db)
}
}
do {
let jsonString2 = """
{
"players": [
{ "id": 2, "name": "Barbara", "score": 3000},
{ "id": 3, "name": "Craig", "score": 500},
{ "id": 4, "name": "Daniel", "score": 1500},
]
}
"""
print("---\nImport \(jsonString2)")
try dbQueue.inDatabase { db in
// SELECT * FROM player ORDER BY id
// DELETE FROM "player" WHERE "id"=1
// UPDATE "player" SET "score"=3000 WHERE "id"=2
// INSERT INTO "player" ("id", "name", "score") VALUES (4,'Daniel',1500)
try synchronizePlayers(with: jsonString2, in: db)
}
}
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='osx' display-mode='raw' last-migration='0800'>
<timeline fileName='timeline.xctimeline'/>
</playground>
@@ -13,9 +13,9 @@ try! dbQueue.inDatabase { db in
t.column("name", .text)
}
try db.execute("INSERT INTO persons (name) VALUES (?)", arguments: ["Arthur"])
try db.execute("INSERT INTO persons (name) VALUES (?)", arguments: ["Barbara"])
try db.execute(sql: "INSERT INTO persons (name) VALUES (?)", arguments: ["Arthur"])
try db.execute(sql: "INSERT INTO persons (name) VALUES (?)", arguments: ["Barbara"])
let names = try String.fetchAll(db, "SELECT name FROM persons")
let names = try String.fetchAll(db, sql: "SELECT name FROM persons")
print(names)
}
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='osx' last-migration='0800'>
<playground version='5.0' target-platform='macos'>
<timeline fileName='timeline.xctimeline'/>
</playground>
@@ -1,9 +1,15 @@
//: To run this playground, select and build the GRDBOSX scheme.
//: To run this playground:
//:
//: - Open GRDB.xcworkspace
//: - Select the GRDBOSX scheme: menu Product > Scheme > GRDBOSX
//: - Build: menu Product > Build
//: - Select the playground in the Playgrounds Group
//: - Run the playground
//:
//: Tour
//: ======
//:
//: This playground is a tour of GRDB.
//: This playground is a quick tour of GRDB.
import GRDB
import CoreLocation
@@ -20,52 +26,53 @@ let dbQueue = DatabaseQueue(configuration: configuration)
//: Execute SQL queries
try dbQueue.inDatabase { db in
try db.execute(
"CREATE TABLE pointOfInterests (" +
"id INTEGER PRIMARY KEY, " +
"title TEXT, " +
"favorite BOOLEAN NOT NULL, " +
"latitude DOUBLE NOT NULL, " +
"longitude DOUBLE NOT NULL" +
")")
try db.execute(sql: """
CREATE TABLE place (
id INTEGER PRIMARY KEY,
title TEXT,
favorite BOOLEAN NOT NULL,
latitude DOUBLE NOT NULL,
longitude DOUBLE NOT NULL
)
""")
try db.execute(
"INSERT INTO pointOfInterests (title, favorite, latitude, longitude) " +
"VALUES (?, ?, ?, ?)",
arguments: ["Paris", true, 48.85341, 2.3488])
try db.execute(sql: """
INSERT INTO place (title, favorite, latitude, longitude)
VALUES (?, ?, ?, ?)
""", arguments: ["Paris", true, 48.85341, 2.3488])
let parisId = db.lastInsertedRowID
}
//: Fetch database rows and values
try dbQueue.inDatabase { db in
let rows = try Row.fetchCursor(db, "SELECT * FROM pointOfInterests")
try! dbQueue.inDatabase { db in
let rows = try Row.fetchCursor(db, sql: "SELECT * FROM place")
while let row = try rows.next() {
let title: String = row["title"]
let favorite: Bool = row["favorite"]
let coordinate = CLLocationCoordinate2DMake(
row["latitude"],
row["longitude"])
let coordinate = CLLocationCoordinate2D(
latitude: row["latitude"],
longitude: row["longitude"])
print("Fetched", title, favorite, coordinate)
}
let poiCount = try Int.fetchOne(db, "SELECT COUNT(*) FROM pointOfInterests")! // Int
let poiTitles = try String.fetchAll(db, "SELECT title FROM pointOfInterests") // [String]
let placeCount = try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM place")! // Int
let placeTitles = try String.fetchAll(db, sql: "SELECT title FROM place") // [String]
}
//: Insert and fetch records
struct PointOfInterest {
struct Place {
var id: Int64?
var title: String?
var favorite: Bool
var coordinate: CLLocationCoordinate2D
}
// Adopt RowConvertible
extension PointOfInterest : RowConvertible {
// Adopt FetchableRecord
extension Place : FetchableRecord {
init(row: Row) {
id = row["id"]
title = row["title"]
@@ -76,13 +83,13 @@ extension PointOfInterest : RowConvertible {
}
}
// Adopt TableMapping
extension PointOfInterest : TableMapping {
static let databaseTableName = "pointOfInterests"
// Adopt TableRecord
extension Place : TableRecord {
static let databaseTableName = "place"
}
// Adopt MutablePersistable
extension PointOfInterest : MutablePersistable {
// Adopt MutablePersistableRecord
extension Place : MutablePersistableRecord {
func encode(to container: inout PersistenceContainer) {
container["id"] = id
container["title"] = title
@@ -97,7 +104,7 @@ extension PointOfInterest : MutablePersistable {
}
try dbQueue.inDatabase { db in
var berlin = PointOfInterest(
var berlin = Place(
id: nil,
title: "Berlin",
favorite: false,
@@ -110,7 +117,7 @@ try dbQueue.inDatabase { db in
try berlin.update(db)
// Fetch from SQL
let pois = try PointOfInterest.fetchAll(db, "SELECT * FROM pointOfInterests") // [PointOfInterest]
let places = try Place.fetchAll(db, sql: "SELECT * FROM place") // [Place]
//: Avoid SQL with the query interface:
@@ -118,10 +125,10 @@ try dbQueue.inDatabase { db in
let title = Column("title")
let favorite = Column("favorite")
berlin = try PointOfInterest.filter(title == "Berlin").fetchOne(db)! // PointOfInterest
let paris = try PointOfInterest.fetchOne(db, key: 1) // PointOfInterest?
let favoritePois = try PointOfInterest // [PointOfInterest]
.filter(favorite)
berlin = try Place.filter(title == "Berlin").fetchOne(db)! // Place
let paris = try Place.fetchOne(db, key: 1) // Place?
let favoritePlaces = try Place // [Place]
.filter(favorite == true)
.order(title)
.fetchAll(db)
}
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='osx' display-mode='rendered'>
<playground version='5.0' target-platform='osx' display-mode='raw'>
<timeline fileName='timeline.xctimeline'/>
</playground>
@@ -0,0 +1,86 @@
//: To run this playground:
//:
//: - Open GRDB.xcworkspace
//: - Select the GRDBOSX scheme: menu Product > Scheme > GRDBOSX
//: - Build: menu Product > Build
//: - Select the playground in the Playgrounds Group
//: - Run the playground
import GRDB
// Create the databsae
let dbQueue = DatabaseQueue() // Memory database
var migrator = DatabaseMigrator()
migrator.registerMigration("createPerson") { db in
try db.create(table: "person") { t in
t.autoIncrementedPrimaryKey("id")
t.column("name", .text).notNull()
}
}
migrator.registerMigration("createPet") { db in
try db.create(table: "pet") { t in
t.autoIncrementedPrimaryKey("id")
t.column("name", .text).notNull()
t.column("ownerId", .integer).references("person", onDelete: .cascade)
}
}
try! migrator.migrate(dbQueue)
//
class TableChangeObserver : NSObject, TransactionObserver {
private var changedTableNames: Set<String> = []
func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
return true
}
func databaseDidChange(with event: DatabaseEvent) {
changedTableNames.insert(event.tableName)
}
func databaseDidCommit(_ db: Database) {
print("Changed table(s): \(changedTableNames.joined(separator: ", "))")
changedTableNames = []
}
func databaseDidRollback(_ db: Database) {
changedTableNames = []
}
}
let observer = TableChangeObserver()
dbQueue.add(transactionObserver: observer)
//
print("-- Changes without transaction")
try dbQueue.inDatabase { db in
try db.execute(sql: "INSERT INTO person (name) VALUES (?)", arguments: ["Arthur"])
let arthurId = db.lastInsertedRowID
try db.execute(sql: "INSERT INTO person (name) VALUES (?)", arguments: ["Barbara"])
try db.execute(sql: "INSERT INTO pet (ownerId, name) VALUES (?, ?)", arguments: [arthurId, "Barbara"])
try db.execute(sql: "DELETE FROM person WHERE id = ?", arguments: [arthurId])
}
print("-- Rollbacked changes")
try dbQueue.inTransaction { db in
try db.execute(sql: "INSERT INTO person (name) VALUES ('Arthur')")
try db.execute(sql: "INSERT INTO person (name) VALUES ('Barbara')")
return .rollback
}
print("-- Changes wrapped in a transaction")
try dbQueue.write { db in
try db.execute(sql: "DELETE FROM person")
try db.execute(sql: "INSERT INTO person (name) VALUES (?)", arguments: ["Arthur"])
let arthurId = db.lastInsertedRowID
try db.execute(sql: "INSERT INTO person (name) VALUES (?)", arguments: ["Barbara"])
try db.execute(sql: "INSERT INTO pet (ownerId, name) VALUES (?, ?)", arguments: [arthurId, "Barbara"])
try db.execute(sql: "DELETE FROM person WHERE id = ?", arguments: [arthurId])
}
+1 -1
View File
@@ -1 +1 @@
The main documentation is available in [README.md](../../../#documentation).
The main documentation is available in [README.md](../README.md#documentation).
+3 -6
View File
@@ -15,18 +15,15 @@ To release a new GRDB version:
- Update GRDB version number and release date in:
- Makefile
- CHANGELOG.md
- Documentation/CustomSQLiteBuilds.md
- Documentation/ExtendingGRDB.md
- GRDB.swift.podspec
- GRDBCipher.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
- Push to the Swift3 branch
- `pod trunk push --allow-warnings GRDB.swift.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
- Update http://github.com/groue/WWDCCompanion
- Update [performance comparison](https://github.com/groue/GRDB.swift/wiki/Performance):
`make test_performance | Tests/parsePerformanceTests.rb | Tests/generatePerformanceReport.rb`
+418
View File
@@ -0,0 +1,418 @@
SQL Interpolation
=================
Your SQL skills are [welcomed] throughout GRDB. Yet writing raw SQL presents commonplace challenges. For example, you want to make sure your queries don't break whenever the database schema changes as you ship new versions of your application. When you inject user values in the database, you have to use statement arguments, and it is easy to make a mistake in the process.
The query below exemplifies this situation. It even contains a bug that is not quite easy to spot:
```swift
try db.execute(
sql: """
UPDATE student
SET firstName = ?, lastName = ?, department = ?, birthDate = ?,
registrationDate = ?, mainTeacherId = ?
WHERE id = ?
""",
arguments: [firstName, lastName, department, birthDate,
registrationDate, mainTeacherId])
```
SQL Interpolation is an answer to these troubles. It is available in Swift 5.
- [Introduction]
- [SQLLiteral]
- [SQL Interpolation and Record Protocols]
- [SQL Interpolation Reference]
## Introduction
**SQL Interpolation** lets you embed values in your SQL queries by wrapping them inside `\(` and `)`:
```swift
let name: String = ...
let id: Int64 = ...
try db.execute(literal: "UPDATE player SET name = \(name) WHERE id = \(id)")
```
SQL interpolation looks and feel just like regular [String interpolation]:
```swift
let name = "World"
print("Hello \(name)!") // prints "Hello World!"
```
The difference is that it generates valid SQL which does not suffer from syntax errors or [SQL injection]. For example, you do not need to validate input or process single quotes:
```swift
// Executes `UPDATE player SET name = 'O''Brien' WHERE id = 42`
let name = "O'Brien"
let id = 42
try db.execute(literal: "UPDATE player SET name = \(name) WHERE id = \(id)")
```
Under the hood, SQL interpolation generates a plain SQL string. It runs exactly as below:
```swift
try db.execute(sql: "UPDATE player SET name = ? WHERE id = ?", arguments: [name, id])
```
Plain SQL strings are indeed still available, and SQL interpolation only kicks in when you ask for it. There is a simple rule to remember:
- For plain SQL strings, use the `sql` argument label:
```swift
try db.execute(sql: "UPDATE player SET name = ? WHERE id = ?", arguments: [name, id])
```
- For SQL interpolation, use the `literal` argument label:
```swift
try db.execute(literal: "UPDATE player SET name = \(name) WHERE id = \(id)")
```
## SQLLiteral
**SQLLiteral** is the type that looks like a plain String, but profits from SQL interpolation:
```swift
let query: SQLLiteral = "UPDATE player SET name = \(name) WHERE id = \(id)"
try db.execute(literal: query)
```
**SQLLiteral is not a Swift String.** You can not use the `execute(literal:)` method with a String argument:
```swift
// Compiler error:
// Cannot convert value of type 'String' to expected argument type 'SQLLiteral'
let query = "UPDATE player SET name = \(name) WHERE id = \(id)" // a String
try db.execute(literal: query)
```
SQLLiteral can build your queries step by step, with regular operators and methods:
```swift
// +, +=, append
var query: SQLLiteral = "UPDATE player "
query += "SET name = \(name) "
query.append(literal: "WHERE id = \(id)")
// joined(), joined(separator:)
let components: [SQLLiteral] = [
"UPDATE player",
"SET name = \(name)",
"WHERE id = \(id)"
]
let query = components.joined(separator: " ")
```
Extract the plain SQL string from a literal:
```swift
let query: SQLLiteral = "UPDATE player SET name = \(name) WHERE id = \(id)"
print(query.sql) // prints "UPDATE player SET name = ? WHERE id = ?"
print(query.arguments) // prints ["O'Brien", 42]
```
Build a literal from a plain SQL string:
```swift
let query = SQLLiteral(
sql: "UPDATE player SET name = ? WHERE id = ?",
arguments: [name, id])
```
SQLLiteral can embed any [value], as we have seen above, but not only. Please keep on reading the next chapter, or jump directly to the [SQL Interpolation Reference].
## SQL Interpolation and Record Protocols
The [record protocols] extend your application types with database abilities.
**A record type knows everything about the schema of its underlying database table**. With the [TableRecord] protocol, the `databaseTableName` property contains the table name. With the [Decodable] protocol, the [CodingKeys] enum contain the column names. And with [FetchableRecord], you can decode raw database rows.
SQL Interpolation puts this knowledge to good use, so that you can build robust queries that consistently use correct table and column names:
```swift
struct Player {
var id: Int64
var name: String
var score: Int?
}
extension Player: Decodable, FetchableRecord, TableRecord {
/// Deletes all player with no score
static func deleteAllWithoutScore(_ db: Database) throws {
try db.execute(literal: "DELETE FROM \(self) WHERE \(CodingKeys.score) IS NULL")
}
/// The player with a given id
static func filter(id: Int64) -> SQLRequest<Player> {
return "SELECT * FROM \(self) WHERE \(CodingKeys.id) = \(id)"
}
/// All players with the given ids
static func filter(ids: [Int64]) -> SQLRequest<Player> {
return "SELECT * FROM \(self) WHERE \(CodingKeys.id) IN \(ids)"
}
/// The maximum score
static func maximumScore() -> SQLRequest<Int> {
return "SELECT MAX(\(CodingKeys.score)) FROM \(self)"
}
/// All players whose score is the maximum score
static func leaders() -> SQLRequest<Player> {
return """
SELECT * FROM \(self)
WHERE \(CodingKeys.score) = \(maximumScore())
"""
}
/// A complex request
static func complexRequest() -> SQLRequest<Player> {
let query: SQLLiteral = "SELECT * FROM \(self) "
query += "JOIN \(Team.self) ON ..."
query += "GROUP BY ..."
return SQLRequest(literal: query)
}
}
```
Let's breakdown each one of those methods.
- `deleteAllWithoutScore(_:)`
```swift
extension Player: Decodable, FetchableRecord, TableRecord {
/// Deletes all player with no score
static func deleteAllWithoutScore(_ db: Database) throws {
try db.execute(literal: "DELETE FROM \(self) WHERE \(CodingKeys.score) IS NULL")
}
}
```
Usage:
```swift
try dbQueue.write { db in
// DELETE FROM player WHERE score IS NULL
try Player.deleteAllWithoutScore(db)
}
```
`DELETE FROM \(self) ...` embeds the Player type itself. Since Player adopts the [TableRecord] protocol, this embeds `Player.databaseTableName` in the SQL query.
`... \(CodingKeys.score) IS NULL` embeds CodingKeys.score. This one has been synthesized by the Swift compiler because Player adopts the Decodable protocol. It embeds the column name in the SQL query.
- `filter(id:)`
```swift
extension Player: Decodable, FetchableRecord, TableRecord {
/// The player with a given id
static func filter(id: Int64) -> SQLRequest<Player> {
return "SELECT * FROM \(self) WHERE \(CodingKeys.id) = \(id)"
}
}
```
Usage:
```swift
let player = try dbQueue.read { db in
// SELECT * player WHERE id = 42
try Player.filter(id: 42).fetchOne(db) // Player?
}
```
The return type of this method is `SQLRequest<Player>`. It is one of the GRDB [request types]. And it profits from SQL interpolation: this is why this method can simply return an "SQL literal"".
It embeds `\(self)` (the Player type which adopts the TableRecord protocol) and `\(CodingKeys.id)` (the coding key synthesized by the Decodable protocol), and `\(id)` (a [value]).
- `filter(ids:)`
```swift
extension Player: Decodable, FetchableRecord, TableRecord {
/// All players with the given ids
static func filter(ids: [Int64]) -> SQLRequest<Player> {
return "SELECT * FROM \(self) WHERE \(CodingKeys.id) IN \(ids)"
}
}
```
Usage:
```swift
let players = try dbQueue.read { db in
// SELECT * player WHERE id IN (1, 2, 3)
try Player.filter(ids: [1, 2, 3]).fetchAll(db) // [Player]
}
```
It embeds `\(ids)`, an array of ids. All [value] sequences are supported (arrays, sets, etc.) Empty sequences are supported as well, with both `IN` and `NOT IN` SQL operators.
- `maximumScore()`
```swift
extension Player: Decodable, FetchableRecord, TableRecord {
/// The maximum score
static func maximumScore() -> SQLRequest<Int> {
return "SELECT MAX(\(CodingKeys.score)) FROM \(self)"
}
}
```
Usage:
```swift
let maximumScore = try dbQueue.read { db in
// SELECT MAX(score) FROM player
try Player.maximumScore().fetchOne(db) // Int?
}
```
The result is `SQLRequest<Int>`, unlike previous requests of type `SQLRequest<Player>`. SQLRequest accepts any fetchable type (database [row], simple [value], or custom [record]).
- `leaders()`
```swift
extension Player: Decodable, FetchableRecord, TableRecord {
/// All players whose score is the maximum score
static func leaders() -> SQLRequest<Player> {
return """
SELECT * FROM \(self)
WHERE \(CodingKeys.score) = \(maximumScore())
"""
}
}
```
Usage:
```swift
let leaders = try dbQueue.read { db in
// SELECT * FROM player
// WHERE score = (SELECT MAX(score) FROM player)
try Player.leaders().fetchAll(db) // [Player]
}
```
This request embeds `\(maximumScore())`, the `SQLRequest<Int>` returned by the `maximumScore` method. After values, coding keys, and types that adopt the TableRecord protocol, this ends our quick tour of things you can embed between `\(` and `)`. Check out the [SQL Interpolation Reference] for the full list of supported interpolations.
- `complexRequest()`
```swift
extension Player: Decodable, FetchableRecord, TableRecord {
/// A complex request
static func complexRequest() -> SQLRequest<Player> {
let query: SQLLiteral = "SELECT * FROM \(self) "
query += "JOIN \(Team.self) ON ..."
query += "GROUP BY ..."
return SQLRequest(literal: query)
}
}
```
This last request shows how to build an SQLRequest from an [SQLLiteral]. You will need SQLLiteral when the request can not be expressed in a single "SQL literal".
## SQL Interpolation Reference
This chapter lists all kinds of supported interpolations.
- Types adopting the [TableRecord] protocol:
```swift
// SELECT * FROM player
extension Player: TableRecord { }
"SELECT * FROM \(Player.self)"
// INSERT INTO player ...
let player: Player = ...
"INSERT INTO \(tableOf: player) ..."
```
- [Expressions] and [values]:
```swift
// SELECT name FROM player
"SELECT \(Column("name")) FROM player"
// SELECT (score + 100) AS points FROM player
let bonus = 100
"SELECT \(Column("score") + bonus) AS points FROM player"
// SELECT (score + 100) AS points FROM player
"SELECT (score + \(bonus)) AS points FROM player"
```
- Coding keys:
```swift
// SELECT name FROM player
"SELECT \(CodingKeys.name) FROM player"
```
- Sequences:
```swift
// SELECT * FROM player WHERE id IN (1, 2, 3)
let ids = [1, 2, 3]
"SELECT * FROM player WHERE id IN \(ids)"
```
- Orderings:
```swift
// SELECT * FROM player ORDER BY name DESC
"SELECT * FROM player WHERE id IN \(Column("name").desc)"
```
- SQLRequest:
```swift
// SELECT * FROM player WHERE score = (SELECT MAX(score) FROM player)
let subQuery: SQLRequest<Int> = "SELECT MAX(score) FROM player"
"SELECT * FROM player WHERE score = \(subQuery)"
```
- SQLLiteral:
```swift
// SELECT * FROM player WHERE name = 'O''Brien'
let condition: SQLLiteral = "name = \("O'Brien")"
"SELECT * FROM player WHERE \(literal: condition)"
```
- Plain SQL strings and eventual arguments:
```swift
// SELECT * FROM player
"SELECT * FROM \(sql: "player")"
// SELECT * FROM player WHERE name = 'O''Brien'
"SELECT * FROM player WHERE \(sql: "name = ?", arguments: ["O'Brien"])"
```
[Introduction]: #introduction
[SQLLiteral]: #sqlliteral
[SQL Interpolation and Record Protocols]: #sql-interpolation-and-record-protocols
[SQL Interpolation Reference]: #sql-interpolation-reference
[String interpolation]: https://docs.swift.org/swift-book/LanguageGuide/StringsAndCharacters.html#ID292
[SQL injection]: ../README.md#avoiding-sql-injection
[record protocols]: ../README.md#record-protocols-overview
[FetchableRecord]: ../README.md#fetchablerecord-protocol
[TableRecord]: ../README.md#tablerecord-protocol
[Decodable]: ../README.md#codable-records
[CodingKeys]: https://developer.apple.com/documentation/foundation/archives_and_serialization/encoding_and_decoding_custom_types
[value]: ../README.md#values
[values]: ../README.md#values
[request types]: ../README.md#custom-requests
[row]: ../README.md#row-queries
[record]: ../README.md#records
[Expressions]: ../README.md#expressions
[welcomed]: ../README.md#sqlite-api
[SE-0228 Fix ExpressibleByStringInterpolation]: https://github.com/apple/swift-evolution/blob/master/proposals/0228-fix-expressiblebystringinterpolation.md
+314
View File
@@ -0,0 +1,314 @@
Why Adopt GRDB?
===============
This document aims at exposing why GRDB could become your favorite database library.
We'll start with a few [core principles](#core-principles), so that you see where this library aims at. Then we'll see how GRDB [solves problems](#solving-problems) that developers often face when they use database libraries such as FMDB, FCModel, SQLite.swift, Core Data, or Realm.
## Core Principles
### It is generally easier to access a database through "record types".
This is because a database row is not an easy type to deal with, and will never be, compared to a regular model. `player.name` looks and feels more natural than `playerRow["name"]`, doesn't it?
The reputation of "active records" and ORMs has been tarnished by the recent focus on immutability, memory safety, and functional idioms that comes with languages like Swift and Rust. Features of 1st-generation records such as auto-updating, uniquing, lazy loading of relations, etc. are now considered ill-advised, if not plain harmful because of the multi-threading headaches they cause.
Yet recent ORMs such as Rust's [Diesel] have shown that it is possible to build record types that behave as plain and simple values. GRDB belongs to this family.
### Raw SQL is sometimes the correct tool for the job.
Complex database queries sometimes need to be prototyped and debugged in an SQL shell. Once perfected, the process of translating this raw SQL query into calls to a query builder can be long and painful, with no guarantee of success. And the resulting code often lacks the legibility of the initial SQL. When this happens, the query builder is no longer useful: whoever wants to write raw SQL should always be welcome.
### The database file is the single source of truth.
Each Core Data's managed object context has its own version of the database. This can be useful when developing a macOS application full of inspector panels and nested undo stacks. But that's about it.
In the same vein, each application thread has its own version of a Realm database, with non trivial synchronization points.
Conversely, GRDB assumes that many apps want to use the database as a reliable and unambiguous storage.
### Applications developers have specific needs.
GRDB puts all bets on SQLite, and focuses on front-end GUI applications.
This means that dealing with servers, MySQL, or PostgreSQL is out of scope. GRDB is not an alternative to IBM's [Swift-Kuery], Vapor's [Fluent], or Perfect's [StORM].
Focusing on SQLite and applications has allowed GRDB to build features usually only found in company-sponsored libraries: migrations, record comparison, database observation, multi-threading safety, table view animations, support for reactive streams...
The bet of GRDB is that developers can take great profit from a library that provides efficient and community-tested solutions to existing problems. For example, one can not address the multithreading difficulties of Core Data or Realm without looking at database concurrency and records straight in the face.
Since you don't have to take my words for granted, we'll now see how GRDB actually solves common problems that developers face with other database libraries.
## Solving Problems
What is the purpose of the above principles, if not providing solutions to difficulties and limitations of other persistence libraries?
### Allow any Swift struct or class to become a database record
Most libraries that provide record types want you to subclass a root class: [NSManagedObject](https://developer.apple.com/documentation/coredata/nsmanagedobject), [Realm.Object](https://www.realm.io/docs/swift/latest), [FCModel](https://github.com/marcoarment/FCModel).
The main problem with those root classes is that they are classes. You can't define records from plain Swift structs, and leverage all advantages of Swift value types: immutability, multi-threading safety, etc.
With GRDB, any type can become a database record. For example, let's start from this `Place` struct:
```swift
struct Place {
var id: Int64?
let title: String
let coordinate: CLLocationCoordinate2D
}
```
By adopting the [FetchableRecord] protocol, places can be loaded from SQL requests:
```swift
extension Place: FetchableRecord { ... }
let places = try Place.fetchAll(db, sql: "SELECT * FROM place") // [Place]
```
Add the [TableRecord] protocol, and SQL requests are generated for you:
```swift
extension Place: TableRecord { ... }
let place = try Place.fetchOne(db, key: 1) // Place?
```
Add the [PersistableRecord] protocol, and places know how to insert, update and delete themselves:
```swift
extension Place: PersistableRecord { ... }
try place.delete(db)
```
For your convenience, those record protocols can be derived from the [Decodable and Encodable](https://developer.apple.com/documentation/foundation/archives_and_serialization/encoding_and_decoding_custom_types) protocols of the standard library. [Codable records] are even given free support for JSON columns and other niceties.
Being a protocol-oriented library that welcomes immutable types, GRDB records are unlike records in other ORM libraries. Particularly, records do not auto-update, and records are not uniqued. We'll see below that the lack of those features can be replaced with **database change notifications**, with many advantages.
See [Good Practices for Designing Record Types](GoodPracticesForDesigningRecordTypes.md) for some practical advice.
### Allow database records to cross threads
As soon as records are immutable values, they can safely be used from different threads. You no longer have to pass object ids or references between threads, as in Core Data or Realm:
```swift
if let player = try Player.fetchOne(db, key: 1) {
DispatchQueue.main.async {
nameField.text = player.name
}
}
```
### Replace auto-updating records with notifications of database changes
GRDB records are plain values, like other values in your application. They are not tied to the database. Sometimes you build them from scratch, and sometimes you fetch them:
```swift
let player = Player(name: "arthur", score: 1000)
let players = try Player.fetchAll(db)
```
**Fetched records behave just like an in-memory cache of the database content.** Your application is free to decide, on its own, how it should handle the lifetime of those cached values: by ignoring future database changes, by observing database changes and react accordingly, or in any way deemed relevant.
There are several ways to be notified of database changes. You can build on top of the fundamental but low-level [TransactionObserver] protocol. Usually, you'll use [ValueObservation], which notifies fresh values after each database change. And don't forget [GRDBCombine] and [RxGRDB], two sets of reactive extensions based on [Combine] and [RxSwift]:
```swift
Player.all().rx
.fetchAll(in: dbQueue)
.subscribe(onNext: { players: [Player] in
print("Players have changed")
})
```
No matter which observation technique you use, you have common guarantees:
First, notifications only come from database changes safely saved on disk. This is part of the "database as the single source of truth" core principle. You won't get notifications from unsaved changes or changes that have an opportunity to be rollbacked.
Next, you choose the dispatch queue on which notifications happen. It can be on the special "writer queue", which allows you to process changes before any other thread has any opportunity to perform further database modifications. But notifications can also happen on the queue of your choice (generally the main queue, by default, as in the example above). Of course, GRDB makes sure notifications happen in the same order as database transactions.
Finally, all changes are notified, no matter how they are performed: record methods, raw SQL statements, foreign key cascades, and even SQL triggers. GRDB roots its notification system in the rock-solid SQLite itself, so that high-level requests and raw SQL queries are equally supported.
### Non-blocking database reads
GRDB ships with two ways to access databases, [database queues](../README.md#database-queues) and [pools](../README.md#database-pools).
Database queues look a lot like FMDB's [FMDatabaseQueue](https://github.com/ccgus/fmdb#using-fmdatabasequeue-and-thread-safety): they serialize database accesses in a serial dispatch queue. There is never more than one thread that is accessing the database. This means that a long running database transaction that happens in a background thread, such as the synchronization of your local database from a remote server, can block your UI. As long as the queue is busy, the main thread can't fetch the values it wants to display on screen.
[Database pools](../README.md#database-pools) can lift these unwanted locks. With database pools, reads are generally non-blocking, unless the maximum number of concurrent reads has been reached (and this maximum number can be configured).
### Strong and clear multi-threading guarantees
I'd like to compare GRDB's handling of concurrency with other libraries. To be as clear as possible, we'll identify a few threats, or potential sources of bugs, and wonder if those are handled by the library, or left to the host application.
The more threats are handled by the application, the more skilled and careful a developer has to be in order to avoid them.
- **Concurrent writes**: Two threads want to write in the database at the same time. SQLite does not allow that.
- **Isolation troubles**: As two database queries run one after the other, a concurrent thread sneaks in and modifies the database in between. The two queries can thus perform inconsistent fetches or updates, unless they are properly isolated. Lack of isolation may display funny values on the screen, trigger a relational constraint error, or silently corrupt the database content.
- **Conflicts**: The same piece of data is both edited by the application user, and refreshed from a network operation. What will eventually be stored in the database? Can any conflict be noticed?
- **Blocked UI**: Can it happen that the UI is blocked because the main thread has to wait for a background thread to release a lock on the database?
| Library | Concurrent Writes | Isolation Trouble | Conflicts | Blocked UI |
| ------- | ----------------- | ----------------- | --------- | ---------- |
| FMDB's FMDatabase | Handled by the application | Handled by the application | Handled by the application | Handled by the application |
| FMDB's FMDatabaseQueue | :white_check_mark: | :white_check_mark: | Handled by the application | UI is blocked |
| SQLite.swift | :white_check_mark: | Handled by the application | Handled by the application | Handled by the application |
| Core Data | Handled by the application, because of the constant threat of conflict errors | :white_check_mark: | Handled by the application, and it is very difficult because of the subtleties of Core Data's conflict policies | Handled by the application |
| GRDB's DatabaseQueue | :white_check_mark: | :white_check_mark: | Handled by the application | UI is blocked |
| GRDB's DatabasePool | :white_check_mark: | :white_check_mark: | Handled by the application | :white_check_mark: (as long as the maximum number of readers has not been reached) |
I had to omit [Realm] and [FCModel] from the list, because I don't know them well enough. Yet I'd bet that Realm shares some behaviors with Core Data, and FCModel shares some behaviors with FMDatabaseQueue.
We can see that the threat of conflicts is *always* left to the application. Core Data provides conflict policies, but no one can pretend that they are easy to plan, use, or test. This is an argument for leaving the application 100% responsible for conflict handling, in hope that simple ones can be handled in a simple way.
Finally, raw FMDatabase, SQLite.swift, and Core Data are the hardest tools, and you'd better be a very skilled developer in order to use them properly.
For detailed information about GRDB concurrency, check the [Concurrency Guide].
For practical advice on designing the database access layer of your application, see the [Good Practices for Designing Record Types](GoodPracticesForDesigningRecordTypes.md).
### Never pay for using raw SQL
SQL is a weird language. Born in the 70s, easy to [misuse](https://xkcd.com/327/), feared by some developers, despised by others, and yet wonderfully concise and powerful.
GRDB [records], [query interface] and [associations] can generate SQL for you:
```swift
// UPDATE player SET score = 950 WHERE id = 42
try player.updateChanges {
$0.score += 10
}
// SELECT * FROM player ORDER BY score DESC LIMIT 10
let bestPlayers: [Player] = try Player
.order(scoreColumn.desc)
.limit(10)
.fetchAll(db)
// SELECT MAX(score) FROM player
let maximumScore: Int? = try Player
.select(max(scoreColumn))
.asRequestOf(Int.self)
.fetchOne(db)
// SELECT book.*, author.*
// FROM book
// LEFT JOIN author ON author.id = book.authorId
let request = Book.including(optional: Book.author)
let bookInfos: [BookInfo] = BookInfo.fetchAll(db, request)
```
But you can always switch to SQL when you want to:
```swift
try db.execute(
sql: "UPDATE player SET score = ? WHERE id = ?",
arguments: [950, 42])
let bestPlayers: [Player] = try Player.fetchAll(db, sql: """
SELECT * FROM player ORDER BY score DESC LIMIT 10
""")
let maximumScore: Int? = try Int.fetchOne(db, sql: """
SELECT MAX(score) FROM player
""")
```
With Swift 5, you can profit from **SQL interpolation**. It lets you build SQL queries from natural looking strings, but without any risk of syntax error or [SQL injection](https://xkcd.com/327/):
```swift
try db.execute(literal: "UPDATE player SET score = \(score) WHERE id = \(id)")
extension Player {
static func filter(name: String) -> SQLRequest<Player> {
return "SELECT * FROM \(self) WHERE \(CodingKeys.name) = \(name)"
}
}
let player = try Player.filter(name: "Arthur O'Brien").fetchOne(db)
```
Custom SQL requests as the one above are welcome in database observation tools like the built-in [ValueObservation], or the companion libraries [GRDBCombine] and [RxGRDB]:
```swift
// RxGRDB
Player.filter(name: "Arthur O'Brien").rx
.fetchOne(in: dbQueue)
.subscribe(onNext: { (player: Player?) in
print("Player has changed")
})
```
Power users can also consume complex joined SQL queries into handy record values, by *adapting* raw database rows to the decoded records (see [Joined Queries Support](#../README.md#joined-queries-support)):
```swift
let bookInfos: [BookInfo] = SQLRequest<BookInfo>(sql: """
SELECT book.*, author.*
FROM book
LEFT JOIN author ON author.id = book.authorId
""")
.adapted { db in
let adapters = try splittingRowAdapters(columnCounts: [
db.columns(in: "book").count,
db.columns(in: "author").count])
return ScopeAdapter([
"book": adapters[0],
"author": adapters[1]])
}
```
In performance-critical sections, you may want to deal with raw database rows, and fetch [lazy cursors](../README.md#cursors) instead of arrays:
```swift
let rows = try Row.fetchCursor(db, sql: "SELECT id, name, score FROM player")
while let row = try rows.next() {
let id: Int64 = row[0]
let name: String = row[1]
let score: Int = row[2]
}
```
---
If this little tour of GRDB has convinced you, the real trip starts here: [GRDB].
And if you happen to maintain an Objective-C application that uses FMDB, checkout [GRDBObjc]. It provides FMDB-compatible bindings to GRDB, so that you can inject sweet drops of Swift into your app, at your own pace, and at minimal cost.
Happy GRDB! :gift:
[Concurrency Guide]: ../README.md#concurrency
[Core Data]: https://developer.apple.com/documentation/coredata
[DatabasePool]: ../README.md#database-pools
[Diesel]: http://diesel.rs
[FCModel]: https://github.com/marcoarment/FCModel
[ValueObservation]: ../README.md#valueobservation
[Fluent]: https://github.com/vapor/fluent
[FMDB]: http://github.com/ccgus/fmdb
[GRDB]: http://github.com/groue/GRDB.swift
[GRDBObjc]: http://github.com/groue/GRDBObjc
[PersistableRecord]: ../README.md#records
[Realm]: http://realm.io
[FetchableRecord]: ../README.md#records
[RxGRDB]: https://github.com/RxSwiftCommunity/RxGRDB
[RxSwift]: https://github.com/ReactiveX/RxSwift
[GRDBCombine]: http://github.com/groue/GRDBCombine
[Combine]: https://developer.apple.com/documentation/combine
[SQLite.swift]: http://github.com/stephencelis/SQLite.swift
[StORM]: https://www.perfect.org/docs/StORM.html
[Swift-Kuery]: http://github.com/IBM-Swift/Swift-Kuery
[TableRecord]: ../README.md#records
[TransactionObserver]: ../README.md#transactionobserver-protocol
[query interface]: ../README.md#the-query-interface
[associations]: AssociationsBasics.md
[Codable records]: ../README.md#codable-records
[records]: ../README.md#records
+33 -18
View File
@@ -1,20 +1,35 @@
Pod::Spec.new do |s|
s.name = 'GRDB.swift'
s.version = '2.0'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'A Swift application toolkit for SQLite databases.'
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 = '4.6.2'
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.swift_versions = ['4.2', '5.0']
s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.9'
s.watchos.deployment_target = '2.0'
s.tvos.deployment_target = '9.0'
s.default_subspec = 'standard'
s.subspec 'standard' do |ss|
ss.source_files = 'GRDB/**/*.swift', 'Support/grdb_config.h'
ss.framework = 'Foundation'
ss.library = 'sqlite3'
end
s.subspec 'SQLCipher' do |ss|
ss.source_files = 'GRDB/**/*.swift', 'Support/grdb_config.h'
ss.framework = 'Foundation'
ss.dependency 'SQLCipher', '>= 3.4.0'
ss.xcconfig = {
'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'
}
end
end
File diff suppressed because it is too large. Load diff
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1030"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -40,8 +40,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1030"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -10,7 +10,6 @@
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
@@ -31,7 +30,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1030"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -10,7 +10,6 @@
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
@@ -31,7 +30,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1030"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1030"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -26,8 +26,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1030"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -14,9 +14,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F3BA80591CFB2BB2003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteOSX"
BlueprintIdentifier = "AAA4DC75230F1E0600C74B15"
BuildableName = "GRDB.framework"
BlueprintName = "GRDBtvOS"
ReferencedContainer = "container:GRDB.xcodeproj">
</BuildableReference>
</BuildActionEntry>
@@ -26,15 +26,16 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F3BA809A1CFB2F6F003DC1BA"
BuildableName = "GRDBCustomSQLiteOSXTests.xctest"
BlueprintName = "GRDBCustomSQLiteOSXTests"
BlueprintIdentifier = "AAA4DD07230F262000C74B15"
BuildableName = "GRDBtvOSTests.xctest"
BlueprintName = "GRDBtvOSTests"
ReferencedContainer = "container:GRDB.xcodeproj">
</BuildableReference>
</TestableReference>
@@ -42,9 +43,9 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F3BA80591CFB2BB2003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteOSX"
BlueprintIdentifier = "AAA4DC75230F1E0600C74B15"
BuildableName = "GRDB.framework"
BlueprintName = "GRDBtvOS"
ReferencedContainer = "container:GRDB.xcodeproj">
</BuildableReference>
</MacroExpansion>
@@ -64,9 +65,9 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F3BA80591CFB2BB2003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteOSX"
BlueprintIdentifier = "AAA4DC75230F1E0600C74B15"
BuildableName = "GRDB.framework"
BlueprintName = "GRDBtvOS"
ReferencedContainer = "container:GRDB.xcodeproj">
</BuildableReference>
</MacroExpansion>
@@ -82,9 +83,9 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F3BA80591CFB2BB2003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteOSX"
BlueprintIdentifier = "AAA4DC75230F1E0600C74B15"
BuildableName = "GRDB.framework"
BlueprintName = "GRDBtvOS"
ReferencedContainer = "container:GRDB.xcodeproj">
</BuildableReference>
</MacroExpansion>
+28 -4
View File
@@ -2,7 +2,7 @@
<Workspace
version = "1.0">
<Group
location = "group:Playgrounds"
location = "group:Documentation/Playgrounds"
name = "Playgrounds">
<FileRef
location = "group:Tour.playground">
@@ -11,22 +11,46 @@
location = "group:JSONSynchronization.playground">
</FileRef>
<FileRef
location = "group:Record.playground">
location = "group:TransactionObserver.playground">
</FileRef>
<FileRef
location = "group:TransactionObserver.playground">
location = "group:Issue156.playground">
</FileRef>
<FileRef
location = "group:CustomizedDecodingOfDatabaseRows.playground">
</FileRef>
<FileRef
location = "group:Associations.playground">
</FileRef>
<FileRef
location = "group:MyPlayground.playground">
</FileRef>
</Group>
<FileRef
location = "group:CHANGELOG.md">
</FileRef>
<FileRef
location = "group:README.md">
</FileRef>
<FileRef
location = "group:TODO.md">
</FileRef>
<FileRef
location = "group:Documentation/ReleaseProcess.md">
</FileRef>
<FileRef
location = "group:Makefile">
</FileRef>
<FileRef
location = "group:GRDB.xcodeproj">
</FileRef>
<FileRef
location = "group:GRDBCustom.xcodeproj">
</FileRef>
<FileRef
location = "group:Tests/Performance/GRDBProfiling/GRDBProfiling.xcodeproj">
</FileRef>
<FileRef
location = "group:DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj">
location = "group:Documentation/DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj">
</FileRef>
</Workspace>
Loaded 100 of 578 files, more files were not shown because too many files have changed in this diff. Show more