Compare commits

...
3451 Commits
Author SHA1 Message Date
Gwendal Roué 786ab176c9 v2.0 2017-09-16 18:37:27 +02:00
Gwendal Roué 973af107da More performance tests, upgrade SQLite.swift submodule 2017-09-16 18:25:24 +02:00
Gwendal Roué 1911ef0172 Merge branch 'master' of github.com:groue/GRDB.swift into Swift4
Conflicts:
	README.md
2017-09-16 14:49:39 +02:00
Gwendal Roué d2e9b340c9 Adapt FT5 support for the non optional Database.primaryKey(_:) 2017-09-15 19:05:39 +02:00
Gwendal Roué 5b487d1722 Fix compiler warning 2017-09-15 19:01:49 +02:00
Gwendal Roué a91da59448 Database.primaryKey(_:) no longer returns an Optional. PrimaryKeyInfo.isRowID tells whether the primary key is the rowed. 2017-09-15 09:00:56 +02:00
Gwendal Roué 2846254304 Improve make distclean, with submodules 2017-09-14 21:51:11 +02:00
Gwendal Roué 5fe765dd29 Improve make distclean 2017-09-14 21:49:06 +02:00
Gwendal Roué 9815f44134 Remove sqlite3.h from the distribution 2017-09-14 20:34:22 +02:00
Gwendal Roué 3f8969b88f PerformanceComparisonTests: update Realm to 2.10.0, SQLite.swift to latest swift-4 branch 2017-09-13 08:11:31 +02:00
Gwendal Roué 4fc7a44a9d Tweak JSONSynchronization playground 2017-09-12 08:30:05 +02:00
Gwendal Roué e132688e00 Simplify JSONSynchronization playground 2017-09-12 08:25:09 +02:00
Gwendal Roué 588df57840 Fix typo 2017-09-12 08:13:23 +02:00
Gwendal Roué 4a8ca6fdc1 TODO 2017-09-11 09:04:05 +02:00
Gwendal Roué 2bb2493731 Turn MutablePersistable.databaseDictionary into a property 2017-09-11 08:53:56 +02:00
Gwendal Roué c61949ceaf DatabaseError.description contains primary result code, not extended result code. 2017-09-11 08:12:43 +02:00
Gwendal Roué 3fce1e00c9 Introduce AnyDatabaseReader and AnyDatabaseWriter 2017-09-10 13:37:48 +02:00
Gwendal Roué 2f2add1c49 Update podspec 2017-09-09 13:29:24 +02:00
Gwendal Roué 697acb103f Cleanup 2017-09-08 21:45:35 +02:00
Gwendal Roué c830e43e8f Update JSONSynchronization playground with Record.updateChanges(_:) 2017-09-08 21:41:39 +02:00
Gwendal Roué 834ef45ca6 Document how to convert a Row to Dictionary 2017-09-08 20:38:03 +02:00
Gwendal Roué 279faa13e9 Less TODO 2017-09-08 13:23:20 +02:00
Gwendal Roué 0309abca6f Tests for Statement.SelectionInfo.description 2017-09-08 13:18:45 +02:00
Gwendal Roué fedee67bda Enhance documentation of fatal errors that happen during value conversion 2017-09-08 08:19:09 +02:00
Gwendal Roué a6c3566aa5 Record.updateChanges(_:) documentation 2017-09-08 08:08:07 +02:00
Gwendal Roué 52fa24e1c4 QueryInterfaceRequest.deleteAll() now honors the order and limit clauses when SQLite is compiled with the SQLITE_ENABLE_UPDATE_DELETE_LIMIT option 2017-09-08 07:07:43 +02:00
Gwendal Roué a7ecf41e3b QueryInterfaceRequest.deleteAll() now honors the order and limit clauses. New Set(cursor) initialiser. 2017-09-07 19:22:21 +02:00
Gwendal Roué e68e5f6265 Tests for Record.updateChangedColumns(_:) 2017-09-06 09:12:38 +02:00
Gwendal Roué aad5a9b060 Less TODO 2017-09-06 08:59:02 +02:00
Gwendal Roué aa064029ec More typed cursor tests 2017-09-06 08:58:27 +02:00
Gwendal Roué e84060e01c More value tests 2017-09-06 08:50:30 +02:00
Gwendal Roué f4f72ebb43 Record.updateChanges(_:) 2017-09-06 08:36:13 +02:00
Gwendal Roué da51e81e38 Fix typo 2017-09-05 09:01:57 +02:00
Gwendal Roué 247cbdd0d0 Date and NSDate interpret database numbers as unix timestamps. 2017-09-05 08:58:17 +02:00
Gwendal Roué c528740154 Documentation 2017-09-05 07:57:00 +02:00
Gwendal Roué 37b357b050 TODO 2017-09-05 05:50:11 +02:00
Gwendal Roué 18c376979d Reformat links to other Swift versions 2017-09-03 11:39:25 +02:00
Gwendal Roué 9cc4357a70 Merge branch 'master' of github.com:groue/GRDB.swift into Swift4 2017-09-03 11:03:36 +02:00
Gwendal Roué f2d35a052f Cleanup 2017-09-03 10:54:13 +02:00
Gwendal Roué 221f378d10 Tests for zero-length blobs as function arguments 2017-09-03 10:31:02 +02:00
Gwendal Roué 06a8c8b940 GRDB is now able to store and load zero-length blobs. 2017-09-03 10:09:00 +02:00
Gwendal Roué eee80b421a Hide StatementCursor from public interface 2017-09-03 08:48:31 +02:00
Gwendal Roué f6e22c3636 Fix Typo 2017-09-02 16:34:07 +02:00
Gwendal Roué 20d77fbba5 README.md 2017-09-02 16:32:52 +02:00
Gwendal Roué 0393ebe012 Try to force SWIFT_VERSION to 4.0 with pod_target_xcconfig 2017-09-02 12:42:50 +02:00
Gwendal Roué 2beddcf77b Cleanup 2017-09-02 12:42:07 +02:00
Gwendal Roué e784ebbcdd Remove public StatementArguments() 2017-08-31 19:35:11 +02:00
Gwendal Roué 30ee538dbd StatementArguments(), tests, changeling 2017-08-30 20:07:34 +02:00
Gwendal Roué 7939ba6e05 Expose RowCursor.statement, StatementCursor.statement, Statement.index(ofColumn:) 2017-08-30 14:06:50 +02:00
Gwendal Roué 2785e69fc1 Data adopts StatementColumnConvertible 2017-08-29 19:27:47 +02:00
Gwendal Roué d472c1696d Workaround SR-5707 2017-08-28 13:49:08 +02:00
Gwendal Roué d9cfa71fc7 MutablePersistable.databaseDictionary() return [String: DatabaseValue] 2017-08-28 08:13:20 +02:00
Gwendal Roué 715e12912b New MutablePersistable.databaseDictionary() convenience method 2017-08-25 18:20:35 +02:00
Gwendal Roué b182fe27f6 Merge branch 'Swift4' of github.com:groue/GRDB.swift into Swift4 2017-08-25 17:43:19 +02:00
Gwendal Roué 5594b33933 Performance tests: distinguish fetching records with change tracking from simple record structs 2017-08-25 17:43:15 +02:00
Gwendal Roué 059b8800f6 TODO 2017-08-25 14:00:12 +02:00
Gwendal Roué 9f687b1848 Documentation 2017-08-25 06:06:59 +02:00
Gwendal Roué a4a05b1f0a Introduce DatabaseValueCursor, NullableDatabaseValueCursor 2017-08-25 05:54:37 +02:00
Gwendal Roué 1a7b0b0626 Introduce RecordCursor 2017-08-24 09:08:29 +02:00
Gwendal Roué 4c467e46cf CHANGELOG 2017-08-24 08:17:09 +02:00
Gwendal Roué fa71edeb07 Consistently use GRDB as the library name 2017-08-23 13:59:51 +02:00
Gwendal Roué 4ff436371d README 2017-08-23 13:57:25 +02:00
Gwendal Roué 9d8fa0bc5a Documentation 2017-08-23 10:03:03 +02:00
Gwendal Roué 1a8ecd7889 Documentation 2017-08-23 10:01:43 +02:00
Gwendal Roué f6614fdfda Documentation 2017-08-23 10:00:02 +02:00
Gwendal Roué a6055df756 New "Documentation diff" section in CHANGELOG 2017-08-23 08:43:35 +02:00
Gwendal Roué 5af91c5eab Documentation 2017-08-23 08:24:08 +02:00
Gwendal Roué 41974c4a46 Documentation 2017-08-23 08:21:28 +02:00
Gwendal Roué f001b5bd76 Documentation 2017-08-23 08:19:29 +02:00
Gwendal Roué 28cf457853 Add a performance test target that doesn't depend on Core Data, FMDB, Realm, and SQLite.swift. 2017-08-23 08:17:47 +02:00
Gwendal Roué 8ccc23333d Replace DatabaseCursor with new concrete cursors RowCursor, StatementColumnCursor, NullableStatementColumnCursor, and StatementCursor. 2017-08-23 08:16:30 +02:00
Gwendal Roué d95954d980 TODO: learn about Decoder.dateEncodingStrategy 2017-08-22 09:04:00 +02:00
Gwendal Roué 3506881c2a Documentation 2017-08-21 19:23:10 +02:00
Gwendal Roué 51d127c378 TODO.md 2017-08-21 08:48:03 +02:00
Gwendal Roué 2d5dd7ef63 Update GRDBProfiling project 2017-08-21 08:47:53 +02:00
Gwendal Roué ef23ba55a1 sqlite3.h is a private header when the SQLite3 module is used 2017-08-21 08:47:31 +02:00
Gwendal Roué ffdbf2f3f1 TODO.md 2017-08-20 05:33:27 +02:00
Gwendal Roué 56cad83f55 CHANGELOG.md 2017-08-19 16:34:28 +02:00
Gwendal Roué 719f33f7a7 GRDBDemoiOS: use default IPHONEOS_DEPLOYMENT_TARGET 2017-08-19 16:09:30 +02:00
Gwendal Roué 700ffacdb1 Minor 2017-08-19 15:55:36 +02:00
Gwendal Roué a6ef4ed55c Minor 2017-08-19 15:53:50 +02:00
Gwendal Roué c5da564fb3 Use built-in SQLite3 module when available 2017-08-19 15:21:44 +02:00
Gwendal Roué a6b04ebb64 FTS5 Cleanup 2017-08-19 12:35:45 +02:00
Gwendal Roué 99ba6db257 Documentation 2017-08-19 11:42:45 +02:00
Gwendal Roué a3cddb72b9 Documentation: rename "person" to "player" (and avoid both "persons" and "people") 2017-08-19 10:36:28 +02:00
Gwendal Roué 2a9e896095 Remove documentation for PrimaryKeyInfo (reference is enough) 2017-08-19 10:25:20 +02:00
Gwendal Roué 89d522d325 Rename "point of interest" to "place" (addresses #246) 2017-08-19 10:21:57 +02:00
Gwendal Roué 3c4ff587ca Documentation 2017-08-19 10:13:40 +02:00
Gwendal Roué e111529035 Documentation 2017-08-19 10:09:41 +02:00
Gwendal Roué cae1f97032 Update documentation now that TableMapping deletion methods have moved to MutablePersistable 2017-08-18 18:40:57 +02:00
Gwendal Roué 20419834a6 Sequence.Iterator.Element -> Sequence.Element 2017-08-18 18:10:56 +02:00
Gwendal Roué 5dabc2a20b CHANGELOG.md 2017-08-18 18:09:28 +02:00
Gwendal Roué c700f5fc68 Move TableMapping deletion methods to MutablePersistable (prevent TableMapping from being able to modify the database) 2017-08-18 17:15:10 +02:00
Gwendal Roué 0b71cf86f2 Less GRDB 2.0 TODO 2017-08-18 16:49:12 +02:00
Gwendal Roué 96159bd09c RowConvertible.fetchCursor(_:keys:) returns a non-optional cursor. 2017-08-18 16:48:06 +02:00
Gwendal Roué bcff802ccb CHANGELOG.md 2017-08-18 16:29:18 +02:00
Gwendal Roué 376d295853 Replace TableMapping.selectsRowID with TableMapping.databaseSelection 2017-08-18 16:27:24 +02:00
Gwendal Roué 0030ad1804 CHANGELOG.md 2017-08-18 14:57:55 +02:00
Gwendal Roué 4ec3e0f7d8 Drop deprecated TableMapping.primaryKeyRowComparator(_:) 2017-08-18 14:30:28 +02:00
Gwendal Roué e36219e408 Thanks @bfad 2017-08-18 14:22:15 +02:00
Gwendal Roué 8f8f53a697 Fix CocoaPods tests by bumping .swift-version 2017-08-18 14:22:15 +02:00
Gwendal Roué 567292c72f Fix SPM test target
Thanks to @aciidb0mb3r: https://bugs.swift.org/browse/SR-5697?focusedCommentId=27793&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-27793
2017-08-18 14:22:15 +02:00
Gwendal Roué b744f73a76 Restore test target in Package.swift, for swift test 2017-08-18 14:22:15 +02:00
Gwendal Roué da440a5e16 Swift 4 + SPM
- Upgrade Tests/SPM package layout and format to version 4, and have `make test_install_SPM` succeed
- Update .gitignore in order to ignore Package.resolved instead of Package.pins
2017-08-18 14:22:15 +02:00
Brad Lindsay 017af1d5c3 Update Package.swift for version 4 tooling 2017-08-18 14:22:14 +02:00
Gwendal Roué 1f5d75d8e9 Fix a compiler error in Xcode 9 beta 5 (and improve tests for DatabaseValue conformance to Equatable) 2017-08-18 14:22:14 +02:00
Gwendal Roué 8b80abc701 TODO.md 2017-08-18 14:22:14 +02:00
Gwendal Roué dc75ca4caf SE-0166 2017-08-18 14:22:14 +02:00
Gwendal Roué d7d4c0a54d Formatting 2017-08-18 14:22:14 +02:00
Gwendal Roué 823b094b60 SE-0168 2017-08-18 14:22:14 +02:00
Gwendal Roué 06a6c982aa SE-0148 2017-08-18 14:22:14 +02:00
Gwendal Roué 1d15ef01f9 Update Travis CI to use Xcode 9 2017-08-18 14:20:35 +02:00
Gwendal Roué f72ffcbb43 SE-0165 2017-08-18 14:20:35 +02:00
Gwendal Roué e0f2305cd9 SE-0104 2017-08-18 14:20:35 +02:00
Gwendal Roué 210939d2c1 SE-0169 2017-08-18 14:20:35 +02:00
Gwendal Roué 2fd071d90e NSLocalizedDescriptionKey 2017-08-18 14:20:35 +02:00
Gwendal Roué badec62cdd SE-0110 2017-08-18 14:20:35 +02:00
Gwendal Roué 895cda4de7 Xcode 9 beta 3 project updates 2017-08-18 14:20:35 +02:00
Gwendal Roué 21fdc9f350 v1.3.0 2017-08-18 13:13:24 +02:00
Gwendal Roué 398c0ef687 Documentation 2017-08-18 12:25:22 +02:00
Gwendal Roué 3b0a9aef3c No more SQLite 3.20.0 TODO 2017-08-18 08:52:48 +02:00
Gwendal Roué 48ec0916bf Use SQLITE_PREPARE_PERSISTENT flag for cached statements 2017-08-18 08:52:23 +02:00
Gwendal Roué 10af87a7d0 SQLite 3.20.0 2017-08-18 08:35:02 +02:00
Gwendal Roué 96e7996f37 SQLite 3.20.0 TODO 2017-08-03 10:19:52 +02:00
Gwendal Roué 0f7af931a9 SQLite 3.20.0 TODO 2017-08-03 10:16:17 +02:00
Gwendal Roué cfd2d80b78 Fix typo 2017-07-30 15:22:13 +02:00
Gwendal Roué 0386c01aa9 CHANGELOG 2017-07-29 14:36:02 +02:00
Gwendal Roué 2c39c91ac6 CHANGELOG 2017-07-29 13:01:49 +02:00
Gwendal Roué 0eb51e3e8b Int8, Int16, UInt, UInt8, UInt16, UInt32, UInt64 adopt DatabaseValueConvertible and StatementColumnConvertible 2017-07-29 12:58:35 +02:00
Gwendal Roué bb931e9da7 FTS5.api(_:) can now throw an error 2017-07-21 18:34:19 +02:00
Gwendal Roué 7b2e672496 Cleanup 2017-07-21 17:59:04 +02:00
Gwendal Roué cdc6370ee5 Restore column ordering in filter(db, keys: [["a": ..., "b": ...], ...]) removed in 2b2e92c810 2017-07-21 13:45:24 +02:00
Gwendal Roué cc762e4e1d TODO 2017-07-21 12:20:32 +02:00
Gwendal Roué ed525bd1d8 Cleanup 2017-07-21 12:15:35 +02:00
Gwendal Roué 2b2e92c810 Cleanup 2017-07-21 12:13:03 +02:00
Gwendal Roué 44d31ead76 Implement deleteAll(_:keys:), deleteOne(_🔑) on top of the Query Interface 2017-07-21 11:19:24 +02:00
Gwendal Roué ec163e94eb Implement fetchCursor(_:keys:), fetchAll(_:keys:), and fetchOne(_🔑) on top of the Query Interface 2017-07-21 09:13:20 +02:00
Gwendal Roué ec2ac33fec TODO.md 2017-07-21 07:58:25 +02:00
Gwendal Roué 20bda2af26 v1.2.2 2017-07-20 19:30:39 +02:00
Gwendal Roué 7a49f6293d CHANGELOG.md 2017-07-20 17:50:14 +02:00
Gwendal Roué 81b21010f1 Fix memory leak with Configuration.trace 2017-07-20 17:47:11 +02:00
Gwendal Roué 2526e0a2f7 Fix links to reference documentation 2017-07-19 19:40:19 +02:00
Gwendal Roué af1e8470c9 v1.2.1 2017-07-19 09:38:25 +02:00
Gwendal Roué dfd9da68a7 CHANGELOG 2017-07-19 08:32:21 +02:00
Gwendal Roué 5e702234f4 Upgrade SQLite to v3.19.3 2017-07-19 08:31:32 +02:00
Gwendal Roué 9020dcca9a CHANGELOG 2017-07-19 08:28:02 +02:00
Gwendal Roué 930a4e4c1d Improve implementation comments in DatabasePool.readFromCurrentState 2017-07-19 08:22:23 +02:00
Gwendal Roué 4db77f96b7 Improve implementation comments in DatabasePool.readFromCurrentState 2017-07-18 16:34:50 +02:00
Gwendal Roué cc12c046b9 func === (lhs: SQLExpressible?, rhs: SQLCollatedExpression) bugfix 2017-07-18 09:00:49 +02:00
Gwendal Roué f5c63e0997 Remove unused method 2017-07-18 07:48:43 +02:00
Gwendal Roué 29a26800b7 Cleanup 2017-07-17 20:20:20 +02:00
Gwendal Roué bc5eeb3b3a expr == DatabaseValue.null is converted to expr IS NULL. 2017-07-17 20:19:19 +02:00
Gwendal Roué 40d02518b0 Cleanup 2017-07-17 15:33:09 +02:00
Gwendal Roué a2556edc69 Use sqlite3_get_autocommit
This function knows whether the database is currently inside a
transaction or not, and provides robust rollback error handling.
2017-07-17 15:33:01 +02:00
Gwendal Roué 111970fda9 Tests for public protocols and open classes
The goal of those tests is to prevent breaking changes as the one that happened in v1.2, where the DatabaseReader protocol was added a new method without any default implementation.
2017-07-13 16:53:01 +02:00
Gwendal Roué ebeb7bc969 v1.2 2017-07-13 13:17:58 +02:00
Gwendal Roué 6ccac5f69c CHANGELOG.md 2017-07-13 13:00:19 +02:00
Gwendal Roué cc41b8b259 Fix Pool bug introduced in 2add1c68ea
I think this is the bug behind this failed test suite: https://travis-ci.org/groue/GRDB.swift/jobs/253093331

In 2add1c68ea Pool has started relying on *indexes* inside its inner array of items. Those indexes weren't reliable enough: this commit brings back independence from indexes by making the Item type a class again.
2017-07-13 12:17:03 +02:00
Gwendal Roué db1a3456b7 Cleanup 2017-07-13 12:12:56 +02:00
Gwendal Roué 1b9305c073 Less TODO 2017-07-13 11:24:41 +02:00
Gwendal Roué a33814ef40 Documentation for unsafe concurrency APIs 2017-07-13 11:10:02 +02:00
Gwendal Roué 581bc9f27c Support for partial records whose encode(to:) method does not provide values for all table columns 2017-07-13 11:03:23 +02:00
Gwendal Roué 40cff0053f TODO.md 2017-07-13 09:58:42 +02:00
Gwendal Roué cc33b12b0d DatabaseReader.unsafeReentrantRead 2017-07-13 09:11:21 +02:00
Gwendal Roué 2add1c68ea Raise a fatal error when DatabasePool is used in a reentrant way 2017-07-12 20:07:05 +02:00
Gwendal Roué 380b6676a6 Statement.sql trims white space and semicolon 2017-07-12 08:45:56 +02:00
Gwendal Roué f133a36477 TODO.md 2017-07-07 17:13:25 +02:00
Gwendal Roué 5f2d6f8e2f Table creation API enhancements 2017-07-01 16:44:33 +02:00
Gwendal Roué a72c207ec5 v1.1 2017-07-01 12:04:27 +02:00
Gwendal Roué ae3c28dee1 Add missing CSQLite import 2017-07-01 11:39:52 +02:00
Gwendal Roué bd919e5209 DatabaseAggregate (fixes #236) 2017-07-01 11:39:52 +02:00
Gwendal Roué d1697756e9 Remove compiler warning 2017-06-30 07:47:14 +02:00
Gwendal Roué 83c3745165 Documentation 2017-06-30 07:47:14 +02:00
Gwendal Roué 56a4a964b7 QueryInterfaceRequest.order() clears the isReversed flag 2017-06-30 07:47:13 +02:00
Gwendal Roué c9a02faf08 Refactor AdaptedTypedRequest around AdaptedRequest 2017-06-30 07:47:13 +02:00
Gwendal Roué e59388738e FetchedRecordsController: don't assume constant row layout when comparing records 2017-06-30 07:47:13 +02:00
Gwendal Roué c8368d98eb Refactor FetchedRecordsController so that it stops using deprecated TableMapping.primaryKeyRowComparator 2017-06-30 07:47:13 +02:00
Gwendal Roué d12dad2e34 Deprecate TableMapping.primaryKeyRowComparator 2017-06-30 07:47:13 +02:00
Gwendal Roué 1ee8c73562 Fix typo 2017-06-30 03:57:36 +02:00
Gwendal Roué ad8de84257 Update Makefile for Xcode 9 beta 2 2017-06-22 19:34:11 +02:00
Gwendal Roué 48398b4913 v1.0 2017-06-20 07:54:19 +02:00
Gwendal Roué d719fe4612 Bump requirements to Xcode8.3+ / Swift 3.1 2017-06-20 07:54:19 +02:00
Gwendal Roué 034a30b444 CHANGELOG.md 2017-06-20 07:54:19 +02:00
Gwendal Roué 9609e2ac4c Database.foreignKeys(on:) 2017-06-20 07:54:19 +02:00
Gwendal Roué 66c2b72a28 Database.afterNextTransactionCommit(_:): document that the closure runs in a protected dispatch queue 2017-06-20 07:54:19 +02:00
Gwendal Roué da48b0880e CHANGELOG.md 2017-06-20 07:54:19 +02:00
Gwendal Roué 4134b1549a CHANGELOG.md 2017-06-20 07:54:19 +02:00
Gwendal Roué 7265b2535b CHANGELOG.md 2017-06-20 07:54:19 +02:00
Gwendal Roué bb638377ac CHANGELOG.md 2017-06-20 07:54:19 +02:00
Gwendal Roué 466113fc4a 🎉 2017-06-20 07:54:19 +02:00
Gwendal Roué 31aea350cb Rename Database.afterCommit(_:) to Database.afterNextTransactionCommit(_:) 2017-06-20 07:54:19 +02:00
Gwendal Roué 56869577d4 Documentation 2017-06-20 07:54:19 +02:00
Gwendal Roué ed3c597a92 Documentation 2017-06-20 07:54:19 +02:00
Gwendal Roué cbb607b6b0 SQLSpecificExpressible.collating(_:) inline documentation 2017-06-20 07:54:19 +02:00
Gwendal Roué 7f64abe820 Identify experimental features in the inline documentation 2017-06-20 07:54:19 +02:00
Gwendal Roué b43dc1ba37 Less TODO 2017-06-20 07:54:19 +02:00
Gwendal Roué 59962e5e88 Identify experimental features in the inline documentation 2017-06-20 07:54:19 +02:00
Gwendal Roué 8eabcecb69 Fix TransactionObservationExtent.nextTransaction 2017-06-20 07:54:19 +02:00
Gwendal Roué a3ad726111 Cleanup 2017-06-20 07:54:19 +02:00
Gwendal Roué a46b4edb0a Replace experimental badge image with searchable text 2017-06-20 07:54:19 +02:00
Gwendal Roué 7059fe3815 TODO.md 2017-06-20 07:54:19 +02:00
Gwendal Roué 780f1afe91 Replace CLLocationCoordinate2DMake(_:_:) with CLLocationCoordinate2D(latitude:longitude:) 2017-06-20 07:54:19 +02:00
Gwendal Roué 2459b4e56f Foster columns gathered in an enum 2017-06-20 07:54:19 +02:00
Gwendal Roué f750cee594 Documentation 2017-06-20 07:54:19 +02:00
Gwendal Roué 1c3824f4b9 Don't retain weak transaction observers 2017-06-20 07:54:19 +02:00
Gwendal Roué 5ba1fa856d Documentation 2017-06-20 07:54:19 +02:00
Gwendal Roué f40a685ac9 Update performance tests for FMDB 2.7.2 2017-06-20 07:54:19 +02:00
Gwendal Roué bf3b6577d5 Deployment target of performance tests is macOS 10.12 2017-06-20 07:54:19 +02:00
Gwendal Roué 7b0659332b Realm 2.8.2 2017-06-20 07:54:19 +02:00
Gwendal Roué 19812cb015 SQLite.swift 0.11.3, FMDB 2.7.2 2017-06-20 07:54:19 +02:00
Gwendal Roué b283c80776 Documentation 2017-06-20 07:54:19 +02:00
Gwendal Roué 49838c67ee Typo 2017-06-20 07:54:19 +02:00
Gwendal Roué 4a40bddd82 Better Database.afterCommit(_:) documentation 2017-06-20 07:54:19 +02:00
Gwendal Roué 208b7860aa Better Database.afterCommit(_:) documentation 2017-06-20 07:54:19 +02:00
Gwendal Roué 05e7c9470b Better Database.afterCommit(_:) documentation 2017-06-20 07:54:19 +02:00
Gwendal Roué 2f79d5f805 Database.afterCommit(_:) 2017-06-20 07:54:19 +02:00
Gwendal Roué 1f120a04f9 CHANGELOG.md 2017-06-20 07:54:19 +02:00
Gwendal Roué 90a46f6556 Introduce TransactionObservationExtent 2017-06-20 07:54:19 +02:00
Gwendal Roué 4dff14a02a README: note about "Pure Transaction Observers", and warning about "Recursive Commits" 2017-06-20 07:54:19 +02:00
Gwendal Roué d9a9acb616 README: Introduction to Database Changes Observation 2017-06-20 07:54:19 +02:00
Gwendal Roué 8ea215931e Refactor Request
Rename TypedRequest's associated type from `Fetched` to `RowConverter`, because if TypedRequest needs a type that can decode rows, the type of the decoded rows does not need to be identical to the decoder type.

Introduce AdaptedRequest and AdaptedTypedRequest as results of Request.adapted(_:) and TypedRequest.adapted(_:), instead of the generic AnyRequest and AnyTypedRequest.
2017-06-20 07:54:19 +02:00
Gwendal Roué 6caed6aacc DatabaseMigrator documentation 2017-06-20 07:54:19 +02:00
Gwendal Roué 0c192fcb57 DatabaseMigrator.migrate(_:upTo:) 2017-06-20 07:54:19 +02:00
Gwendal Roué 3e819a5051 TODO.md 2017-06-20 07:54:19 +02:00
Gwendal Roué b31983cc3a TODO: write regression tests for #156 and #157 2017-06-20 07:54:19 +02:00
Gwendal Roué e24cb1783c Change default transaction kind to deferred (the SQLite default). 2017-06-20 07:54:19 +02:00
Gwendal Roué a913aba018 Replace persistentDictionary with encode(to:) 2017-06-20 07:54:19 +02:00
Gwendal Roué 35d34ab524 Remove obsolete documentation of QueryInterfaceRequest.contains(_:) 2017-06-20 07:54:19 +02:00
Gwendal Roué 604cf6b522 Remove QueryInterfaceRequest.contains(_:) 2017-06-20 07:54:19 +02:00
Gwendal Roué e987695732 Remove obsolete documentation of QueryInterfaceRequest.exists() 2017-06-20 07:54:19 +02:00
Gwendal Roué 09f37a86ad Fix link of experimental badges 2017-06-20 07:54:19 +02:00
Gwendal Roué ff32f99610 Better experimental description 2017-06-20 07:54:19 +02:00
Gwendal Roué 4cd099ef30 Fix link of experimental badges 2017-06-20 07:54:19 +02:00
Gwendal Roué 54d3b0eabc Flag Request.adapted(_:) as experimental 2017-06-20 07:54:19 +02:00
Gwendal Roué b3d731b040 Remove QueryInterfaceRequest.exists() 2017-06-20 07:54:19 +02:00
Gwendal Roué 6629ec48a3 Flag SQLExpressionFunction, SQLFunctionName, SQLExpressionUnary, SQLExpressionBinary, SQLExpressionFunction, QueryInterfaceRequest.exists() as experimental 2017-06-20 07:54:19 +02:00
Gwendal Roué 19c273771d Flag row adapters as experimental 2017-06-20 07:54:19 +02:00
Gwendal Roué e7b6919bc1 Experimental badge and FAQ (with workaround https://github.com/isaacs/github/issues/316) 2017-06-20 07:54:19 +02:00
Gwendal Roué 60e6c7d250 Remove DatabaseCoder 2017-06-20 07:54:19 +02:00
Gwendal Roué 4feeb0e608 Help Xcode 9 beta 1 users in the README (completes #230) 2017-06-09 06:53:20 +02:00
Gwendal Roué b3243efdf5 Update Makefile for Xcode 8.3.3 2017-06-09 06:44:26 +02:00
Gwendal Roué 60a23bb280 More Xcode-9 fixes 2017-06-09 06:44:26 +02:00
Gwendal Roué 973f38727d More Xcode-9 fixes 2017-06-09 06:44:26 +02:00
David Hart deaac5808d Make the bug-fix conditional to continue building on 3.1 2017-06-09 06:44:26 +02:00
David Hart 22dc01610e Fix compilation with Xcode 9 in compatibilty mode 2017-06-09 06:44:26 +02:00
Gwendal Roué fe702d8fea The magic command that helps finding unwanted git tags 2017-06-01 10:02:59 +02:00
Gwendal Roué 10e669423f Use the dbValue identifier for variables of type DatabaseValue 2017-06-01 08:35:14 +02:00
Gwendal Roué fbf146657e CHANGELOG for SQLite 3.19.2 2017-05-28 15:48:46 +02:00
Gwendal Roué 8667fab206 v0.110.0 2017-05-28 14:29:41 +02:00
Gwendal Roué e974cd4b33 Fix make test_SPM by backporting 7adfb3c233fc3fdeacbb3933d7d13b4c2a3a2eed and using the default Swift compiler unless TOOLCHAIN is defined 2017-05-28 14:02:13 +02:00
Gwendal Roué 43c96803be CHANGELOG: announce removal of deprecation warning for sqlite3_trace 2017-05-28 13:32:17 +02:00
Gwendal Roué 70b42a5633 CHANGELOG: announce Travis-CI integration 2017-05-28 13:24:21 +02:00
Gwendal Roué 9f989f7706 CHANGELOG: announce SQLCipher v3.4.1 2017-05-28 13:20:27 +02:00
swiftlyfalling 4d976ef803 Add Travis-CI build status badge to README.md 2017-05-28 13:16:47 +02:00
Gwendal Roué 02257fd78f Update SQLite version in documentation 2017-05-28 13:15:41 +02:00
Gwendal Roué 929c8f49a6 Upgrade SQLite to v3.19.2 2017-05-28 13:15:41 +02:00
Gwendal Roué a6ec38c805 Upgrade SQLite to v3.19.1 2017-05-28 13:15:41 +02:00
Gwendal Roué e5ec8ea3b2 Update SQLite version in documentation 2017-05-28 13:15:41 +02:00
Gwendal Roué 36ac5a2802 CHANGELOG for SQLite 3.19.0 2017-05-28 13:15:41 +02:00
Gwendal Roué b5beff5030 Fix SelectStatementTests.testSelectionInfo SPM test 2017-05-28 13:15:41 +02:00
Gwendal Roué d1d1a5da77 Improve SelectionInfo for SQLite 3.19.0 2017-05-28 13:15:41 +02:00
Gwendal Roué 713d58612e SQLite 3.19.0 wants authorizer callbacks to be prepared from NULL inputs 2017-05-28 13:15:41 +02:00
Gwendal Roué bd0990deb4 Upgrade SQLite to v3.19.0 2017-05-28 13:15:41 +02:00
Gwendal Roué 35e8d9c12b Update SQLCipher version in documentation 2017-05-28 11:40:26 +02:00
Gwendal Roué 1fb7f9ff5b Disable query tracing inside EncryptionTests.testExportPlainTextDatabaseToEncryptedDatabase (workaround https://github.com/sqlcipher/sqlcipher/issues/216) 2017-05-28 11:40:26 +02:00
Gwendal Roué 7eecb059e6 Disable EncryptionTests.testExportPlainTextDatabaseToEncryptedDatabase until https://github.com/sqlcipher/sqlcipher/issues/216 is fixed 2017-05-28 11:40:26 +02:00
Gwendal Roué ba8375adb1 Upgrade SQLCipher to v3.4.1 2017-05-28 11:40:26 +02:00
Gwendal Roué 2ef547c461 Fix flaky busy handler tests 2017-05-27 15:04:27 +02:00
Gwendal Roué a34784ca73 TODO: Fix flaky ConcurrencyTests.testReaderInDeferredTransactionDuringDefaultTransaction 2017-05-25 23:02:31 +02:00
Gwendal Roué 5594d46c2d Makefile cleanup 2017-05-25 19:57:51 +02:00
Gwendal Roué dc7a1e3f41 Delete Package.pins files in clean and distclean Makefile targets 2017-05-25 19:57:46 +02:00
Gwendal Roué 68732487f9 Ignore Package.pins files 2017-05-25 19:57:41 +02:00
Gwendal Roué 5ea1d4376d Remove quotes around "GRDB [SPM] (Xcode 8.3, macOS 10.12)" TID in .travis.yml 2017-05-25 19:57:36 +02:00
Gwendal Roué 9cb8b205c5 Rewrite tests that check that closing a connection does not break unclosed statements (this should fix #216, for good this time!) 2017-05-25 19:25:47 +02:00
Gwendal Roué a35c453423 Fix flaky test ConcurrencyTests.testBusyCallback 2017-05-25 18:54:02 +02:00
Gwendal Roué e7f91d7c25 TODO: fix flaky test ConcurrencyTests.testBusyCallback 2017-05-25 18:43:21 +02:00
Gwendal Roué 4886f43463 Rewrite tests that check that closing a connection does not break unclosed statements (this should fix #216) 2017-05-25 18:39:38 +02:00
Gwendal Roué 929c8ac2b5 GRDB has no longer iterators, but cursors 2017-05-25 18:23:14 +02:00
Gwendal Roué 1438934aa6 Extract deployment targets in dedicated xcconfig files. 2017-05-25 17:13:45 +02:00
Gwendal Roué ec65335fcd Use sqlite3_trace_v2 when available (addresses #100) 2017-05-25 17:13:04 +02:00
Gwendal Roué 39d31dbd11 Merge pull request #218 from swiftlyfalling/travis_add_spm_test
Add `make test_SPM` to .travis.yml
2017-05-25 13:53:26 +02:00
swiftlyfalling 6c5be7a169 Minor tweaks 2017-05-24 11:15:59 -04:00
swiftlyfalling b45894fd51 Add test_SPM to travis.yml 2017-05-24 11:13:32 -04:00
swiftlyfalling a660b4e5c4 Merge remote-tracking branch 'groue/master' 2017-05-24 11:04:43 -04:00
Gwendal Roué e11c88cf05 Merge pull request #215 from swiftlyfalling/travis-ci-xcode-82-fix
Makefile Fix: Xcode 8.2 max-iOS builds
2017-05-24 07:53:25 +02:00
swiftlyfalling 40f930f08a Fix Xcode 8.2 max-iOS builds
- Fixes errant “fancy quotes”
2017-05-23 16:57:15 -04:00
swiftlyfalling 0c55e7819d Merge remote-tracking branch 'groue/master' 2017-05-23 16:54:04 -04:00
Gwendal Roué 3c17ee941f Documentation 2017-05-23 11:44:43 +02:00
Gwendal Roué 5a67ca0411 Foster asRequest(of:) 2017-05-23 11:38:17 +02:00
Gwendal Roué 63d04a6707 TODO: upgrade SQLCipher 2017-05-23 08:17:31 +02:00
Gwendal Roué 676a116cda Merge pull request #213 from swiftlyfalling/travis-ci-integration
Continuous Integration (w/ Travis CI)
2017-05-23 07:45:43 +02:00
Gwendal Roué 55435fd324 v0.109.0 2017-05-22 19:58:48 +02:00
Gwendal Roué 612f8059b8 Documentation 2017-05-22 19:58:01 +02:00
Gwendal Roué ffd16f7639 Backport some Makefile improvements from @zmeyc's pr_linux branch 2017-05-22 19:56:57 +02:00
swiftlyfalling 528860161e Add Travis-CI support 2017-05-22 13:24:22 -04:00
swiftlyfalling 1fe6094da5 Remove + ignore .ruby-version to avoid conflicts with Travis-CI
If the .ruby-version file is present and contains a version of Ruby
greater than Travis-CI supports, it will break the Travis-CI builds.
2017-05-22 13:23:07 -04:00
swiftlyfalling 399c51b1ee Merge remote-tracking branch 'groue/master' 2017-05-22 13:18:05 -04:00
Gwendal Roué 55e4abd534 Rename USING_SQLCIPHER to GRDBCIPHER and USING_CUSTOMSQLITE to GRDBCUSTOMSQLITE 2017-05-22 19:15:10 +02:00
Gwendal Roué e9d02f441b More links to RxGRDB 2017-05-22 19:00:24 +02:00
Gwendal Roué f858bcbe5b Rename Request.fetching(_:) to Request.asRequest(of:) 2017-05-22 18:55:51 +02:00
Gwendal Roué cd107711a9 Rename Request.bound(to:) to Request.fetching(_:) 2017-05-22 18:37:46 +02:00
Gwendal Roué ce4c20b112 Replace DatabaseWriter.availableDatabaseConnection with unsafeReentrantWrite() 2017-05-22 18:10:19 +02:00
Gwendal Roué 0b8ba1ccfa Merge branch 'master' of github.com:groue/GRDB.swift 2017-05-22 14:21:29 +02:00
Gwendal Roué c72c97fd53 TODO.md 2017-05-22 13:54:33 +02:00
Gwendal Roué 1e12068e64 DatabaseEventKind.impacts(_ selectionInfo:SelectStatement.SelectionInfo) now returns an non-optional boolean. 2017-05-22 13:53:59 +02:00
Gwendal Roué 1799fe1ff9 Consistently crash for all failed conversions from DatabaseValue 2017-05-22 13:51:39 +02:00
Gwendal Roué ae5175c5b4 CHANGELOG.md 2017-05-17 20:01:28 +02:00
Gwendal Roué 86d5b0b23d Update ReleaseProcess.md 2017-05-17 14:41:43 +02:00
Gwendal Roué 341044356f v0.108.0 2017-05-17 14:27:53 +02:00
Gwendal Roué 5eb7a62062 Add @sroddy to the thanks section 2017-05-17 14:25:09 +02:00
Gwendal Roué 74f96c0766 CHANGELOG.md 2017-05-17 14:24:03 +02:00
Gwendal Roué 49b62cb27a Merge pull request #212 from BendingSpoons/feature/CocoaPods-SQLCipher
SQLCipher support with Cocoapods
2017-05-17 14:20:05 +02:00
Gwendal Roué 798588c54b Documentation for GRDBCipher installation via CocoaPods 2017-05-17 14:19:31 +02:00
Gwendal Roué f1a9cdaa8e Restore GRDB.swift.podspec, introduce GRDBCipher.podspec 2017-05-17 13:27:03 +02:00
Stefano Rodriguez c66c0a11b6 Add Cocoapods checks for SQLCipher subspec 2017-05-17 01:29:28 +02:00
Stefano Rodriguez b1cdd1360b Update README.md 2017-05-17 01:17:10 +02:00
Stefano Rodriguez 7c8b48e08a Fix Podspec 2017-05-15 01:08:33 +02:00
Stefano Rodriguez 64df5c6b41 Update README.md 2017-05-13 22:54:56 +02:00
Stefano Rodriguez a5c1361dc9 Add Support for SQLCipher in CocoaPods 2017-05-13 22:49:14 +02:00
Gwendal Roué 798b1a7d2e Tests for DatabaseEventKind.impacts(_ selectionInfo: SelectStatement.SelectionInfo) and triggers. 2017-05-10 13:35:55 +02:00
Gwendal Roué e484e4c6de Tests for DatabaseEventKind.impacts(_ selectionInfo: SelectStatement.SelectionInfo) and foreign keys. 2017-05-10 13:26:57 +02:00
Gwendal Roué 31299a529a TODO.md 2017-05-10 10:27:53 +02:00
Gwendal Roué 53ac681d49 TODO.md 2017-05-09 10:16:18 +02:00
Gwendal Roué 828ef48441 Database.setupErrorLog() rewrite 2017-05-08 13:27:51 +02:00
Gwendal Roué 63e8742fb1 TODO.md 2017-05-05 13:27:46 +02:00
Gwendal Roué 192a958fdc Fix manual installation git checkout command 2017-05-05 13:26:58 +02:00
Gwendal Roué f606e633da Drop RowConvertible.awakeFromFetch 2017-05-05 13:20:37 +02:00
Gwendal Roué e2d2b031a5 Bump Ruby version for jazzy 2017-05-05 10:16:30 +02:00
Gwendal Roué c203a972ff v0.107.0 2017-05-05 08:23:17 +02:00
Gwendal Roué 44df1aa0bd Update GRDBOSXPerformanceTests for Swift 3.1 2017-05-05 08:16:06 +02:00
Gwendal Roué d010587f44 README.md: more direct links to DemoApps/GRDBDemoiOS 2017-05-05 08:05:49 +02:00
Gwendal Roué 840525c11a Improve DemoApps/GRDBDemoiOS/Database.swift 2017-05-05 08:05:28 +02:00
Gwendal Roué a0881d851c Drop attempt to have Carthage build SQLCipher (undo changes for #41) 2017-05-04 22:50:03 +02:00
Gwendal Roué ac00e05a72 CHANGELOG.md 2017-05-04 20:21:45 +02:00
Gwendal Roué 4938568ea7 Refactor statement cache, allow SQLRequest to use cached statements 2017-05-04 20:11:45 +02:00
Gwendal Roué cb4c07a5fb TODO.md 2017-05-04 18:05:49 +02:00
Gwendal Roué 4edd76341e There are two statement caches: one for statements generated by the user, and one for the statements generated by GRDB. Those are separated so that GRDB has no opportunity to inadvertently modify the arguments of user statements. 2017-05-04 18:05:36 +02:00
Gwendal Roué bb8aee8965 TODO.md 2017-05-04 17:17:36 +02:00
Gwendal Roué 5d97d2d680 TODO.md 2017-05-02 10:16:50 +02:00
Gwendal Roué 3eb2646cad More SPM tests 2017-04-23 19:04:28 +02:00
Gwendal Roué 96c3dadb7b Tests/README.md 2017-04-23 18:38:17 +02:00
Gwendal Roué 4d9a238c27 Merge pull request #208 from groue/SPMTests
Support for Swift Package Manager tests
2017-04-23 16:40:53 +02:00
Gwendal Roué a475cfa340 Tests organization 2017-04-23 16:37:59 +02:00
Gwendal Roué e54cec9123 Move tests to Swift Package Manager test target 2017-04-23 15:47:16 +02:00
Gwendal Roué 3edad29501 Documentation: Database.logError is now available through SPM (#207) 2017-04-22 19:27:20 +02:00
Gwendal Roué 392a004bd1 Add @zmeyc to the thanks section 2017-04-22 19:20:53 +02:00
Gwendal Roué 7f8ec17511 Merge pull request #207 from zmeyc/pr_spm_logging
Enable logging when using SPM
2017-04-22 19:17:53 +02:00
Gwendal Roué d9e6fd3b89 Bump CSQLite dependency to 0.2 2017-04-22 19:17:33 +02:00
Andrey Fidrya 6cf59838a6 Enable logging when using SPM 2017-04-22 20:04:09 +03:00
Gwendal Roué 3efa60ce8a Merge pull request #206 from groue/ErrorLoggingCallback
Error logging callback
2017-04-22 18:27:37 +02:00
Gwendal Roué 7a90cd2562 Database.logError documentation 2017-04-22 17:58:19 +02:00
Gwendal Roué 4cdbe4f0f4 Use Database.logError in GRDBDemoiOS 2017-04-22 17:57:56 +02:00
Gwendal Roué 595408b351 Rename logErrorFunction into logError 2017-04-22 17:57:33 +02:00
Gwendal Roué 4ee1fd9f65 Database.logErrorFunction for GRDBCipher and GRDBCustomSQLite 2017-04-22 17:26:16 +02:00
Gwendal Roué f16f4d557a Database.logErrorFunction for CocoaPods 2017-04-22 16:51:22 +02:00
Gwendal Roué 27314d1af3 No Database.logErrorFunction for SPM 2017-04-22 16:35:12 +02:00
Gwendal Roué 4f14fb0ccd Support for SQLITE_CONFIG_LOG via Database.logErrorFunction 2017-04-22 15:11:01 +02:00
Gwendal Roué 9b2a8f847f Remove some useless availability checks in tests 2017-04-22 15:04:47 +02:00
Gwendal Roué dae4ae1c6b Reduce internal coupling 2017-04-22 11:12:43 +02:00
Gwendal Roué c8023adff1 Cleanup 2017-04-20 14:49:08 +02:00
Gwendal Roué c34ac0f17b Cleanup 2017-04-20 14:37:06 +02:00
Gwendal Roué 2222a1bfe2 doc: Fix links to Github in jazzy-generated doc 2017-04-14 15:59:06 +02:00
Gwendal Roué 3134809c22 minor 2017-04-13 13:51:46 +02:00
Gwendal Roué 203e8c41ce Better test_install_SPM 2017-04-12 14:39:53 +02:00
Gwendal Roué 5804c044d5 make test_install_SPM 2017-04-12 14:24:11 +02:00
Gwendal Roué 80c378df21 v0.106.1 2017-04-12 13:16:39 +02:00
Gwendal Roué 0f3bc5922d Documentation about Swift Package Manager 2017-04-12 12:54:23 +02:00
Gwendal Roué 1810edfa6e Sample SPM executable 2017-04-11 13:58:41 +02:00
Gwendal Roué 362b8d3243 0.106.0 2017-04-11 13:50:28 +02:00
Gwendal Roué b06f76512d Merge pull request #202 from zmeyc/pr_spm1
SPM support
2017-04-11 13:37:23 +02:00
Gwendal Roué 6c2b421b57 Add test_framework_SPM target to Makefile 2017-04-11 13:33:36 +02:00
Gwendal Roué 63b3b4225a Rename package to GRDB, and rename SQLite module to CSQLite 2017-04-11 13:22:26 +02:00
Gwendal Roué 5b7ad40163 [whitespace] 2017-04-11 11:05:49 +02:00
Andrey Fidrya 1751fb38e5 SPM support 2017-04-08 21:32:58 +03:00
Gwendal Roué 184a2bcf18 Typo 2017-04-06 14:19:40 +02:00
Gwendal Roué 57fce9d20f Link to http://github.com/RxSwiftCommunity/RxGRDB 2017-04-06 14:18:54 +02:00
Gwendal Roué d354157c0e v0.105.0 2017-04-06 13:07:03 +02:00
Gwendal Roué de78e065cb CHANGELOG.md 2017-04-06 11:40:01 +02:00
Gwendal Roué 17a49b5d8c New public property: DatabaseWriter.availableDatabaseConnection. This new API opens the door to reentrant uses of the database, a much needed tool for RxGRDB. 2017-04-06 11:02:49 +02:00
Gwendal Roué 6c6bbf6294 Fix failing test for SELECT COUNT(*) FROM table observation 2017-04-06 10:35:41 +02:00
Gwendal Roué 72f04367d9 TODO.md 2017-04-05 11:41:19 +02:00
Gwendal Roué 7395305f87 Failing test for SELECT COUNT(*) FROM table observation 2017-04-05 10:45:37 +02:00
Gwendal Roué 1c62a665c7 TODO.md 2017-04-03 14:21:54 +02:00
Gwendal Roué 518919aeee Merge pull request #194 from groue/modulemapRefactor
Xcode 8.3 support
2017-04-03 14:19:39 +02:00
Gwendal Roué da798b3748 v0.104.0 2017-04-03 14:14:00 +02:00
Gwendal Roué 441e936d88 ReleaseProcess.md 2017-04-03 14:12:24 +02:00
Gwendal Roué 23def44101 Stop requiring that Xcode is located at /Applications/Xcode.app. Add a word about Carthage, and leave the door open. 2017-04-03 14:02:39 +02:00
Gwendal Roué 35fafdb476 CHANGELOG.md 2017-04-03 13:47:12 +02:00
Gwendal Roué 0e20e6a0bb Update manual installation instructions for WatchOS 2017-04-03 13:40:38 +02:00
Gwendal Roué 04654a5c85 Functional GRDBDemoWatchOS 2017-04-03 13:37:36 +02:00
Gwendal Roué e17c4e5271 GRDBDemoWatchOS 2017-04-03 13:10:24 +02:00
Gwendal Roué 4d79b35c47 Share GRDBOSXPerformanceTests scheme 2017-04-03 13:10:08 +02:00
Gwendal Roué 26aeb7dcbd New public function: TableMapping.primaryKeyRowComparator. This new API exposes record comparison abilities that were reserved to FetchedRecordsController, and open a better support for GRDB reactive extensions. 2017-04-02 17:27:25 +02:00
Gwendal Roué 7bc3582525 SelectStatement.SelectionInfo.description 2017-04-02 14:18:48 +02:00
Gwendal Roué 1ad00e1102 Custom SQLite 3.18.0 2017-04-01 19:54:38 +02:00
Gwendal Roué 311ad6b940 New public APIs: SelectStatement.selectionInfo, DatabaseEventKind.impacts(_:). Those new APIs expose database observation abilities that were reserved to FetchedRecordsController, and open a better support for GRDB reactive extensions. 2017-04-01 16:01:55 +02:00
Gwendal Roué c65f3289a3 TODO.md 2017-04-01 15:06:48 +02:00
Gwendal Roué cfeaf2f376 TODO.md 2017-04-01 15:04:59 +02:00
Gwendal Roué 8434e856f4 Update documentation about access to the raw SQLite C API since it is now embedded right into the GRDB module. 2017-04-01 14:59:25 +02:00
Gwendal Roué 35a700027c TODO.md 2017-04-01 14:40:14 +02:00
Gwendal Roué 2196158f58 Run GRDBDemoiOS in Release configuration 2017-04-01 14:13:38 +02:00
Gwendal Roué 56d5ca180a Update ReleaseProcess.md 2017-04-01 14:02:07 +02:00
Gwendal Roué 60326b8f65 Update ReleaseProcess.md 2017-04-01 14:01:46 +02:00
Gwendal Roué 363943583d Update ReleaseProcess.md 2017-04-01 14:01:19 +02:00
Gwendal Roué 4348889865 Drop mention of Carthage support from documentation 2017-04-01 14:00:05 +02:00
Gwendal Roué 50e50e82e1 Makefile cleanup and documentation 2017-04-01 13:38:00 +02:00
Gwendal Roué fd30f16364 Stop testing Carthage (see https://github.com/Carthage/Carthage/issues/1867) 2017-04-01 08:49:05 +02:00
Gwendal Roué 21879db549 Bootstrap GRDBCustom / GRDBCipher tests 2017-03-31 18:18:38 +02:00
Gwendal Roué 313b9d64f6 Bootstrap GRDBCustom / GRDBCipher tests 2017-03-31 13:44:37 +02:00
Gwendal Roué 87be97a38d Some tests require submodules 2017-03-31 13:27:56 +02:00
Gwendal Roué 4f5054d792 Share more tested schemes 2017-03-31 13:27:35 +02:00
Gwendal Roué 51545c4db0 Share tested schemes + test GRCBCipheriOS installation (addresses #193) 2017-03-31 13:23:08 +02:00
Gwendal Roué 98fb48eb1d Makefile adaptation for Xcode 8.1 (test up to iOS 10.1) 2017-03-31 09:22:05 +02:00
Gwendal Roué fa2817ab52 GRDBCipher test app 2017-03-31 08:53:37 +02:00
Gwendal Roué 2a35601ff4 make test checks iOS 8.1 2017-03-31 08:32:03 +02:00
Gwendal Roué ed70058a1f ReleaseProcess.md 2017-03-31 08:14:42 +02:00
Gwendal Roué 79a1b65547 ReleaseProcess.md 2017-03-31 08:01:18 +02:00
Gwendal Roué cccddd8455 make test checks manual install, pod lint, and carthage build 2017-03-31 07:54:49 +02:00
Gwendal Roué 9a4d9f7f1f make test 2017-03-31 06:19:34 +02:00
Gwendal Roué c532f40b7d CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE, CLANG_WARN_DOCUMENTATION_COMMENTS = YES 2017-03-31 06:07:29 +02:00
Gwendal Roué d7e68c340c Disable fragile test DatabasePoolBackupTests.testConcurrentWriteDuringBackup 2017-03-31 05:59:40 +02:00
Gwendal Roué 42a985112a Drop watchOS demo app 2017-03-30 22:47:53 +02:00
Gwendal Roué 16a653ed9d Fix product name of test targets (and restore GRDBCipheriOS tests) 2017-03-30 21:59:33 +02:00
Gwendal Roué 91f18323be Merge branch 'master' of github.com:groue/GRDB.swift into modulemapRefactor
Conflicts:
	.gitignore
2017-03-30 20:12:55 +02:00
Gwendal Roué 09bbb50e1f README.md 2017-03-28 08:36:52 +02:00
Gwendal Roué a4eebfeeb2 Documentation: more explicit dbQueue.inDatabase wrapping in key chapters (addresses #189 from @pumplerod) 2017-03-28 08:33:52 +02:00
Gwendal Roué 62d19c9d11 Xcode8.3 WIP 2017-03-28 08:02:08 +02:00
Gwendal Roué 07142b3052 TODO.md 2017-03-27 09:45:58 +02:00
Gwendal Roué a304bc0eed README.md 2017-03-27 09:42:22 +02:00
Gwendal Roué 857b7e53d9 v0.103.0 2017-03-26 18:39:16 +02:00
Gwendal Roué 2987bb129c CocoaPods test application 2017-03-26 18:32:50 +02:00
Gwendal Roué 8da9ad696b Fix signing of GRDBDemoWatchOS 2017-03-26 18:00:33 +02:00
Gwendal Roué 8720d6937a Remove inaccurate documentation for int64EqualDouble(_:_:): Swift standard library does not aim at providing this function. 2017-03-26 17:55:30 +02:00
Gwendal Roué 9262834ffb Fix the test project for Carthage installation of GRDB on iOS 2017-03-26 17:55:24 +02:00
Gwendal Roué a41b1a5a2d Remove the test project for the no longer supported installation of GRDBCipher via Carthage 2017-03-26 17:55:18 +02:00
Gwendal Roué 1e362fdd53 Prefer write { $0... } over write { db in db... } for one liners 2017-03-26 17:55:06 +02:00
Gwendal Roué 8dfe166944 CocoaPods test 2017-03-26 16:32:35 +02:00
Gwendal Roué 8d0feea2c2 Cocoapods support 2017-03-26 16:28:44 +02:00
Gwendal Roué 47d9f5920f Cocoapods support 2017-03-26 16:24:18 +02:00
Gwendal Roué 25eca4146c Cocoapods support 2017-03-26 16:15:24 +02:00
Gwendal Roué 61938601fd SDK-relative sqlite3.h 2017-03-26 16:04:41 +02:00
Gwendal Roué 61d114f297 Remove inaccurate documentation for int64EqualDouble(_:_:): Swift standard library does not aim at providing this function. 2017-03-26 15:38:37 +02:00
Gwendal Roué eddebfbba5 Prefer write { $0... } over write { db in db... } for one liners 2017-03-26 15:38:03 +02:00
Gwendal Roué 323d828eb7 Fix the test project for Carthage installation of GRDB on iOS 2017-03-26 15:37:46 +02:00
Gwendal Roué bb763f7315 Remove the test project for the no longer supported installation of GRDBCipher via Carthage 2017-03-26 15:37:39 +02:00
Gwendal Roué b1d93112da Embed a copy of sqlite3.h in order to work around my inability at importing <sqlite3.h> from all targeted SDKs (addresses #166, #170) 2017-03-26 15:37:31 +02:00
Gwendal Roué 56bd3513a3 Fix FTS3 pattern test so that it compiles when support for FTS5 is available 2017-03-26 15:14:18 +02:00
Gwendal Roué ddcf26058b CHANGELOG.md 2017-03-26 15:10:47 +02:00
Gwendal Roué ba4ee3f1fc Bugfix 2017-03-26 15:09:05 +02:00
Gwendal Roué dedfd5cd33 Document that extended result codes are not always available (#171, #180) 2017-03-26 15:07:04 +02:00
Gwendal Roué b5296f4206 Remove warning from documentation now that availability checks for FTS3Pattern(matchingAnyTokenIn:), FTS3Pattern(matchingAllTokensIn:), FTS3Pattern(matchingPhrase:) have been added 2017-03-26 14:52:22 +02:00
Gwendal Roué e2e2c58d9f Add availability checks for FTS3Pattern(matchingAnyTokenIn:), FTS3Pattern(matchingAllTokensIn:), FTS3Pattern(matchingPhrase:) 2017-03-26 14:51:11 +02:00
Gwendal Roué 7a90b9ce23 Add availability checks for FTS3 unicode61 tokenizer, FTS4 unindexed columns, and partial indexes. 2017-03-26 14:41:15 +02:00
Gwendal Roué ae0928e686 TODO.md 2017-03-26 13:58:26 +02:00
Gwendal Roué b815ad7a8c Apply SQLCipher advice from https://discuss.zetetic.net/t/important-advisory-sqlcipher-with-xcode-8-and-new-sdks/1688 2017-03-26 13:53:39 +02:00
Gwendal Roué 06cca9033a TODO.md 2017-03-26 13:33:46 +02:00
Gwendal Roué 5302364139 [format] 2017-03-26 13:33:39 +02:00
Gwendal Roué 78b7fc6169 Workaround PRAGMA table_info bug: check against SQLite version instead of build options 2017-03-26 13:32:01 +02:00
Gwendal Roué b159c30cf1 SQLITE_CONSTRAINT_FOREIGNKEY was added in SQLite 3.7.16 (iOS 8.2+ and OS X 10.10+) 2017-03-26 13:17:59 +02:00
Gwendal Roué 5c7712bf6c PRAGMA query_only was added in SQLite 3.8.0 (iOS 8.2+ and OS X 10.10+) 2017-03-26 13:17:25 +02:00
Gwendal Roué e64b766599 Expose withoutRowID table creation option for custom SQLite builds and SQLCipher. 2017-03-26 12:48:21 +02:00
Gwendal Roué 89a852286c Reading list 2017-03-26 11:48:13 +02:00
Gwendal Roué 1e312cfbb1 TODO.md 2017-03-25 16:56:11 +01:00
Gwendal Roué 8d4522227c Replace all assertNoError and try! with throwing tests 2017-03-25 16:31:54 +01:00
Gwendal Roué eee39a7c0b Improve unexpected error reporting 2017-03-25 14:15:04 +01:00
Gwendal Roué bd58c18bb0 Simplify cursor step failure steps 2017-03-25 14:14:42 +01:00
Gwendal Roué 685b3a4f21 SQLite 3.17.0 has a big FTS5 bug: don't ship it. 2017-03-25 14:13:36 +01:00
Gwendal Roué 4e82a482d1 DatabaseCursor: test preservation of custom error codes 2017-03-25 14:12:47 +01:00
Gwendal Roué 1214e28563 Remove the "DatabaseReader.read does not prevent a queue from writing." sentence from the documentation: it is no longer true 2017-03-24 20:18:54 +01:00
Gwendal Roué 9170ed6e3a CHANGELOG.md 2017-03-24 20:12:21 +01:00
Gwendal Roué f2bb8bb8af Remove DatabaseValue.value() 2017-03-24 20:05:02 +01:00
Gwendal Roué 24d74698ef TODO.md 2017-03-24 18:39:49 +01:00
Gwendal Roué ba615c15cb Documentation, and remove DatabaseQueue.writeInTransaction 2017-03-24 18:39:14 +01:00
Gwendal Roué 88f206e7f5 New DatabaseReader.read() guarantee: database modifications are prevented 2017-03-24 09:18:24 +01:00
Gwendal Roué 511740ccd7 Warn against slow compilation in the documentation of Persistable.persistentDictionary, and strip down the documentation of the Record class hoping readers will check detailed protocol documentations (addresses #188) 2017-03-23 08:00:46 +01:00
Gwendal Roué 7a2fab1126 Stop relying on CocoaDocs since http://blog.cocoapods.org/CocoaDocs-Documentation-Sunsetting/ 2017-03-19 15:56:38 +01:00
Gwendal Roué fd435f0941 make doc with Jazzy 2017-03-19 15:49:53 +01:00
Gwendal Roué ffd5a8b321 gh-pages consistency 2017-03-19 15:49:39 +01:00
Gwendal Roué 5454e43bc4 Use Int(exactly:) and Int32(exactly:) initializers 2017-03-18 17:00:06 +01:00
Gwendal Roué a94fd2d127 TODO.md 2017-03-18 13:52:45 +01:00
Gwendal Roué 14c53c5e3e Have DatabasePool implementation better expose the write method and its readerPool as its fundamentals. 2017-03-17 09:06:13 +01:00
Gwendal Roué b25648eea1 Have DatabaseQueue implementation better expose inDatabase as its fundamental method. 2017-03-17 09:05:42 +01:00
Gwendal Roué 10d0d162b5 Performance tests against Realm 2.4.3, SQLite.swift 0.11.2 2017-03-09 17:25:35 +01:00
Gwendal Roué e5b2be4346 README.md 2017-03-07 11:14:29 +01:00
Gwendal Roué 4cea442b59 README.md 2017-03-07 11:11:02 +01:00
Gwendal Roué 532f682fc7 Typo 2017-03-07 11:10:14 +01:00
Gwendal Roué c2cd689c32 README.md 2017-03-07 11:09:00 +01:00
Gwendal Roué c3e986eb56 Document that database pools require mastery of database transactions 2017-03-04 18:19:02 +01:00
Gwendal Roué d91f4c244f Documentation 2017-03-04 18:11:25 +01:00
Gwendal Roué 22b768963f Typo 2017-03-04 18:05:54 +01:00
Gwendal Roué 57354cd1ef README.md 2017-03-04 18:00:14 +01:00
Gwendal Roué c74cc40d5c CHANGELOG.md 2017-03-04 07:22:33 +01:00
Gwendal Roué b867a74b6b CHANGELOG.md 2017-03-03 08:15:31 +01:00
Gwendal Roué 7a10486492 DatabaseError conversion to NSError preserves extended result code 2017-03-03 08:14:36 +01:00
Gwendal Roué f36b833654 CHANGELOG.md 2017-03-02 13:47:53 +01:00
Gwendal Roué ef9206088e v0.102.0 2017-03-02 13:39:09 +01:00
Gwendal Roué e141b26411 Remove done TODOs 2017-03-02 13:38:41 +01:00
Gwendal Roué 1f4da13060 Add ReleaseProcess.md to project, for quick access 2017-03-02 13:38:29 +01:00
Gwendal Roué 4ec85e2f25 Merge pull request #181 from groue/RequestFetchCount
Let all requests count, introduce Request.fetchCount()
2017-03-02 13:01:23 +01:00
Gwendal Roué 842831d729 Merge branch 'master' into RequestFetchCount 2017-03-02 13:01:13 +01:00
Gwendal Roué 39a0b5672b Merge pull request #180 from groue/Issue171
Activate extended result codes, and expose result codes as Swift constants
2017-03-02 12:59:27 +01:00
Gwendal Roué 2729892676 Merge branch 'master' into Issue171 2017-03-02 12:58:42 +01:00
Gwendal Roué 50318354a6 Merge branch 'master' into RequestFetchCount 2017-03-02 12:56:57 +01:00
Gwendal Roué 77593c8031 Fix RequestTests.swift so that it tests the Request protocol, not the concrete type that adopts it. 2017-03-02 10:54:27 +01:00
Gwendal Roué 3bfb9adb99 Document how to query external content tables (addresses #178) 2017-03-02 08:42:19 +01:00
Gwendal Roué deebf289de Rename DatabaseMigrator.registerMigrationWithDisabledForeignKeyChecks to registerMigrationWithDeferredForeignKeyCheck 2017-03-02 08:29:45 +01:00
Gwendal Roué d4e777900c #171: less TODO 2017-03-02 08:24:21 +01:00
Gwendal Roué 1b44683cfe #171: cleanup 2017-03-02 08:21:29 +01:00
Gwendal Roué 0ff53f0bd7 #171: CHANGELOG 2017-03-02 08:03:01 +01:00
Gwendal Roué a5cbf08a76 Documentation 2017-03-02 08:01:43 +01:00
Gwendal Roué 023fa8afc9 #171: Missing upgrades to the new ResultCode APIs 2017-03-02 07:57:02 +01:00
Gwendal Roué a721748de1 #171: fix-it for DatabaseError.code 2017-03-02 07:56:48 +01:00
Gwendal Roué ad112285e6 Wording 2017-03-01 14:41:34 +01:00
Gwendal Roué fe05ac9753 #171: Missing upgrades to the new ResultCode APIs 2017-03-01 14:21:14 +01:00
Gwendal Roué b873162a6f #171: Preserve some extended result code that were lost 2017-03-01 14:19:48 +01:00
Gwendal Roué 846604cce5 Merge branch 'master' into Issue171 2017-03-01 14:12:31 +01:00
Gwendal Roué b1ea970f62 #171: ResultCode tests 2017-03-01 13:57:51 +01:00
Gwendal Roué 5bcfb7f488 #171: ~= ResultCode operator 2017-03-01 13:27:19 +01:00
Gwendal Roué 1908f1b4f6 #171: Documentation 2017-03-01 13:03:54 +01:00
Gwendal Roué b0bf8e81aa Better CHANGELOG 2017-03-01 10:10:18 +01:00
Gwendal Roué 4866ba0c84 Typo 2017-03-01 09:14:45 +01:00
Gwendal Roué 8dadf42504 #171: CHANGELOG 2017-03-01 09:13:57 +01:00
Gwendal Roué fc18b15106 #171: Apply @hartbit's suggestion of having two DatabaseError properties: resultCode and extendedResultCode 2017-03-01 09:05:06 +01:00
Gwendal Roué 9b4e55be28 Documentation for Request.fetchCount() (https://github.com/groue/GRDB.swift/issues/176#issuecomment-282783884) 2017-03-01 08:24:43 +01:00
Gwendal Roué 8a4686984a Tests for Request.fetchCount() (https://github.com/groue/GRDB.swift/issues/176#issuecomment-282783884) 2017-03-01 08:06:54 +01:00
Gwendal Roué 42ebffc4fc Keep Request.fetchCount() simple (https://github.com/groue/GRDB.swift/issues/176#issuecomment-282783884) 2017-03-01 07:56:17 +01:00
Gwendal Roué 2d2c596f75 Add Request.fetchCount(). Implements https://github.com/groue/GRDB.swift/issues/176#issuecomment-282783884 2017-03-01 05:32:52 +01:00
Gwendal Roué fa464b489d TODO 2017-02-28 04:35:18 +01:00
Gwendal Roué b531504912 TODOs for #171, #172, #176, #178 2017-02-28 03:19:23 +01:00
Gwendal Roué e4a346995b #171: rename ResultCode.code into ResultCode.resultCode (@hartbit's suggestion) 2017-02-26 17:24:44 +01:00
Gwendal Roué f0d1f2387d #171: always use extended result codes 2017-02-26 15:49:14 +01:00
Gwendal Roué 7eb592df79 #171: introduce ResultCode 2017-02-26 15:36:21 +01:00
Gwendal Roué a704c0ad35 Add @hartbit to the thanks section 2017-02-25 17:07:11 +01:00
Gwendal Roué acf4077878 Merge pull request #174 from hartbit/fix-record-persistenceconflictpolicy
Fix Record's persistenceConflictPolicy
2017-02-25 15:43:56 +01:00
David Hart ba50771007 add tests 2017-02-22 23:02:44 +01:00
David Hart 898db8b7d4 fix Record getting the default implementation of persistenceConflictPolicy 2017-02-22 19:33:22 +01:00
Gwendal Roué d452a00592 Warning against FTS3Pattern initializers before iOS8.2 and macOS 10.10 2017-02-01 14:13:39 +01:00
Gwendal Roué 4ab8fb359b Restore some tests that were avoided because of linker errors (all we needed was to set deployment targets on test targets) 2017-02-01 13:48:34 +01:00
Gwendal Roué 29e6082663 Fix registerMigrationWithDisabledForeignKeyChecks for legacy sqlite 2017-02-01 13:36:20 +01:00
Gwendal Roué 7c6197b1fc TODO: don't use fts3tokenize before SQLite 3.7.17 2017-02-01 13:31:36 +01:00
Gwendal Roué 1e0e40912b GRDBiOS tests on iOS8.1 2017-02-01 13:28:08 +01:00
Gwendal Roué ff84638df8 Documentation 2017-01-31 09:06:45 +01:00
Gwendal Roué 90dee9c171 Documentation 2017-01-30 09:08:27 +01:00
Gwendal Roué 53873c7864 Rewrite the "How do I close a database connection?" FAQ 2017-01-26 06:20:48 +01:00
Gwendal Roué f60a9708b2 Link to the Xcode8.3beta branch 2017-01-25 18:20:34 +01:00
Gwendal Roué 84497bfba7 TODO.md 2017-01-24 08:53:14 +01:00
Gwendal Roué 4dfd672c04 Compound unique keys: preserve index ordering in generated SQL queries 2017-01-22 16:51:02 +01:00
Gwendal Roué d8b64aa2f4 Use sqlite3_close_v2 in GRDBCipher and GRDBCustomSQLite 2017-01-22 16:04:10 +01:00
Gwendal Roué 4968100420 Expose DatabaseMigrator.registerMigrationWithDisabledForeignKeyChecks to GRDBCipher and GRDBCustomSQLite 2017-01-22 14:37:14 +01:00
Gwendal Roué b52687f356 Documentation 2017-01-21 07:51:42 +01:00
Gwendal Roué 71d4565aa5 Typo 2017-01-20 18:12:19 +01:00
Gwendal Roué 42ff295092 v0.101.1 2017-01-20 14:03:26 +01:00
Gwendal Roué f0758e2a6c Darn 2017-01-20 14:02:27 +01:00
Gwendal Roué 33e93ea156 v0.101.0 2017-01-20 13:53:54 +01:00
Gwendal Roué 9f212184fd FetchedRecordsController.allowBackgroundChangesTracking(in:) 2017-01-20 12:16:14 +01:00
Gwendal Roué 1c16d4bd3f Merge branch 'BackgroundFetchedRecordsController' of github.com:groue/GRDB.swift 2017-01-20 12:07:19 +01:00
Gwendal Roué 0008ffc735 TransactionObserver: update documentation about database event filtering 2017-01-20 11:13:57 +01:00
Gwendal Roué e5dce929bb Data Protection documentation 2017-01-20 09:12:22 +01:00
Gwendal Roué 40bcf96c2b Data Protection documentation 2017-01-20 08:54:23 +01:00
Gwendal Roué 519d4470e3 Drop Configuration.fileAttributes 2017-01-20 08:22:46 +01:00
Gwendal Roué cdf18b5480 README 2017-01-19 17:12:00 +01:00
Gwendal Roué dbe4965438 DatabaseEventKind.tableName 2017-01-19 10:12:30 +01:00
Gwendal Roué 899b9b07dd Merge branch 'master' of github.com:groue/GRDB.swift into BackgroundFetchedRecordsController 2017-01-19 10:10:38 +01:00
Gwendal Roué 54d8a03e87 README 2017-01-19 08:56:34 +01:00
Gwendal Roué 052ad87da0 README 2017-01-19 07:56:02 +01:00
Gwendal Roué 2a515b1d8d README 2017-01-19 07:55:20 +01:00
Gwendal Roué dad48df039 TODO 2017-01-18 16:05:49 +01:00
Gwendal Roué ee798df57d Documentation 2017-01-18 15:54:13 +01:00
Gwendal Roué eed21b8f8f Typo 2017-01-18 15:48:24 +01:00
Gwendal Roué 29938f5703 Documentation 2017-01-18 15:47:45 +01:00
Gwendal Roué 52bcf97d73 TODO.md 2017-01-18 15:02:06 +01:00
Gwendal Roué 9934184f5f README 2017-01-18 08:51:48 +01:00
Gwendal Roué fdf33cbf81 Experimental: FetchedRecordsController.allowBackgroundTracking 2017-01-17 15:01:14 +01:00
Gwendal Roué 34458bc86e README 2017-01-17 09:08:52 +01:00
Gwendal Roué 9b061b3aa7 README 2017-01-17 09:06:34 +01:00
Gwendal Roué 2fa6acef1c README 2017-01-17 09:01:48 +01:00
Gwendal Roué 3afb1f145a README 2017-01-17 08:54:01 +01:00
Gwendal Roué b03b75d125 README 2017-01-17 08:53:17 +01:00
Gwendal Roué b9756f0bdc README 2017-01-17 08:39:52 +01:00
Gwendal Roué c3234cb79f README 2017-01-17 08:33:51 +01:00
Gwendal Roué 828ab97837 README 2017-01-17 08:32:26 +01:00
Gwendal Roué ac66510f32 README organization 2017-01-17 08:31:27 +01:00
Gwendal Roué 599397b6f7 Typo 2017-01-17 08:30:42 +01:00
Gwendal Roué e230f5d358 Introduction 2017-01-17 08:29:36 +01:00
Gwendal Roué 91486f1b70 TODO.md 2017-01-12 08:04:01 +01:00
Gwendal Roué 95e6de8654 Time to jump into 2017 2017-01-10 14:19:41 +01:00
Gwendal Roué 784baaec46 v0.100.0 2017-01-10 13:58:27 +01:00
Gwendal Roué 6adaca568f Copyright (C) 2017 Gwendal Roué 2017-01-10 13:53:13 +01:00
Gwendal Roué bcdcceb809 Cleanup 2017-01-10 13:38:51 +01:00
Gwendal Roué de3d075ff2 Updated documentation for #160 2017-01-10 13:33:37 +01:00
Gwendal Roué c5f3aa21b3 FetchedRecordsController documentation 2017-01-10 13:05:17 +01:00
Gwendal Roué 9831b0e3d4 FetchedRecordsController.setRequest() uses TypedRequest 2017-01-10 08:23:09 +01:00
Gwendal Roué 24a8df801f Upgrade SQLite to v3.16.2 2017-01-10 08:16:00 +01:00
Gwendal Roué e0cfd404a1 Update GRDBDemoiOS 2017-01-10 08:03:21 +01:00
Gwendal Roué 0e62c3455b GRDBiOS tests: enable code coverage 2017-01-10 07:59:56 +01:00
Gwendal Roué 9cd5a7926a TODO: upgrade SQLite to v3.16.2 2017-01-06 18:54:00 +01:00
Gwendal Roué 8e4995c8d9 Upgrade SQLite to v3.16.1 2017-01-06 08:51:25 +01:00
Gwendal Roué ca5fc1e8fc Documentation 2017-01-06 08:43:16 +01:00
Gwendal Roué 14dca4667a Simplify FetchedRecordsController callbacks API 2017-01-06 08:40:09 +01:00
Gwendal Roué ebff14adac Cleanup 2017-01-06 08:24:50 +01:00
Gwendal Roué 51f02ed46e Move TableMapping.primaryKeyFunction and primaryKeyRowComparator into TableMapping.swift 2017-01-06 08:19:07 +01:00
Gwendal Roué 03740d0918 Remove FetchedRecordsController compareRecordsByPrimaryKey initializer option 2017-01-06 08:16:57 +01:00
Gwendal Roué c83a16e22e FetchedRecordsController initialisers use TypedRequest 2017-01-06 08:12:14 +01:00
Gwendal Roué e1bf662884 TODO post #160 2017-01-04 06:53:57 +01:00
Gwendal Roué d866bc9044 Row adopts Hashable 2017-01-04 06:52:57 +01:00
Gwendal Roué fd0e4c20ee CHANGELOG.md 2017-01-04 06:47:53 +01:00
Gwendal Roué 55ca0a80b6 Restore test that one can change the set of columns tracked by a fetched records controller 2017-01-04 06:43:17 +01:00
Gwendal Roué eeaf3dc2cf Merge branch 'fetched_records_events_platforms' of https://github.com/reTXT/GRDB.swift 2017-01-04 06:32:18 +01:00
Gwendal Roué 467b948349 Another diff algorithm to look at 2017-01-03 16:40:47 +01:00
Kevin Wooten f368af3d02 Support “TableViewEvent” on all all platforms
* TableViewEvent features of FetchedRecordsController supported on all platforms
* Renamed TableViewEvent to FetchedRecordsChangeEvent
* Renamed TableViewChange to FetchedRecordsChange
2016-12-30 00:30:23 -07:00
Gwendal Roué 0f34ee7d16 Revert "DatabaseError.code is now Database.ResultCode"
This reverts commit 968942f128.
2016-12-29 13:32:29 +01:00
Gwendal Roué 2fe89fc41b Documentation 2016-12-28 13:05:29 +01:00
Gwendal Roué 968942f128 DatabaseError.code is now Database.ResultCode 2016-12-28 11:55:47 +01:00
Gwendal Roué b5fae096a9 Typo 2016-12-23 07:28:48 +01:00
Gwendal Roué 5cad9a1071 Documentation 2016-12-23 07:28:22 +01:00
Gwendal Roué f4a350c3d0 Typo 2016-12-23 07:22:11 +01:00
Gwendal Roué 89885ed4d9 Document the scope of DatabaseWriter DatabaseReader (#159) 2016-12-23 07:18:39 +01:00
Gwendal Roué 612878d3b1 v0.99.2 2016-12-22 08:30:45 +01:00
Gwendal Roué 65d0bb6a90 TODO.md 2016-12-22 08:29:07 +01:00
Gwendal Roué 484b440816 Database.cachedSelectStatement() no longer returns a statement that can not be reused because it has already failed. 2016-12-21 18:59:23 +01:00
Gwendal Roué 92d78515c4 Failing test for cached select statements that have failed 2016-12-21 18:53:55 +01:00
Gwendal Roué 341bedd7ca Failing test for cached select statements that have failed 2016-12-21 18:46:01 +01:00
Gwendal Roué e9f54f1841 TODO.md 2016-12-21 17:52:58 +01:00
Gwendal Roué 4c4af5f1fc TODO.md 2016-12-21 09:11:23 +01:00
Gwendal Roué 2558cd9356 v0.99.1 2016-12-21 06:06:18 +01:00
Gwendal Roué 4670026c92 Fix #157 for virtual tables 2016-12-21 06:06:12 +01:00
Gwendal Roué 302b9c2ac5 Fix #156 and #157 2016-12-21 05:44:19 +01:00
Gwendal Roué 000f1d02c3 Fix #156? 2016-12-20 19:17:12 +01:00
Gwendal Roué 63ce8429f2 TODO.md 2016-12-20 17:45:59 +01:00
Gwendal Roué 61993c4a50 CHANGELOG.md 2016-12-20 06:19:20 +01:00
Gwendal Roué c248efc9fe v0.99.0 2016-12-20 06:17:43 +01:00
Gwendal Roué ec64ca2865 Documentation & Changelog 2016-12-20 06:15:03 +01:00
Gwendal Roué d4fe7467b6 truncate optimization TODO 2016-12-20 06:14:41 +01:00
Gwendal Roué e8a229103a Fix #156 2016-12-20 06:01:28 +01:00
Gwendal Roué e6cdab37b0 TODO.md 2016-12-19 10:12:56 +01:00
Gwendal Roué 26c88ffaec TODO.md 2016-12-18 14:48:20 +01:00
Gwendal Roué abf1c144c5 TODO.md 2016-12-16 19:58:13 +01:00
Gwendal Roué c4e04d6e07 Tests for FetchedRecordsController error handling 2016-12-16 19:46:46 +01:00
Gwendal Roué ed4826a67f FetchedRecordsController error handling 2016-12-16 19:46:12 +01:00
Gwendal Roué dee2df9e45 TODO.md 2016-12-16 18:45:40 +01:00
Gwendal Roué acabd11d40 CHANGELOG.md 2016-12-16 14:21:47 +01:00
Gwendal Roué 8adea6ba1e TODO.md 2016-12-16 14:20:50 +01:00
Gwendal Roué c36be55c2f FetchedRecordsController error handling WIP 2016-12-16 09:09:50 +01:00
Gwendal Roué 5355555568 Typo 2016-12-16 07:42:34 +01:00
Gwendal Roué 176735d4cf v0.98.0 2016-12-16 05:35:39 +01:00
Gwendal Roué 3e01bca690 Documentation 2016-12-16 05:25:18 +01:00
Gwendal Roué dd99d96c24 Documentation: links to StatementArgument reference 2016-12-16 05:12:34 +01:00
Gwendal Roué 22e8c59031 TODO.md 2016-12-16 05:02:37 +01:00
Gwendal Roué 44cefc89e4 Documentation for StatementArguments.append(contentsOf:) and operators +, &+, += 2016-12-16 05:02:27 +01:00
Gwendal Roué df15249f23 Tests for StatementArguments.append(contentsOf:) and operators +, &+, += 2016-12-16 05:02:01 +01:00
Gwendal Roué b737321cbd Rows expressed as dictionary literals now preserve column ordering, and allow duplicated column names 2016-12-16 05:01:07 +01:00
Gwendal Roué 319380ec6c CHANGELOG.md 2016-12-15 21:45:20 +01:00
Gwendal Roué cae7cad5d4 TODO.md 2016-12-15 21:45:11 +01:00
Gwendal Roué d4c7b41897 StatementArguments.append(contentsOf:) returns the updated values; operators +, &+, += 2016-12-15 21:39:28 +01:00
Gwendal Roué 0ecf6b5aa1 Drop StatementArguments + StatementArguments (because it allows [1, 2] + ["foo": 1] to compile) 2016-12-15 17:50:56 +01:00
Gwendal Roué cb51c03992 StatementArguments + StatementArguments 2016-12-15 17:47:01 +01:00
Gwendal Roué 5dca5fe3cb StatementArguments.append(contentsOf:) refuses to update named arguments 2016-12-15 17:38:33 +01:00
Gwendal Roué a7acd50159 StatementArguments.append(contentsOf:) 2016-12-15 17:26:23 +01:00
Gwendal Roué e732ec9fe4 v0.97.0 2016-12-15 08:56:46 +01:00
Gwendal Roué e4070c8b5e Clarify scope of mismatched Swift/SQLite transaction state 2016-12-15 08:49:38 +01:00
Gwendal Roué b171b5904b CHANGELOG.md 2016-12-15 08:48:34 +01:00
Gwendal Roué cc89c994c8 Remove useless self. 2016-12-15 08:13:33 +01:00
Gwendal Roué fc2689e207 Fix Pool.get when an error prevents a pool item from being created (counting semaphore wasn't signaled). This fixes DatabasePool.read when read connection can not be established. Tests. 2016-12-15 08:09:17 +01:00
Gwendal Roué a5979b2e47 Documentation 2016-12-15 05:16:36 +01:00
Gwendal Roué 2eb8e32705 Documentation 2016-12-15 05:12:31 +01:00
Gwendal Roué b32984b1d6 Document improved error handling of DatabasePool.readFromCurrentState() and support for raw BEGIN/COMMIT/ROLLBACK transaction statements 2016-12-15 05:11:25 +01:00
Gwendal Roué 7e2fd9e690 DatabasePool.readFromCurrentState throws if it can't acquire an isolated database access 2016-12-15 04:57:31 +01:00
Gwendal Roué a96dac8205 Now that we support free BEGIN/COMMIT transaction statements, DatabaesPool.readFromCurrentState will be able to handle read errors 2016-12-15 04:00:00 +01:00
Gwendal Roué 6afc2fd75a Test that DatabasePool.read and readFromCurrentState open a transaction 2016-12-15 03:58:44 +01:00
Gwendal Roué e44bd4684b Fix SerializedDatabase crash when database is deallocated in its own queue 2016-12-15 03:57:46 +01:00
Gwendal Roué 115158a70e Cleanup 2016-12-14 20:19:10 +01:00
Gwendal Roué 63577feca4 Documentation 2016-12-14 18:49:11 +01:00
Gwendal Roué e8b91bf617 TODO.md 2016-12-14 18:47:42 +01:00
Gwendal Roué 567e6f1d82 TODO 2016-12-14 12:55:22 +01:00
Gwendal Roué 2b9b8ce536 Cleanup 2016-12-14 12:53:11 +01:00
Gwendal Roué a0f4cb9271 Fix failing tests for TransactionObserver 2016-12-14 12:49:33 +01:00
Gwendal Roué 46f24c582c Fix failing tests for Database.isInsideTransaction 2016-12-14 08:59:57 +01:00
Gwendal Roué 2068710a30 Failing test for Database.isInsideTransaction when transaction is implicitly rollbacked 2016-12-14 08:19:13 +01:00
Gwendal Roué 0568b5c6de Tests for free BEGIN/COMMIT/ROLLBACK statements 2016-12-14 08:11:20 +01:00
Gwendal Roué a0d9b9fbe8 Support for free BEGIN/COMMIT/ROLLBACK statements 2016-12-14 08:07:42 +01:00
Gwendal Roué 2190e449c1 Documentation fix 2016-12-13 09:13:46 +01:00
Gwendal Roué f665b56e2b Documentation 2016-12-12 08:46:50 +01:00
Gwendal Roué 041b6abd59 Documentation 2016-12-12 08:42:02 +01:00
Gwendal Roué fb7ace729c Documentation 2016-12-12 08:41:18 +01:00
Gwendal Roué a68ed01003 Documentation 2016-12-12 08:38:03 +01:00
Gwendal Roué 95af80acde Documentation 2016-12-12 08:21:27 +01:00
Gwendal Roué 18664b7e7e Documentation 2016-12-12 08:13:31 +01:00
Gwendal Roué 37f9634389 v0.96.0 2016-12-11 21:32:31 +01:00
Gwendal Roué a995b76f24 Request.adapted(_:) example 2016-12-11 21:13:18 +01:00
Gwendal Roué cb81e50f71 Request.adapted(_:) 2016-12-11 21:07:52 +01:00
Gwendal Roué f8ba151b76 Typo 2016-12-11 08:00:13 +01:00
Gwendal Roué a0af67fce8 Documentation 2016-12-11 07:58:49 +01:00
Gwendal Roué 1467936c89 Typo 2016-12-11 07:57:36 +01:00
Gwendal Roué 0d3008b839 TODO.md 2016-12-10 05:37:35 +01:00
Gwendal Roué 517821632a TODO.md 2016-12-10 05:29:37 +01:00
Gwendal Roué 0ed3e540c2 Typo 2016-12-10 05:20:27 +01:00
Gwendal Roué c96bb16db6 Typo 2016-12-09 15:34:24 +01:00
Gwendal Roué bd82441883 CHANGELOG.md 2016-12-09 15:32:41 +01:00
Gwendal Roué 18421cde49 v0.95.0 2016-12-09 13:39:21 +01:00
Gwendal Roué 6dea26932e Merge branch 'master' of github.com:groue/GRDB.swift into TypedFetchRequest 2016-12-09 13:38:21 +01:00
Gwendal Roué 258768505e Documentation 2016-12-09 13:32:00 +01:00
Gwendal Roué 8caa20b746 Refactor Row Adapters documentation 2016-12-09 13:26:02 +01:00
Gwendal Roué 5efc39af6a Documentation 2016-12-09 12:49:05 +01:00
Gwendal Roué 66daa2eb29 RangeRowAdapter(CountableClosedRange<Int>) 2016-12-09 09:54:25 +01:00
Gwendal Roué 02687991e0 #153: GRDB requires Xcode 8.1+ 2016-12-09 09:44:20 +01:00
Gwendal Roué 1e64592a39 Documentation 2016-12-09 09:02:49 +01:00
Gwendal Roué 9d2b074bec Restore MyPlayground content 2016-12-09 08:56:12 +01:00
Gwendal Roué 384a6f3d36 Documentation 2016-12-09 08:54:13 +01:00
Gwendal Roué 754d972253 Documentation 2016-12-09 08:50:31 +01:00
Gwendal Roué 9a29a6de5a Documentation 2016-12-09 08:49:23 +01:00
Gwendal Roué f6513932b0 Documentation 2016-12-09 08:48:26 +01:00
Gwendal Roué 368f91c4c5 Documentation 2016-12-08 21:02:03 +01:00
Gwendal Roué f1f40f0289 CHANGELOG.md 2016-12-08 19:14:08 +01:00
Gwendal Roué 1d6671c11a Introduce RangeRowAdapter 2016-12-08 19:07:11 +01:00
Gwendal Roué 9a0fa2f8b3 Documentation 2016-12-08 18:41:16 +01:00
Gwendal Roué 9b6ec9ffd3 Documentation 2016-12-08 18:28:23 +01:00
Gwendal Roué e9b8fe5018 Documentation 2016-12-08 18:09:31 +01:00
Gwendal Roué 4a5cec8ed5 Documentation 2016-12-08 18:07:29 +01:00
Gwendal Roué fa6f0ba77c Documentation 2016-12-08 18:05:04 +01:00
Gwendal Roué a8fc58e143 Documentation 2016-12-08 18:04:36 +01:00
Gwendal Roué 57961e04b3 Documentation 2016-12-08 18:00:36 +01:00
Gwendal Roué 6628aa7eaf Documentation 2016-12-08 17:56:27 +01:00
Gwendal Roué b7e492e03d Documentation 2016-12-08 17:24:15 +01:00
Gwendal Roué 2f2dc86c9d Documentation 2016-12-08 17:20:32 +01:00
Gwendal Roué bfb2ff9390 Documentation 2016-12-08 16:02:35 +01:00
Gwendal Roué cbd14c4b8c Documentation 2016-12-08 14:03:22 +01:00
Gwendal Roué cb08660a78 Rename FetchRequest -> Request 2016-12-08 13:56:05 +01:00
Gwendal Roué 87e1b075e0 Remove public qualifiers from README.md 2016-12-08 09:08:33 +01:00
Gwendal Roué 26a3682c6e Documentation 2016-12-08 09:07:05 +01:00
Gwendal Roué be30a2463a Documentation 2016-12-08 08:50:29 +01:00
Gwendal Roué cc1df37725 Documentation 2016-12-08 08:50:00 +01:00
Gwendal Roué 3510032050 Documentation 2016-12-08 08:48:20 +01:00
Gwendal Roué 07aecd3a95 Fix failing tests of TypedFetchRequest 2016-12-08 08:43:58 +01:00
Gwendal Roué 0e2a96b402 Failing tests from TypedFetchRequest 2016-12-08 08:39:06 +01:00
Gwendal Roué 603c121874 Documentation 2016-12-08 08:09:49 +01:00
Gwendal Roué 9e634196bf Public SQLFetchRequest initializer 2016-12-08 07:48:28 +01:00
Gwendal Roué 4f20ea4570 Documentation 2016-12-08 07:14:58 +01:00
Gwendal Roué c851708b3d Documentation 2016-12-08 06:53:58 +01:00
Gwendal Roué fd6a693bc8 Documentation 2016-12-08 06:48:53 +01:00
Gwendal Roué bab56b4c9d Documentation 2016-12-08 06:46:39 +01:00
Gwendal Roué 970da50910 Expose SQLFetchRequest, and cleanup 2016-12-07 23:20:58 +01:00
Gwendal Roué 0008e4b645 FetchedRecordsController's ObservedRequest adopts TypedFetchRequest 2016-12-07 22:39:53 +01:00
Gwendal Roué 89e7a62d99 Introduce AnyFetchRequest, TypedFetchRequest, AnyTypedFetchRequest 2016-12-07 22:21:19 +01:00
Gwendal Roué 74e89c542a Cleanup 2016-12-07 18:45:14 +01:00
Gwendal Roué d441483201 TODO.md 2016-12-07 11:07:57 +01:00
Gwendal Roué f11d4fa613 v0.94.0 2016-12-07 10:48:25 +01:00
Gwendal Roué 11f9880ccf Documentation 2016-12-07 10:12:31 +01:00
Gwendal Roué 8c440961c5 Database.columnCount(in:) 2016-12-07 10:10:59 +01:00
Gwendal Roué 8f5d7da934 Documentation 2016-12-07 09:03:15 +01:00
Gwendal Roué 807347da80 v0.93.1 2016-12-07 08:55:52 +01:00
Gwendal Roué 9364491316 CHANGELOG.md 2016-12-07 08:54:34 +01:00
Gwendal Roué 255e12849e Fix failing test for change tracking of wrapped Record 2016-12-07 08:46:02 +01:00
Gwendal Roué 5c0fe81dcf Failing test for change tracking of wrapped Record 2016-12-07 08:31:47 +01:00
Gwendal Roué e34dee8852 Documentation 2016-12-05 19:40:25 +01:00
Gwendal Roué a803420576 Documentation 2016-12-05 19:32:50 +01:00
Gwendal Roué a1939bc295 Documentation 2016-12-05 19:31:02 +01:00
Gwendal Roué 8c7bbd937f Documentation 2016-12-05 19:19:59 +01:00
Gwendal Roué c87b2eaf7b Documentation 2016-12-05 13:44:57 +01:00
Gwendal Roué f156718d86 Documentation 2016-12-05 13:44:10 +01:00
Gwendal Roué 9cabfacb99 Documentation 2016-12-05 13:42:32 +01:00
Gwendal Roué 377237d7c0 Documentation 2016-12-05 13:35:36 +01:00
Gwendal Roué 13f2611b25 Documentation 2016-12-05 13:32:23 +01:00
Gwendal Roué 519dfd3be7 Update "fetching methods don't fail" guarantee 2016-12-05 13:27:31 +01:00
Gwendal Roué c9c8d23ed5 Add a 3rd guarantee 2016-12-05 13:17:22 +01:00
Gwendal Roué ed4ceb41b5 Documentation 2016-12-05 10:06:58 +01:00
Gwendal Roué fb4643630b Documentation 2016-12-05 09:23:09 +01:00
Gwendal Roué 999c3be21a Documentation 2016-12-05 09:20:29 +01:00
Gwendal Roué 0793a0638e Documentation 2016-12-05 09:13:45 +01:00
Gwendal Roué 8ad1d93cc6 Documentation 2016-12-05 08:23:49 +01:00
Gwendal Roué afb4c9a00d Documentation 2016-12-05 08:15:48 +01:00
Gwendal Roué 93d9516a07 Minor 2016-12-04 15:42:31 +01:00
Gwendal Roué 7950f23b6d Typo 2016-12-04 09:34:58 +01:00
Gwendal Roué 178e206d19 v0.93.0 2016-12-04 07:42:13 +01:00
Gwendal Roué d157308306 Upgrade SQLite to v3.15.2 2016-12-04 07:35:54 +01:00
Gwendal Roué 261eb19fea Documentation 2016-12-04 06:51:14 +01:00
Gwendal Roué 6a973421e3 Fix typo 2016-12-03 08:48:14 +01:00
Gwendal Roué 325110c0cd Documentation 2016-12-03 08:12:19 +01:00
Gwendal Roué 184360925d Documentation 2016-12-02 21:20:08 +01:00
Gwendal Roué 58710196ca CHANGELOG.md 2016-12-02 21:18:48 +01:00
Gwendal Roué a3c57a01d6 Documentation 2016-12-02 20:05:00 +01:00
Gwendal Roué 63d26c2a51 Documentation 2016-12-02 19:44:02 +01:00
Gwendal Roué 8cd824f66f Documentation 2016-12-02 19:43:30 +01:00
Gwendal Roué 1652990324 Rewrite readFromCurrentState documentation 2016-12-02 19:40:33 +01:00
Gwendal Roué 28221e398e Documentation 2016-12-02 14:23:17 +01:00
Gwendal Roué 49fde8158f Documentation 2016-12-02 14:02:17 +01:00
Gwendal Roué 59d1526a88 Documentation 2016-12-02 13:58:17 +01:00
Gwendal Roué 36fdf1f67b Documentation 2016-12-02 13:57:19 +01:00
Gwendal Roué a2771c262b Documentation 2016-12-02 13:56:34 +01:00
Gwendal Roué de4e753429 Documentation 2016-12-02 13:13:44 +01:00
Gwendal Roué cac9104769 Documentation 2016-12-02 13:09:39 +01:00
Gwendal Roué f56cb03a09 Documentation 2016-12-02 12:59:43 +01:00
Gwendal Roué 911d3ad722 Documentation: add a 3rd concurrency rule 2016-12-02 12:52:55 +01:00
Gwendal Roué 72a1984331 v0.92.1 2016-12-02 08:40:06 +01:00
Gwendal Roué 67035b8422 Database.execute(_:) iterates all rows of statements 2016-12-02 08:28:24 +01:00
Gwendal Roué 1c9416fbed Cleanup 2016-12-02 06:38:13 +01:00
Gwendal Roué cf25ced2e6 Documentation 2016-12-02 06:04:47 +01:00
Gwendal Roué 4003697850 TODO 2016-12-02 05:29:08 +01:00
Gwendal Roué 7f48c7abbe v0.92.0 2016-12-01 19:35:30 +01:00
Gwendal Roué b8d924ab6f Restore DatabasePool in a stable state 2016-12-01 19:17:19 +01:00
Gwendal Roué b58a4e90da WIP DatabaseWriter/DatabaseReader improvements 2016-12-01 18:13:00 +01:00
Gwendal Roué f781da41a4 WIP: the recent failing tests of DatabasePool.readFromCurrentState, a paramount brick of FetchedRecordsController, have led to a refactoring of the DatabaseWriter protocol, and DatabasePool.write { ... } always executing a transaction. 2016-12-01 14:12:20 +01:00
Gwendal Roué c0695e80a8 Fix failing DatabasePool tests 2016-12-01 10:44:28 +01:00
Gwendal Roué 019363e56b Failing tests for DatabasePool.read 2016-12-01 10:44:18 +01:00
Gwendal Roué bf76567fdf Remove useless code 2016-12-01 10:43:10 +01:00
Gwendal Roué e64250c519 Documentation 2016-12-01 09:27:16 +01:00
Gwendal Roué 4d190cd055 Documentation 2016-12-01 09:24:56 +01:00
Gwendal Roué fe02fd7284 Documentation 2016-12-01 09:23:56 +01:00
Gwendal Roué d73ced98ad Documentation 2016-12-01 09:22:22 +01:00
Gwendal Roué ee5f915cca Documentation 2016-12-01 09:20:34 +01:00
Gwendal Roué d801f1f5fb Failing test for DatabasePool.readFromCurrentState 2016-12-01 08:56:04 +01:00
Gwendal Roué bd32afbed2 Rename DatabaseWriter.readFromWrite to readFromCurrentState 2016-12-01 08:55:47 +01:00
Gwendal Roué 226d98cf6b CHANGELOG.md 2016-12-01 06:35:34 +01:00
Gwendal Roué dc3b4d3770 CHANGELOG.md 2016-12-01 06:31:39 +01:00
Gwendal Roué 409169061e CHANGELOG.md 2016-12-01 06:30:27 +01:00
Gwendal Roué c539166747 Cleanup 2016-12-01 06:08:30 +01:00
Gwendal Roué 2bb199bc25 CHANGELOG.md 2016-12-01 05:20:27 +01:00
Gwendal Roué 6da9c50b9d CHANGELOG.md 2016-12-01 05:19:00 +01:00
Gwendal Roué 8118f781d9 v0.91.0 2016-11-30 20:26:19 +01:00
Gwendal Roué 2e2f28d1bb Documentation 2016-11-30 20:24:17 +01:00
Gwendal Roué 316bb91625 Documentation 2016-11-30 20:23:22 +01:00
Gwendal Roué 263adb157c Update tests for SQLCipher 2016-11-30 19:34:09 +01:00
Gwendal Roué 18937bdcc4 Fixit files belong to GRDB 2016-11-30 18:49:17 +01:00
Gwendal Roué 948d7498bd Expose fixit files into CocoaPods 2016-11-30 18:35:38 +01:00
Gwendal Roué 59ff18b508 Thanks @kdubb in the README 2016-11-30 14:07:19 +01:00
Gwendal Roué baa9501c65 Fix-its for removed APIs. Update GRDBDemoiOS for FetchedRecordsController changes 2016-11-30 13:57:46 +01:00
Gwendal Roué 5c44f55ef6 FetchedRecordsController: remove some crash opportunities by compiling the fetch request statement right from the initializer and the setRequest() method. 2016-11-30 13:27:51 +01:00
Gwendal Roué 095778cf0f Documentation 2016-11-30 10:53:57 +01:00
Gwendal Roué 2cec3f29d1 Statement.fetchCursor() no longer throws. TODO: Type.fetchCursor(statement) should not throw 2016-11-30 09:18:22 +01:00
Gwendal Roué 9523b88d77 CHANGELOG.md 2016-11-30 09:13:02 +01:00
Gwendal Roué 6bcab179d1 Classify all try! and fatalError into TODO, Programmer Error, or GRDB bug that needs to be fixed. 2016-11-30 08:56:45 +01:00
Gwendal Roué fc1fdab51a Documentation 2016-11-29 22:35:05 +01:00
Gwendal Roué f9bb3defde Documentation 2016-11-29 22:34:12 +01:00
Gwendal Roué 6075a92905 Documentation 2016-11-29 22:14:45 +01:00
Gwendal Roué f495edfb3a Improve Cursor test coverage 2016-11-29 21:11:12 +01:00
Gwendal Roué 6af47fa6ee CHANGELOG.md 2016-11-29 19:03:15 +01:00
Gwendal Roué 972789dba3 Replace Array(Type.fetchCursor()) with Type.fetchAll() 2016-11-29 19:02:58 +01:00
Gwendal Roué cec1ed8d3d IteratorCursor has public initializers. Add joined() method for cursors of sequences. 2016-11-29 19:02:10 +01:00
Gwendal Roué 374963167a Documentation 2016-11-29 17:29:25 +01:00
Gwendal Roué ccb5826a25 Documentation 2016-11-29 14:27:15 +01:00
Gwendal Roué 527aed0ea3 Documentation 2016-11-29 14:17:41 +01:00
Gwendal Roué a8e266377c Documentation 2016-11-29 12:02:29 +01:00
Gwendal Roué de57dc9410 TODO: think about supporting Cursor's underestimatedCount 2016-11-29 08:49:58 +01:00
Gwendal Roué 617f0c8c17 TODO: more Cursor methods so that it looks more like a sequence 2016-11-29 08:47:34 +01:00
Gwendal Roué 2e73199153 Cleanup FlattenCursor 2016-11-29 08:41:13 +01:00
Gwendal Roué 5b0b674988 DatabaseStore: *really* expose initialization error (addresses https://github.com/groue/GRDB.swift/pull/148#issuecomment-263376526) 2016-11-29 08:21:43 +01:00
Gwendal Roué d85a74570d DatabaseStore: expose initialization error (addresses https://github.com/groue/GRDB.swift/pull/148#issuecomment-263376526) 2016-11-29 08:20:36 +01:00
Gwendal Roué bb1f8aab24 Drop Cursor.lazy 2016-11-29 06:35:09 +01:00
Gwendal Roué 0c4fb36827 Add RowFetchTests 2016-11-28 20:48:38 +01:00
Gwendal Roué ec2017ff72 Cursor.enumerated, filter, flatMap, map now return cursors. Cursor.lazy returns a lazy sequence. Introduce AnyCursor. Force Cursor types to be classes. 2016-11-28 20:34:53 +01:00
Gwendal Roué f3cc0a07bc Update sample playgrounds 2016-11-28 16:33:14 +01:00
Gwendal Roué 5e2dc95331 DatabaseValueConvertible.fetchOne(): avoid double DatabaseValue conversion 2016-11-28 08:46:57 +01:00
Gwendal Roué ee99abc266 Replace fetchCursor().next() with fetchOne() 2016-11-28 08:41:59 +01:00
Gwendal Roué cbf4ab797d TODO.md 2016-11-28 08:35:24 +01:00
Gwendal Roué bbe0bfadd9 #147: fetchCursor, fetchAll & fetchOne all throw sqlite3_prepare_v2 errors, sqlite3_step errors, and conversion errors (for DatabaseValueConvertible) 2016-11-27 20:13:58 +01:00
Gwendal Roué 35414e0afd Update GRDBProfiling app 2016-11-27 19:29:50 +01:00
Gwendal Roué 90e99aac3b TODO.md 2016-11-27 19:09:49 +01:00
Gwendal Roué 59506a97d6 Cleanup 2016-11-27 19:08:25 +01:00
Gwendal Roué ebf9b0e4f1 Simplify tests for RowConvertible fetch requests 2016-11-27 18:44:54 +01:00
Gwendal Roué b85a8b8b0b #147: DatabaseValueConvertible.fetchOne() can throw conversion errors 2016-11-27 18:21:04 +01:00
Gwendal Roué f8029a6dc9 Remove a couple try! 2016-11-27 15:38:36 +01:00
Gwendal Roué 95eb9afeef Cleanup 2016-11-27 15:37:03 +01:00
Gwendal Roué 87024f0426 QueryInterfaceSelectQueryDefinition.makeDeleteStatement() throws 2016-11-27 15:26:23 +01:00
Gwendal Roué 09697f2593 DAO.init() throws DatabaseError instead of crashing whenever table does not exist, or database can't be accessed 2016-11-27 15:23:00 +01:00
Gwendal Roué e99e9f3e40 Migration.runWithDisabledForeignKeys(): throw error from PRAGMA foreign_keys = ON 2016-11-27 15:18:25 +01:00
Gwendal Roué b8c05e551d Cleanup 2016-11-27 15:14:38 +01:00
Gwendal Roué 829eb7d3a2 SelectStatement.SelectionInfo cleanup 2016-11-27 15:12:08 +01:00
Gwendal Roué 268080cbc5 #147: FetchedRecordsController.performFetch() can now throw database errors; remove work around for SR-2623 2016-11-27 08:19:43 +01:00
Gwendal Roué 8d9d0dd826 DatabasePool.nonIsolatedRead(_:) can now throw on macOS, too 2016-11-27 06:26:50 +01:00
Gwendal Roué 195c201f87 #147: DatabasePool.read(_:) and DatabasePool.nonIsolatedRead(_:) can now throw database errors. 2016-11-26 23:44:14 +01:00
Gwendal Roué ceb0fc4db9 TODO.md 2016-11-26 23:42:36 +01:00
Gwendal Roué 6121a9b48c Remove dead code 2016-11-26 23:22:34 +01:00
Gwendal Roué e3138154f1 Update performance tests 2016-11-26 23:18:53 +01:00
Gwendal Roué ac6c7f6a35 #147: fetchAll() and fetchOne() can now throw database errors. 2016-11-26 22:38:40 +01:00
Gwendal Roué af6e31dcdf #147: The fetch method have been removed, along with DatabaseSequence and DatabaseIterator. 2016-11-26 21:14:10 +01:00
Gwendal Roué 6f158e3382 TODO.md 2016-11-26 18:52:25 +01:00
Gwendal Roué 81504bba1e #147: DatabaseCursor.flatMap() 2016-11-26 16:10:39 +01:00
Gwendal Roué 66bedf46a1 #147: DatabaseCursor.enumerated() 2016-11-26 15:19:40 +01:00
Gwendal Roué a196ac03b1 #147: tests for DatabaseCursor.filter, forEach, map, reduce; dropped DatabaseCursor.enumerated since it can't be implemented yet 2016-11-26 14:39:09 +01:00
Gwendal Roué ae1010166a #147: record.exists(_:) can now throw a database error 2016-11-26 11:36:07 +01:00
Gwendal Roué a548212f27 #147: tests for QueryInterfaceRequest.fetchCursor(_:) and (RowConvertible & TableMapping).fetchCursor(_:) 2016-11-26 11:20:35 +01:00
Gwendal Roué 1aeb6d0d9e bugfix 2016-11-26 11:13:36 +01:00
Gwendal Roué 612c963105 TODO 2016-11-26 10:23:41 +01:00
Gwendal Roué 173a60eac6 bugfix 2016-11-26 10:23:36 +01:00
Gwendal Roué 8411efc8ef #147: tests for RowConvertible.fetchCursor(_:keys:) methods 2016-11-26 10:19:56 +01:00
Gwendal Roué af8fe35222 #147: tests for RowConvertible.fetchCursor() methods 2016-11-26 09:52:54 +01:00
Gwendal Roué a0e5f64ddf #147: tests for StatementColumnConvertible.fetchCursor() methods 2016-11-26 09:37:50 +01:00
Gwendal Roué c80f0d317a #147: Array(cursor) initialiser; base all fetchAll and fetchOne methods on fetchCursor. 2016-11-26 09:13:39 +01:00
Gwendal Roué e5a9159282 #147: tests for DatabaseValueConvertible.fetchCursor() methods 2016-11-26 08:46:57 +01:00
Gwendal Roué 8215791051 cleanup 2016-11-26 08:37:53 +01:00
Gwendal Roué ab62abed79 #147: use cursor 2016-11-26 08:29:51 +01:00
Gwendal Roué b31356aada #147: Database.tableExists(_:) and Database.indexes(on:) can now throw database errors 2016-11-26 08:28:32 +01:00
Gwendal Roué b0db219aeb #147: Rename DatabaseCursor.step() into next 2016-11-26 08:20:26 +01:00
Gwendal Roué 20a7c550fe DatabaseCursor.enumerated, filter, forEach, map, reduce are public. Once DatabaseCursor.step() has returned nil, all subsequent calls return nil. (addresses #147) 2016-11-26 07:37:34 +01:00
Gwendal Roué 2eb190dbbb Base DatabaseSequence on DatabaseCursor (addresses #147) 2016-11-26 00:56:37 +01:00
Gwendal Roué d97360ef52 DatabaseCursor.enumerated, filter, forEach, map, reduce (addresses #147) 2016-11-25 19:12:36 +01:00
Gwendal Roué fab64c61c4 Add DatabaseCursor to CHANGELOG, fix FTS5, and some TODO (addresses #147) 2016-11-25 18:43:41 +01:00
Gwendal Roué b9fea2ea12 Introduce DatabaseCursor (addresses #147)
let cursor = try Row.fetchCursor(db, "SELECT * FROM persons)
while let row = try cursor.step() { ... }
2016-11-25 18:34:16 +01:00
Gwendal Roué adc4ae48d6 Test DatabaseSequence<Row>.map 2016-11-25 08:11:26 +01:00
Gwendal Roué e7549a2887 Documentation 2016-11-25 05:47:12 +01:00
Gwendal Roué f28507a366 Merge branch 'master' of github.com:groue/GRDB.swift 2016-11-24 20:02:17 +01:00
Gwendal Roué a1b2c011f5 Performance tests against Realm v2.1.0 and Swift 3.0.1 2016-11-24 19:00:33 +01:00
Gwendal Roué b8ee051f8f TODO.md 2016-11-24 10:18:34 +01:00
Gwendal Roué 06e34c88b5 TODO.md 2016-11-24 10:14:33 +01:00
Gwendal Roué 9866b92405 Documentation 2016-11-23 20:42:33 +01:00
Gwendal Roué d1846217fd Documentation 2016-11-23 20:41:16 +01:00
Gwendal Roué aa82f3637b Documentation 2016-11-23 18:15:55 +01:00
Gwendal Roué 731684f22f Documentation 2016-11-23 18:07:05 +01:00
Gwendal Roué 48b84270c4 Documentation 2016-11-23 18:06:18 +01:00
Gwendal Roué acc4bbf628 Documentation 2016-11-23 17:21:37 +01:00
Gwendal Roué 1718c3bc16 New FAQ entry: Compilation takes a long time 2016-11-23 17:20:18 +01:00
Gwendal Roué 235fa57423 FetchedRecordsController cleanup 2016-11-23 12:48:28 +01:00
Gwendal Roué 90f0ebde1d FetchedRecordsController cleanup 2016-11-23 09:26:09 +01:00
Gwendal Roué e016725814 FetchedRecordsController cleanup 2016-11-23 08:54:02 +01:00
Gwendal Roué 3f449a40ad FetchedRecordsController cleanup 2016-11-23 08:12:58 +01:00
Gwendal Roué e92726bdb3 Documentation 2016-11-23 05:23:44 +01:00
Gwendal Roué 45fe70d8ed Documentation 2016-11-23 04:56:28 +01:00
Gwendal Roué e833e5d86d Documentation 2016-11-23 04:51:53 +01:00
Gwendal Roué 3dff5cb99f Documentation 2016-11-23 04:41:32 +01:00
Gwendal Roué 666d09e296 Documentation 2016-11-23 04:41:03 +01:00
Gwendal Roué 6e1e49a185 Documentation 2016-11-23 04:39:34 +01:00
Gwendal Roué 15c13ece27 Documentation 2016-11-22 19:46:16 +01:00
Gwendal Roué 754efefd32 Documentation 2016-11-22 19:44:26 +01:00
Gwendal Roué f81e69f73c TODO: check https://github.com/wokalski/Diff.swift 2016-11-22 16:05:37 +01:00
Gwendal Roué dd8e73e8f2 Documentation 2016-11-22 08:47:43 +01:00
Gwendal Roué 660520b939 Documentation 2016-11-21 20:35:05 +01:00
Gwendal Roué a1c3096556 Documentation 2016-11-21 09:15:10 +01:00
Gwendal Roué 8cd9dea821 Documentation 2016-11-21 09:13:36 +01:00
Gwendal Roué 0cf64a7dde Documentation 2016-11-21 09:04:28 +01:00
Gwendal Roué 53aff4fbbb Documentation 2016-11-21 09:01:13 +01:00
Gwendal Roué 78789fad1c Documentation 2016-11-21 08:54:07 +01:00
Gwendal Roué 3c54d844b2 Documentation 2016-11-21 08:51:56 +01:00
Gwendal Roué d8e27abff9 Documentation 2016-11-20 19:14:00 +01:00
Gwendal Roué b7b8f9caa6 TODO.md 2016-11-20 17:05:37 +01:00
Gwendal Roué 7e1cd47a4e TODO.md 2016-11-20 17:04:00 +01:00
Gwendal Roué badbd846c2 Documentation 2016-11-20 07:19:00 +01:00
Gwendal Roué e08089ba3e Documentation 2016-11-19 21:22:35 +01:00
Gwendal Roué 27f57ce0b3 Documentation 2016-11-19 17:50:12 +01:00
Gwendal Roué 8aa773df9a Documentation 2016-11-19 17:40:27 +01:00
Gwendal Roué 8fb19d24e8 Documentation 2016-11-19 17:38:20 +01:00
Gwendal Roué fd1376be53 Documentation 2016-11-19 17:35:49 +01:00
Gwendal Roué 051f0fd377 Documentation 2016-11-19 17:03:57 +01:00
Gwendal Roué 954644a001 v0.90.1 2016-11-18 17:36:17 +01:00
Gwendal Roué 19fcbf8f25 Fix availabilities for watchOS 2016-11-18 17:30:14 +01:00
Gwendal Roué c1e2c20ace Documentation 2016-11-18 08:40:39 +01:00
Gwendal Roué 09dbbc17e4 Documentation 2016-11-18 08:38:42 +01:00
Gwendal Roué 4d9db3665f Documentation 2016-11-18 08:34:18 +01:00
Gwendal Roué 625f19ae00 Documentation 2016-11-17 09:14:12 +01:00
Gwendal Roué dcc715d75d Documentation 2016-11-17 08:47:40 +01:00
Gwendal Roué e8717498b5 Documentation 2016-11-17 08:39:07 +01:00
Gwendal Roué ecfbbb39bd Documentation 2016-11-17 08:34:32 +01:00
Gwendal Roué 2cd8f56842 Documentation 2016-11-17 08:28:21 +01:00
Gwendal Roué 588b9737bf Revert "Use sqlite3_trace_v2 when available (but the warning on sqlite3_trace remains)"
This reverts commit 049e9f1a55.
2016-11-15 18:38:46 +01:00
Gwendal Roué 22d540caaa TODO.md 2016-11-15 08:15:19 +01:00
Gwendal Roué 2dead0306a TODO.md 2016-11-11 09:21:32 +01:00
Gwendal Roué b77fa9f627 TODO.md 2016-11-11 09:09:15 +01:00
Gwendal Roué 6a29eecf8d TODO.md 2016-11-11 09:04:17 +01:00
Gwendal Roué 049e9f1a55 Use sqlite3_trace_v2 when available (but the warning on sqlite3_trace remains) 2016-11-10 09:11:02 +01:00
Gwendal Roué dcb995c626 Fix compiler warning 2016-11-10 08:32:23 +01:00
Gwendal Roué 6200f5fb62 Fix Xcode 8.1 warning 2016-11-10 06:55:24 +01:00
Gwendal Roué cc27c19c66 FIXME: sqlite3_rekey is discouraged. 2016-11-08 19:37:28 +01:00
Gwendal Roué 23dc818eac Documentation 2016-11-06 12:48:05 +01:00
Gwendal Roué 311d40a9f1 Test that FetchedRecordsController.sections.count is 1 when there are no fetched records 2016-11-06 12:39:42 +01:00
Gwendal Roué ad4d2831c9 Improve FetchedRecordsController misuse feedback 2016-11-06 12:37:28 +01:00
Gwendal Roué ee9c959262 TODO.md 2016-11-06 11:24:25 +01:00
Gwendal Roué b739603a3c v0.90.0 2016-11-05 15:41:42 +01:00
Gwendal Roué 153701133d Documentation 2016-11-05 15:27:11 +01:00
Gwendal Roué d8704edc7f TODO.md 2016-11-05 15:01:20 +01:00
Gwendal Roué 57f6b2d122 availability cleanup 2016-11-05 14:40:14 +01:00
Gwendal Roué 21c41fb145 availability cleanup 2016-11-05 14:37:36 +01:00
Gwendal Roué 12d35a39c7 TODO.md 2016-11-05 14:13:25 +01:00
Gwendal Roué 11aa9f7b79 Upgrade SQLite to v3.15.1 2016-11-05 14:05:23 +01:00
Gwendal Roué 23ae3ad8ad CHANGELOG.md 2016-11-05 13:56:08 +01:00
Gwendal Roué 84d468ad2f TODO.md 2016-11-05 13:55:58 +01:00
Gwendal Roué 0459612632 Documentation 2016-11-03 06:38:32 +01:00
Gwendal Roué 7dfa4bcdb5 FetchedRecordsController: restore default record comparator 2016-10-29 10:49:32 +02:00
Gwendal Roué a3e73508f4 CHANGELOG.md 2016-10-29 07:34:10 +02:00
Gwendal Roué df120ec4a3 FetchedRecordsController: default record comparator now compares rows 2016-10-29 07:25:56 +02:00
Gwendal Roué 6dfa6a3710 FetchedRecordsController.isSameRecord is an iOS-only tool 2016-10-28 19:42:02 +02:00
Gwendal Roué 7ae39a00cb Naming things is hard 2016-10-28 19:22:52 +02:00
Gwendal Roué 0cbcbe3e69 Documentation 2016-10-28 08:11:28 +02:00
Gwendal Roué 47debc0223 Documentation 2016-10-27 09:05:38 +02:00
Gwendal Roué 5953f08495 v0.89.2 2016-10-26 08:35:58 +02:00
Gwendal Roué 43276582ed Typo 2016-10-21 19:58:42 +02:00
Gwendal Roué 2c3d7871ff Merge branch 'master' of github.com:groue/GRDB.swift 2016-10-21 09:56:07 +02:00
Gwendal Roué 112f10a16d Performance tests: Record initializer from FMDB resultsDictionary does not have to use NSNumber 2016-10-21 09:56:03 +02:00
Gwendal Roué 28beefcbb8 Documentation 2016-10-21 09:22:47 +02:00
Gwendal Roué edcff1068b CHANGELOG.md 2016-10-21 09:20:15 +02:00
Gwendal Roué 266f23d1e6 Update tests for CountableRange.contains(), add tests for 0.negated 2016-10-21 09:14:54 +02:00
Gwendal Roué c4dfd24782 CountableRange.contains(): turn 0..<10.contains(x) to "x >= 0 AND x < 10" instead of "x BETWEEN 0 AND 9" (and avoid Int ranges to mess with double values) 2016-10-21 09:14:19 +02:00
Gwendal Roué 9ae2de6dc1 DatabaseValue.negated: prefer 1 to NOT 0 2016-10-21 09:13:03 +02:00
Gwendal Roué 45fd6f89c0 Performance tests: fix warnings 2016-10-21 08:47:06 +02:00
Gwendal Roué b1ba4b505a Documentation 2016-10-20 19:17:47 +02:00
Gwendal Roué 99e6cf4796 Documentation 2016-10-20 19:14:00 +02:00
Gwendal Roué 4df5752df7 Documentation 2016-10-20 18:08:53 +02:00
Gwendal Roué 7a2837b6c9 Performance tests: Swift 3 2016-10-20 18:08:43 +02:00
Gwendal Roué dc08805307 Performance tests: SQLite.swift 0.11.0 2016-10-20 18:07:39 +02:00
Gwendal Roué 2ffebb9c0b Performance tests: Realm v2.0.2 2016-10-20 18:01:13 +02:00
Gwendal Roué 2553a51408 Documentation 2016-10-20 09:44:27 +02:00
Gwendal Roué e2a338c3c9 Documentation 2016-10-20 09:40:25 +02:00
Gwendal Roué 795f4cd7a7 Documentation 2016-10-20 09:11:42 +02:00
Gwendal Roué 932fa22701 Documentation 2016-10-20 09:11:16 +02:00
Gwendal Roué 5c746ad3d4 Documentation 2016-10-20 09:09:36 +02:00
Gwendal Roué d0c8a80e5e Documentation 2016-10-20 09:07:16 +02:00
Gwendal Roué da40f7ab07 CocoaPods is no longer beta 2016-10-20 08:53:01 +02:00
Gwendal Roué f4c42a5d39 Fix links to cocoadocs.org 2016-10-20 08:23:35 +02:00
Gwendal Roué 7b3a752ad9 Documentation 2016-10-19 19:54:59 +02:00
Gwendal Roué ad861e7da1 Documentation 2016-10-19 19:51:48 +02:00
Gwendal Roué 17e8cf8aaa Documentation 2016-10-19 19:45:18 +02:00
Gwendal Roué 6773f1e152 v0.89.1 2016-10-19 19:37:36 +02:00
Gwendal Roué 928b95861d Explicit SQLCipher version 2016-10-19 19:36:34 +02:00
Gwendal Roué f274abcc8d Bold 2016-10-19 19:31:21 +02:00
Gwendal Roué 5a725af1bb Link to https://www.sqlite.org/changes.html 2016-10-19 19:30:42 +02:00
Gwendal Roué b0d5c8870a Documentation/CustomSQLiteBuilds.md replaces SQLiteCustom/README.md 2016-10-19 19:29:41 +02:00
Gwendal Roué fb14a49dd5 Link to custom FTS5 tokenizers from GRDB Extension Guide 2016-10-19 08:03:38 +02:00
Gwendal Roué b6d2ec3bea TODO.md 2016-10-18 09:05:32 +02:00
Gwendal Roué 3fd5b77de8 README.md 2016-10-18 08:59:17 +02:00
Gwendal Roué b060039a28 README.md 2016-10-18 08:55:45 +02:00
Gwendal Roué ba84e8bc33 TODO.md 2016-10-18 08:13:39 +02:00
Gwendal Roué cba111c055 TODO.md 2016-10-18 08:05:01 +02:00
Gwendal Roué a1f4c3506d Typo 2016-10-18 06:25:40 +02:00
Gwendal Roué a4e0abf7bc Typo 2016-10-18 06:14:19 +02:00
Gwendal Roué 7058bb5e12 Have DatabaseError adopt CustomNSError 2016-10-18 05:49:12 +02:00
Gwendal Roué 43d4d3cddc CHANGELOG.md 2016-10-17 20:44:16 +02:00
Gwendal Roué c4804f427f CHANGELOG.md 2016-10-17 20:40:31 +02:00
Gwendal Roué 430ef5d1a6 Hide FetchedRecordsControlleriOSTests behind #if os(iOS) 2016-10-17 20:27:24 +02:00
Gwendal Roué d8fb4304b7 CHANGELOG.md 2016-10-17 20:23:03 +02:00
Gwendal Roué caf5ee7412 Fix the compareRecordsByPrimaryKey option of FetchedRecordsController when record has no primary key but has selectsRowID set to true 2016-10-17 20:17:37 +02:00
Gwendal Roué 2acfbcdce6 Failing test for compareRecordsByPrimaryKey option of FetchedRecordsController when record has no primary key 2016-10-17 20:16:31 +02:00
Gwendal Roué c687c5df24 CHANGELOG.md 2016-10-17 19:27:05 +02:00
Gwendal Roué f63db81268 Merge branch 'master' of github.com:groue/GRDB.swift
Conflicts:
	TODO.md
2016-10-17 19:23:54 +02:00
Gwendal Roué 00de9bbbc5 Database.create(virtualTable:using:) wraps the table creation and virtual module post actions in a save point. Fix failing test for virtual module that throws in its database(_:didCreate:using:) method. 2016-10-17 19:23:11 +02:00
Gwendal Roué 825db1158c Add failing test for virtual table module that throws in its database(_:didCreate:using:) 2016-10-17 19:21:57 +02:00
Gwendal Roué b5bff64cf0 TODO.md 2016-10-17 16:55:45 +02:00
Gwendal Roué c5255872ca Documentation 2016-10-17 15:59:11 +02:00
Gwendal Roué 9920f44a90 TODO.md 2016-10-17 14:04:32 +02:00
Gwendal Roué f5bbc43c87 Add a test for FetchedRecordsController request modification with uppercase table and column names 2016-10-17 14:00:32 +02:00
Gwendal Roué 7076809b71 v0.89.0 2016-10-17 13:41:57 +02:00
Gwendal Roué 34b7cda2ec Fix failing test for FetchedRecordsController: when the request changes, we now do update the tracked tables and columns 2016-10-17 13:34:46 +02:00
Gwendal Roué f2cd90a999 Failing test for FetchedRecordsController: when the request changes, we do not update the tracked tables and columns 2016-10-17 13:16:15 +02:00
Gwendal Roué 2c35c63a09 Typo 2016-10-17 12:00:06 +02:00
Gwendal Roué 7832a6eb6f Documentation 2016-10-17 11:59:46 +02:00
Gwendal Roué e1c3dda6e0 Documentation 2016-10-17 11:52:44 +02:00
Gwendal Roué f11c015522 Documentation 2016-10-17 10:24:13 +02:00
Gwendal Roué 9cd23bc02b Documentation 2016-10-17 10:22:00 +02:00
Gwendal Roué 8c0ab4285b Documentation 2016-10-17 10:17:48 +02:00
Gwendal Roué 3cbc5aaf2d Documentation 2016-10-17 09:13:24 +02:00
Gwendal Roué c43aae15ff Typo 2016-10-17 09:11:00 +02:00
Gwendal Roué 2fd3ded6e2 TableMapping.none() 2016-10-17 09:09:17 +02:00
Gwendal Roué cb6d727664 Column.rank 2016-10-17 08:12:30 +02:00
Gwendal Roué 3be2047c9c Documentation 2016-10-16 16:48:39 +02:00
Gwendal Roué b3ec9a0900 Documentation 2016-10-16 16:16:31 +02:00
Gwendal Roué 50cf830404 Documentation 2016-10-16 16:09:24 +02:00
Gwendal Roué 72e58a7f0d Documentation 2016-10-16 16:02:20 +02:00
Gwendal Roué 36781c0bc6 Documentation 2016-10-16 15:58:18 +02:00
Gwendal Roué 12ca7d0fe2 Documentation 2016-10-16 15:57:45 +02:00
Gwendal Roué b85066eb06 Documentation 2016-10-16 15:56:37 +02:00
Gwendal Roué 456705de54 Documentation 2016-10-16 15:55:37 +02:00
Gwendal Roué 31b500cc7f Documentation 2016-10-16 15:50:37 +02:00
Gwendal Roué 03d0011c2f Documentation 2016-10-16 15:39:34 +02:00
Gwendal Roué 101088cadc Link to https://github.com/groue/WWDCCompanion 2016-10-16 11:27:57 +02:00
Gwendal Roué 638702728c CHANGELOG.md 2016-10-16 11:05:29 +02:00
Gwendal Roué 015a0888d4 v0.88.0 2016-10-16 11:00:18 +02:00
Gwendal Roué 361eaeca07 Upgrade SQLiteCustom to v3.15.0 2016-10-16 10:59:28 +02:00
Gwendal Roué 6850c2a9ee External Content Full-Text Tables documentation 2016-10-16 10:21:17 +02:00
Gwendal Roué 12af387e50 FTS4: support for external content table synchronization 2016-10-16 09:52:58 +02:00
Gwendal Roué 55216be46b FTS5: support for external content table synchronization 2016-10-16 09:32:41 +02:00
Gwendal Roué 7630642c56 matching() and match() methods accept nil FTS patterns 2016-10-16 07:47:25 +02:00
Gwendal Roué ad8fe7923a TODO.md 2016-10-15 18:15:51 +02:00
Gwendal Roué f06b4f70f9 CHANGELOG.md: fix link 2016-10-14 09:09:50 +02:00
Gwendal Roué 408ecda944 Add contentRowID to FTS5TableDefinition 2016-10-14 08:58:58 +02:00
Gwendal Roué 95844cd6c0 Validate FTS patterns with db.execute() instead of a fetch sequence since it achieves error detection with less code 2016-10-14 05:05:01 +02:00
Gwendal Roué cf4824e588 Documentation 2016-10-13 08:08:17 +02:00
Gwendal Roué c99aaf763d Documentation 2016-10-13 08:07:03 +02:00
Gwendal Roué 1156027587 Documentation 2016-10-13 07:59:12 +02:00
Gwendal Roué 46c6d43556 Documentation 2016-10-12 17:23:14 +02:00
Gwendal Roué 07fccd0479 Documentation 2016-10-12 17:20:33 +02:00
Gwendal Roué 10e4fe7a71 Documentation 2016-10-12 17:16:53 +02:00
Gwendal Roué 5f37891eae Documentation 2016-10-12 17:15:16 +02:00
Gwendal Roué f09644be00 Documentation 2016-10-12 17:08:52 +02:00
Gwendal Roué 96e573b356 Documentation 2016-10-12 14:58:13 +02:00
Gwendal Roué bed63b55fe Documentation 2016-10-12 09:10:57 +02:00
Gwendal Roué 0a8ac5cb05 v0.87.0 2016-10-12 08:48:19 +02:00
Gwendal Roué 590d7cc79b Documentation 2016-10-12 08:41:26 +02:00
Gwendal Roué aeeaa18b28 Documentation 2016-10-12 08:38:42 +02:00
Gwendal Roué d6a6f1ed51 Documentation 2016-10-12 08:37:53 +02:00
Gwendal Roué 68bf5d5105 Documentation 2016-10-12 08:36:55 +02:00
Gwendal Roué 78d5f6f598 Documentation 2016-10-12 08:36:04 +02:00
Gwendal Roué fa8c6dfa6f Documentation 2016-10-12 08:34:49 +02:00
Gwendal Roué 15d3bc70d2 Documentation 2016-10-12 08:19:51 +02:00
Gwendal Roué c37b52645c Documentation 2016-10-12 08:17:39 +02:00
Gwendal Roué e6f61699d7 Documentation 2016-10-12 08:15:59 +02:00
Gwendal Roué 6cdf61d6cf Documentation 2016-10-12 08:15:10 +02:00
Gwendal Roué 60dee64fa0 Documentation 2016-10-12 08:12:56 +02:00
Gwendal Roué 21f4ba4f3a Documentation 2016-10-12 08:12:03 +02:00
Gwendal Roué df4777dca4 Documentation 2016-10-12 08:11:39 +02:00
Gwendal Roué 03b8e98cb2 Documentation 2016-10-12 08:07:57 +02:00
Gwendal Roué fafe2374b7 Documentation 2016-10-12 08:03:26 +02:00
Gwendal Roué 1840fac000 Documentation 2016-10-12 08:01:05 +02:00
Gwendal Roué ec460ff07a Documentation 2016-10-12 08:00:32 +02:00
Gwendal Roué b0e68366d4 Documentation 2016-10-12 07:58:19 +02:00
Gwendal Roué 99266e4ea9 Documentation 2016-10-12 07:55:52 +02:00
Gwendal Roué 34025599a0 Documentation 2016-10-12 07:46:33 +02:00
Gwendal Roué 21f34b8039 Documentation 2016-10-12 07:45:09 +02:00
Gwendal Roué 30b3a4c9c7 Documentation 2016-10-12 07:41:18 +02:00
Gwendal Roué 7ca2f7d6b1 Documentation 2016-10-12 07:37:37 +02:00
Gwendal Roué 7a6ac1f6d0 Documentation 2016-10-12 06:56:56 +02:00
Gwendal Roué e53f0a3191 Documentation 2016-10-12 06:55:47 +02:00
Gwendal Roué 54b28ae356 Documentation 2016-10-11 22:36:37 +02:00
Gwendal Roué 22b7181c40 Documentation 2016-10-11 22:01:45 +02:00
Gwendal Roué daf6a856c7 Documentation 2016-10-11 22:00:37 +02:00
Gwendal Roué 4e2baa0868 Documentation 2016-10-11 21:48:55 +02:00
Gwendal Roué 6b48084c9c Documentation 2016-10-11 21:27:46 +02:00
Gwendal Roué 1e48959c0a Documentation 2016-10-11 21:04:37 +02:00
Gwendal Roué 088c37d1ea Documentation 2016-10-11 20:51:32 +02:00
Gwendal Roué 18dcc21340 Documentation 2016-10-11 14:43:53 +02:00
Gwendal Roué e03c1d4c85 Documentation 2016-10-11 14:42:45 +02:00
Gwendal Roué 9fb85f252e Documentation 2016-10-11 14:41:15 +02:00
Gwendal Roué c7601c9921 Documentation 2016-10-11 14:41:04 +02:00
Gwendal Roué eab2bd3565 Documentation 2016-10-11 14:38:50 +02:00
Gwendal Roué 4454c6be73 FTS5Tokenizer.tokenize callback is not optional 2016-10-11 11:28:22 +02:00
Gwendal Roué 0adf8a0a05 Documentation 2016-10-11 10:47:33 +02:00
Gwendal Roué bdf59c1a5f Documentation 2016-10-11 10:27:50 +02:00
Gwendal Roué e317926fcb Documentation 2016-10-11 10:26:50 +02:00
Gwendal Roué 1487a0ecd2 Documentation 2016-10-11 09:23:57 +02:00
Gwendal Roué 950d2689c7 Documentation 2016-10-11 09:22:00 +02:00
Gwendal Roué 8687ed6697 Documentation 2016-10-11 09:19:15 +02:00
Gwendal Roué ab9c0dab04 Documentation 2016-10-11 09:05:39 +02:00
Gwendal Roué 45e2819694 Documentation 2016-10-11 09:04:53 +02:00
Gwendal Roué 0187a0cace Documentation 2016-10-11 09:04:11 +02:00
Gwendal Roué 9d714ba9e0 Documentation 2016-10-11 09:01:20 +02:00
Gwendal Roué a614434c04 Documentation 2016-10-11 09:00:33 +02:00
Gwendal Roué 0fbfee521f Documentation 2016-10-11 08:59:15 +02:00
Gwendal Roué d2233acc44 Documentation 2016-10-11 08:57:04 +02:00
Gwendal Roué 4b86741683 Documentation 2016-10-11 08:56:37 +02:00
Gwendal Roué 26bf91e1da Documentation 2016-10-11 08:52:03 +02:00
Gwendal Roué 37eab31b40 Documentation 2016-10-11 08:06:03 +02:00
Gwendal Roué 39aa548586 Documentation 2016-10-11 07:59:50 +02:00
Gwendal Roué a228b36e8e Documentation 2016-10-11 07:57:46 +02:00
Gwendal Roué 7d33a1572e Documentation 2016-10-11 07:54:40 +02:00
Gwendal Roué 5ccbf0042c Documentation 2016-10-11 07:54:13 +02:00
Gwendal Roué 0313ea636a Documentation 2016-10-11 07:53:30 +02:00
Gwendal Roué d7a5db3dbb Documentation 2016-10-11 07:52:52 +02:00
Gwendal Roué 82435bf6ff Documentation 2016-10-11 06:56:04 +02:00
Gwendal Roué e56a4ed9e2 Documentation 2016-10-11 06:55:31 +02:00
Gwendal Roué 52ef16dba5 Documentation 2016-10-11 06:21:46 +02:00
Gwendal Roué e4713edd75 Documentation 2016-10-11 05:19:37 +02:00
Gwendal Roué 5abe72f7e7 Documentation 2016-10-11 05:06:28 +02:00
Gwendal Roué fdeb07f82b Documentation 2016-10-11 05:05:25 +02:00
Gwendal Roué 44b59eea58 Documentation 2016-10-10 20:54:35 +02:00
Gwendal Roué f8bf2f38d3 Documentation 2016-10-10 20:41:40 +02:00
Gwendal Roué 091854a6d0 Documentation 2016-10-10 20:30:05 +02:00
Gwendal Roué fd55aa61cf Documentation 2016-10-10 20:28:04 +02:00
Gwendal Roué 7bd014f9de Documentation 2016-10-10 20:17:02 +02:00
Gwendal Roué 793ef35c95 Documentation 2016-10-10 20:16:15 +02:00
Gwendal Roué d8eb8499ef Documentation 2016-10-10 20:14:53 +02:00
Gwendal Roué ad98339de7 Documentation 2016-10-10 19:53:06 +02:00
Gwendal Roué d121326382 Documentation 2016-10-10 19:06:17 +02:00
Gwendal Roué bd9e689885 Documentation 2016-10-10 19:05:36 +02:00
Gwendal Roué 79dcf6d63b Code cleanup 2016-10-10 18:54:25 +02:00
Gwendal Roué 3390a26588 Rename FTSXTokenizerRequest to FTSXTokenizerDescriptor 2016-10-10 18:33:32 +02:00
Gwendal Roué 93d1cd3ee7 Remove the FTS3TokenizerRequest public initializer 2016-10-10 18:31:56 +02:00
Gwendal Roué 4b3cfc5de1 FTS3 is not ready for Database.tokenize(string:with:). Only FTS5 is. 2016-10-10 18:17:39 +02:00
Gwendal Roué f9d38fdd69 Database.tokenize(string:with:) 2016-10-10 18:15:14 +02:00
Gwendal Roué 628c375b8c Documentation 2016-10-10 15:31:05 +02:00
Gwendal Roué 714c884732 Code cleanup 2016-10-10 14:43:23 +02:00
Gwendal Roué f6dffe9845 Rename FTSXTokenizerDefinition to FTSXTokenizerRequest 2016-10-10 13:58:05 +02:00
Gwendal Roué a28b3cc268 FTS5.api robustness 2016-10-10 13:51:58 +02:00
Gwendal Roué 388dd99986 Custom FTS5 tokenizer cleanup 2016-10-10 13:46:04 +02:00
Gwendal Roué 1081b6a1c0 Custom FTS5 tokenizer cleanup 2016-10-10 13:11:11 +02:00
Gwendal Roué 80d93b1fc9 FTS5WrapperTokenizer 2016-10-10 11:36:03 +02:00
Gwendal Roué 3980fe5de1 CHANGELOG.md 2016-10-10 08:51:17 +02:00
Gwendal Roué b374b1ef7a Typo 2016-10-10 08:49:47 +02:00
Gwendal Roué 09a7865e7d Test the custom FTS5 tokenizer with a synonyms tokenizer 2016-10-10 08:46:56 +02:00
Gwendal Roué 2f9a399d18 Fix NFKC tokenizer so that it does not mangle token offsets inside pText (convert tokens to NFKC, not the base string) 2016-10-10 08:16:27 +02:00
Gwendal Roué bbda3955c3 Test the custom FTS5 tokenizer with a NFKC tokenizer 2016-10-09 23:41:25 +02:00
Gwendal Roué ba42932024 Test the custom FTS5 tokenizer with a "stop words" tokenizer 2016-10-09 23:09:22 +02:00
Gwendal Roué f7c8bd6d1c FTS5TokenizeFlags 2016-10-09 22:15:11 +02:00
Gwendal Roué 35479575ec Tests for custom FTS5 tokenizer with DatabaseQueue and DatabasePool 2016-10-09 21:52:22 +02:00
Gwendal Roué 23a4aab3c4 Custom FTS5 tokenizer experiments 2016-10-09 21:35:07 +02:00
Gwendal Roué ec5bd18b67 Custom FTS5 tokenizer experiments 2016-10-09 19:01:51 +02:00
Gwendal Roué d5750bf329 Documentation 2016-10-09 07:20:45 +02:00
Gwendal Roué ac55d35b13 Custom SQLite examples 2016-10-08 19:34:24 +02:00
Gwendal Roué a1c27049d6 CHANGELOG.md 2016-10-08 19:14:46 +02:00
Gwendal Roué 8b36b29126 v0.86.0 2016-10-08 19:09:46 +02:00
Gwendal Roué c0e75ac6b4 Update the GRDB Extension Guide so that it stops talking about the MATCH operator - use GLOB instead. 2016-10-08 19:09:40 +02:00
Gwendal Roué 897f3a86c5 More FTS tests 2016-10-08 17:31:59 +02:00
Gwendal Roué 58025d3b01 Remove unused code 2016-10-08 16:59:29 +02:00
Gwendal Roué 591197422d Prefer flatMap to guard when chaining values 2016-10-08 16:56:39 +02:00
Gwendal Roué 027b1f711c URL, UUID and Date now adopt DatabaseValueConvertible through NSURL, NSUUID and NSDate, thanks to the new support for Foundation's ReferenceConvertible. 2016-10-08 16:54:32 +02:00
Gwendal Roué 5f15a0f555 Improve test coverage 2016-10-08 16:30:08 +02:00
Gwendal Roué c46238301a Improve test coverage 2016-10-08 16:04:30 +02:00
Gwendal Roué 7c282d28df Improve test coverage 2016-10-08 15:44:11 +02:00
Gwendal Roué 587251e73c TODO 2016-10-08 15:44:00 +02:00
Gwendal Roué 12dbafd0c9 Improve test coverage 2016-10-08 14:56:17 +02:00
Gwendal Roué 3c822399b1 Restore DatabaseValue.description into its previous behavior, and test that \n or \t are described as "\\n" and "\\t" (avoid multi-line DatabaseValue description) 2016-10-08 14:38:30 +02:00
Gwendal Roué ae7252fbec Code cleanup 2016-10-08 14:37:14 +02:00
Gwendal Roué 13dfde1862 Upgrade SQLiteCustom to v3.14.2 2016-10-08 14:18:10 +02:00
Gwendal Roué 3a0aef3779 README.md 2016-10-08 14:03:29 +02:00
Gwendal Roué a82cc8cbd4 Update playgrounds 2016-10-08 14:03:08 +02:00
Gwendal Roué 6e6701a644 CHANGELOG.md 2016-10-08 13:46:21 +02:00
Gwendal Roué b6b74e292f Cleanup 2016-10-08 13:40:16 +02:00
Gwendal Roué db0dfdcd59 VirtualTableModule cleanup and documentation 2016-10-08 13:36:27 +02:00
Gwendal Roué fc49643860 Remove QueryInterfaceRequest public initializer 2016-10-08 13:06:46 +02:00
Gwendal Roué 7968c1dcd2 Fix warnings 2016-10-08 12:59:34 +02:00
Gwendal Roué b9180798ca Tests for delete(db) return value 2016-10-08 12:53:35 +02:00
Gwendal Roué 8ed0888ea8 Documentation 2016-10-08 12:46:15 +02:00
Gwendal Roué e5d941f98b Documentation 2016-10-08 12:43:38 +02:00
Gwendal Roué 62f434f0e0 Documentation 2016-10-08 12:22:03 +02:00
Gwendal Roué 829451486e Documentation 2016-10-08 12:18:48 +02:00
Gwendal Roué 0da1a293e6 Update tests for error descriptions that include argument literals, since DatabaseValue.description now returns the SQL literal representation of the value 2016-10-08 12:17:49 +02:00
Gwendal Roué a51ccad560 Code cleanup 2016-10-08 11:52:46 +02:00
Gwendal Roué b8ab30fc22 DatabaseValue.description now returns the SQL literal representation of the value 2016-10-08 11:51:10 +02:00
Gwendal Roué 915bc6c7cd Less TODO 2016-10-08 11:36:22 +02:00
Gwendal Roué 0bc55a5185 FTS5Pattern and FTS4Tokenizer require SQLITE_ENABLE_FTS5 2016-10-08 10:24:50 +02:00
Gwendal Roué 07c2973459 Full text and records 2016-10-08 10:03:19 +02:00
Gwendal Roué 2bc8722049 Document that fetchOne(_🔑), fetch(_:keys:), fetchAll(_:keys:), deleteOne(_🔑), and deleteAll(_:keys:) assume a rowID primary key when table has no explicit primary key. 2016-10-08 09:57:15 +02:00
Gwendal Roué 84259fd9d8 TableMapping.selectsRowID documentation 2016-10-08 09:49:42 +02:00
Gwendal Roué 31474b581b TableMapping.selectsRowID documentation 2016-10-08 09:33:35 +02:00
Gwendal Roué 2fc71c762a TODO.md 2016-10-08 08:39:42 +02:00
Gwendal Roué a541e6db1f deleteOne(_🔑) and deleteAll(_:keys:) with implicit rowID key 2016-10-08 08:36:56 +02:00
Gwendal Roué a4aab9f4c2 TableMapping.selectsRowID test 2016-10-08 08:33:19 +02:00
Gwendal Roué 2d6abc088f TableMapping.selectsRowID + passing tests for FTS3Record 2016-10-07 19:17:40 +02:00
Gwendal Roué a1f3d42fd0 Failing tests from FTS3Record 2016-10-07 17:47:56 +02:00
Gwendal Roué 915e72584c fetchOne(_🔑), fetch(_:keys:), fetchAll(_:keys:), deleteOne(_🔑), and deleteAll(_:keys:) now assumes a rowID primary key when table has no explicit primary key. 2016-10-07 17:47:29 +02:00
Gwendal Roué 22ef3c8b2a Persistable DAO assumes "rowid" as a default primary key, so that a record that exposes "rowid" in its persistentDictionary can be updated, and deleted. 2016-10-07 17:44:38 +02:00
Gwendal Roué 0936793b23 TODO 2016-10-07 17:35:07 +02:00
Gwendal Roué 8bbdf56cb0 Documentation 2016-10-07 15:16:04 +02:00
Gwendal Roué 25fd939bc6 FTS documentation 2016-10-07 15:10:25 +02:00
Gwendal Roué 5e4f31fe84 Unicode gotchas 2016-10-07 15:08:43 +02:00
Gwendal Roué 5638b4f889 Unicode gotchas 2016-10-07 15:06:02 +02:00
Gwendal Roué 2f28a7f3f2 FTS documentation 2016-10-07 14:52:34 +02:00
Gwendal Roué 9f3137e509 FTS cleanup 2016-10-07 14:48:34 +02:00
Gwendal Roué 32c91f56f3 FTS documentation 2016-10-07 14:42:56 +02:00
Gwendal Roué c81284754f FTS documentation 2016-10-07 14:34:12 +02:00
Gwendal Roué e300546a32 FTS4 and FTS5 options 2016-10-07 14:21:29 +02:00
Gwendal Roué ce0f62d598 FTS documentation 2016-10-07 11:03:21 +02:00
Gwendal Roué 18e1987a6a FTS documentation 2016-10-07 10:59:32 +02:00
Gwendal Roué 626c12c8a3 FTS documentation 2016-10-07 10:50:28 +02:00
Gwendal Roué 8e8fb9cfe8 FTS documentation 2016-10-07 10:48:25 +02:00
Gwendal Roué c0c3f2c9ba FTS documentation 2016-10-07 10:26:33 +02:00
Gwendal Roué 7e4846b83c FTS documentation 2016-10-07 10:13:00 +02:00
Gwendal Roué adcd0e2936 FTS documentation 2016-10-07 10:10:12 +02:00
Gwendal Roué 2a02a2e40b FTS documentation 2016-10-07 10:07:21 +02:00
Gwendal Roué 8b8953b98c FTS documentation 2016-10-07 09:22:10 +02:00
Gwendal Roué 05baa544bc Typo 2016-10-07 09:21:15 +02:00
Gwendal Roué 95aee6eb37 Typo 2016-10-07 09:15:47 +02:00
Gwendal Roué d348c0e794 FTS documentation 2016-10-07 09:15:22 +02:00
Gwendal Roué bdc25e4fb5 Query interface matching() method 2016-10-07 08:59:39 +02:00
Gwendal Roué f864fba78b FTS documentation 2016-10-07 08:36:29 +02:00
Gwendal Roué ec34261674 FTS documentation 2016-10-07 08:35:43 +02:00
Gwendal Roué 119965a7fb FTS documentation 2016-10-07 08:34:00 +02:00
Gwendal Roué 24c672ddc9 Validation of raw FTS5 patterns requires a database connection and a table name 2016-10-07 08:32:23 +02:00
Gwendal Roué 56578c7c0c CURRENT_TIMESTAMP, not NOW 2016-10-07 06:50:57 +02:00
Gwendal Roué fdc78b5c32 Typo 2016-10-07 06:37:22 +02:00
Gwendal Roué 3585223827 Typo 2016-10-07 06:35:21 +02:00
Gwendal Roué 13bdb881c7 FTS column queries 2016-10-07 06:17:54 +02:00
Gwendal Roué 12c46c794f Remove dead code 2016-10-07 06:17:26 +02:00
Gwendal Roué 3b839ebd1f FTS documentation 2016-10-06 19:19:39 +02:00
Gwendal Roué 04d5c98756 FTS documentation 2016-10-06 16:00:42 +02:00
Gwendal Roué 2cce4bf2a8 FTS documentation 2016-10-06 15:57:32 +02:00
Gwendal Roué 15560229ce FTS documentation 2016-10-06 15:55:18 +02:00
Gwendal Roué 20317e5830 FTS5 documentation 2016-10-06 15:44:50 +02:00
Gwendal Roué 2bf1de5a43 FTS5 documentation 2016-10-06 15:42:55 +02:00
Gwendal Roué 7306ce09b4 FTS5 documentation 2016-10-06 15:38:40 +02:00
Gwendal Roué 846bcf3ef5 FTS5 documentation 2016-10-06 15:26:01 +02:00
Gwendal Roué 69b69da52a FTS5 documentation 2016-10-06 14:09:10 +02:00
Gwendal Roué 7a7be6e454 FTS documentation 2016-10-06 14:07:54 +02:00
Gwendal Roué 3587e450a3 FTS5 documentation 2016-10-06 14:06:15 +02:00
Gwendal Roué 0b8001eac2 FTS5 documentation 2016-10-06 14:05:04 +02:00
Gwendal Roué 8235c6d4fc FTS5 documentation 2016-10-06 14:03:42 +02:00
Gwendal Roué aed88bd857 FTS documentation 2016-10-06 13:38:18 +02:00
Gwendal Roué 8fcca219b4 FTS documentation 2016-10-06 13:11:11 +02:00
Gwendal Roué 4b16ed6bdd FTS documentation 2016-10-06 12:56:43 +02:00
Gwendal Roué 3ad7901edb FTS documentation 2016-10-06 12:55:10 +02:00
Gwendal Roué a684823f25 FTS documentation 2016-10-06 12:52:50 +02:00
Gwendal Roué 90a03c5096 FTS documentation 2016-10-06 12:42:08 +02:00
Gwendal Roué 46f8f3c27e FTS documentation 2016-10-06 09:16:19 +02:00
Gwendal Roué 3569a85488 FTS TODO 2016-10-06 09:08:22 +02:00
Gwendal Roué 9a0942e9b2 Split FTS tokenizer tests from table builder tests 2016-10-06 08:52:51 +02:00
Gwendal Roué 26725bd878 FTS5 table builder tests 2016-10-06 08:35:35 +02:00
Gwendal Roué ae01148b76 FTS5 patterns tests 2016-10-06 08:35:15 +02:00
Gwendal Roué 1269959265 FTS3 tokenizer tests: stop testing NFC/NFD 2016-10-06 08:31:31 +02:00
Gwendal Roué a471d68d6c FTS3 tokenizer tests: stop testing NFC/NFD 2016-10-06 08:31:20 +02:00
Gwendal Roué 2eb8859080 FTS3PatternTests: stop testing NFC/NFD, and stop testing document prefix queries, which seem fragile according to SQLite version (some tests fail with custom SQLite 3.14.1) 2016-10-06 08:30:56 +02:00
Gwendal Roué 038fe07fd4 TS5Tokenizer.porter(wrapping:) 2016-10-06 08:28:40 +02:00
Gwendal Roué 578b899653 FTS5 virtual table require at least one column 2016-10-06 08:28:05 +02:00
Gwendal Roué 32e0151f7d Correct implementation for FTS5Pattern(rawPattern:) 2016-10-06 08:27:50 +02:00
Gwendal Roué 43cf02d5b8 FTS3Pattern(matchingAllTokensIn:) does not insert useless AND operator 2016-10-06 08:27:22 +02:00
Gwendal Roué d60a1193b2 Reminder about NFKC NFKD tests 2016-10-05 18:09:50 +02:00
Gwendal Roué 806e0b6d7f FTS Documentation 2016-10-05 18:09:35 +02:00
Gwendal Roué 74434e87c5 Introduce FTS5 2016-10-05 14:14:14 +02:00
Gwendal Roué 41935d8b48 Code cleanup 2016-10-05 14:13:57 +02:00
Gwendal Roué 8a93c7472f FTS3Tokenizer.tokenize(string) 2016-10-05 13:04:53 +02:00
Gwendal Roué 687737f71a FTS3Pattern: remove ability to specify tokenizer 2016-10-05 09:23:03 +02:00
Gwendal Roué c4296f0127 FTS documentation 2016-10-05 09:13:25 +02:00
Gwendal Roué 933e8d4409 FTS documentation 2016-10-05 08:53:24 +02:00
Gwendal Roué 28950473b2 FTS documentation 2016-10-05 08:48:31 +02:00
Gwendal Roué 6a478ca315 Introduce FTS tests 2016-10-05 06:17:42 +02:00
Gwendal Roué 03d4175bea More FTS4 2016-10-04 18:39:32 +02:00
Gwendal Roué 25abdef96a Introduce FTS4 2016-10-04 18:27:48 +02:00
Gwendal Roué a01d8548e3 FTS cleanup 2016-10-04 18:21:51 +02:00
Gwendal Roué c1946e57b7 FTS3Pattern initializers use a tokenizer when relevant 2016-10-04 18:15:57 +02:00
Gwendal Roué 811ed6efe5 FTS: TODO 2016-10-04 16:19:58 +02:00
Gwendal Roué 6855a0afbe #92: FTS3Tokenizer and tests 2016-10-04 14:17:34 +02:00
Gwendal Roué f9e68a0c9c #92: FTS3 module documentation 2016-10-04 11:43:15 +02:00
Gwendal Roué f1ecdfc9df #92: Refactor experimental API around virtual tables creation so that virtual modules can require initialization parameters 2016-10-04 09:37:01 +02:00
Gwendal Roué 01fc9f6130 #92: Experimental API around virtual tables creation 2016-10-04 09:08:23 +02:00
Gwendal Roué a2c3f74ab2 TODO.md 2016-10-03 22:35:41 +02:00
Gwendal Roué 11301d7b63 Remove obsolete code 2016-10-03 22:35:31 +02:00
Gwendal Roué 1d2e1d9950 #92, #129: Test interaction of RowConvertible and MutablePersistable with FTS virtual tables 2016-10-03 22:35:10 +02:00
Gwendal Roué 47938a2278 #92, #129: Test full-text search with NFD-normalized patterns 2016-10-03 20:00:32 +02:00
Gwendal Roué 6922ad04a9 #92, #129: Rename test file 2016-10-03 19:37:00 +02:00
Gwendal Roué cc24e73483 #92, #129: Test FTS3Pattern(matchingAnyTokenIn:), FTS3Pattern(matchingAllTokensIn:), FTS3Pattern(matchingPhrase:) 2016-10-03 19:34:56 +02:00
Gwendal Roué 59fed5c756 #92, #129: Test FTS3Pattern with invalid patterns 2016-10-03 19:10:16 +02:00
Gwendal Roué f93e7579bc #92, #129: Test FTS3Pattern with valid patterns 2016-10-03 19:06:43 +02:00
Gwendal Roué a617053d97 #92, #129: Full-Text Search documentation 2016-10-03 15:32:57 +02:00
Gwendal Roué 3ebd5a95d4 #92, #129: FTS3Pattern cleanup 2016-10-03 14:46:16 +02:00
Gwendal Roué 4f4ecbf819 #92, #129: Full-Text Search documentation 2016-10-03 14:40:28 +02:00
Gwendal Roué cb81b63524 #92, #129: Full-Text Search documentation 2016-10-03 14:39:15 +02:00
Gwendal Roué 8bd3512bc8 #92, #129: Full-Text Search documentation 2016-10-03 14:37:58 +02:00
Gwendal Roué 7f0d3c89bd #92, #129: Full-Text Search documentation 2016-10-03 14:37:00 +02:00
Gwendal Roué f4d87458dd #92, #129: Full-Text Search documentation 2016-10-03 14:31:07 +02:00
Gwendal Roué 2c3c80e45c #92, #129: Full-Text Search documentation 2016-10-03 14:14:42 +02:00
Gwendal Roué 1a24193d2c #92, #129: Full-Text Search documentation 2016-10-03 14:08:36 +02:00
Gwendal Roué 92ac40e4da #92, #129: FTS3Pattern cleanup 2016-10-03 12:18:52 +02:00
Gwendal Roué fcc316674e #92, #129: FTS3Pattern cleanup 2016-10-03 09:07:26 +02:00
Gwendal Roué a0237d4259 #92, #129: FTS3Pattern ~= Column 2016-10-03 08:34:12 +02:00
Gwendal Roué bf061b9d4f #92, #129: FTS3Pattern(matchingAnyTokenIn:tokenizer:), FTS3Pattern(matchingAllTokensIn:tokenizer:), FTS3Pattern(matchingPhrase:tokenizer:) 2016-10-03 08:26:35 +02:00
Gwendal Roué 6f3b5b1c61 #92: introduce FTS4Pattern (addresses #129) 2016-09-30 10:47:36 +02:00
Gwendal Roué 1244b6b283 Move == operators inside their adopting type 2016-09-30 06:00:50 +02:00
Gwendal Roué b01303f5ae GRDBDemoiOS: make setupDatabase() a throwing function 2016-09-29 10:06:50 +02:00
Gwendal Roué 3a9d5730e5 Latest Swift 2.3 version: v0.81.2 2016-09-28 20:55:34 +02:00
Gwendal Roué 17a8a5984b v0.85.0 2016-09-28 20:47:22 +02:00
Gwendal Roué 0cd2c067b6 GRDB Extension Guide: link to future reference 2016-09-28 20:44:28 +02:00
Gwendal Roué b4342492d5 CHANGELOG.md 2016-09-28 20:38:01 +02:00
Gwendal Roué ccbbdd280d CHANGELOG.md 2016-09-28 20:37:14 +02:00
Gwendal Roué ada209dc75 TODO.md 2016-09-28 20:20:58 +02:00
Gwendal Roué a602e3c88a TODO.md 2016-09-28 20:17:24 +02:00
Gwendal Roué b507d527e3 TODO.md 2016-09-28 20:16:59 +02:00
Gwendal Roué 6d1ce4bca2 Documentation: how to access the SQLite C Interface (ping #132) 2016-09-28 20:13:59 +02:00
Gwendal Roué 36eda331d1 ROUND() is a weird beast... Don't use it as an documentation example (and fix extensibility tests) 2016-09-28 19:03:23 +02:00
Gwendal Roué a2eca89fb8 TODO.md 2016-09-28 18:55:31 +02:00
Gwendal Roué a555ba09f1 Documentation 2016-09-28 13:59:02 +02:00
Gwendal Roué 313104a01b TODO.md 2016-09-28 09:49:53 +02:00
Gwendal Roué 744d2a535f Failing extensibility tests 2016-09-28 09:13:00 +02:00
Gwendal Roué f08d9d2775 Document the release process 2016-09-28 09:12:51 +02:00
Gwendal Roué 224cf9b88d Project fixes for SQLCipher and Custom SQLite tests on OSX 2016-09-28 08:49:25 +02:00
Gwendal Roué 5ba06a74a0 Remove support for text encodings 2016-09-28 07:14:22 +02:00
Gwendal Roué 1f14cc35dd CHANGELOG.md 2016-09-28 06:49:12 +02:00
Gwendal Roué 4953307e1e Documentation 2016-09-28 06:47:18 +02:00
Gwendal Roué b33d429212 Documentation 2016-09-28 06:46:25 +02:00
Gwendal Roué d3a17b64f4 Documentation 2016-09-28 06:45:10 +02:00
Gwendal Roué 5a572b25a0 Refactor the query interface types to enhance extensibility 2016-09-27 23:11:21 +02:00
Gwendal Roué 03187804c4 Minor 2016-09-23 08:04:45 +02:00
Gwendal Roué 99b005f0cc Minor 2016-09-23 07:40:57 +02:00
Gwendal Roué 7bf5d027bf TODO: FTS needs =~ match operator 2016-09-22 22:45:46 +02:00
Gwendal Roué e6f7cc8d74 README.md 2016-09-22 15:36:24 +02:00
Gwendal Roué 4224c01925 README.md 2016-09-22 09:14:57 +02:00
Gwendal Roué ea85d577d8 Clarification the behavior of the REPLACE conflict handling regarding transaction observers 2016-09-22 07:48:37 +02:00
Gwendal Roué add0e43723 TODO.md 2016-09-22 07:45:46 +02:00
Gwendal Roué e7378cbba0 Test that the truncate optimization does not prevent transaction observers from observing individual deletions 2016-09-22 07:45:32 +02:00
Gwendal Roué dc58ff19d4 Clarification the behavior of the REPLACE conflict handling regarding transaction observers 2016-09-22 07:44:43 +02:00
Gwendal Roué 7bce331eb1 Clarification the behavior of the REPLACE conflict handling regarding transaction observers 2016-09-22 06:48:18 +02:00
Gwendal Roué 141dc247d6 Playgrounds/MyPlayground.swift 2016-09-21 19:51:23 +02:00
Gwendal Roué dda8df678a Documentation 2016-09-21 09:15:27 +02:00
Gwendal Roué e06abbc354 Documentation 2016-09-21 09:14:00 +02:00
Gwendal Roué 26938c245b Documentation 2016-09-21 09:12:51 +02:00
Gwendal Roué 54e9803080 Rename SchedulingWatchdog.makeSerializedQueueAllowing(database:) to SchedulingWatchdog.makeSerializedQueue(allowingDatabase:) 2016-09-21 09:11:23 +02:00
Gwendal Roué bf30c7cb01 TODO.md 2016-09-17 13:00:35 +02:00
Gwendal Roué 32f063fd2b TODO.md 2016-09-17 12:57:56 +02:00
Gwendal Roué e4c27a31fa TODO.md 2016-09-17 12:53:05 +02:00
Gwendal Roué 365e44e376 TableMapping.deleteAll(db) 2016-09-17 12:50:57 +02:00
Gwendal Roué 7e55a8558a Documentation 2016-09-17 11:05:27 +02:00
Gwendal Roué e38b007743 Documentation 2016-09-17 11:03:09 +02:00
Gwendal Roué f2dd248200 Documentation 2016-09-17 11:02:02 +02:00
Gwendal Roué ce8673e7e2 Documentation 2016-09-17 10:35:59 +02:00
Gwendal Roué aaf4deee2c Documentation 2016-09-17 06:30:44 +02:00
Gwendal Roué 7a0895f872 Documentation 2016-09-17 06:13:37 +02:00
Gwendal Roué d052c32f7a Documentation 2016-09-17 06:01:12 +02:00
Gwendal Roué 07dbee52cd Documentation 2016-09-17 05:58:50 +02:00
Gwendal Roué aa8b1f39b3 Documentation 2016-09-17 05:39:16 +02:00
Gwendal Roué 849c550191 Typo 2016-09-17 05:35:30 +02:00
Gwendal Roué 41cdb4911c CHANGELOG.md 2016-09-17 05:26:19 +02:00
Gwendal Roué 15c4efcbe4 Typo 2016-09-17 05:20:12 +02:00
Gwendal Roué 6b776f0b92 Documentation of DatabaseValue.fromDatabaseValue 2016-09-16 22:25:58 +02:00
Gwendal Roué b8005deaa4 Fix typo 2016-09-16 22:23:48 +02:00
Gwendal Roué 2fc35e2543 Documentation of DatabaseValue.fromDatabaseValue 2016-09-16 22:23:12 +02:00
Gwendal Roué e7fcfff370 Documentation of DatabaseValue conversion from NULL 2016-09-16 22:16:08 +02:00
Gwendal Roué 4bc9033205 Documentation of DatabaseValue conversion from NULL 2016-09-16 22:14:10 +02:00
Gwendal Roué 8673550b69 Conflict resolution documentation 2016-09-16 20:29:06 +02:00
Gwendal Roué e47ed9c012 Conflict resolution documentation 2016-09-16 20:25:47 +02:00
Gwendal Roué bdd58a50b1 Conflict resolution documentation 2016-09-16 20:23:26 +02:00
Gwendal Roué e3d8deba0c v0.84.0 2016-09-16 20:05:44 +02:00
Gwendal Roué b386832256 Conflict resolution documentation 2016-09-16 19:56:43 +02:00
Gwendal Roué 26564cfeda Conflict resolution documentation 2016-09-16 19:55:52 +02:00
Gwendal Roué 78e560318d Conflict resolution documentation 2016-09-16 19:54:51 +02:00
Gwendal Roué 7a88044edb Conflict resolution documentation 2016-09-16 19:53:19 +02:00
Gwendal Roué cc06968c42 Conflict resolution documentation 2016-09-16 19:40:34 +02:00
Gwendal Roué ae7c89d746 Conflict resolution documentation 2016-09-16 19:37:29 +02:00
Gwendal Roué 0c525a8e52 Only the IGNORE conflict policy invalidates the last inserted rowID (#118) 2016-09-16 19:37:14 +02:00
Gwendal Roué 4ac562a55a Fixes #118 2016-09-16 13:52:43 +02:00
Gwendal Roué 5180673b6d v0.83.0 2016-09-16 07:50:35 +02:00
Gwendal Roué f573046107 Merge branch 'Swift2.3' of github.com:groue/GRDB.swift
Conflicts:
	CHANGELOG.md
	GRDB.swift.podspec
	GRDB/Core/DatabaseValue.swift
	GRDB/Core/Row.swift
	GRDB/Core/RowAdapter.swift
	GRDB/Record/Record.swift
	README.md
	Support/Info.plist
	Tests/Public/Core/DatabaseValue/DatabaseValueTests.swift
	Tests/Public/Record/MinimalPrimaryKeyRowIDTests.swift
	Tests/Public/Record/MinimalPrimaryKeySingleTests.swift
	Tests/Public/Record/PrimaryKeyMultipleTests.swift
	Tests/Public/Record/PrimaryKeyRowIDTests.swift
	Tests/Public/Record/PrimaryKeySingleTests.swift
	Tests/Public/Record/PrimaryKeySingleWithReplaceConflictResolutionTests.swift
2016-09-16 06:46:42 +02:00
Gwendal Roué a24878209b v0.81.1 2016-09-16 06:00:16 +02:00
Gwendal Roué f12d69a4f6 CHANGELOG.md 2016-09-16 05:59:42 +02:00
Gwendal Roué 4a1706ede6 Remove Row.databaseValue(atIndex:) and Row.databaseValue(named:) 2016-09-16 05:58:17 +02:00
Gwendal Roué f5cb34f506 DatabaseValue no longer adopts StatementColumnConvertible; DatabaseValue.fromDatabaseValue() no longer returns nil for NULL (fixes #119) 2016-09-16 05:48:09 +02:00
Gwendal Roué 2f1e758eb4 Upgrade SQLiteCustom to v3.14.1 2016-09-16 05:46:37 +02:00
Gwendal Roué f825f43528 Upgrade custom SQLite builds to v3.14.1, and restore support for SQLite pre-update hooks 2016-09-15 09:05:09 +02:00
Gwendal Roué 8f1844921e README.md 2016-09-15 07:24:20 +02:00
Gwendal Roué 1cd887d3ec TODO.md 2016-09-15 06:42:05 +02:00
Gwendal Roué 0bb53a73a8 README.md 2016-09-14 21:31:05 +02:00
Gwendal Roué 6ede5dda6b README.md 2016-09-14 21:29:25 +02:00
Gwendal Roué 3dbf92bb58 README.md 2016-09-14 21:21:33 +02:00
Gwendal Roué f447d7f423 README.md 2016-09-14 16:08:37 +02:00
Gwendal Roué a3f6a330e2 README.md 2016-09-14 13:28:35 +02:00
Gwendal Roué 0c26670bf6 README.md 2016-09-14 13:19:55 +02:00
Gwendal Roué 97884af83d Documentation 2016-09-14 09:13:26 +02:00
Gwendal Roué 946df5f8d6 Documentation 2016-09-14 09:05:20 +02:00
Gwendal Roué e98a12c797 v0.82.1 2016-09-14 08:59:27 +02:00
Gwendal Roué 7444870741 CocoaPods support: .swift-version 2016-09-14 08:57:20 +02:00
Gwendal Roué 2bcf6a5da8 Restore FetchedRecordsController (fixes #117)
The Swift 3 compiler in Release configuration collapses when a property of type DatabaseWriter calls its rethrowing write() method. This commit introduces an ad-hoc non-rethrowing method to make the compiler happy.
2016-09-13 13:39:01 +02:00
Gwendal Roué b77fa8d57b Revert "Disable FetchedRecordsController which does not compile in Release configuration (fixes #116)"
This reverts commit cfd6f063e1.
2016-09-13 13:10:26 +02:00
Gwendal Roué cfd6f063e1 Disable FetchedRecordsController which does not compile in Release configuration (fixes #116)
Tests won't run in Release mode (because of compilation errors around the DatabaseReader protocol), but at least Carthage can build the iOS, macOS, and watchOS frameworks.
2016-09-13 09:02:51 +02:00
Gwendal Roué a8906da890 Fix documentation typo 2016-09-11 13:44:45 +02:00
Gwendal Roué b63046b20a v0.82.0 2016-09-11 13:16:40 +02:00
Gwendal Roué df91e31397 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3
Conflicts:
	README.md
2016-09-11 13:11:27 +02:00
Gwendal Roué b40622c093 More renaming Fix-its for the Swift 2.x -> Swift 3 API changes 2016-09-11 12:56:31 +02:00
Gwendal Roué a925aac1df Project settings 2016-09-11 12:30:28 +02:00
Gwendal Roué 2081b6a4a8 Merge pull request #114 from swiftlyfalling/Swift3-Swift2-conversion-fixits
Automatic renaming Fix-Its for many of the Swift 2.x -> Swift 3 GRDB API changes
2016-09-11 08:07:36 +02:00
Gwendal Roué 7b66f5afb3 Fix repo URL in Podfile snippet (fixes #113) 2016-09-11 07:48:55 +02:00
swiftlyfalling a14da417a7 Add automatic renaming Fix-Its that cover many of the Swift 2.x -> Swift 3 GRDB API changes. 2016-09-10 17:44:48 -04:00
Gwendal Roué 5af4e1db67 README.md 2016-09-10 18:44:02 +02:00
Gwendal Roué e90e0f7d57 Database event filtering documentation 2016-09-10 18:40:43 +02:00
Gwendal Roué eac0901af0 Refactor database event filtering 2016-09-10 18:28:44 +02:00
Gwendal Roué 79f3f69827 Revert "Tests for numeric overflows depend on architecture"
This reverts commit 88cc17b530.
2016-09-10 17:55:46 +02:00
Gwendal Roué 7c0ca54249 Swift 3: move some types declarations inside the Database class 2016-09-10 17:52:15 +02:00
Gwendal Roué d10d4220a8 README.md 2016-09-10 17:25:13 +02:00
Gwendal Roué ab8ef25f89 Remove SQLCipher support from Carthage 2016-09-10 17:22:16 +02:00
Gwendal Roué 8ff60854ac CHANGELOG.md 2016-09-10 17:15:47 +02:00
Gwendal Roué 41938a5f16 CHANGELOG.md 2016-09-10 16:36:19 +02:00
Gwendal Roué 10f8a2e807 CHANGELOG.md 2016-09-10 16:31:57 +02:00
Gwendal Roué 2d8de7009b Swift 3 and watchOS 2016-09-10 16:28:18 +02:00
Gwendal Roué 88cc17b530 Tests for numeric overflows depend on architecture 2016-09-10 16:15:35 +02:00
Gwendal Roué df09d0c8bb Swift 3 and SQLCipher 2016-09-10 16:03:42 +02:00
Gwendal Roué 749aa28b9a Merge branch 'Swift2.3' of github.com:groue/GRDB.swift into Swift3
Conflicts:
	CHANGELOG.md
	DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj/project.pbxproj
	GRDB.xcodeproj/project.pbxproj
	GRDB/Core/Support/Foundation/NSURL.swift
	README.md
	TODO.md
	Tests/Public/SQLTableBuilder/SQLTableBuilderTests.swift
2016-09-10 15:36:56 +02:00
Gwendal Roué 912ec6a9e9 Cleanup 2016-09-10 15:34:32 +02:00
Gwendal Roué e49957b2b2 v0.81.0 2016-09-10 13:28:17 +02:00
Gwendal Roué 06e74ffb47 Update link to latest Swift2.2 version 2016-09-09 13:46:45 +02:00
Gwendal Roué 4ebbc638da Merge branch 'Swift2.2' of github.com:groue/GRDB.swift 2016-09-09 13:45:39 +02:00
Gwendal Roué 757fbbdd88 v0.80.2 2016-09-09 13:35:36 +02:00
Gwendal Roué c73965f69a Fix SQLiteWatchOS module 2016-09-09 13:33:54 +02:00
Gwendal Roué 2af0f73473 Swift 2.3 requires Xcode 8 2016-09-09 09:15:35 +02:00
Gwendal Roué 305ecf8a7c watchOS requirement 2016-09-09 09:10:38 +02:00
Gwendal Roué da56090604 Typo 2016-09-09 09:02:45 +02:00
Gwendal Roué 98eb5640ed Typo 2016-09-09 09:02:19 +02:00
Gwendal Roué 1e1b1baad5 Update README about various Swift versions 2016-09-09 09:00:41 +02:00
Gwendal Roué a68103e8ba Apply https://github.com/groue/GRDB.swift/issues/101#issuecomment-240568714 2016-09-09 08:48:10 +02:00
Gwendal Roué 3438addf6c Swift 2.3 (addresses #110, #112) 2016-09-09 08:44:03 +02:00
Gwendal Roué 6fc7c4e2c0 TODO.md 2016-09-08 13:57:30 +02:00
Gwendal Roué dc7537ac0a Apply https://github.com/groue/GRDB.swift/issues/101#issuecomment-240568714 2016-09-08 13:56:59 +02:00
Gwendal Roué d7a83f3361 TODO.md 2016-09-08 13:25:06 +02:00
Gwendal Roué 5e75b1e7dc v0.80.1 2016-09-08 13:04:01 +02:00
Gwendal Roué a11a16a700 Project cleanup 2016-09-08 12:58:14 +02:00
Gwendal Roué a3de8281ef Ooops add watchOS to the podspec 2016-09-08 09:13:23 +02:00
Gwendal Roué 7960528464 Update GRDBDemo iOS/watchOS for Xcode 8 GM 2016-09-08 09:06:44 +02:00
Gwendal Roué a8b067885f Merge branch 'master' of github.com:groue/GRDB.swift into Swift3
Conflicts:
	DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj/project.pbxproj
	GRDB/Core/Database.swift
	README.md
	TODO.md
2016-09-08 08:37:58 +02:00
Gwendal Roué 945fabbdd6 Disable macOS tests that trigger a linker error 2016-09-08 08:10:00 +02:00
Gwendal Roué c12bf0aead Xcode is no longer beta 2016-09-08 08:09:10 +02:00
Gwendal Roué 12f25ddafd Fix Xcode 8.0 GM compilation errors 2016-09-08 08:08:38 +02:00
Gwendal Roué 55f07e913a v0.80.0 2016-09-07 22:59:03 +02:00
Gwendal Roué 0bd22281f7 GRDBDemoWatchOS 2016-09-07 22:51:12 +02:00
Gwendal Roué 72ab62b21b Merge branch 'WatchOS' of github.com:groue/GRDB.swift 2016-09-07 22:17:08 +02:00
Gwendal Roué 796d30d863 TODO.md 2016-09-07 22:16:01 +02:00
Gwendal Roué b191323e2b Query Interface deletion documentation 2016-09-07 18:06:30 +02:00
Gwendal Roué e4ae0988a4 QueryInterfaceRequest.deleteAll (for @pakko972) 2016-09-07 14:10:16 +02:00
Gwendal Roué 238ebdeed8 Fix the documentation of delete/Fetch/One/All(keys:) so that it makes clear that arguments are unique keys. 2016-09-07 13:44:25 +02:00
Gwendal Roué 68ebe1a4ff TODO.md 2016-09-07 13:39:37 +02:00
Gwendal Roué 8a89be6999 Pass test for Database.tableExists() and temporary table 2016-09-07 13:33:31 +02:00
Gwendal Roué 0620fc9f17 Failing test for Database.tableExists() and temporary table 2016-09-07 13:29:06 +02:00
Gwendal Roué 1e95e38505 TODO.md 2016-09-07 04:24:18 +02:00
Gwendal Roué 5b4e5f9d1d TODO.md 2016-09-06 10:08:05 +02:00
Gwendal Roué 6285fd9f98 TODO.md 2016-09-06 06:25:37 +02:00
Gwendal Roué 401d5cab66 TODO.md 2016-09-02 12:46:29 +02:00
Gwendal Roué d7e2df5ca9 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3
Conflicts:
	README.md
2016-08-19 09:01:59 +02:00
Gwendal Roué b38177bb32 Fix reference Swift 2.2 version 2016-08-19 09:00:34 +02:00
Gwendal Roué 27b9cbda38 Documentation 2016-08-19 08:59:06 +02:00
Gwendal Roué a71e08ad2a TODO: attempt to read from the database in DatabasePool.init() and throw eventual error (see #99) 2016-08-18 11:16:47 +02:00
Gwendal Roué 5e0c9165ba Update project settings 2016-08-17 13:06:17 +02:00
Gwendal Roué cb2a6cd3b5 TODO 2016-08-17 12:59:55 +02:00
Gwendal Roué 81c0e73751 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3
Conflicts:
	GRDB/Core/Row.swift
	GRDB/QueryInterface/SQLTableBuilder.swift
	README.md
2016-08-17 12:58:41 +02:00
Gwendal Roué 6f12594b3e v0.79.4 2016-08-17 08:04:01 +02:00
Gwendal Roué 5a296b1238 Fix #102 2016-08-17 07:54:13 +02:00
Gwendal Roué 249456c916 Add failing test for #102 (DatabasePool can't open a non-WAL database and then read, with error 14) 2016-08-17 07:20:25 +02:00
Gwendal Roué 5aa2554584 v0.79.3 2016-08-16 19:21:11 +02:00
Gwendal Roué 9999ced817 Pass tests for table creation DSL with auto references
Conflicts:
	CHANGELOG.md
2016-08-16 19:03:35 +02:00
Gwendal Roué 6c137b29c2 Failing tests for table creation DSL with auto references 2016-08-16 19:01:53 +02:00
Gwendal Roué 854c070b82 Xcode Version 8.0 beta 6 (8S201h) 2016-08-16 17:47:57 +02:00
Gwendal Roué 6a5a4664e9 CHANGELOG.md 2016-08-13 11:01:20 +02:00
Gwendal Roué 5aaecd3946 Row.value(SQLColumn) 2016-08-13 10:59:16 +02:00
Gwendal Roué 425310710f TODO.md 2016-08-11 09:09:08 +02:00
Gwendal Roué af990fb666 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3 2016-08-11 08:12:29 +02:00
Gwendal Roué c0b2669c46 Tests for generated UPDATE queries allow some variation 2016-08-11 08:11:48 +02:00
Gwendal Roué edc615f487 Tests for generated UPDATE queries allow some variation 2016-08-11 08:07:58 +02:00
Gwendal Roué 04b8b8dd5a Update version 2016-08-10 21:30:19 +02:00
Gwendal Roué 34ef36544e Merge branch 'master' of github.com:groue/GRDB.swift into Swift3
Conflicts:
	GRDB/Record/Persistable.swift
	README.md
	Tests/Public/Core/Persistable/MutablePersistableTests.swift
	Tests/Public/Core/Persistable/PersistableTests.swift
2016-08-10 21:29:30 +02:00
Gwendal Roué 4a9deadcf4 v0.79.2 2016-08-10 21:19:06 +02:00
Gwendal Roué e1eb1d705a Pass tests for partial update case insensitivity 2016-08-10 21:14:35 +02:00
Gwendal Roué ab035a3887 Failing tests for partial update case insensitivity 2016-08-10 21:14:26 +02:00
Gwendal Roué c92f0f3edf Merge branch 'master' of github.com:groue/GRDB.swift into Swift3
Conflicts:
	GRDB/QueryInterface/SQLTableBuilder.swift
	GRDB/Record/Persistable.swift
	GRDB/Record/Record.swift
	README.md
	TODO.md
	Tests/Public/Core/Persistable/MutablePersistableTests.swift
	Tests/Public/SQLTableBuilder/SQLTableBuilderTests.swift
2016-08-10 20:43:24 +02:00
Gwendal Roué ceb73730c2 v0.79.1 2016-08-10 18:56:23 +02:00
Gwendal Roué 60e0a731ad Partial updates now requires updated columns to be present in the persistentDictionary. 2016-08-10 18:54:32 +02:00
Gwendal Roué d9e77284c1 Pass test for multiple foreign keys on a column 2016-08-10 13:23:24 +02:00
Gwendal Roué 4d9c7d0dcb Failing test for multiple foreign keys on a column 2016-08-10 13:23:19 +02:00
Gwendal Roué 936d2e56ea CHANGELOG.md 2016-08-10 09:08:06 +02:00
Gwendal Roué 4be1923921 Pass test for multiple check constraints on a column 2016-08-10 08:48:24 +02:00
Gwendal Roué 7bb5866164 Failing test for multiple check constraints on a column 2016-08-10 08:48:06 +02:00
Gwendal Roué 0f2854fe17 CHANGELOG.md 2016-08-10 08:26:43 +02:00
Gwendal Roué 548b2f4b77 Rename DataMapper to DAO 2016-08-10 08:24:31 +02:00
Gwendal Roué cd776e4b64 Passing tests for delete() when primary key is nil 2016-08-10 08:20:15 +02:00
Gwendal Roué aeca4c0f9c Failing tests that delete() returns false when primary key is nil 2016-08-10 08:16:32 +02:00
Gwendal Roué d96b1bb9f8 Passing tests for update() and exists() when primary key is nil 2016-08-10 08:14:37 +02:00
Gwendal Roué 944bdd5bba Failing tests that update() throws PersistenceError.NotFound when primary key is nil 2016-08-10 08:03:41 +02:00
Gwendal Roué e61550841b Failing tests that exists() returns false when primary key is nil 2016-08-10 08:00:27 +02:00
Gwendal Roué ff5e171d4a Date format documentation (addresses #97) 2016-08-10 07:45:04 +02:00
Gwendal Roué b5bb92459d WatchOS framework (adresses #96) 2016-08-10 06:27:50 +02:00
Gwendal Roué b9ea94e9be TODO.md 2016-08-10 06:15:53 +02:00
Gwendal Roué f42186f7c9 TODO.md 2016-08-10 06:10:59 +02:00
Gwendal Roué b510bff195 Documentation 2016-08-09 18:41:30 +02:00
Gwendal Roué c1b85c0d21 TODO.md 2016-08-09 18:35:50 +02:00
Gwendal Roué 08f84bdc07 TODO.md 2016-08-09 14:36:56 +02:00
Gwendal Roué 187c93377f Documentation 2016-08-09 09:09:11 +02:00
Gwendal Roué eb4b85dc79 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3 2016-08-09 09:08:48 +02:00
Gwendal Roué 36d7bf77e3 Documentation 2016-08-09 09:07:45 +02:00
Gwendal Roué 2a47e5f32c TODO.md 2016-08-08 21:28:15 +02:00
Gwendal Roué b522abffb5 TODO.md 2016-08-08 21:24:01 +02:00
Gwendal Roué ba272061b7 Documentation 2016-08-08 13:54:02 +02:00
Gwendal Roué 142542da1e Merge branch 'master' of github.com:groue/GRDB.swift into Swift3 2016-08-08 13:47:19 +02:00
Gwendal Roué c79c4d265c Documentation 2016-08-08 13:46:26 +02:00
Gwendal Roué 95289f1715 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3
Conflicts:
	GRDB/QueryInterface/SQLTableBuilder.swift
	README.md
	TODO.md
	Tests/Public/SQLTableBuilder/SQLTableBuilderTests.swift
2016-08-08 13:35:59 +02:00
Gwendal Roué a35d5c4c3a v0.79.0 2016-08-08 13:22:49 +02:00
Gwendal Roué c6fd36b75d SQLTableBuilder: column.defaults(to:) 2016-08-08 13:19:43 +02:00
Gwendal Roué 985eb69c50 TODO.md 2016-08-08 10:42:09 +02:00
Gwendal Roué 17912ebffe Documentation 2016-08-08 09:19:41 +02:00
Gwendal Roué a9b41d4a21 TODO.md 2016-08-08 08:57:10 +02:00
Gwendal Roué 0b020ce1ac Documentation 2016-08-08 08:12:18 +02:00
Gwendal Roué 580532aeca Merge branch 'master' of github.com:groue/GRDB.swift into Swift3
Conflicts:
	GRDB/Core/Statement.swift
2016-08-08 08:10:48 +02:00
Gwendal Roué 8c43047c95 Documentation 2016-08-08 08:06:43 +02:00
Gwendal Roué 05aeef0ea0 Documentation 2016-08-08 08:06:09 +02:00
Gwendal Roué ced9493069 Better compilation time 2016-08-07 15:26:39 +02:00
Gwendal Roué 76ab3fd1ab Better compilation time 2016-08-07 15:26:30 +02:00
Gwendal Roué 7d6fcda03e slow_methods.sh output methods that are slow to compile 2016-08-07 15:26:18 +02:00
Gwendal Roué a7d2c1137c CHANGELOG.md 2016-08-07 13:53:25 +02:00
Gwendal Roué 033ad18779 CHANGELOG.md 2016-08-07 13:51:34 +02:00
Gwendal Roué 404706a3db Swift 3 tests 2016-08-07 13:19:53 +02:00
Gwendal Roué 2c3bf06740 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3
Conflicts:
	GRDB/QueryInterface/QueryInterfaceRequest.swift
	GRDB/QueryInterface/SQLCollation.swift
	GRDB/QueryInterface/SQLFunction.swift
	GRDB/QueryInterface/SQLOperator.swift
	GRDB/QueryInterface/SQLSelectQuery.swift
	GRDB/QueryInterface/SQLTableBuilder.swift
2016-08-07 12:57:48 +02:00
Gwendal Roué a132b58227 Promote _SQLExpressible protocol to SQLExpressible 2016-08-07 12:46:19 +02:00
Gwendal Roué 8d91141d6a Swift 3 : lowercase enum cases for DatabasePreUpdateEvent.Kind 2016-08-07 12:25:13 +02:00
Gwendal Roué a8ac895998 Swift 3 documentation 2016-08-07 12:24:32 +02:00
Gwendal Roué ee8aa1d9c6 Swift 3: move @noescape qualifiers 2016-08-07 11:04:04 +02:00
Gwendal Roué 206e45214f Merge branch 'master' of github.com:groue/GRDB.swift into Swift3 2016-08-07 11:00:25 +02:00
Gwendal Roué ba2aef0468 Documentation 2016-08-07 10:59:56 +02:00
Gwendal Roué 7642b522f9 SQLTableBuilder: add missing @noescape qualifiers 2016-08-07 10:57:26 +02:00
Gwendal Roué b8960c4549 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3
Conflicts:
	DemoApps/GRDBDemoiOS/GRDBDemoiOS/PersonsViewController.swift
2016-08-07 10:48:46 +02:00
Gwendal Roué 358b823e00 GRDBDemoiOS: use table creation DSL 2016-08-07 10:44:19 +02:00
Gwendal Roué aa3a95f528 Swift 3 GRDBDemoiOS 2016-08-07 10:38:51 +02:00
Gwendal Roué 00a1eebf60 Swift 3 Grand Renaming: SQLColumn -> Column 2016-08-07 10:38:24 +02:00
Gwendal Roué b6587da081 Swift 3 Documentation 2016-08-07 10:20:07 +02:00
Gwendal Roué bcd6e6767a Merge branch 'master' of github.com:groue/GRDB.swift into Swift3
Conflicts:
	GRDB.xcodeproj/project.pbxproj
	GRDB/Core/Database.swift
	GRDB/Core/DatabaseSchemaCache.swift
	GRDB/QueryInterface/SQLCollation.swift
	README.md
	TODO.md
	Tests/Public/Core/DatabaseValueConvertible/DatabaseValueConversionTests.swift
	Tests/Public/Core/StatementColumnConvertible/StatementColumnConvertibleTests.swift
	Tests/Public/QueryInterfaceRequest/QueryInterfaceRequestTests.swift
2016-08-07 10:11:31 +02:00
Gwendal Roué 7d21772f87 Documentation 2016-08-07 05:01:27 +02:00
Gwendal Roué 949d706eaa Documentation 2016-08-07 04:41:43 +02:00
Gwendal Roué c8445b9b5f Documentation 2016-08-07 04:35:31 +02:00
Gwendal Roué d3c901678c Documentation 2016-08-07 04:18:44 +02:00
Gwendal Roué 1549affd5c Documentation 2016-08-07 04:14:29 +02:00
Gwendal Roué f9e875a7cc Documentation 2016-08-07 04:11:37 +02:00
Gwendal Roué 5b65279a0a Documentation 2016-08-07 04:00:57 +02:00
Gwendal Roué ccd58d2909 Documentation 2016-08-07 03:41:18 +02:00
Gwendal Roué 714f56c17c Fix version links 2016-08-06 20:50:38 +02:00
Gwendal Roué a820a96996 v0.78.0 2016-08-06 15:40:11 +02:00
Gwendal Roué 1d77523e41 Merge pull request #93 from groue/SQLTableBuilder
Table Creation DSL
2016-08-06 15:38:06 +02:00
Gwendal Roué 107c1529ff Merge branch 'master' of github.com:groue/GRDB.swift into SQLTableBuilder
Conflicts:
	TODO.md
2016-08-06 15:29:06 +02:00
Gwendal Roué a7f80ef144 CHANGELOG.md 2016-08-06 15:27:32 +02:00
Gwendal Roué 9274864a83 Identity 2016-08-06 15:09:47 +02:00
Gwendal Roué f51bbd8a39 Documentation tweaks 2016-08-06 15:07:07 +02:00
Gwendal Roué 1534e1a1ee Documentation tweaks 2016-08-06 15:05:16 +02:00
Gwendal Roué 0c9c176223 SQLTableBuilder documentation 2016-08-06 15:00:38 +02:00
Gwendal Roué e58ed7a3dc SQLTableBuilder documentation 2016-08-06 14:59:01 +02:00
Gwendal Roué adde65f757 SQLTableBuilder documentation 2016-08-06 14:58:21 +02:00
Gwendal Roué b45939ed26 SQLTableBuilder documentation 2016-08-06 14:57:01 +02:00
Gwendal Roué 3de4920385 SQLTableBuilder documentation 2016-08-06 14:54:53 +02:00
Gwendal Roué 0ab4df99b7 SQLTableBuilder documentation 2016-08-06 14:43:43 +02:00
Gwendal Roué adaabcb8e5 SQLTableBuilder documentation 2016-08-06 14:38:20 +02:00
Gwendal Roué 68403ee142 SQLTableBuilder documentation 2016-08-06 14:33:31 +02:00
Gwendal Roué 1eb0040126 SQLTableBuilder documentation 2016-08-06 14:21:57 +02:00
Gwendal Roué 6cca2fd991 Rename PrimaryKey to PrimaryKeyInfo 2016-08-06 14:21:39 +02:00
Gwendal Roué f276ab830a README.md 2016-08-06 14:02:00 +02:00
Gwendal Roué 2d3f45bad5 README.md 2016-08-06 13:57:03 +02:00
Gwendal Roué 30259c4360 SQLTableBuilder polish 2016-08-06 13:49:46 +02:00
Gwendal Roué cfa091dbc4 SQLTableBuilder documentation + drop support for explicit primary key ordering until someone asks for it. 2016-08-06 13:40:04 +02:00
Gwendal Roué eb18f474c8 Error handling documentation 2016-08-06 12:12:04 +02:00
Gwendal Roué 6554a027d7 Error handling documentation 2016-08-06 12:07:12 +02:00
Gwendal Roué 0e83f0b217 Error handling documentation 2016-08-06 12:05:45 +02:00
Gwendal Roué b45d6945b1 Error handling documentation 2016-08-06 11:15:41 +02:00
Gwendal Roué c2e32c0bf2 Error handling documentation 2016-08-06 11:13:27 +02:00
Gwendal Roué 926b9b1d1a Error handling documentation 2016-08-06 11:11:38 +02:00
Gwendal Roué 57b51cec9c TODO.md 2016-08-06 11:11:06 +02:00
Gwendal Roué ebfcc2e23a SQLTableBuilder documentation 2016-08-06 10:16:43 +02:00
Gwendal Roué 980b3234d5 SQLTableBuilder documentation 2016-08-06 10:14:04 +02:00
Gwendal Roué a25b914085 SQLTableBuilder documentation 2016-08-06 10:11:56 +02:00
Gwendal Roué c936000d62 SQLTableBuilder documentation 2016-08-06 10:08:00 +02:00
Gwendal Roué e1f3adafb7 Typo 2016-08-06 10:02:24 +02:00
Gwendal Roué 4745eb190a Query Interface Request documentation 2016-08-06 10:00:13 +02:00
Gwendal Roué d78784e45e SQLTableBuilder documentation 2016-08-06 09:54:30 +02:00
Gwendal Roué 6e60ff2062 SQLTableBuilder documentation 2016-08-06 09:53:34 +02:00
Gwendal Roué b8c1c1ef1e Length function documentation 2016-08-06 09:51:35 +02:00
Gwendal Roué d918f0fb03 SQLTableBuilder: limit WITHOUT ROWID availability 2016-08-06 07:08:59 +02:00
Gwendal Roué 91d6880218 SQLTableBuilder documentation 2016-08-06 00:13:56 +02:00
Gwendal Roué ea30075602 SQLTableBuilder documentation 2016-08-06 00:10:15 +02:00
Gwendal Roué a00ca647f5 SQLTableBuilder documentation 2016-08-05 23:53:05 +02:00
Gwendal Roué f6260087c3 SQLTableBuilder documentation 2016-08-05 23:51:58 +02:00
Gwendal Roué 81e1d86047 SQLTableBuilder documentation 2016-08-05 23:51:01 +02:00
Gwendal Roué 988ac8e60b SQLTableBuilder polish 2016-08-05 23:45:27 +02:00
Gwendal Roué cc624f9ed2 SQLTableBuilder documentation 2016-08-05 23:39:28 +02:00
Gwendal Roué 8d2984c572 SQLTableBuilder documentation 2016-08-05 23:36:54 +02:00
Gwendal Roué 29d4396956 SQLTableBuilder: tests for unicode default strings 2016-08-05 23:35:56 +02:00
Gwendal Roué 0ba0023099 SQLTableBuilder documentation + support for LENGTH SQLite function 2016-08-05 23:22:47 +02:00
Gwendal Roué 2ef26e9681 SQLTableBuilder documentation 2016-08-05 23:06:38 +02:00
Gwendal Roué 3be6b6966b SQLTableBuilder documentation 2016-08-05 23:04:44 +02:00
Gwendal Roué 415aeb1ef5 SQLTableBuilder documentation 2016-08-05 23:02:39 +02:00
Gwendal Roué 2fc25e9b13 SQLTableBuilder documentation 2016-08-05 23:00:23 +02:00
Gwendal Roué 00a032e6b0 SQLTableBuilder documentation 2016-08-05 22:58:03 +02:00
Gwendal Roué 04ab95ab76 README.md 2016-08-05 20:51:15 +02:00
Gwendal Roué 2f3c7eb550 README.md 2016-08-05 20:49:57 +02:00
Gwendal Roué dce6d50350 README.md 2016-08-05 20:49:32 +02:00
Gwendal Roué 6ac63436f7 README.md 2016-08-05 20:48:16 +02:00
Gwendal Roué 03979d8665 README.md 2016-08-05 20:45:58 +02:00
Gwendal Roué 8991232681 SQLTableBuilder: alter(table:) { $0.add(column:) } 2016-08-05 20:31:18 +02:00
Gwendal Roué 31a0604341 SQLTableBuilder: rename(table:to:) 2016-08-05 20:04:28 +02:00
Gwendal Roué 8b6ac9c736 SQLTableBuilder: create(index:), drop(index:) 2016-08-05 19:58:12 +02:00
Gwendal Roué ac5279fa70 Use SQLCollation instead of String 2016-08-05 18:51:06 +02:00
Gwendal Roué ed2ea88cb5 TODO.md 2016-08-05 14:55:07 +02:00
Gwendal Roué f2a7706bdf SQLTableBuilder: test ordering of DSL statements is not the ordering of SQL clauses 2016-08-05 14:06:11 +02:00
Gwendal Roué b88d2fe111 SQLTableBuilder: table.check() 2016-08-05 14:03:50 +02:00
Gwendal Roué 9b9b4d4bdf SQLTableBuilder: column.defaults() and column.check() now accept SQL literal 2016-08-05 13:52:09 +02:00
Gwendal Roué 41037eb425 SQLTableBuilder: column.defaults() requires a constant value (so does SQLite) 2016-08-05 13:33:47 +02:00
Gwendal Roué ba126f1f1a SQLTableBuilder: code organization 2016-08-05 13:24:10 +02:00
Gwendal Roué 88894a6d54 SQLTableBuilder: TODO 2016-08-05 09:12:25 +02:00
Gwendal Roué 61cb276b94 SQLTableBuilder: table.foreignKey() 2016-08-05 09:05:32 +02:00
Gwendal Roué f83f5455c2 SQLTableBuilder: table.primaryKey(), table.uniqueKey() 2016-08-05 08:48:46 +02:00
Gwendal Roué 09e409cb79 SQLTableBuilder: documentation 2016-08-05 08:25:46 +02:00
Gwendal Roué 39e3cba80e SQLTableBuilder: column.references(deferred: true) 2016-08-05 08:24:00 +02:00
Gwendal Roué 8246f1c990 SQLTableBuilder: column.references() 2016-08-05 08:17:09 +02:00
Gwendal Roué 10c32381d4 SQLTableBuilder: column.collate() 2016-08-04 23:05:56 +02:00
Gwendal Roué 5b6efbbb5f SQLTableBuilder: column.defaults() 2016-08-04 22:57:14 +02:00
Gwendal Roué 5edb5276f8 SQLTableBuilder: column.check() 2016-08-04 13:57:32 +02:00
Gwendal Roué b1109780ed SQLTableBuilder: column.notNull() and unique() 2016-08-04 13:48:08 +02:00
Gwendal Roué 62070c50ff SQLTableBuilder WIP 2016-08-04 13:38:39 +02:00
Gwendal Roué 8332dc188a SQLTableBuilder tests 2016-08-04 13:34:14 +02:00
Gwendal Roué 3e28fd69b3 SQLTableBuilder: table & column primary key options 2016-08-04 09:10:32 +02:00
Gwendal Roué 4cf6f7bd7c SQLTableBuilder: first passing test 2016-08-04 08:51:00 +02:00
Gwendal Roué a2b0a57971 Realm 1.0.2 2016-08-03 13:27:50 +02:00
Gwendal Roué df7d5c6075 Performance tips 2016-08-02 09:03:34 +02:00
Gwendal Roué e6f9811162 Performance tips 2016-08-02 09:00:59 +02:00
Gwendal Roué 7625c75dc7 Swift 3: update project settings 2016-08-02 08:43:29 +02:00
Gwendal Roué 07ab79d8dd Swift 3 2016-08-02 08:38:59 +02:00
Gwendal Roué 54f8550229 Swift 3 2016-08-02 08:38:45 +02:00
Gwendal Roué f6ae7587ea More where clause to end of function declarations 2016-08-02 08:20:05 +02:00
Gwendal Roué 2d78d04d52 Update for Xcode Version 8.0 beta 4 (8S188o) 2016-08-01 22:33:50 +02:00
Gwendal Roué 5a26ee2ca9 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis 2016-08-01 19:02:42 +02:00
Gwendal Roué 8971d7b876 Performance tips 2016-08-01 19:02:25 +02:00
Gwendal Roué 158894c7cc Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis 2016-08-01 18:59:05 +02:00
Gwendal Roué 589f98bcc2 Performance tips 2016-08-01 18:58:46 +02:00
Gwendal Roué 9b250b0dda Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis 2016-08-01 18:47:53 +02:00
Gwendal Roué ebe147ee34 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis
Conflicts:
	GRDB.xcodeproj/project.pbxproj
	GRDB/Core/Row.swift
	README.md
	TODO.md
2016-08-01 18:47:42 +02:00
Gwendal Roué 4cd0334ed1 Performance tips 2016-08-01 18:38:23 +02:00
Gwendal Roué c49506e588 Performance tips 2016-08-01 17:27:49 +02:00
Gwendal Roué 238f5a9af3 didInsertWithRowID documentation 2016-08-01 17:25:30 +02:00
Gwendal Roué 5d81d0e640 Performance tips 2016-08-01 17:21:37 +02:00
Gwendal Roué 4baa0b102d Performance tips 2016-08-01 17:17:21 +02:00
Gwendal Roué 0cd17f15d7 Performance tips 2016-08-01 17:15:47 +02:00
Gwendal Roué 1fa08bbbc3 Performance tips 2016-08-01 17:09:39 +02:00
Gwendal Roué 9e06242c1d Performance tips 2016-08-01 15:19:16 +02:00
Gwendal Roué 5b7006d695 Performance tips 2016-08-01 15:15:31 +02:00
Gwendal Roué cd3273bb51 Performance tips 2016-08-01 14:02:32 +02:00
Gwendal Roué 917ad5f750 Performance tips 2016-08-01 13:59:04 +02:00
Gwendal Roué 29ee22f6cc TODO: Document Statement.unsafeSetArguments (addresses #91) 2016-08-01 12:14:44 +02:00
Gwendal Roué 4ad8157ba0 TODO.md 2016-08-01 07:45:14 +02:00
Gwendal Roué 69a8bd1761 TODO.md 2016-07-31 12:38:33 +02:00
Gwendal Roué 2bdeae0ddb README.md 2016-07-31 06:26:16 +02:00
Gwendal Roué 0fb1eec3cd Row adopts DictionaryLiteralConvertible 2016-07-31 06:18:16 +02:00
Gwendal Roué 243d6ebd2c TODO.md 2016-07-31 05:48:38 +02:00
Gwendal Roué 6b2882fe47 TODO.md 2016-07-30 21:09:49 +02:00
Gwendal Roué 6ad8dc7f3e CHANGELOG.md 2016-07-30 18:13:57 +02:00
Gwendal Roué fcedab74c0 sqlcipher v3.4.0 2016-07-30 18:09:47 +02:00
Gwendal Roué 7404c642e3 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis
Conflicts:
	GRDB.xcodeproj/project.pbxproj
	GRDB/Core/Database.swift
	GRDB/Core/DatabaseSchemaCache.swift
	GRDB/Record/Persistable.swift
	GRDB/Record/Record.swift
	README.md
	Tests/Private/DatabasePoolSchemaCacheTests.swift
	Tests/Public/Core/Persistable/MutablePersistableTests.swift
	Tests/Public/Core/Persistable/PersistableTests.swift
	Tests/Public/Record/RecordSubClassTests.swift
2016-07-30 12:58:10 +02:00
Gwendal Roué d922961112 Remove documentation for DatabaseValue.value() 2016-07-29 09:03:40 +02:00
Gwendal Roué c679970832 README.md 2016-07-29 08:31:49 +02:00
Gwendal Roué 8393cd4b86 CHANGELOG.md 2016-07-29 03:57:25 +02:00
Gwendal Roué 42125c756e v0.77.0 2016-07-28 19:32:20 +02:00
Gwendal Roué 447df0af17 Partial update WIP: changelog 2016-07-28 19:31:02 +02:00
Gwendal Roué 38d5646975 Merge branch 'master' of github.com:groue/GRDB.swift 2016-07-28 19:28:51 +02:00
Gwendal Roué b16656bd23 Partial update WIP: cache & column case insensitivity 2016-07-28 19:28:46 +02:00
Gwendal Roué 0f987916b7 Redirect Core Data and Realm users to "How to build an iOS application with SQLite and GRDB.swift" 2016-07-28 17:03:37 +02:00
Gwendal Roué 21e419ff8a Typo 2016-07-28 10:00:10 +02:00
Gwendal Roué d2acc351a2 README.md: link to the new blog post 2016-07-28 09:59:45 +02:00
Gwendal Roué faa076c1e9 TODO.md 2016-07-28 09:09:08 +02:00
Gwendal Roué 1eac28a145 Fix typo 2016-07-28 09:07:31 +02:00
Gwendal Roué df7791a3e7 Partial update WIP: documentation 2016-07-28 09:05:46 +02:00
Gwendal Roué 176a23fe97 Partial update WIP: tests 2016-07-28 08:53:17 +02:00
Gwendal Roué 548ff068fd Partial update WIP: implementation 2016-07-28 08:41:22 +02:00
Gwendal Roué 50ce433bcb Partial update WIP: public API 2016-07-28 08:25:08 +02:00
Gwendal Roué d8ada8c9d3 TODO.md 2016-07-26 06:47:33 +02:00
Gwendal Roué f04972a902 Documentation 2016-07-25 09:00:57 +02:00
Gwendal Roué 0b2ec35324 TODO.md 2016-07-23 15:01:42 +02:00
Gwendal Roué 77278e77eb Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis
Conflicts:
	GRDB/QueryInterface/QueryInterfaceRequest.swift
	GRDB/QueryInterface/SQLCollation.swift
	GRDB/QueryInterface/SQLSelectQuery.swift
2016-07-22 13:48:39 +02:00
Gwendal Roué c6f2c8a3f5 Remove dead code 2016-07-22 13:40:07 +02:00
Gwendal Roué e037972dbb Remove dead code 2016-07-22 13:38:31 +02:00
Gwendal Roué ba24c55d41 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis
Conflicts:
	GRDB.xcodeproj/project.pbxproj
	GRDB/QueryInterface/QueryInterfaceRequest.swift
	GRDB/QueryInterface/SQLCollation.swift
	GRDB/QueryInterface/SQLSelectQuery.swift
2016-07-22 13:04:20 +02:00
Gwendal Roué 034a24dfe3 _SQLExpression.sql(_:_:) turns all values into safely escaped SQL literals when given nil arguments. (addresses #83) 2016-07-22 12:56:26 +02:00
Gwendal Roué 9f7851a178 TODO.md 2016-07-22 11:11:13 +02:00
Gwendal Roué 7ea2d7d1ab Merge branch 'master' of github.com:groue/GRDB.swift into Swift3
Conflicts:
	GRDB/Core/DatabaseValueConvertible.swift
2016-07-22 10:08:48 +02:00
Gwendal Roué 8ecfb872b6 Simplify DatabaseValueConvertible.sqlLiteral 2016-07-22 10:01:36 +02:00
Gwendal Roué 2a91ab07b9 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis
Conflicts:
	GRDB.xcodeproj/project.pbxproj
	GRDB/Core/Database.swift
	GRDB/Core/DatabaseSchemaCache.swift
	GRDB/Core/Statement.swift
	TODO.md
	Tests/Private/RecordUniqueIndexTests.swift
2016-07-22 09:01:39 +02:00
Gwendal Roué 111d11a71b DatabaseValueConvertible.sqlLiteral returns a safely escaped SQL literal (addresses #83) 2016-07-22 08:49:35 +02:00
Gwendal Roué 6aeee05e8a Code cleanup 2016-07-22 08:18:04 +02:00
Gwendal Roué 472586e772 TODO.md 2016-07-21 19:27:39 +02:00
Gwendal Roué 4f15322cec CHANGELOG.md 2016-07-21 19:10:46 +02:00
Gwendal Roué 0e46ff2b6d Documentation 2016-07-21 19:10:41 +02:00
Gwendal Roué fcf90a053a Database.indexes(on:) and Database.table(_:hasUniqueKey:) are public 2016-07-21 19:08:27 +02:00
Gwendal Roué b9e19e84d4 TODO.md 2016-07-21 09:11:23 +02:00
Gwendal Roué 1fc60cf410 TODO.md 2016-07-21 09:09:59 +02:00
Gwendal Roué 21bc1fd5a6 TODO.md 2016-07-21 09:04:01 +02:00
Gwendal Roué 3989f0c332 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis
Conflicts:
	GRDB/Record/Persistable.swift
2016-07-20 18:47:41 +02:00
Gwendal Roué 23ffef8943 Swift3: turn TableMapping.databaseTableName() into a read-only property 2016-07-20 18:38:56 +02:00
Gwendal Roué c3105fa66f Documentation 2016-07-20 14:00:25 +02:00
Gwendal Roué 8b09b2cdba Improve error messages for MutablePersistable.update(), delete() & exist() (see #81) 2016-07-20 13:49:16 +02:00
Gwendal Roué 315426a4b6 TODO.md 2016-07-19 23:40:17 +02:00
Gwendal Roué 51d948fc29 TODO.md 2016-07-19 17:29:26 +02:00
Gwendal Roué 68f4f011b7 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3
Conflicts:
	GRDB/QueryInterface/QueryInterfaceRequest.swift
	README.md
	Tests/Public/QueryInterfaceRequest/QueryInterfaceRequestTests.swift
2016-07-19 14:08:05 +02:00
Gwendal Roué ebdd6c5a4d Update for Xcode Version 8.0 beta 3 (8S174q) 2016-07-19 14:01:46 +02:00
Gwendal Roué deda8dcd97 CHANGELOG.md 2016-07-19 09:00:36 +02:00
Gwendal Roué f19f29a4bd v0.76.0 2016-07-19 08:54:35 +02:00
Gwendal Roué 0677a8a21a The query interface order method replaces any previously applied ordering (see #85) 2016-07-19 08:53:43 +02:00
Gwendal Roué b3c12c33b7 Merge branch 'master' into Swift3bis 2016-07-19 08:20:22 +02:00
Gwendal Roué 09f57d3bb6 TODO.md 2016-07-18 20:58:30 +02:00
Gwendal Roué 6b9b249e22 TODO.md 2016-07-18 19:24:20 +02:00
Gwendal Roué 78327f648d v0.75.2 2016-07-18 13:16:36 +02:00
Gwendal Roué df32c1c5d5 Allow SelectStatement to perform database changes - Fixes #80 and #82 for good. 2016-07-18 12:57:38 +02:00
Gwendal Roué e93f13f6b0 Remove dead documentation 2016-07-09 08:57:39 +02:00
Gwendal Roué 02d2b89a4d Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis
Conflicts:
	GRDB.xcodeproj/project.pbxproj
	GRDB/Core/Database.swift
	GRDB/Core/DatabaseScheduler.swift
	GRDB/Core/SerializedDatabase.swift
	GRDB/Core/Statement.swift
2016-07-08 18:30:16 +02:00
Gwendal Roué 34ff64b103 Rename DatabaseScheduler to SchedulingWatchdog 2016-07-08 18:22:34 +02:00
Gwendal Roué 827dc3da8b Cleanup 2016-07-08 18:02:06 +02:00
Gwendal Roué 1cd9c8f817 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3
Conflicts:
	GRDB/Core/DatabaseScheduler.swift
	GRDB/Core/SerializedDatabase.swift
2016-07-08 17:52:27 +02:00
Gwendal Roué e8a9035e68 Simplify DatabaseScheduler, and let SerializedDatabase implement the serialization constraints. 2016-07-08 17:38:52 +02:00
Gwendal Roué a288c8d7fb Merge branch 'master' of github.com:groue/GRDB.swift into Swift3
Conflicts:
	GRDB/Core/Database.swift
	GRDB/Core/RowAdapter.swift
	README.md
	Tests/Public/Core/Row/AdapterRowTests.swift
	Tests/Public/Core/Row/RowConvertibleTests.swift
2016-07-08 16:57:16 +02:00
Gwendal Roué 88e8c2ba33 #80 cleanup 2016-07-08 16:10:38 +02:00
Gwendal Roué 252ec6fe59 v0.75.1 2016-07-08 14:33:24 +02:00
Gwendal Roué e664ab18ee Fixes #80 2016-07-08 14:30:45 +02:00
Gwendal Roué b78c5b32c6 Documentation 2016-07-08 10:01:23 +02:00
Gwendal Roué 4ddc8f950e Row adapters: rename AdaptedColumnsDescription to ConcreteColumnMapping 2016-07-08 09:52:04 +02:00
Gwendal Roué 0260a33678 v0.75.0 2016-07-08 08:46:55 +02:00
Gwendal Roué 358c3ab0c3 Row adapters: rename "variants" to "scopes" 2016-07-08 08:44:41 +02:00
Gwendal Roué a658599406 Documentation fix 2016-07-07 09:15:24 +02:00
Gwendal Roué d0b1bde521 Add Cristian Filipov to the thanks section 2016-07-07 09:09:53 +02:00
Gwendal Roué b24075ca1c Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis
Conflicts:
	GRDB.xcodeproj/project.pbxproj
	GRDB/Core/Database.swift
	GRDB/Core/DatabaseSchemaCache.swift
	GRDB/Core/Utils.swift
	GRDB/Record/TableMapping.swift
	README.md
	Tests/Private/DatabasePoolSchemaCacheTests.swift
	Tests/Public/Encryption/EncryptionTests.swift
	Tests/Public/Record/PrimaryKeyNoneTests.swift
2016-07-07 08:41:17 +02:00
Gwendal Roué 88fb4051a4 Update playgrounds for Xcode Version 8.0 beta 2 (8S162m) 2016-07-07 08:07:30 +02:00
Gwendal Roué 0c7cff5602 Update for Xcode Version 8.0 beta 2 (8S162m) 2016-07-07 05:30:43 +02:00
Gwendal Roué f872f17d39 Fix project 2016-07-07 05:14:03 +02:00
Gwendal Roué 70917c19d1 TODO.md 2016-07-07 05:03:31 +02:00
Gwendal Roué 4353e997fc v0.74.0 2016-07-06 21:09:44 +02:00
Gwendal Roué e5bf8a8e75 Fix GRDBiOS 2016-07-06 21:09:24 +02:00
Gwendal Roué d3928b30de Typo 2016-07-06 19:31:03 +02:00
Gwendal Roué ec2bc5e8cb Typo 2016-07-06 19:30:47 +02:00
Gwendal Roué b74e3d389b #56: changelog 2016-07-06 19:29:33 +02:00
Gwendal Roué e567668346 #56: documentation 2016-07-06 19:25:43 +02:00
Gwendal Roué 6e31480ed9 #56: documentation 2016-07-06 19:18:56 +02:00
Gwendal Roué d35b65c9d2 #56: cleanup
- Dabase.indexes(tableName) returns actual indexes (no more fake index on INTEGER PRIMARY KEY column)
- Database.colums(_:uniquelyIdentifyRowsIn:) checks indexes, and primary key
- DatabaseSchemaCache caches table indexes (with invalidation on CREATE/DROP INDEX statements)
2016-07-06 19:09:25 +02:00
Gwendal Roué 0f27299586 #56: fetchOne(_:key:Dictionary) and deleteOne(_:key:Dictionary) raise a fatal error when there is no unique index on the key columns. 2016-07-06 08:39:18 +02:00
Gwendal Roué baff716ef6 #56: fetchOne(_:key:Dictionary) performs the same unique index check as deleteOne() 2016-07-06 08:18:14 +02:00
Gwendal Roué 1141676223 #56: Database.indexes(tableName) includes the implicit unique index on INTEGER PRIMARY KEY column. 2016-07-05 22:33:56 +02:00
Gwendal Roué a6ce80d39b #56: TableMapping.deleteOne(_🔑), TableMapping.deleteAll(_:keys:) 2016-07-05 22:16:23 +02:00
Gwendal Roué 6d3e0eaa22 More encryption documentation 2016-07-05 21:01:46 +02:00
Gwendal Roué 18c1333496 More encryption documentation 2016-07-05 20:59:32 +02:00
Gwendal Roué ab00d73d7a More encryption documentation 2016-07-05 20:57:40 +02:00
Gwendal Roué 5bc574025d Typo 2016-07-05 15:24:03 +02:00
Gwendal Roué 71e7d92d75 Typo 2016-07-05 14:50:22 +02:00
Gwendal Roué 723c7a97fc Typo 2016-07-05 14:41:39 +02:00
Gwendal Roué 16a3b88db5 Document how to encrypt an existing database (should help #77) 2016-07-05 14:37:28 +02:00
Gwendal Roué 19ed31a2c2 TODO.md: reconsider #56 in order to improve feature set with other ORMs 2016-07-04 11:31:38 +02:00
Gwendal Roué 93fd430863 TODO.md 2016-07-04 10:58:20 +02:00
Gwendal Roué c1ac810ff2 TODO.md 2016-07-01 09:09:06 +02:00
Gwendal Roué e785085d0d Cleanup our code thanks to DispatchQueue.sync<T>(block: @noescape () throws -> T) rethrows. 2016-06-30 18:38:16 +02:00
Gwendal Roué 334133ea61 TODO.md 2016-06-30 17:33:08 +02:00
Gwendal Roué 82b801498a Merge branch 'master' of github.com:groue/GRDB.swift into Swift3
Conflicts:
	GRDB.xcodeproj/project.pbxproj
	GRDB/Core/DatabaseValueConvertible.swift
	GRDB/Core/Row.swift
	GRDB/Core/StatementColumnConvertible.swift
	GRDB/FetchRequest/FetchRequest.swift
	GRDB/QueryInterface/QueryInterfaceRequest.swift
	GRDB/Record/RowConvertible.swift
	README.md
	Tests/Public/Core/DatabaseValueConvertible/DatabaseValueConvertibleFetchTests.swift
	Tests/Public/Core/SQLiteStatementConvertible/SQLiteStatementConvertibleFetchTests.swift
	Tests/Public/FetchRequest/FetchRequestTests.swift
	Tests/Public/Foundation/NSDateTests.swift
2016-06-29 13:38:24 +02:00
Gwendal Roué 83c74cf9e1 TODO.md 2016-06-28 15:04:10 +02:00
Gwendal Roué 3dc4dcf874 TODO.md 2016-06-28 14:50:59 +02:00
Gwendal Roué aaf184ddb3 Tests for StatementColumnConvertible fetching methods with adapter 2016-06-28 14:46:26 +02:00
Gwendal Roué 21e9e64b3d DatabaseValueConvertible and StatementColumnConvertible can now be fetched through a RowAdapter. DatabaseValueConvertible: raise a fatal error instead of converting to nil for invalid conversions triggered by fetch() methods. 2016-06-28 13:54:45 +02:00
Gwendal Roué 48c431c0a9 Backup clears the schema cache of the target database 2016-06-28 13:07:53 +02:00
Gwendal Roué 8992b4a284 Move FetchRequest to Core 2016-06-28 09:09:06 +02:00
Gwendal Roué c9d7da5951 TODO.md 2016-06-28 08:55:05 +02:00
Gwendal Roué f76744fc98 Typo 2016-06-23 15:59:16 +02:00
Gwendal Roué b624874768 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis
Conflicts:
	GRDB.xcodeproj/project.pbxproj
	GRDB/Core/Database.swift
	GRDB/Core/DatabaseWriter.swift
	GRDB/Core/Statement.swift
	GRDB/FetchRequest/QueryInterfaceRequest.swift
	GRDB/FetchRequest/SQLCollation.swift
	GRDB/FetchRequest/SQLSelectQuery.swift
	GRDB/Record/FetchedRecordsController.swift
	README.md
	Tests/Private/StatementInformationTests.swift
	Tests/Public/Core/DatabaseValueConvertible/DatabaseValueConversionTests.swift
	Tests/Public/Core/SQLiteStatementConvertible/SQLiteStatementConversionTests.swift
2016-06-21 09:03:02 +02:00
Gwendal Roué ed84727938 v0.73.0 2016-06-20 22:55:28 +02:00
Gwendal Roué 10f8318883 README.md 2016-06-20 22:50:50 +02:00
Gwendal Roué 7dd7f1a32c README.md 2016-06-20 22:47:34 +02:00
Gwendal Roué a06fa75419 TODO.md 2016-06-20 22:39:48 +02:00
Gwendal Roué 7e0ca09bf7 NSUUID documentation 2016-06-20 22:38:13 +02:00
Gwendal Roué cae3d7b321 Support for NSUUID 2016-06-20 22:37:31 +02:00
Gwendal Roué 1c30a93da1 README.md 2016-06-20 21:05:28 +02:00
Gwendal Roué 03d30d7f99 CHANGELOG.md 2016-06-20 21:03:25 +02:00
Gwendal Roué 6e4aecb3dc README.md 2016-06-20 20:50:49 +02:00
Gwendal Roué 660d01c59a CHANGELOG.md 2016-06-20 20:44:28 +02:00
Gwendal Roué 81cccadf80 Database event filtering documentation 2016-06-20 20:41:20 +02:00
Gwendal Roué e0ea5af18e Refactor database events filtering 2016-06-20 20:38:31 +02:00
Gwendal Roué 4544759cff CHANGELOG.md 2016-06-20 15:23:43 +02:00
Gwendal Roué 6a466fcb12 Detailed database changes observation 2016-06-20 15:21:14 +02:00
Gwendal Roué a07c09b3d4 TODO.md 2016-06-20 10:14:10 +02:00
Gwendal Roué 2c3bee16c9 TODO.md 2016-06-19 12:04:26 +02:00
Gwendal Roué 9a397c1ff8 Emoji tests 2016-06-19 11:14:11 +02:00
Gwendal Roué c627363fca Update TODO.md 2016-06-19 07:30:44 +02:00
Gwendal Roué 219899fc9b Query Interface arguments to SQL snippets 2016-06-18 14:49:17 +02:00
Gwendal Roué d987d99913 TODO.md 2016-06-16 09:17:24 +02:00
Gwendal Roué 985c32510c Documentation 2016-06-16 09:14:55 +02:00
Gwendal Roué 01ab19a263 README.md 2016-06-16 09:11:08 +02:00
Gwendal Roué 0ba6d5de28 Typo 2016-06-16 09:10:23 +02:00
Gwendal Roué e6031addf5 README.md 2016-06-15 15:29:06 +02:00
Gwendal Roué 8845babb28 Documentation 2016-06-15 06:48:28 +02:00
Gwendal Roué ed34a59a0c Swift3 typo 2016-06-15 06:47:00 +02:00
Gwendal Roué 767cd877b8 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis
Conflicts:
	README.md
2016-06-15 06:43:47 +02:00
Gwendal Roué fd7c4a0653 Typo 2016-06-15 06:41:56 +02:00
Gwendal Roué 26f08a59ad Documentation 2016-06-15 06:36:41 +02:00
Gwendal Roué 841b6f68dd Swift3 typo 2016-06-15 06:15:40 +02:00
Gwendal Roué dbe835912a .Rollback is .rollback in Swift3 2016-06-15 06:14:29 +02:00
Gwendal Roué 6b9182645d Fix link to DatabaseValue documentation 2016-06-14 21:13:03 +02:00
Gwendal Roué 16c1ca0bba Fix link to DatabaseValue documentation 2016-06-14 21:12:55 +02:00
Gwendal Roué 181aea9aec Support for URL 2016-06-14 21:09:11 +02:00
Gwendal Roué 422971d229 Link to Swift3 branch 2016-06-14 20:42:55 +02:00
Gwendal Roué 2010a3169d Describe the Swift3 branch 2016-06-14 20:41:22 +02:00
Gwendal Roué 397b538c9d Update README.md for Xcode 8 2016-06-14 20:34:01 +02:00
Gwendal Roué 1d1d843dc7 Xcode 8 WIP 2016-06-14 20:05:13 +02:00
Gwendal Roué abd6fe9f2d Xcode 8 WIP 2016-06-14 19:48:46 +02:00
Gwendal Roué f5db3c08e3 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis
Conflicts:
	GRDB.xcodeproj/project.pbxproj
	GRDB/Core/RowAdapter.swift
	GRDB/Core/Support/Foundation/NSNumber.swift
	README.md
	Tests/Public/Core/Row/RowConvertibleTests.swift
	Tests/Public/FetchRequest/FetchRequestTests.swift
2016-06-14 19:42:21 +02:00
Gwendal Roué 0b568b2d28 Documentation 2016-06-14 19:23:36 +02:00
Gwendal Roué 42885a3df0 Xcode 8 WIP 2016-06-14 19:14:10 +02:00
Gwendal Roué cd820c2dbe Xcode 8 WIP 2016-06-14 19:06:53 +02:00
Gwendal Roué 0944ed331b Xcode 8 WIP 2016-06-14 14:04:04 +02:00
Gwendal Roué f45b9a3757 Xcode 8 WIP 2016-06-14 13:45:08 +02:00
Gwendal Roué d52c552721 Xcode 8 WIP 2016-06-14 12:51:33 +02:00
Gwendal Roué 2a5bdbcbdc BROKEN - Xcode 8 WIP 2016-06-14 09:08:43 +02:00
Gwendal Roué 2606f7196e SuffixRowAdapter index preconditions 2016-06-09 09:11:44 +02:00
Gwendal Roué 09a672561d Update error handling documentation 2016-06-09 08:53:16 +02:00
Gwendal Roué cbabdf02de Update error handling documentation 2016-06-09 08:51:20 +02:00
Gwendal Roué a65d7cdc15 Documentation fix 2016-06-09 08:30:19 +02:00
Gwendal Roué 1a17efcf8e Documentation fix 2016-06-09 08:28:17 +02:00
Gwendal Roué 9f60d63a6b v0.72.0 2016-06-09 08:01:30 +02:00
Gwendal Roué 4426166f1d RowAdapter documentation 2016-06-09 07:54:34 +02:00
Gwendal Roué d97ceeaa6c RowAdapter documentation 2016-06-09 07:50:37 +02:00
Gwendal Roué a7ac615bb2 Merge branch 'master' into RowAdapter2 2016-06-09 07:33:42 +02:00
Gwendal Roué 90fc23205c Cleanup 2016-06-09 06:21:39 +02:00
Gwendal Roué c233fec9b9 CHANGELOG.md 2016-06-08 23:23:08 +02:00
Gwendal Roué a8df726bff NSDecimalNumber.databaseValue only returns a double when the decimal number does not contain an integer that fits in Int64. 2016-06-08 23:14:49 +02:00
Gwendal Roué ff3f26f935 Merge branch 'master' of github.com:groue/GRDB.swift into RowAdapter2 2016-06-08 20:54:59 +02:00
Gwendal Roué a882a5f346 RowAdapter documentation 2016-06-08 20:54:25 +02:00
Gwendal Roué 1b318154c2 TODO.md 2016-06-08 10:38:39 +02:00
Gwendal Roué 390cf44a88 RowAdapter documentation 2016-06-08 09:00:22 +02:00
Gwendal Roué 3e71253ffb RowAdapter documentation 2016-06-08 08:17:37 +02:00
Gwendal Roué 748e2a81ad RowAdapter documentation 2016-06-08 08:03:35 +02:00
Gwendal Roué d3ebe43cbd RowAdapter refactoring 2016-06-08 06:41:37 +02:00
Gwendal Roué 7a13b9c4b7 More RowAdapter tests 2016-06-08 06:20:27 +02:00
Gwendal Roué 15f9aabaf0 SuffixRowAdapter 2016-06-07 22:18:13 +02:00
Gwendal Roué c617a8f354 RowAdapter refactoring 2016-06-07 21:44:32 +02:00
Gwendal Roué 6ac2cd4686 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis
Conflicts:
	DemoApps/GRDBDemoiOS7/GRDBDemoiOS7/AppDatabase.swift
	DemoApps/GRDBDemoiOS7/GRDBDemoiOS7/Person.swift
	DemoApps/GRDBDemoiOS7/GRDBDemoiOS7/PersonEditionViewController.swift
	DemoApps/GRDBDemoiOS7/GRDBDemoiOS7/PersonsViewController.swift
	GRDB/Core/Support/Foundation/NSNumber.swift
	GRDB/Core/Support/StandardLibrary/StandardLibrary.swift
	GRDB/Record/FetchedRecordsController.swift
	Tests/Public/Core/DatabaseValueConvertible/NSNumberTests.swift
	Tests/Public/FetchedRecordsController/FetchedRecordsControllerTests.swift
2016-06-07 19:01:08 +02:00
Gwendal Roué 2833da3b2d README.md 2016-06-07 09:09:42 +02:00
Gwendal Roué 8058a79ed0 README.md 2016-06-07 09:07:42 +02:00
Gwendal Roué 93755a62aa Typo 2016-06-07 09:01:27 +02:00
Gwendal Roué d4c7e00a19 README.md 2016-06-07 07:58:55 +02:00
Gwendal Roué 70deb7b388 Merge pull request #70 from schveiguy/patch-1
Add description of rollback without throwing error
2016-06-06 21:18:01 +02:00
Steven Schveighoffer c229439dec Add description of rollback without throwing error 2016-06-06 15:13:42 -04:00
Gwendal Roué cb2dda8421 README.md 2016-06-06 07:47:07 +02:00
Gwendal Roué 4558321ef7 v0.71.0 2016-06-05 16:45:34 +02:00
Gwendal Roué 9376f048be TODO.md 2016-06-05 16:45:27 +02:00
Gwendal Roué d038227941 #62: Don’t share GRDBCustomSQLite schemes (avoid messing with Carthage) 2016-06-05 16:43:00 +02:00
Gwendal Roué 2c885cb347 Document when it is safe to use unowned references in a FetchedRecordsController's callbacks 2016-06-05 16:03:40 +02:00
Gwendal Roué 01bf13189c Documentation 2016-06-05 15:59:41 +02:00
Gwendal Roué f92d433a3e Test for FetchedRecordsController.trackChanges(fetchAlongside:) 2016-06-05 15:35:05 +02:00
Gwendal Roué 25476f2973 Drop the unmaintained GRDBDemoiOS7 app 2016-06-05 15:06:51 +02:00
Gwendal Roué 1d4bff1add #68: conversion error messages contain the "database" word. 2016-06-05 14:57:07 +02:00
Gwendal Roué 30864a16a2 #68: numeric overflow error messages contain the faulty value 2016-06-05 14:02:28 +02:00
Gwendal Roué 7b492fe7ed CHANGELOG.md 2016-06-05 13:52:46 +02:00
Gwendal Roué 7186c9a3a0 #68: take care of Int, Int32 and Int64 overflow when converting from database values 2016-06-05 13:49:47 +02:00
Gwendal Roué a5760a7462 #68: NSNumber.databaseValue raises explicit fatal error when value doesn’t fit Int64 2016-06-05 12:16:37 +02:00
Gwendal Roué aa5c6283a7 #68: document NSNumber limits 2016-06-04 19:09:51 +02:00
Gwendal Roué 280955801c CHANGELOG.md 2016-06-04 18:41:11 +02:00
Gwendal Roué adc3f6d184 TODO.md 2016-06-04 18:41:07 +02:00
Gwendal Roué c9ebb6da00 FetchedRecordsController:
- make unowned references in the callbacks safe, as long as the unowned object is deallocated in the fetched records controller’s queue (usually the main queue).
- FetchedRecordsController.trackChanges(fetchAlong: { db in … }, …) allows the user to fetch values that are consistent with the fetched records.
2016-06-04 18:24:49 +02:00
Gwendal Roué a8f04a1ba5 GRDBDemoiOS: stress fetched records controller longer, so that we can check what happens when one leaves the table view controller as transactions are still running. Answer: we crash due to [unowned self] references being used after table view controller has been deallocated. 2016-06-04 18:22:18 +02:00
Gwendal Roué d478e4b1f4 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis 2016-06-04 12:39:27 +02:00
Gwendal Roué ac9b2e8ba4 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis 2016-06-04 12:10:36 +02:00
Gwendal Roué 770ee6aaec Merge pull request #69 from swiftlyfalling/fix-preupdate-hook-uninstall
Added missing call to uninstall the preupdate hook
2016-06-03 18:59:07 +02:00
swiftlyfalling 003a6ef4d2 Added missing call to uninstall the preupdate hook 2016-06-03 12:45:28 -04:00
Gwendal Roué f9e43fae29 Merge pull request #66 from swiftlyfalling/test-coverage-improvements
Test coverage improvements
2016-06-03 14:47:25 +02:00
swiftlyfalling 7e1eb5a970 Increase test coverage of DatabaseQueue 2016-06-03 08:36:25 -04:00
swiftlyfalling f231218a69 Increase test coverage of DatabaseValue.swift 2016-06-03 08:35:56 -04:00
swiftlyfalling e21c9cb8f0 Revert "Increase test coverage of DatabaseValue.swift"
This reverts commit 58084c6a65.
2016-06-03 08:35:04 -04:00
swiftlyfalling 8597808a61 Revert "Increase test coverage of DatabaseQueue"
This reverts commit 5ffac12f5b.
2016-06-03 08:34:41 -04:00
Gwendal Roué 1871eed0ab TODO.md 2016-06-03 10:49:38 +02:00
Gwendal Roué 8f2685b335 Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis
Conflicts:
	GRDB/Core/Database.swift
2016-06-03 08:44:27 +02:00
Gwendal Roué cd85b54dd7 #63 follow-up: let DatabaseEventType dispatch events to the correct TransactionObserver method so that we avoid runtime checks on events type 2016-06-03 08:37:53 +02:00
Gwendal Roué 6dd04142b3 #63 follow-up: remove DatabaseEventType from public API 2016-06-03 08:31:17 +02:00
Gwendal Roué 0618054968 Thank @swiftlyfalling 2016-06-03 08:24:47 +02:00
Gwendal Roué e11673d15c Merge branch 'master' of github.com:groue/GRDB.swift into Swift3bis
Conflicts:
	GRDB/Core/Database.swift
	GRDB/FetchRequest/SQLSelectQuery.swift
	GRDB/Record/FetchedRecordsController.swift
	GRDB/Record/TableMapping.swift
	Tests/Public/Core/Persistable/MutablePersistableTests.swift
	Tests/Public/Core/Persistable/PersistableTests.swift
	Tests/Public/Core/Savepoint/SavepointTests.swift
	Tests/Public/Core/TransactionObserver/TransactionObserverSavepointsTests.swift
	Tests/Public/Core/TransactionObserver/TransactionObserverTests.swift
2016-06-03 05:17:11 +02:00
swiftlyfalling 066a4de15f Added tests
For:
- NSNull.swift
- NSNumber.swift
- NSString.swift
- NSURL.swift
- DatabaseValue+Foundation.swift
2016-06-02 19:25:42 -04:00
swiftlyfalling 5ffac12f5b Increase test coverage of DatabaseQueue 2016-06-02 18:20:08 -04:00
swiftlyfalling b24631345b Increase test coverage of NSData.swift 2016-06-02 18:08:28 -04:00
swiftlyfalling ab3332ed8f Add test of removeTransactionObserver() 2016-06-02 18:07:42 -04:00
swiftlyfalling 58084c6a65 Increase test coverage of DatabaseValue.swift 2016-06-02 18:06:35 -04:00
swiftlyfalling 6664733650 Increase test coverage of FetchRequest.swift
Existing DatabaseValueConvertible tests were only testing the
`extension DatabaseValueConvertible where Self:
StatementColumnConvertible` cases.

Added tests to explicitly cover the cases where something conforms to
`DatabaseValueConvertible` but *not* `StatementColumnConvertible`, and
renamed the old tests.
2016-06-02 18:05:31 -04:00
swiftlyfalling f7a537ab91 Increase test coverage of DatabaseCoder.swift
Test failure cases.
2016-06-02 18:02:08 -04:00
swiftlyfalling 0506d47a4f Increase test coverage of DatabaseDateComponents.swift
Test init from nil NSDateComponents case.
2016-06-02 18:01:31 -04:00
swiftlyfalling e06bcab62b Increase test coverage of Row+Foundation.swift
Add missing test to verify initialization failure if NSDictionary has
invalid (non-String) keys.
2016-06-02 18:01:13 -04:00
swiftlyfalling 90061a4b25 Increase test coverage of StatementArguments+Foundation.swift
Test initializing failure from invalid NSArray, NSDictionary.
2016-06-02 17:59:47 -04:00
Gwendal Roué 5a17fa53cd More TODO 2016-06-02 20:48:57 +02:00
Gwendal Roué 88c284dbf1 Merge branch 'master' into Swift3bis
Conflicts:
	GRDB/Core/Database.swift
	GRDB/FetchRequest/QueryInterfaceRequest.swift
	GRDB/FetchRequest/SQLCollation.swift
	GRDB/FetchRequest/SQLFunction.swift
	GRDB/FetchRequest/SQLOperator.swift
	GRDB/FetchRequest/SQLSelectQuery.swift
	README.md
2016-06-02 20:47:04 +02:00
Gwendal Roué dd98fdbee1 SE-0059: Update API Naming Guidelines and Rewrite Set APIs Accordingly 2016-06-02 20:16:26 +02:00
Gwendal Roué af43079e33 SE-0032: Add first(where:) method to Sequence 2016-06-02 20:10:31 +02:00
Gwendal Roué aa6097dff8 swift-DEVELOPMENT-SNAPSHOT-2016-05-31-a 2016-06-02 19:58:58 +02:00
Gwendal Roué 7fa4346cd1 Merge pull request #65 from swiftlyfalling/patch-1
Add language, platform, and license badges to README.md
2016-06-02 15:30:49 +02:00
swiftlyfalling d286041e04 Add language, platform, and license badges to README.md 2016-06-02 09:05:13 -04:00
Gwendal Roué bf0f9e1fa2 Merge pull request #63 from swiftlyfalling/preupdate-hooks
Add support for SQLite Pre-Update Hooks (+ tests)
2016-06-02 13:29:26 +02:00
Gwendal Roué d4c0dd824b Merge pull request #64 from swiftlyfalling/fix-slow-compile
Slow compilation fixes
2016-06-02 13:05:26 +02:00
Gwendal Roué 528ce8c9de README.md 2016-06-02 08:38:55 +02:00
Gwendal Roué 7c4ff7677d swift-DEVELOPMENT-SNAPSHOT-2016-05-09-a 2016-06-02 08:38:15 +02:00
Gwendal Roué cb36991cb2 Cleanup Query Interface protocols 2016-06-02 08:09:44 +02:00
swiftlyfalling f15a4df79e Slow compilation fixes
Implemented a workaround for the cause of the two slowest-to-compile
methods.
2016-06-01 21:12:33 -04:00
swiftlyfalling 901b7a0f12 Add support for SQLite Pre-Update Hooks (+ tests)
If SQLITE_ENABLE_PREUPDATE_HOOK is defined, and GRDB is built with a
custom SQLite library with the functionality (see: GRDBCustomSQLite),
enable support for SQLite Pre-Update Hooks and the new
`willChangeWithEvent` callback on TransactionObservers.
2016-06-01 20:42:21 -04:00
Gwendal Roué 687bcc3469 Merge pull request #62 from swiftlyfalling/Custom-SQLite
Add GRDBCustomSQLite to permit easily building GRDB with a custom, embedded SQLite library
2016-06-01 12:21:38 +02:00
Gwendal Roué a239e435a6 More transaction/savepoints documentation 2016-06-01 09:31:41 +02:00
Gwendal Roué 75728418af More savepoints documentation 2016-06-01 09:28:57 +02:00
swiftlyfalling 893714c968 Update README 2016-05-31 20:42:35 -04:00
swiftlyfalling 5cb4044408 Merge remote-tracking branch 'groue/master' into Custom-SQLite 2016-05-31 17:33:59 -04:00
swiftlyfalling 4966ce447f Add missing Target Dependency for GRDBCustomSQLite frameworks. 2016-05-31 17:33:04 -04:00
swiftlyfalling 8213bf5b6d Update to point to SQLiteLib-USER.xcconfig, and new SQLiteLib 2016-05-31 17:32:09 -04:00
swiftlyfalling 280d90cdc4 More tweaks to GRDBCustomSQLite run script phase 2016-05-31 09:39:42 -04:00
Gwendal Roué df5a327da4 Top-level Database.inSavepoint opens a transaction if the default transaction kind is not DEFERRED 2016-05-31 13:09:33 +02:00
Gwendal Roué e736923312 Typo 2016-05-31 12:14:49 +02:00
Gwendal Roué fe4f932be4 README.md 2016-05-31 09:08:25 +02:00
Gwendal Roué fe7e39776b Documentation 2016-05-31 06:49:35 +02:00
Gwendal Roué da33e480c3 Improve Database.execute() detection of white-space string endings 2016-05-31 06:47:44 +02:00
swiftlyfalling 19a0a7098d Add GRDBCustomSQLite USER configuration files to .gitignore 2016-05-30 21:56:04 -04:00
swiftlyfalling 74d46f201a Tweaks to GRDBCustomSQLite run script build phase 2016-05-30 21:54:07 -04:00
swiftlyfalling 0eec061d01 Improve first-time build of GRDBCustomSQLite
Define CUSTOM_OTHER_SWIFT_FLAGS in GRDB.xcconfig prior to including the
"GRDBCustomSQLite-USER.xcconfig" file.
2016-05-30 21:52:55 -04:00
swiftlyfalling 7c1ad9abab Updated .example files 2016-05-30 21:51:42 -04:00
swiftlyfalling 3ad99011f2 Remove User xcconfig from branch. 2016-05-30 21:17:37 -04:00
swiftlyfalling cb8331f213 Renamed customizable files to <file>-USER, added .example files, preserve user customizations.
Added .example files.
Added build phase script to copy .example files if user configuration
files are not already present.
2016-05-30 21:16:36 -04:00
swiftlyfalling ffa2858d82 Update SQLiteLib subproject commit 2016-05-30 19:56:05 -04:00
swiftlyfalling 1cf20da416 Add README for GRDBCustomSQLite 2016-05-30 19:39:11 -04:00
swiftlyfalling 30bc7e4f6c Replace most uses of #if SQLITE_HAS_CODEC with the appropriate USING_BUILTIN_SQLITE or USING_SQLCIPHER defines.
This enables easier compilation of a custom version of SQLite that
itself uses the SQLITE_HAS_CODEC define. (ex. If building SQLite with
the SQLite Encryption Extension.)
The SQLITE_HAS_CODEC define is now only used to guard use of the SQLite
encryption APIs.
GRDBCipher builds define USING_BUILTIN_SQLITE and USING_SQLCIPHER.
2016-05-30 18:19:45 -04:00
swiftlyfalling 9f406c6725 Add GRDBCustomSQLite targets and schemes.
To support building GRDB with a built-in custom SQLite build/version.
2016-05-30 18:16:04 -04:00
swiftlyfalling b1ff790e43 Add SQLiteLib submodule 2016-05-30 16:05:53 -04:00
Gwendal Roué 90f304a881 Typo 2016-05-30 12:33:42 +02:00
Gwendal Roué 99cbfa13cb v0.70.1 2016-05-30 12:27:42 +02:00
Gwendal Roué ce7736a4b8 Failed statements can not be reused: remove them from the statement cache. 2016-05-30 12:21:20 +02:00
Gwendal Roué c36ed7b660 Add failing test for Persistable.insert() after a previous failed insert. 2016-05-30 12:20:42 +02:00
Gwendal Roué d6c4705626 Fix documentation 2016-05-30 08:34:27 +02:00
Gwendal Roué 9df4455f07 Minor 2016-05-30 08:22:00 +02:00
Gwendal Roué 5e4923b5bc More tests and documentation for DatabaseScheduler 2016-05-30 08:10:39 +02:00
Gwendal Roué 9d00189ac0 Inner Documentation 2016-05-30 07:46:40 +02:00
Gwendal Roué 3af2d7c0df Inner Documentation 2016-05-29 20:03:33 +02:00
Gwendal Roué 521222ad19 Typo 2016-05-29 16:30:38 +02:00
Gwendal Roué e0f5a1c1a1 FetchedRecordsController: document that callbacks are invoked asynchronously 2016-05-29 15:45:35 +02:00
Gwendal Roué fa393a53b2 FetchedRecordsController: document that callbacks are invoked asynchronously 2016-05-29 15:44:21 +02:00
Gwendal Roué 43e81781a3 FetchedRecordsController documentation 2016-05-29 15:32:30 +02:00
Gwendal Roué b03e9922a4 FetchedRecordsController: document record identity where it is needed, for table view updates. 2016-05-29 15:29:45 +02:00
Gwendal Roué 7206e46377 Relax FetchedRecordsController compareRecordsByPrimaryKey initializer argument by only requiring TableMapping protocol 2016-05-29 15:28:50 +02:00
Gwendal Roué 554b9a03b5 FetchedRecordsController: avoid instantiate records when building table view updates 2016-05-29 15:20:17 +02:00
Gwendal Roué 20278d23e1 CHANGELOG.md 2016-05-28 21:45:48 +02:00
Gwendal Roué 81607da632 CHANGELOG.md 2016-05-28 21:45:21 +02:00
Gwendal Roué c1ec74a5b7 v0.70.0 2016-05-28 21:18:08 +02:00
Gwendal Roué eaed0c098b Issue #61: document interaction between Transaction observers and save points. 2016-05-28 21:11:52 +02:00
Gwendal Roué 886fb6b5a1 Typo 2016-05-28 21:07:54 +02:00
Gwendal Roué 9fe92bc669 Issue #61: Savepoint documentation 2016-05-28 21:05:56 +02:00
Gwendal Roué 098e9fee8c Issue #61: TODO 2016-05-28 20:40:51 +02:00
Gwendal Roué 1d0f670100 Issue #61: more savepoint tests 2016-05-28 20:39:27 +02:00
Gwendal Roué ee7f505cde Issue #61: add savepoint sanity check 2016-05-28 20:39:02 +02:00
Gwendal Roué 4581850b05 Issue #61: since savepoint names can be reused and nested, there is no purpose forcing the user to name them: use a single default savepoint name. And provide thorough testing. 2016-05-28 18:57:07 +02:00
Gwendal Roué bc757016af Issue #61: Database.inSavepoint(named:) 2016-05-28 18:46:12 +02:00
Gwendal Roué d3259a8430 v0.69.0 2016-05-28 16:37:55 +02:00
Gwendal Roué d57107ca2a Issue #61: document interaction between Transaction observers and save points. 2016-05-28 16:29:29 +02:00
Gwendal Roué 2cf606bdbd Issue #61: pass all tests for TransactionObserver and savepoints :-) 2016-05-28 15:59:20 +02:00
Gwendal Roué 32cd559379 Issue #61: fix failing test for TransactionObserver and savepoints 2016-05-28 15:57:32 +02:00
Gwendal Roué ad8551b746 Issue #61: fix failing test for TransactionObserver and savepoints 2016-05-28 15:54:26 +02:00
Gwendal Roué a26bef8813 Issue #61: failing test for TransactionObserver with several identically named savepoints 2016-05-28 15:09:56 +02:00
Gwendal Roué 34dad07393 Issue #61: failing test for Database.isInsideTransaction after a SAVEPOINT statement 2016-05-28 15:03:02 +02:00
Gwendal Roué 5453aec1d0 Issue #61: fix failing test for TransactionObserver and savepoints 2016-05-28 15:00:26 +02:00
Gwendal Roué 03a5671bb0 Issue #61: prevent SelectStatement from hiding the update statements we track 2016-05-28 14:51:54 +02:00
Gwendal Roué 37c16fbb48 Issue #61: recognize savepoints statements 2016-05-28 14:44:37 +02:00
Gwendal Roué 92431f20d7 Issue #61: DatabaseEvent.copy() returns an event that can outlive a transaction observer’s databaseDidChangeWithEvent callback. 2016-05-28 14:27:25 +02:00
Gwendal Roué 9b6b66d22d Issue #61: fix failing test for TransactionObserver and savepoints 2016-05-28 14:25:39 +02:00
Gwendal Roué 83477c67d7 Issue #61: failing tests for TransactionObserver and savepoints 2016-05-28 13:59:15 +02:00
Gwendal Roué ac31392b90 Issue #61: test TransactionObserver with a simple savepoint 2016-05-28 13:42:48 +02:00
Gwendal Roué 201485eed6 v0.68.0 2016-05-28 13:05:17 +02:00
Gwendal Roué 87992f9e75 Issue #60: PrimaryKey documentation 2016-05-28 12:56:19 +02:00
Gwendal Roué 0b24721b4a Issue #60: Cached statements documentation 2016-05-28 12:51:31 +02:00
Gwendal Roué 8d540751e1 Issue #60: PrimaryKey documentation 2016-05-28 12:03:58 +02:00
Gwendal Roué fc8b2ee679 Issue #60: make cachedUpdateStatement() and cachedSelectStatement() public 2016-05-25 08:55:05 +02:00
Gwendal Roué bc512e775c Issue #60: make PrimaryKey public 2016-05-25 08:41:54 +02:00
Gwendal Roué 7b9d54183c Fix RowAdapter documentation 2016-05-23 19:19:14 +02:00
Gwendal Roué 85d640c4f8 CHANGELOG.md 2016-05-22 20:49:05 +02:00
Gwendal Roué a0275aa413 v0.67.0 2016-05-22 20:39:33 +02:00
Gwendal Roué 7d1c4a9991 TODO.md 2016-05-22 20:27:33 +02:00
Gwendal Roué ade05d5d1b Merge branch 'master' into RowAdapter 2016-05-22 20:26:45 +02:00
Gwendal Roué 6e259f9a0e Rename SQLRequest to SQLFetchRequest 2016-05-22 20:21:30 +02:00
Gwendal Roué 02a21b8050 FetchRequest documentation 2016-05-22 20:18:49 +02:00
Gwendal Roué 5fe7c5d888 FetchRequest tests 2016-05-22 20:16:17 +02:00
Gwendal Roué 1ee4437970 Fix Row.fetch(db, request) and RowConvertible.fetch(db, request) by using the request’s adapter. 2016-05-22 19:55:57 +02:00
Gwendal Roué a8cebfe06c TODO.md 2016-05-22 19:38:54 +02:00
Gwendal Roué 0b73275933 maximumReaderCount documentation 2016-05-22 19:38:49 +02:00
Gwendal Roué 04fec2c2f0 More RowAdapter use case 2016-05-21 17:45:45 +02:00
Gwendal Roué ccd560cbc6 More RowAdapter use case 2016-05-21 17:44:37 +02:00
Gwendal Roué 43df7f18be Fix typo 2016-05-21 17:42:48 +02:00
Gwendal Roué 2f18d1ff8b Merge branch 'master' into RowAdapter
Conflicts:
	GRDB/Record/FetchedRecordsController.swift
2016-05-21 16:03:45 +02:00
Gwendal Roué 6c816bfdeb Minor 2016-05-21 16:01:22 +02:00
Gwendal Roué afa8cfce5e Minor 2016-05-21 15:43:27 +02:00
Gwendal Roué 49ad4bdb26 v0.66.0 2016-05-21 15:15:03 +02:00
Gwendal Roué e76e8b1404 CHANGELOG.md 2016-05-21 15:13:17 +02:00
Gwendal Roué 9794b72607 Fixes #55 2016-05-21 15:08:16 +02:00
Gwendal Roué 997a29e70b Fixes #58 2016-05-21 12:15:36 +02:00
Gwendal Roué a478a1c888 RowAdapter documentation 2016-05-21 11:48:31 +02:00
Gwendal Roué 5db11aa49a RowAdapter documentation 2016-05-21 11:48:01 +02:00
Gwendal Roué 24a650f562 RowAdapter documentation 2016-05-21 11:46:14 +02:00
Gwendal Roué a1d9bf297f RowAdapter documentation 2016-05-21 08:28:10 +02:00
Gwendal Roué 92682cb11f RowAdapter documentation 2016-05-21 08:26:39 +02:00
Gwendal Roué b51b02b1d3 RowAdapter documentation 2016-05-21 08:26:13 +02:00
Gwendal Roué df410d2444 RowAdapter documentation 2016-05-21 08:24:39 +02:00
Gwendal Roué ec07380055 RowAdapter documentation 2016-05-21 08:19:15 +02:00
Gwendal Roué 3a766cd826 RowAdapter documentation 2016-05-21 08:18:17 +02:00
Gwendal Roué eef7fa5b40 RowAdapter documentation 2016-05-21 08:09:40 +02:00
Gwendal Roué eb726e47c3 RowAdapter documentation 2016-05-21 08:07:20 +02:00
Gwendal Roué 5378cd07bf RowAdapter documentation 2016-05-20 23:37:11 +02:00
Gwendal Roué d8b935369b RowAdapter refactoring 2016-05-20 21:57:39 +02:00
Gwendal Roué 4e2f396b4a RowAdapter refactoring 2016-05-20 21:00:50 +02:00
Gwendal Roué 34c43a2bbe TODO.md 2016-05-20 16:51:42 +02:00
Gwendal Roué f7fddbc162 RowAdapter TODO 2016-05-20 15:55:49 +02:00
Gwendal Roué 4c2a53ac26 Issue #50: More MappedRowTests 2016-05-20 15:53:57 +02:00
Gwendal Roué ffe1021c2a TODO.md 2016-05-20 14:35:23 +02:00
Gwendal Roué 3fcbcb9455 Merge branch 'master' into RowAdapter
Conflicts:
	TODO.md
2016-05-20 10:56:02 +02:00
Gwendal Roué 19fbce4479 Configuration.maximumReaderCount documentation 2016-05-20 10:17:53 +02:00
Gwendal Roué b2e0874efa Configuration.maximumReaderCount documentation 2016-05-20 10:17:12 +02:00
Gwendal Roué ca81422c4b Issue #53: update FAQ entry for the Generic parameter 'T' could not be inferred error 2016-05-20 08:23:24 +02:00
Gwendal Roué 6bdf433e95 Issue #53: add a FAQ entry for the Generic parameter 'T' could not be inferred error 2016-05-20 08:19:39 +02:00
Gwendal Roué daba5b2102 Merge branch 'master' into RowAdapter
Conflicts:
	GRDB.xcodeproj/project.pbxproj
	GRDB/Record/FetchedRecordsController.swift
	TODO.md
2016-05-19 20:40:26 +02:00
Gwendal Roué 9dbf992c40 Configuration.maximumReaderCount replaces DatabasePool initializer option 2016-05-19 18:10:36 +02:00
Gwendal Roué 7772749e88 Fix DatabaseQueueTests for GRDBCipher tests 2016-05-19 15:28:56 +02:00
Gwendal Roué 0c0fd48700 v0.65.0 2016-05-19 14:19:46 +02:00
Gwendal Roué 41f2cdc6e6 Documentation 2016-05-19 14:08:21 +02:00
Gwendal Roué cf572ea931 Documentation 2016-05-19 14:03:41 +02:00
Gwendal Roué da372fbb93 TODO.md 2016-05-19 14:01:51 +02:00
Gwendal Roué 92e1336db0 Fix issue #54 2016-05-19 14:00:45 +02:00
Gwendal Roué a9d3dffd3c Failing test for issue #54 2016-05-19 13:57:25 +02:00
Gwendal Roué 5fac4abc07 Use FetchRequest instead of QueryInterfaceRequest where relevant 2016-05-19 13:35:45 +02:00
Gwendal Roué 28a795eddb Rename FetchRequestType to FetchRequest 2016-05-19 13:09:30 +02:00
Gwendal Roué 06b824928b Rename FetchRequest to QueryInterfaceRequest 2016-05-19 13:08:48 +02:00
Gwendal Roué 5b57707b86 Rename FetchRequest to QueryInterfaceRequest 2016-05-19 13:08:36 +02:00
Gwendal Roué a348febf3e Introduce FetchRequestType 2016-05-19 12:23:58 +02:00
Gwendal Roué 7f8a7ac628 TODO.md 2016-05-19 11:02:50 +02:00
Gwendal Roué a5fab4e0f6 TODO.md 2016-05-19 10:56:40 +02:00
Gwendal Roué 2724e90981 README.md 2016-05-19 09:14:13 +02:00
Gwendal Roué 26fc80213e README.md 2016-05-19 09:10:24 +02:00
Gwendal Roué 47890fa74e TODO.md 2016-05-19 09:08:05 +02:00
Gwendal Roué 49b35a9216 More failing tests for issue #53 2016-05-19 09:05:12 +02:00
Gwendal Roué a08bbbad29 Failing tests for issue #53 2016-05-19 09:02:20 +02:00
Gwendal Roué 3b93cf8e28 Issue #50: More MappedRowTests 2016-05-19 08:32:34 +02:00
Gwendal Roué 75258afb6c Issue #50: Tests for FetchedRecordsController(...:adapter:) 2016-05-19 08:26:28 +02:00
Gwendal Roué fca37601dd Issue #50: Tests for RowConvertible.fetch(…:adapter:) 2016-05-19 06:37:56 +02:00
Gwendal Roué 55301efa3e Issue #50: FetchedRecordsController(…:adapter:) 2016-05-19 06:03:22 +02:00
Gwendal Roué 82052848ee Issue #50: RowConvertible.fetch(…:adapter:) 2016-05-19 05:55:42 +02:00
Gwendal Roué 25dd52fdda Documentation 2016-05-19 05:55:06 +02:00
Gwendal Roué c891c3cff8 Merge branch 'master' into RowAdapter 2016-05-19 05:40:15 +02:00
Gwendal Roué 917e75050e Merge branch 'master' into RowAdapter
Conflicts:
	GRDB/Core/Row.swift
2016-05-19 05:35:20 +02:00
Gwendal Roué a46b3aa816 v0.64.0 2016-05-18 19:20:57 +02:00
Gwendal Roué 60fafd399f Fix Database closing in GRDBCipher targets 2016-05-18 19:20:09 +02:00
Gwendal Roué f3d3eb43dc TODO.md 2016-05-18 19:09:27 +02:00
Gwendal Roué 5ff030607e TODO.md 2016-05-18 19:06:39 +02:00
Gwendal Roué 71492c5d37 README.md: remove documentation for row subscripting by column name 2016-05-18 19:05:42 +02:00
Gwendal Roué f553f2d2b0 Remove Row subscripting by column name; row.databaseValue(named:) returns an optional DatabaseValue 2016-05-18 19:03:29 +02:00
Gwendal Roué 5fdff2dc6f TODO.md 2016-05-18 18:40:38 +02:00
Gwendal Roué 4185de77e0 Remove DatabaseValue.failableValue() 2016-05-18 18:40:03 +02:00
Gwendal Roué aa51a6c54e TODO.md 2016-05-18 16:38:46 +02:00
Gwendal Roué 092509b3c3 TODO.md 2016-05-18 16:33:22 +02:00
Gwendal Roué 695279e784 Issue #50: More MappedRowTests 2016-05-18 16:28:06 +02:00
Gwendal Roué 5c6bccd7b3 Issue #50: Row equality now compares subrows 2016-05-18 16:25:24 +02:00
Gwendal Roué 45c8b48b0a TODO.md 2016-05-18 13:58:33 +02:00
Gwendal Roué 51130c354b Issue #50: More MappedRowTests 2016-05-18 13:55:02 +02:00
Gwendal Roué 79d1845266 Issue #50: More RowAdapterTests 2016-05-18 09:16:03 +02:00
Gwendal Roué 4f1173e609 Issue #50: More RowAdapterTests 2016-05-18 09:10:48 +02:00
Gwendal Roué 23178a2727 Issue #50: More RowAdapterTests 2016-05-18 09:09:09 +02:00
Gwendal Roué 60ab73d8a4 Issue #50: AdaptedRowImpl preserves column ordering 2016-05-18 09:04:39 +02:00
Gwendal Roué 2a39120b38 Issue #50: RowAdapter mappings have mandatory matching columns in the iterated statement. 2016-05-18 08:27:52 +02:00
Gwendal Roué c5bc699c26 Merge branch 'master' into RowAdapter 2016-05-18 07:53:17 +02:00
Gwendal Roué 9cc225dede Document that fetchOne(_🔑) supports multiple-column primary keys 2016-05-17 21:11:31 +02:00
Gwendal Roué 5f743f4cad v0.63.0 2016-05-17 20:32:11 +02:00
Gwendal Roué a7266e38c4 Issue #51: Database.close() logs when sqlite_close() fails 2016-05-17 20:30:50 +02:00
Gwendal Roué ea2f202e4d registerMigrationWithDisabledForeignKeyChecks documentation 2016-05-17 20:12:20 +02:00
Gwendal Roué c1169f0d2c Issue #51: Restore statement caching, now that the database is closed in the correct queue. 2016-05-17 20:08:55 +02:00
Gwendal Roué 37d7c178f5 DatabaseMigratorTests: accept various error messages from various SQLite versions 2016-05-17 19:43:15 +02:00
Gwendal Roué c34d64b3bb DatabaseErrorTests: accept various error messages from various SQLite versions 2016-05-17 19:43:07 +02:00
Gwendal Roué 8934596527 DatabaseErrorTests: accept various error messages from various SQLite versions 2016-05-17 19:40:47 +02:00
Gwendal Roué c13ac87a5b Database.primaryKey(): work around an SQLite bug 2016-05-17 19:40:17 +02:00
Gwendal Roué 09ea2dcd10 PRAGMA defer_foreign_keys is not available until iOS 8.2 and OS X 10.10 2016-05-17 19:25:04 +02:00
Gwendal Roué 1dd6707070 Support for advanced migrations is not available until iOS 8.2 and OS X 10.10 2016-05-17 19:24:39 +02:00
Gwendal Roué d5367fc2b2 Issue #51: Perform Database.close() in the correct queue 2016-05-17 19:03:07 +02:00
Gwendal Roué 0333406fbc Fix tests for 32bits systems 2016-05-17 19:02:06 +02:00
Gwendal Roué 6f779faa05 Documentation 2016-05-17 13:45:39 +02:00
Gwendal Roué 82fa559962 Issue #51: sqlite3_close_v2() is not available until iOS 8.2 and OS X 10.10. Until then, use sqlite3_close(), and avoid caching statements. Disable the concurrency tests that check database deallocation while some statements are running. 2016-05-17 13:39:29 +02:00
Gwendal Roué eca93cb43f Fix some tests for iOS8 2016-05-17 13:00:34 +02:00
Gwendal Roué 04e648b3f9 More RowAdapter tests 2016-05-13 11:37:31 +02:00
Gwendal Roué 6de0debb49 More RowAdapter tests 2016-05-13 11:35:38 +02:00
Gwendal Roué 84929771be RowAdapter initial implementation 2016-05-13 11:30:44 +02:00
Gwendal Roué 3b00230580 README.md 2016-05-12 19:53:48 +02:00
Gwendal Roué 959b11d19e Fix v0.62.0 release date 2016-05-12 08:19:29 +02:00
Gwendal Roué 2ad59f1aa5 v0.62.0 2016-05-12 08:18:02 +02:00
Gwendal Roué 494682c2af FetchedRecordsController iOS fixes 2016-05-12 08:15:24 +02:00
Gwendal Roué d48d0e621f FetchedRecordsController documentation 2016-05-12 07:59:38 +02:00
Gwendal Roué 1a3382aa24 CHANGELOG.md 2016-05-12 07:56:36 +02:00
Gwendal Roué 5c065d3f8a FetchedRecordsController documentation 2016-05-12 07:54:57 +02:00
Gwendal Roué 4799957d08 CHANGELOG.md 2016-05-12 07:48:36 +02:00
Gwendal Roué 307f43ce12 FetchedRecordsController documentation 2016-05-11 23:25:21 +02:00
Gwendal Roué b13fc99797 FetchedRecordsController: hide all UITableView-related methods from OSX 2016-05-11 23:24:30 +02:00
Gwendal Roué 1f30f8dcf3 FetchedRecordsController: hide all UITableView-related methods from OSX 2016-05-11 19:35:45 +02:00
Gwendal Roué fbb40e1232 FetchedRecordsController: tests that trackChanges { ... } trailing closure is invoked after records have been changed. 2016-05-11 10:45:48 +02:00
Gwendal Roué 1d5999e50b FetchedRecordsController: expose UITableView-targetted callbacks to iOS only 2016-05-11 10:36:51 +02:00
Gwendal Roué 04713d9652 FetchedRecordsController: use unowned self in callbacks 2016-05-11 10:04:22 +02:00
Gwendal Roué 050f432c10 FetchedRecordsController: callbacks must be set all at once. Restore optional tracking. 2016-05-11 08:32:11 +02:00
Gwendal Roué 1201f4e008 FetchedRecordsController: replace delegate with callbacks 2016-05-10 14:16:13 +02:00
Gwendal Roué 5614f57f43 v0.61.0 2016-05-10 09:57:03 +02:00
Gwendal Roué f9d82b8ead FetchedRecordsController cleanup 2016-05-10 09:12:27 +02:00
Gwendal Roué fba181bfea FetchedRecordsController: notify delegate of eventual changes when the delegate is set after performFetch() has been called.
With this change, it doesn’t matter if the delegate setter is called before of after performFetch().
2016-05-10 08:17:20 +02:00
Gwendal Roué 10d20748ad SQLITE_FULL, SQLITE_IOERR, SQLITE_BUSY, and SQLITE_NOMEM errors can mean that a transaction has been automatically rollbacked: update isInsideTransaction flag accordingly. 2016-05-09 20:52:36 +02:00
Gwendal Roué 25fc832ae5 CHANGELOG.md 2016-05-09 20:19:13 +02:00
Gwendal Roué fe5ef03bc8 A failed COMMIT is repaired with a ROLLBACK 2016-05-09 20:17:30 +02:00
Gwendal Roué fe158d20ed Failing test that checks that a failed COMMIT is repaired with a ROLLBACK 2016-05-09 20:17:19 +02:00
Gwendal Roué 95cb311f6c More TODO 2016-05-09 08:06:26 +02:00
Gwendal Roué e1bb98ec94 Less TODO 2016-05-08 19:49:34 +02:00
Gwendal Roué d7e0e44de0 TODO.md 2016-05-07 19:48:24 +02:00
Gwendal Roué 8a54e4cd76 TODO.md 2016-05-07 14:46:55 +02:00
Gwendal Roué b89c4f95e8 CHANGELOG.md 2016-05-07 13:29:06 +02:00
Gwendal Roué 087a1a1af5 v0.60.1 2016-05-07 13:27:52 +02:00
Gwendal Roué db86ceca0e Tests that when Database is deallocated, there is no remaining busy update statement. 2016-05-07 13:18:50 +02:00
Gwendal Roué a54b0389ae Remove sharing of cached statements between database pool readers 2016-05-07 13:17:45 +02:00
Gwendal Roué 6c826b6ecf Statement: don’t store sql string, and use sqlite3_sql instead. Plus some cleanup. 2016-05-07 11:57:35 +02:00
Gwendal Roué 8e864b9df4 Use sqlite3_close_v2, and check its result 2016-05-07 11:37:33 +02:00
Gwendal Roué 6e0837325c Documentation 2016-05-07 11:34:24 +02:00
Gwendal Roué b237df4b6d Use sqlite3_close_v2 2016-05-07 11:34:18 +02:00
Gwendal Roué 96f8a57f44 minor 2016-05-07 09:50:55 +02:00
Gwendal Roué f5575510f5 README.md 2016-05-07 06:28:23 +02:00
Gwendal Roué 745a72a0c4 README.md 2016-05-07 06:15:58 +02:00
Gwendal Roué c34b9e77a1 README.md 2016-05-06 14:54:27 +02:00
Gwendal Roué 7e8a47cd92 README.md 2016-05-06 14:52:03 +02:00
Gwendal Roué a0ecab10ac Cleanup 2016-05-06 13:30:40 +02:00
Gwendal Roué 185c2575b6 Protect Persistable query cache with a thread-safe ReadWriteBox 2016-05-06 13:17:57 +02:00
Gwendal Roué 565f627429 Reimplement ReadWriteBox with GCD 2016-05-06 13:01:28 +02:00
Gwendal Roué ef4f483a9e Typo 2016-05-06 12:35:47 +02:00
Gwendal Roué 92538de969 Remove useless warnings in the documentation of DatabaseReader.backup(to:)
GRBD serializes uses of writer connections: it’s useless to warn the user against using a database during a backup.
2016-05-05 15:37:41 +02:00
Gwendal Roué 88fe1cae08 v0.60.0 2016-05-05 15:26:12 +02:00
Gwendal Roué fbb59d2d6c DatabaseReader.backup(to:) 2016-05-05 15:24:14 +02:00
Gwendal Roué 3b9688eb2f TODO.md 2016-05-05 13:54:55 +02:00
Gwendal Roué 03debbf434 Documentation 2016-05-05 13:51:27 +02:00
Gwendal Roué f3bc909a02 From future import Swift 3 2016-05-05 13:23:28 +02:00
Gwendal Roué c3c20acb80 TODO.md 2016-05-05 07:12:48 +02:00
Gwendal Roué eccb4530a1 TODO.md 2016-05-04 18:29:56 +02:00
Gwendal Roué 3dd81071a5 README.md 2016-05-03 19:24:31 +02:00
Gwendal Roué d95f98f67d README.md 2016-05-03 19:18:07 +02:00
Gwendal Roué 94797986a9 Expose FetchedRecordsController to OSX 2016-05-03 11:44:04 +02:00
Gwendal Roué ac5e7e8973 README.md 2016-05-03 08:46:26 +02:00
Gwendal Roué 2684c4a735 README.md 2016-05-03 08:45:36 +02:00
Gwendal Roué bd67f86769 FetchedRecordsController tests WIP 2016-05-02 09:13:07 +02:00
Gwendal Roué e2765a3fd6 README.md 2016-05-02 09:10:31 +02:00
Gwendal Roué 73714933d7 README.md 2016-05-02 08:57:56 +02:00
Gwendal Roué d3da0bf860 README.md 2016-05-02 08:52:14 +02:00
Gwendal Roué dc011d522f README.md 2016-05-02 08:28:00 +02:00
Gwendal Roué 3d1ecc1881 README.md 2016-05-01 20:02:33 +02:00
Gwendal Roué 7676f10e0c README.md 2016-05-01 19:55:18 +02:00
Gwendal Roué c83bdfa810 README.md 2016-05-01 19:53:50 +02:00
Gwendal Roué 282677b8fc README.md 2016-05-01 19:53:06 +02:00
Gwendal Roué b2d0080637 README.md 2016-05-01 19:32:34 +02:00
Gwendal Roué 5f1be7c815 README.md 2016-05-01 19:31:45 +02:00
Gwendal Roué d5e2d6b88b README.md 2016-05-01 19:30:56 +02:00
Gwendal Roué 39a2efbcd9 README.md 2016-05-01 19:28:20 +02:00
Gwendal Roué 063b367951 README.md 2016-05-01 19:21:23 +02:00
Gwendal Roué 37ce59af6e README.md 2016-05-01 19:20:07 +02:00
Gwendal Roué 2d0cd5d186 README.md 2016-05-01 19:17:43 +02:00
Gwendal Roué dbbded56cf README.md 2016-05-01 19:16:34 +02:00
Gwendal Roué 67d6ac1760 README.md 2016-05-01 19:14:30 +02:00
Gwendal Roué 48d2ce5a98 README.md 2016-05-01 18:31:55 +02:00
Gwendal Roué 96a8a0f1fa FetchedRecordsController tests WIP 2016-05-01 16:56:17 +02:00
Gwendal Roué 4253a46282 FetchedRecordsController tests WIP 2016-05-01 14:06:04 +02:00
Gwendal Roué 660c255532 Drop obsolete test 2016-05-01 14:05:55 +02:00
Gwendal Roué 3956f1d183 FetchedRecordsController tests WIP 2016-05-01 14:00:00 +02:00
Gwendal Roué 234e1e6810 FetchedRecordsController tests WIP 2016-04-30 14:50:10 +02:00
Gwendal Roué e9e2d0bf10 README.md 2016-04-30 14:49:51 +02:00
Gwendal Roué 5d8a380f86 README.md 2016-04-28 08:44:04 +02:00
Gwendal Roué a9a06a0652 README.md 2016-04-28 08:35:55 +02:00
Gwendal Roué 9f4b03c14f Mark methods that are slow to compile (thanks to https://medium.com/swift-programming/speeding-up-slow-swift-build-times-922feeba5780) 2016-04-28 06:36:23 +02:00
Gwendal Roué a8f93a5a9c TODO.md 2016-04-27 14:30:17 +02:00
Gwendal Roué 4c52d51aa2 Fix performance tests 2016-04-26 13:27:42 +02:00
Gwendal Roué 663b89a4a5 SQLite.swift 0.10.1 2016-04-26 13:13:51 +02:00
Gwendal Roué 0a4779ed8c Realm 0.99.1 2016-04-26 13:13:36 +02:00
Gwendal Roué c09463e529 README.md 2016-04-26 09:07:13 +02:00
Gwendal Roué f93b029b82 TODO 2016-04-26 08:49:27 +02:00
Gwendal Roué 929122934e v0.59.1 2016-04-25 20:42:44 +02:00
Gwendal Roué dfd38150f2 https://github.com/groue/GRDB.swift/issues/41 2016-04-25 20:24:53 +02:00
Gwendal Roué 11bb86a8ed TODO.md 2016-04-25 20:24:33 +02:00
Gwendal Roué 05dad7e0d6 TODO.md 2016-04-23 17:40:54 +02:00
Gwendal Roué 541316cd89 README.md 2016-04-23 10:53:54 +02:00
Gwendal Roué 08c75a2d06 README.md 2016-04-23 10:52:44 +02:00
Gwendal Roué 15a4aa3d1b Fix collation documentation 2016-04-23 10:51:20 +02:00
Gwendal Roué acb46d3e86 v0.59.0 2016-04-23 09:58:10 +02:00
Gwendal Roué 000bd1b200 Database.isInsideTransaction 2016-04-23 09:56:47 +02:00
Gwendal Roué baf87f837a TODO.md 2016-04-23 09:31:33 +02:00
Gwendal Roué 0bcc8639c1 Update playgrounds 2016-04-23 09:28:10 +02:00
Gwendal Roué e75b25c0c1 Update playgrounds 2016-04-23 09:22:04 +02:00
Gwendal Roué 2cc6d17014 README.md 2016-04-23 08:00:48 +02:00
Gwendal Roué 404bb0eafd README.md 2016-04-22 21:05:24 +02:00
Gwendal Roué 284f0e7ccb README.md 2016-04-22 21:03:42 +02:00
Gwendal Roué 081df4cad9 README.md 2016-04-22 20:48:43 +02:00
Gwendal Roué 13d25939ec README.md 2016-04-22 20:47:58 +02:00
Gwendal Roué 9b6c05ca04 TODO.md 2016-04-22 20:36:53 +02:00
Gwendal Roué 8b9e78e158 Update Tour.playground 2016-04-22 19:36:48 +02:00
Gwendal Roué a974f311d9 README.md 2016-04-22 19:04:27 +02:00
Gwendal Roué b034137516 README.md 2016-04-22 18:52:36 +02:00
Gwendal Roué b819271441 README.md 2016-04-22 18:51:34 +02:00
Gwendal Roué b898391124 README.md 2016-04-22 18:42:52 +02:00
Gwendal Roué 4c57436fe8 README.md 2016-04-22 18:42:25 +02:00
Gwendal Roué f0479a656a README.md 2016-04-22 18:40:14 +02:00
Gwendal Roué 41e0537eca README.md 2016-04-22 18:30:11 +02:00
Gwendal Roué dd04990143 TODO.md 2016-04-22 08:34:36 +02:00
Gwendal Roué d0d9344c8a README.md 2016-04-22 08:34:33 +02:00
Gwendal Roué 64ee2ef045 README.md 2016-04-22 05:18:15 +02:00
Gwendal Roué 061d444a8f README.md 2016-04-22 05:16:56 +02:00
Gwendal Roué d4cb690b8b CHANGELOG.md 2016-04-22 05:16:31 +02:00
Gwendal Roué bd50f1ce59 README.md 2016-04-22 05:10:41 +02:00
Gwendal Roué 944cae53de README.md 2016-04-22 05:03:27 +02:00
Gwendal Roué 17b43d021a README.md 2016-04-22 04:57:38 +02:00
Gwendal Roué 059af3a621 README.md 2016-04-22 04:52:58 +02:00
Gwendal Roué 524701caad README.md 2016-04-22 04:46:54 +02:00
Gwendal Roué 34111df889 README.md 2016-04-22 04:44:13 +02:00
Gwendal Roué 5dfca74327 README.md 2016-04-22 04:43:07 +02:00
Gwendal Roué 12cfdac1b0 README.md 2016-04-22 04:31:03 +02:00
Gwendal Roué 5ccf66bd9b README.md 2016-04-22 04:28:28 +02:00
Gwendal Roué 4f344ab1a6 README.md 2016-04-21 19:29:53 +02:00
Gwendal Roué 624ac5b81c README.md 2016-04-21 19:23:33 +02:00
Gwendal Roué 7c2fb3506c README.md 2016-04-21 19:16:46 +02:00
Gwendal Roué dc4ac5568c README.md 2016-04-21 19:16:24 +02:00
Gwendal Roué 460cfd05c6 README.md 2016-04-21 19:15:35 +02:00
Gwendal Roué 40525d9bcf README.md 2016-04-21 13:46:07 +02:00
Gwendal Roué 8dbf8c92cf README.md 2016-04-21 13:45:41 +02:00
Gwendal Roué 92d417dc0c README.md 2016-04-21 13:41:46 +02:00
Gwendal Roué 43e9a63210 FetchRequest.reverse() sort by descending rowID when no ordering has been specified. 2016-04-21 09:03:01 +02:00
Gwendal Roué 4483d748e9 TODO.md 2016-04-21 08:48:25 +02:00
Gwendal Roué 48f2581d07 TODO.md 2016-04-20 22:05:57 +02:00
Gwendal Roué f074f1ab36 v0.58.0 2016-04-20 22:05:26 +02:00
Gwendal Roué 42bea06b93 CHANGELOG.md 2016-04-20 22:04:22 +02:00
Gwendal Roué 6550454d1e Replace DatabaseChanges with Database.lastInsertedRowID and Database.changesCount 2016-04-20 21:58:58 +02:00
Gwendal Roué 0a80316d09 Close experiment with API diff 2016-04-20 20:45:38 +02:00
Gwendal Roué 64b98a8330 TODO.md 2016-04-18 10:00:54 +02:00
Gwendal Roué 992c63480d DatabasePool uses PRAGMA synchronous = NORMAL
As advised by https://www.sqlite.org/pragma.html#pragma_synchronous
2016-04-15 06:24:18 +02:00
Gwendal Roué 6566f3f83d Experiment with API diff 2016-04-14 19:50:12 +02:00
Gwendal Roué 973da2de61 Experiment with API diff 2016-04-14 19:06:42 +02:00
Gwendal Roué bf7fdd68f2 Typo 2016-04-13 09:09:54 +02:00
Gwendal Roué 1136d367c7 Code organization 2016-04-13 08:59:32 +02:00
Gwendal Roué e7b1c9b7cd Update README.md 2016-04-11 19:49:01 +02:00
Gwendal Roué 9a03e0866b README.md 2016-04-09 09:21:37 +02:00
Gwendal Roué a5d26bdc81 README.md 2016-04-09 09:11:44 +02:00
Gwendal Roué e9cca9657f CHANGELOG.md 2016-04-09 06:32:23 +02:00
Gwendal Roué 8498dd927f README.md 2016-04-08 18:29:36 +02:00
Gwendal Roué ccc8d2ba33 TODO.md 2016-04-08 17:59:21 +02:00
Gwendal Roué 1098b0254e Typo in CHANGELOG.md 2016-04-08 13:45:31 +02:00
Gwendal Roué 9eda86eb29 Update CHANGELOG.md 2016-04-08 13:17:15 +02:00
Gwendal Roué 2d126010bc Update documentation 2016-04-08 13:17:03 +02:00
Gwendal Roué 30f4744199 Remove dead code 2016-04-08 13:13:21 +02:00
Gwendal Roué e26892ad90 v0.57.0 2016-04-08 13:04:54 +02:00
Gwendal Roué 4976b7e648 Remove all direct database accesses examples from README.md 2016-04-08 09:00:04 +02:00
Gwendal Roué a539b629e7 Remove all direct database accesses examples from README.md 2016-04-08 08:57:24 +02:00
Gwendal Roué 8bd22b545c Update GRDBDemoiOS app to block-based database accesses. 2016-04-08 08:40:57 +02:00
Gwendal Roué 8d3796324d Update GRDBProfiling app to block-based database accesses. 2016-04-08 08:37:02 +02:00
Gwendal Roué af53fe8e79 Update playgrounds to block-based database accesses. 2016-04-08 08:35:48 +02:00
Gwendal Roué 4bcff181c7 Back to block-based database accesses.
Rationale: https://medium.com/@gwendal.roue/four-different-ways-to-handle-sqlite-concurrency-db3bcc74d00e
2016-04-08 08:29:58 +02:00
Gwendal Roué 783da0c45d TODO.md 2016-04-07 07:46:32 +02:00
Gwendal Roué 6ef4a6eb08 More tests for DatabasePool read that starts while a write is running. 2016-04-07 06:22:51 +02:00
Gwendal Roué 9e52513138 Explicit test for DatabasePool read that starts while a write is running. 2016-04-06 23:53:10 +02:00
Gwendal Roué e9043d1e93 Explicit test for DatabasePool read that starts while a write is running. 2016-04-06 21:29:49 +02:00
Gwendal Roué 3dd821a975 v0.56.2 2016-04-05 18:32:42 +02:00
Gwendal Roué 18ba7ed086 Restore save(DatabaseQueue/Pool) 2016-04-05 18:31:06 +02:00
Gwendal Roué 0128385195 CHANGELOG.md 2016-04-05 14:10:25 +02:00
Gwendal Roué 4c3efab946 Test app for Carthage integration of GRDBCipher 2016-04-05 13:57:57 +02:00
Gwendal Roué 858d427690 v0.56.1 2016-04-05 13:21:51 +02:00
Gwendal Roué 486666279d Revert "Document that CocoaPods is not supported until https://github.com/CocoaPods/CocoaPods/issues/5108"
This reverts commit 24d2ddada7.
2016-04-05 09:22:23 +02:00
Gwendal Roué 24d2ddada7 Document that CocoaPods is not supported until https://github.com/CocoaPods/CocoaPods/issues/5108
is solved.
2016-04-05 09:12:22 +02:00
Gwendal Roué 023d757964 Attempt to fix CocoaPods 2016-04-05 08:53:02 +02:00
Gwendal Roué e4b12d6a2d v0.56.0 2016-04-05 08:23:59 +02:00
Gwendal Roué d67625a966 README.md 2016-04-05 08:18:50 +02:00
Gwendal Roué 608f671c48 TODO.md 2016-04-05 07:51:45 +02:00
Gwendal Roué 9ef1c70eb2 Encryption documentation 2016-04-05 06:55:29 +02:00
Gwendal Roué b7e236a693 Encryption documentation 2016-04-05 06:50:35 +02:00
Gwendal Roué d519a92719 testExportPlainTextDatabaseToEncryptedDatabase 2016-04-05 06:33:11 +02:00
Gwendal Roué a83d7c6140 CHANGELOG.md 2016-04-05 05:53:55 +02:00
Gwendal Roué d74a8636b3 TODO.md 2016-04-05 05:53:49 +02:00
Gwendal Roué d010271f5d Update SQLCipher deployment targets 2016-04-05 05:51:50 +02:00
Gwendal Roué f868d3eead changePassphrase() 2016-04-05 05:51:19 +02:00
Gwendal Roué 166ae08465 EncryptionTests: make sure we can not open a database encrypted with PRAGMA key 2016-04-04 13:34:32 +02:00
Gwendal Roué 15f3450f8c GRDBTestCase cleanup 2016-04-04 13:31:57 +02:00
Gwendal Roué b2bc2700b3 Fix https://github.com/sqlcipher/sqlcipher/issues/162 2016-04-04 13:18:37 +02:00
Gwendal Roué 8183f57b85 Fix SQLCipher 2016-04-04 09:01:26 +02:00
Gwendal Roué 79ffb7b9b8 TODO.md 2016-04-04 08:23:46 +02:00
Gwendal Roué af108e1ac9 Change SQLCipher commit target. 2016-04-04 08:22:38 +02:00
Gwendal Roué 627bca09c0 SQLCipher: test compatibility between Configuration.passphrase and PRAGMA key 2016-04-03 22:57:12 +02:00
Gwendal Roué 08de2cc920 Remove explicit deployment targets for OS X tests 2016-04-03 22:46:20 +02:00
Gwendal Roué f1c87b6604 CHANGELOG.md 2016-04-03 22:24:24 +02:00
Gwendal Roué 9f6c5ccccb Fix availability attributes of localizedCapitalizedString, etc. Restore iOS7 compatibility. 2016-04-03 22:22:06 +02:00
Gwendal Roué 41fab091d0 GRDBCipheriOS 2016-04-03 22:16:30 +02:00
Gwendal Roué 484d5a5968 Framework for GRDB+SQLCipher is named GRDBCipher 2016-04-03 21:30:22 +02:00
Gwendal Roué eabacfafb2 Encryption tests 2016-04-03 20:39:20 +02:00
Gwendal Roué 2ec2e85679 Passing tests for encrypted databases 2016-04-03 18:42:31 +02:00
Gwendal Roué e0bb6d106c Failing tests for encrypted databases 2016-04-03 17:58:58 +02:00
Gwendal Roué 20a16de9de DatabaseWriter.setKey() and reKey() 2016-04-03 17:58:03 +02:00
Gwendal Roué e3d8c06ad0 Refactor tests so that DatabasePool can be configured at the target level. We are preparing tests for encrypted databases. 2016-04-03 16:55:04 +02:00
Gwendal Roué 7e3563f64b Refactor tests so that DatabaseQueue can be configured at the target level. We are preparing tests for encrypted databases. 2016-04-03 16:20:45 +02:00
Gwendal Roué f188db2dab TODO.md 2016-04-03 14:04:12 +02:00
Gwendal Roué 0473d232ed Tests for GRDBOSX, GRDBiOS, and GRDBCipherOSX (without encryption) 2016-04-03 14:04:04 +02:00
Gwendal Roué 861e43a25b SQLCipher/README.md 2016-04-03 11:41:29 +02:00
Gwendal Roué 3e0fcc4b87 New GRDBCipherOSX target + tests 2016-04-03 11:40:34 +02:00
Gwendal Roué a355892ce5 FetchedRecordsController.setRequest(sql:arguments:) 2016-04-02 08:52:38 +02:00
Gwendal Roué 52c0f31578 FetchedRecordsController: rename writer property to databaseWriter 2016-04-02 08:46:04 +02:00
Gwendal Roué e132b54c9f FetchedRecordsController documentation 2016-04-02 08:41:19 +02:00
Gwendal Roué dc942c5734 The save() method now requires a Database connection argument, and won’t accept DatabaseQueue or DatabasePool directly. 2016-04-02 08:37:30 +02:00
Gwendal Roué a7038a9eaf TODO.md 2016-04-02 08:17:20 +02:00
Gwendal Roué 7664e0b187 TODO.md 2016-04-01 23:14:25 +02:00
Gwendal Roué e8ccc48815 Add performance tests README in project so that I don’t have to look after it in order to build Realm 2016-04-01 20:20:15 +02:00
Gwendal Roué eda40621c4 TODO.md 2016-04-01 13:25:09 +02:00
Gwendal Roué 5b4c6b62a7 README.md 2016-04-01 08:12:17 +02:00
Gwendal Roué b7bab76232 v0.55.0 2016-03-31 16:42:21 +02:00
Gwendal Roué bd3c39eaaf setupMemoryManagement() documentation 2016-03-31 16:38:57 +02:00
Gwendal Roué 2fb1d6f731 setupMemoryManagement() documentation 2016-03-31 16:37:55 +02:00
Gwendal Roué ef299acbe8 Memory management is not automatic when GRDB is built for iOS, but easier. 2016-03-31 16:26:07 +02:00
Gwendal Roué 005c4ded24 Memory management is automatic when GRDB is built for iOS 2016-03-31 14:26:59 +02:00
Gwendal Roué cfceabb4ec v0.54.2 2016-03-31 10:31:00 +02:00
Gwendal Roué 06095ec343 Fix #37 2016-03-31 10:27:12 +02:00
Gwendal Roué a753a654ca GRDBDemoiOS WIP 2016-03-31 07:57:03 +02:00
Gwendal Roué 2dfd6c79c0 Fix Carthage test app 2016-03-31 06:55:41 +02:00
Gwendal Roué abbf0cd856 README.md: even though "column == true" condition is supported, we don't have to foster it. 2016-03-30 09:58:58 +02:00
Gwendal Roué 83ec50e4ab GRDBDemoiOS WIP 2016-03-30 08:34:57 +02:00
Gwendal Roué d51b6fd61d GRDBDemoiOS WIP 2016-03-30 08:33:42 +02:00
Gwendal Roué 894bb05cba GRDBDemoiOS: simplify view controllers’ names 2016-03-30 08:00:50 +02:00
Gwendal Roué 669720c6dc v0.54.1 2016-03-29 19:07:32 +02:00
Gwendal Roué fdcbc2db86 v0.54.1 2016-03-29 18:52:12 +02:00
Gwendal Roué 37f0e4af3e TODO.md 2016-03-29 16:01:08 +02:00
Gwendal Roué 7c14e63fef v0.54.0 2016-03-29 13:31:59 +02:00
Gwendal Roué 7b5088b921 DatabaseWriter documentation 2016-03-29 13:10:11 +02:00
Gwendal Roué 66fe22d716 Update Carthage test application 2016-03-29 13:07:40 +02:00
Gwendal Roué d2339cc7c2 Merge branch 'master' of github.com:groue/GRDB.swift into FetchedRecordsController 2016-03-29 12:45:19 +02:00
Gwendal Roué d53c7f5d2d DatabaseWriter documentation 2016-03-29 09:08:32 +02:00
Gwendal Roué efdc6053ff FetchedRecordsController: fix concurrency bug 2016-03-29 08:53:55 +02:00
Gwendal Roué ab3ec443d2 Simplify SerializedDatabase 2016-03-29 08:26:07 +02:00
Gwendal Roué f5873ae0e4 README.md 2016-03-28 20:30:22 +02:00
Gwendal Roué e9197817f5 README.md 2016-03-28 20:21:25 +02:00
Gwendal Roué c04c8ef815 Merge branch 'master' of github.com:groue/GRDB.swift into FetchedRecordsController 2016-03-28 19:34:52 +02:00
Gwendal Roué c5d1181d72 README.md 2016-03-28 19:34:18 +02:00
Gwendal Roué 4b479ad327 Merge branch 'master' into FetchedRecordsController
Conflicts:
	CHANGELOG.md
	DemoApps/GRDBDemoiOS/GRDBDemoiOS/Assets.xcassets/AppIcon.appiconset/Contents.json
	DemoApps/GRDBDemoiOS/GRDBDemoiOS/Database.swift
	TODO.md
2016-03-28 18:54:59 +02:00
Gwendal Roué be4497f768 Update GRDBDemoiOS so that it uses built-in collation 2016-03-28 18:28:40 +02:00
Gwendal Roué 6ad79b12a6 README.md 2016-03-28 18:20:28 +02:00
Gwendal Roué 24fe6b3c4d README.md 2016-03-28 18:18:18 +02:00
Gwendal Roué f4d5f1c584 README.md 2016-03-28 18:16:51 +02:00
Gwendal Roué 9a18ab44a6 Default unicode-aware collations 2016-03-28 18:12:29 +02:00
Gwendal Roué a97530bde8 The Query interface no longer use non-unicode aware UPPER and LOWER functions 2016-03-28 16:35:20 +02:00
Gwendal Roué ec176bbec5 Xcode hiccup 2016-03-28 16:33:10 +02:00
Gwendal Roué 76e194ab1a GRDBDemoiOS WIP 2016-03-28 15:19:49 +02:00
Gwendal Roué 460e1c87d9 GRDBDemoiOS WIP 2016-03-28 15:06:18 +02:00
Gwendal Roué 66db3fd6d6 GRDBDemoiOS WIP 2016-03-28 15:06:15 +02:00
Gwendal Roué 15ec342519 FetchedRecordsController documentation 2016-03-28 14:25:34 +02:00
Gwendal Roué 136d262d4c FetchedRecordsController documentation 2016-03-28 14:15:55 +02:00
Gwendal Roué 582dafd50d Thanks 2016-03-28 00:17:50 +02:00
Gwendal Roué a827a1b105 FetchedRecordsController documentation 2016-03-28 00:13:22 +02:00
Gwendal Roué 50a62edbaf FetchedRecordsController documentation 2016-03-28 00:08:46 +02:00
Gwendal Roué 4924b39f93 FetchedRecordsController documentation 2016-03-28 00:08:12 +02:00
Gwendal Roué afe2c9db2f FetchedRecordsController documentation 2016-03-28 00:05:20 +02:00
Gwendal Roué d18b30da10 FetchedRecordsController documentation 2016-03-28 00:03:11 +02:00
Gwendal Roué d6b07185ae FetchedRecordsController documentation 2016-03-28 00:00:11 +02:00
Gwendal Roué 1a32753ce9 CHANGELOG.md 2016-03-27 23:14:58 +02:00
Gwendal Roué 0bab743936 GRDBDemoiOS WIP 2016-03-27 23:05:40 +02:00
Gwendal Roué 6f82912701 Merge branch 'master' into FetchedRecordsController 2016-03-27 19:26:50 +02:00
Gwendal Roué 827ffa88fe README.md 2016-03-27 19:26:28 +02:00
Gwendal Roué 83534e2848 GRDBDemoiOS WIP 2016-03-27 16:55:29 +02:00
Gwendal Roué a7dcbea8ef GRDBDemoiOS WIP 2016-03-27 16:32:41 +02:00
Gwendal Roué 36a35ef303 [Swift bug] Prevent a memory leak 2016-03-27 15:48:07 +02:00
Gwendal Roué 91eced4b26 GRDBDemoiOS WIP 2016-03-27 15:47:45 +02:00
Gwendal Roué ec5f33179a Merge branch 'master' of github.com:groue/GRDB.swift into FetchedRecordsController 2016-03-27 15:05:05 +02:00
Gwendal Roué e180ae4cbd README.md 2016-03-27 15:00:49 +02:00
Gwendal Roué 98bc81cdd5 README.md 2016-03-27 14:56:44 +02:00
Gwendal Roué 2b549c358d README.md 2016-03-27 14:54:46 +02:00
Gwendal Roué d170b0d0e1 DatabaseEvent: make it lazy 2016-03-27 14:39:12 +02:00
Gwendal Roué 5fbdd03acb Restore disabled tests (???) 2016-03-27 14:38:03 +02:00
Gwendal Roué 3e3ba6e7ed FetchedRecordsController optimization for DatabasePool: release the writer dispatch queue before the end of the fetch 2016-03-27 14:22:32 +02:00
Gwendal Roué ea929a78e0 FetchedRecordsController TODO 2016-03-27 11:15:56 +02:00
Gwendal Roué c845c19477 FetchedRecordsController TODO 2016-03-27 11:15:31 +02:00
Gwendal Roué ef0d2c6234 GRDBDemoiOS WIP 2016-03-27 11:14:19 +02:00
Gwendal Roué 8af5f54767 GRDBDemoiOS WIP 2016-03-27 01:44:43 +01:00
Gwendal Roué fb601ee80f GRDBDemoiOS WIP 2016-03-26 18:51:44 +01:00
Gwendal Roué 72fa9d1a4a GRDBDemoiOS WIP 2016-03-26 18:49:44 +01:00
Gwendal Roué d1b21708e6 Merge FetchedRecordsController demo in GRDBDemoiOS 2016-03-26 18:39:03 +01:00
Gwendal Roué 703aa07407 GRDBFetchedRecordsControllerDemo WIP 2016-03-26 18:33:39 +01:00
Gwendal Roué 6e2ed61743 GRDBFetchedRecordsControllerDemo WIP 2016-03-26 18:30:20 +01:00
Gwendal Roué c9ce98c5d5 GRDBFetchedRecordsControllerDemo WIP 2016-03-26 17:55:50 +01:00
Gwendal Roué f0c23b7244 GRDBFetchedRecordsControllerDemo WIP 2016-03-26 17:50:09 +01:00
Gwendal Roué 00e49e76be GRDBFetchedRecordsControllerDemo WIP 2016-03-26 17:49:47 +01:00
Gwendal Roué 05eb7b35f8 FetchedRecordsController can change its fetch request, and notify the delegate of changes 2016-03-26 17:41:45 +01:00
Gwendal Roué f6df412350 GRDBFetchedRecordsControllerDemo WIP 2016-03-26 17:03:32 +01:00
Gwendal Roué f952b9bbcb GRDBFetchedRecordsControllerDemo WIP 2016-03-26 16:52:08 +01:00
Gwendal Roué 9160021442 New GRDBFetchedRecordsControllerDemo app 2016-03-26 16:28:40 +01:00
Gwendal Roué 77e245aec3 Make FetchedRecordsControllerDelegate methods optional 2016-03-26 16:26:39 +01:00
Gwendal Roué eaf8193d37 Documentation of didInsertWithRowID(rowID:forColumn:) 2016-03-26 16:26:28 +01:00
Gwendal Roué 8257b05c8f FetchedRecordsController documentation 2016-03-26 14:21:17 +01:00
Gwendal Roué 0912139fc5 FetchedRecordsController documentation 2016-03-26 14:10:40 +01:00
Gwendal Roué 4592566748 FetchedRecordsController documentation 2016-03-26 13:41:00 +01:00
Gwendal Roué 22851dd9e8 FetchedRecordsController: fix indexPathForRecord 2016-03-26 13:37:56 +01:00
Gwendal Roué 87bab96097 FetchedRecordsController only tracks changes when it has a delegate. 2016-03-26 13:35:00 +01:00
Gwendal Roué 81ed566467 FetchedRecordsController TODO 2016-03-26 12:17:52 +01:00
Gwendal Roué 336220d998 FetchedRecordsController documentation 2016-03-26 08:34:08 +01:00
Gwendal Roué 859e71d976 FetchedRecordsController documentation 2016-03-26 08:23:09 +01:00
Gwendal Roué deb25d916d Merge branch 'master' into FetchedRecordsController
Conflicts:
	TODO.md
2016-03-26 07:36:59 +01:00
Gwendal Roué c412a01fa6 README.md 2016-03-25 21:13:04 +01:00
Gwendal Roué 2a9be8a28c README.md 2016-03-25 21:08:00 +01:00
Gwendal Roué 310704e0c5 README.md 2016-03-25 21:07:17 +01:00
Gwendal Roué 03f89c9131 TODO.md 2016-03-25 20:57:43 +01:00
Gwendal Roué 8ed39f43b4 v0.53.0 2016-03-25 20:56:06 +01:00
Gwendal Roué 84292beef9 Document convenience conversions of SQLite 2016-03-25 20:43:41 +01:00
Gwendal Roué d612b86d7f Document the new behavior of Row.value() and DatabaseValue.value() 2016-03-25 20:18:07 +01:00
Gwendal Roué 93180d6843 CHANGELOG.md 2016-03-25 20:17:42 +01:00
Gwendal Roué 644ec3caec DatabaseValue.value() raises a fatal error when conversion of a non-NULL value fails. 2016-03-25 20:17:31 +01:00
Gwendal Roué bb5aa47d7b Tests for Row.databaseValue(atIndex:) and Row.databaseValue(named:) 2016-03-25 20:16:31 +01:00
Gwendal Roué b9338b31bc Row.databaseValue(atIndex:) and Row.databaseValue(named:) 2016-03-25 20:16:23 +01:00
Gwendal Roué 5ed3b39219 Rename DatabaseValue.unsafeValue() to failableValue() 2016-03-25 18:46:24 +01:00
Gwendal Roué ee55afe8c0 Row.value() no longer turns non-NULL values to nil, should the conversion fail. 2016-03-25 18:28:42 +01:00
Gwendal Roué 6bfab3d04a DatabaseValue.value() no longer turns non-NULL values to nil, should the conversion fail. The new method DatabaseValue.unsafeValue() has the old, information-discarding, behavior. 2016-03-25 13:56:38 +01:00
Gwendal Roué 5f84f1378b TODO.md 2016-03-25 09:32:09 +01:00
Gwendal Roué 18a63504ed FetchedRecordsController documentation 2016-03-25 08:45:12 +01:00
Gwendal Roué 44f80dc385 README.md 2016-03-24 14:19:43 +01:00
Gwendal Roué fe5af8308c CHANGELOG.md 2016-03-24 14:10:04 +01:00
Gwendal Roué 197fc48d92 v0.52.1 2016-03-24 14:06:57 +01:00
Gwendal Roué 293268a004 Query interface: fix SQL generation for boolean tests
For example,`valid == true` now generates `"valid"`
2016-03-24 13:59:43 +01:00
Gwendal Roué c558d8fcaa Query interface: fix SQL generation for boolean tests
For example,`valid == true` now generates `"valid" <> 0`
2016-03-24 13:50:52 +01:00
Gwendal Roué b13ad57ea5 FetchedRecordsController: Back to delegate pattern 2016-03-24 13:35:11 +01:00
Gwendal Roué eba839b58e FetchedRecordsController: Cleanup 2016-03-24 08:37:19 +01:00
Gwendal Roué 36a480a5fc FetchedRecordsController: Clean up 2016-03-24 06:33:05 +01:00
Gwendal Roué 68c83ea156 README.md 2016-03-24 05:16:33 +01:00
Gwendal Roué 9102c94db2 FetchedRecordsController: Fix tableView crashes 2016-03-23 20:04:00 +01:00
Gwendal Roué 26d6330771 TODO.md 2016-03-23 14:18:22 +01:00
Gwendal Roué c123d27b89 README.md 2016-03-23 13:59:03 +01:00
Gwendal Roué 8aa5324892 README.md 2016-03-23 13:56:09 +01:00
Gwendal Roué fb448e27ad FetchedRecordsController: Still some tableView crashes 2016-03-23 13:50:21 +01:00
Gwendal Roué b24c872b52 RowConvertible.awakeFromFetch loses its database argument. FetchedRecordsController lazily instantiates records. 2016-03-23 13:44:05 +01:00
Gwendal Roué fdb31f37ba FetchedRecordsController: let the user choose the callback queue 2016-03-23 13:24:52 +01:00
Gwendal Roué 87733729b1 Merge branch 'master' into FetchedRecordsController
Conflicts:
	GRDB.xcworkspace/contents.xcworkspacedata
2016-03-23 13:15:35 +01:00
Gwendal Roué 09cbbb4570 Fix GRDBiOSTests target 2016-03-23 13:13:40 +01:00
Gwendal Roué cc2489e4ed Fix path to Tour.playground 2016-03-23 09:53:21 +01:00
Gwendal Roué 82d71b637d FetchedRecordsController: TODO 2016-03-23 09:08:46 +01:00
Gwendal Roué c4c0e67407 FetchedRecordsController.recordAtIndexPath returns a non-optional (as NSFetchedResultsController does) 2016-03-23 09:08:38 +01:00
Gwendal Roué d0c5e98366 FetchedRecordsController: add initializer that compares record by primary key (if the record adopts MutablePersistable) 2016-03-23 08:54:02 +01:00
Gwendal Roué 83c5afdd2d FetchedRecordsController: define record comparison function in the controller’s initializer 2016-03-23 08:32:57 +01:00
Gwendal Roué c46663007b Merge branch 'master' into FetchedRecordsController
Conflicts:
	DemoApps/GRDBDemoiOS/GRDBDemoiOS/MasterViewController.swift
2016-03-23 08:22:55 +01:00
Gwendal Roué df748e5e75 README.md 2016-03-23 08:19:05 +01:00
Gwendal Roué e98685b6cc Modernize GRDBDemoiOS 2016-03-23 08:07:28 +01:00
Gwendal Roué 2374c67975 TODO.md 2016-03-23 07:59:35 +01:00
Gwendal Roué 30f288a6b9 FetchedRecordsController: update for Swift 2.2 2016-03-22 21:34:47 +01:00
Gwendal Roué aea7609e0b Merge branch 'master' into FetchedRecordsController 2016-03-22 21:29:46 +01:00
Gwendal Roué 700b256cad Merge commit 'a0b5f87b7d83655efa010c24f654ab03a97a1afa' into FetchedRecordsController 2016-03-22 21:06:59 +01:00
Gwendal Roué 64b4372a18 Merge commit '557fbc21efd227e50e790b1149907720a91fe346' into FetchedRecordsController 2016-03-22 21:06:42 +01:00
Gwendal Roué 32461d221a Merge commit '7de27389aa89f731b977e2d046c8b12ff2191e5d' into FetchedRecordsController 2016-03-22 21:06:04 +01:00
Gwendal Roué b9190e116a README.md 2016-03-22 20:54:00 +01:00
Gwendal Roué 2d6247d48a README.md 2016-03-22 20:52:37 +01:00
Gwendal Roué 4aaf001885 README.md 2016-03-22 20:50:36 +01:00
Gwendal Roué cc5726577e README.md 2016-03-22 20:34:44 +01:00
Gwendal Roué 626ae53057 README.md 2016-03-22 20:33:18 +01:00
Gwendal Roué ff69f6fdfc README.md 2016-03-22 20:31:28 +01:00
Gwendal Roué 3178af0074 README.md 2016-03-22 20:29:44 +01:00
Gwendal Roué 98a93346fc Refactor concurrency documentation 2016-03-22 20:27:14 +01:00
Gwendal Roué 01eea12f4e Typo 2016-03-22 14:12:21 +01:00
Gwendal Roué 1b78881f78 Update performance tests 2016-03-22 14:11:36 +01:00
Gwendal Roué a0b5f87b7d Replace prebuilt Realm frameworks with source (v0.98.5) 2016-03-22 13:38:45 +01:00
Gwendal Roué 557fbc21ef Performance tests target ccgus/fmdb v2.6.2 and stephencelis/SQLite.swift v0.9.2 2016-03-22 09:26:30 +01:00
Gwendal Roué 7de27389aa TODO.md 2016-03-22 08:49:30 +01:00
Gwendal Roué 049148305f Simplify throwing initializers since Swift 2.2 allows partial initialization 2016-03-22 08:28:55 +01:00
Gwendal Roué 90f468c329 Remove Swift warning 2016-03-21 23:31:10 +01:00
Gwendal Roué cd7acbc4ce v0.52.0 2016-03-21 23:18:45 +01:00
Gwendal Roué 907f020bf6 Update module.modulemap for latest Xcode 7.3 2016-03-21 23:14:37 +01:00
Gwendal Roué a6af89755d Merge branch 'master' into Swift2.2 2016-03-21 23:09:02 +01:00
Gwendal Roué e3ee49a868 FetchedRecordsController: properly serialize computations, require client access from main thread, fix known crashers 2016-03-21 14:08:36 +01:00
Gwendal Roué af538c4feb Improve test for migration with disabled foreign key checks 2016-03-18 06:44:24 +01:00
Gwendal Roué 4e5d5aac8c CHANGELOG.md 2016-03-18 06:26:47 +01:00
Gwendal Roué 5c8526d197 TODO.md 2016-03-18 06:26:40 +01:00
Gwendal Roué 4f13055a45 README.md 2016-03-18 06:22:26 +01:00
Gwendal Roué 2d7a035297 TODO.md 2016-03-18 06:21:32 +01:00
Gwendal Roué cc6f2c00df Fix ==(Row, Row) 2016-03-18 06:21:22 +01:00
Gwendal Roué 3293a33f38 Row adopts Equatable 2016-03-18 06:21:16 +01:00
Gwendal Roué 5e6dd56933 README.md 2016-03-18 06:20:25 +01:00
Gwendal Roué 6104d6193c FetchedRecordsController: found crashers 2016-03-18 06:17:13 +01:00
Gwendal Roué b45c711483 FetchedResultsController: replace "Result" by "Record", and "Change" by "Event" (this leaves changes free for actual row changes) 2016-03-17 13:27:06 +01:00
Gwendal Roué bebcefddcc FetchedResultsController: replace Delegate protocol with callbacks.
This change was required because the generic delegate methods did prevent the delegate to know the type of the changed objects.
2016-03-17 13:15:27 +01:00
Gwendal Roué 68a9089d14 Fix Tour.playground path 2016-03-17 13:14:41 +01:00
Gwendal Roué c6f96906ca Avoid build errors by using ad-hoc Swift modules that import the right sqlite3 header depending on the platform (MacOSX, iPhoneOS, iPhoneSimulator). 2016-03-17 08:54:09 +01:00
Gwendal Roué 9733fb22fd Merge branch 'master' into Swift2.2 2016-03-17 08:19:51 +01:00
Gwendal Roué e6010e334a One modulemap per target 2016-03-17 08:18:49 +01:00
Gwendal Roué 4f427601d4 Dictionary(_ sequence:) renamed to Dictionary(keyValueSequence:) 2016-03-17 08:08:26 +01:00
Gwendal Roué a716a5788d JSONSynchronization.playground: update for Swift 2.2 2016-03-17 08:07:59 +01:00
Gwendal Roué a308ffebeb Merge branch 'master' of github.com:groue/GRDB.swift into Swift2.2 2016-03-17 08:02:06 +01:00
Gwendal Roué 649667a403 Merge pull request #29 from mpurland/Swift2.2
Fixed Swift 2.2 compile error
2016-03-17 07:11:56 +01:00
Matthew Purland 97f9805afa Fixed Swift 2.2 compile error 2016-03-16 23:01:26 -07:00
Gwendal Roué 6d0cdcd20b FetchedResultsController: improve delegate API by extracting the rarely used changed object from the ResultChange enum 2016-03-16 23:33:31 +01:00
Gwendal Roué a8e85f2c41 FetchedResultsController: cleanup 2016-03-16 22:43:04 +01:00
Gwendal Roué 2e11551bd7 FetchedResultsController: cleanup 2016-03-16 22:04:23 +01:00
Gwendal Roué ea7aae603d FetchedResultsController: full features! 2016-03-16 21:49:30 +01:00
Gwendal Roué 6c3976e657 FetchedResultsController demo app tweak 2016-03-16 20:06:11 +01:00
Gwendal Roué 09abd1e5cd FetchedResultsController: don’t notify delegate when there is no change 2016-03-16 20:05:13 +01:00
Gwendal Roué d5d467192d TODO.md 2016-03-16 15:49:04 +01:00
Gwendal Roué d455e50a27 FetchedResultsController (breaking commit): attempt to communicate updates and changes 2016-03-16 14:11:15 +01:00
Gwendal Roué f7d9970842 Fix ==(Row, Row) 2016-03-16 14:09:29 +01:00
Gwendal Roué b4a7ba239c FetchedResultsController: improve general API consistency: use unlabelled arguments 2016-03-16 09:12:10 +01:00
Gwendal Roué 86e3fc7075 FetchedResultsController: improve resultAtIndexPath performance 2016-03-16 09:07:00 +01:00
Gwendal Roué be2ef28fad FetchedResultsController: throw errors for invalid sql arguments 2016-03-16 09:02:44 +01:00
Gwendal Roué 97fcdf9ce6 FetchedResultsController: remove Equatable requirement on fetched type. 2016-03-16 08:59:28 +01:00
Gwendal Roué b9f7ea187d FetchedResultsController: remove Equatable requirement on fetched type. 2016-03-16 08:40:24 +01:00
Gwendal Roué c8f5f1ae1d Row adopts Equatable 2016-03-16 08:36:55 +01:00
Gwendal Roué 92b8b00a49 FetchedResultsController: remove TableMapping requirement 2016-03-15 20:26:34 +01:00
Gwendal Roué eeddb32ab6 FetchedResultsController: only listen to changes in observed tables 2016-03-15 20:23:23 +01:00
Gwendal Roué c1a59a015c FetchedResultsController: perform the changes computation in a background queue 2016-03-15 19:49:00 +01:00
Gwendal Roué bc3b13d719 FetchedResultsController.indexPathForResult(_) is not implemented 2016-03-15 19:30:06 +01:00
Gwendal Roué 29dcbaeaa3 FetchedResultsController: add optional arguments to the sql initializer (be consistent with the rest of the library) 2016-03-15 19:29:17 +01:00
Gwendal Roué 46f6e6d1ea FetchedResultsController: gather SQL and FetchRequest in a common Source enum 2016-03-15 19:27:33 +01:00
Gwendal Roué c76b7a8b77 FetchedResultsController: gather SQL and FetchRequest in a common Source enum 2016-03-15 19:21:35 +01:00
Gwendal Roué 8514513af3 FetchedResultsController: register as a transaction observer once and only once. Don’t unregister, since transaction observers are weakly referenced. 2016-03-15 19:15:12 +01:00
Gwendal Roué dc2ee92404 Up to date GRDBDemoiOS demo of FetchedResultsController 2016-03-15 19:13:27 +01:00
Gwendal Roué 7cd5b881b2 Merge branch 'master' into FetchedRecordsController 2016-03-15 19:05:20 +01:00
Gwendal Roué 63545c1f08 Documentation 2016-03-15 19:05:04 +01:00
Gwendal Roué 171862097e Merge branch 'master' into FetchedRecordsController
Conflicts:
	GRDB.xcworkspace/contents.xcworkspacedata
2016-03-15 13:48:13 +01:00
Gwendal Roué ab69f64957 TODO.md 2016-03-15 09:51:49 +01:00
Gwendal Roué 91bf2a85d0 README.md 2016-03-15 09:12:34 +01:00
Gwendal Roué 6315aad0bc Improve performance of row copy 2016-03-15 08:43:48 +01:00
Gwendal Roué 613a0386bd Performance tests sure "modern" API calls 2016-03-15 08:42:51 +01:00
Gwendal Roué a79565bb65 README.md 2016-03-14 13:49:44 +01:00
Gwendal Roué 63213d7f10 v0.51.2 2016-03-14 13:46:35 +01:00
Gwendal Roué 218d7a7f15 DatabaseStore: fix a race condition that could make us miss file attributes 2016-03-14 09:59:33 +01:00
Gwendal Roué 4f5e87b1e1 Documentation 2016-03-14 09:01:33 +01:00
Gwendal Roué 8ef27ccbf6 Documentation 2016-03-14 08:55:00 +01:00
Gwendal Roué b1e3aaf399 README.md 2016-03-14 05:33:23 +01:00
Gwendal Roué 1af1c84132 README.md 2016-03-14 05:32:02 +01:00
Gwendal Roué c6a00d0e45 Performance tests for Realm 0.98.4 2016-03-13 22:00:48 +01:00
Gwendal Roué 319556daec README.md 2016-03-13 19:55:23 +01:00
Gwendal Roué c096736e2b v0.51.1 2016-03-13 19:52:23 +01:00
Gwendal Roué afea1c4175 Remove useless complexity 2016-03-13 19:45:54 +01:00
Gwendal Roué f00dda7f43 Improve performance by removing useless retain/release 2016-03-13 19:20:52 +01:00
Gwendal Roué 8bc52b29e7 Attempt at optimizing reference counting 2016-03-13 17:42:06 +01:00
Gwendal Roué 967b10311e Cleanup tests 2016-03-13 17:41:38 +01:00
Gwendal Roué 09a600d955 Make DatabaseReader a class protocol 2016-03-13 17:38:33 +01:00
Gwendal Roué a99e064c28 v0.51.0 2016-03-13 14:49:08 +01:00
Gwendal Roué 01f1043e1a Fix project organization 2016-03-13 14:39:13 +01:00
Gwendal Roué c3316346ac Documentation 2016-03-13 14:33:06 +01:00
Gwendal Roué 19da676caf Configuration.fileAttributes: apply file attributes to database files 2016-03-13 14:16:17 +01:00
Gwendal Roué 39a14d6528 Documentation 2016-03-13 10:01:35 +01:00
Gwendal Roué 198c4c7b5a Documentation 2016-03-13 09:54:32 +01:00
Gwendal Roué 698f3b4fad Documentation 2016-03-13 09:31:59 +01:00
Gwendal Roué f3bee9e85f Documentation 2016-03-13 09:30:53 +01:00
Gwendal Roué 75f1b045c9 Documentation 2016-03-13 09:27:56 +01:00
Gwendal Roué 24bcee02c1 Documentation 2016-03-13 07:38:23 +01:00
Gwendal Roué 2b159dfb02 Documentation 2016-03-13 07:36:58 +01:00
Gwendal Roué 67f79f20dc Documentation 2016-03-13 07:35:40 +01:00
Gwendal Roué a992871cb9 Documentation 2016-03-13 07:32:35 +01:00
Gwendal Roué 802e67d8ba Documentation 2016-03-13 07:31:46 +01:00
Gwendal Roué 5169ba8798 Documentation 2016-03-13 07:30:13 +01:00
Gwendal Roué f41f9c2d87 Documentation 2016-03-13 07:28:49 +01:00
Gwendal Roué d720433880 Documentation 2016-03-13 07:21:02 +01:00
Gwendal Roué 11747f43ee Documentation 2016-03-13 07:02:36 +01:00
Gwendal Roué 66b0163f7b Documentation 2016-03-12 23:45:43 +01:00
Gwendal Roué e7006a9ac4 Documentation 2016-03-12 23:42:11 +01:00
Gwendal Roué 9ace4d7cc6 Documentation 2016-03-12 23:28:43 +01:00
Gwendal Roué d3d8641053 Documentation 2016-03-12 21:55:21 +01:00
Gwendal Roué 2de46d7038 TODO.md 2016-03-12 21:55:17 +01:00
Gwendal Roué d1062ec050 Documentation 2016-03-12 21:40:08 +01:00
Gwendal Roué 079ba05b88 Documentation 2016-03-12 21:16:26 +01:00
Gwendal Roué a47fef9d19 Documentation 2016-03-12 21:06:01 +01:00
Gwendal Roué adbca4ba1a TODO.md 2016-03-12 21:03:08 +01:00
Gwendal Roué 41ac9563ef Documentation 2016-03-12 20:36:07 +01:00
Gwendal Roué 9a48bcc013 Documentation 2016-03-12 20:34:21 +01:00
Gwendal Roué aba08042ed Documentation 2016-03-12 20:32:05 +01:00
Gwendal Roué 9f9804c8a3 Documentation 2016-03-12 20:30:33 +01:00
Gwendal Roué 1f1ac06c91 Documentation 2016-03-12 19:22:26 +01:00
Gwendal Roué d2f3f9d1b5 Documentation 2016-03-12 18:57:22 +01:00
Gwendal Roué 111688ff18 Typo 2016-03-12 18:53:38 +01:00
Gwendal Roué a81a29c952 Documentation 2016-03-12 18:48:57 +01:00
Gwendal Roué 9c3e677e0c Make Database.read() conform to the isolation level required by DatabaseReader. 2016-03-12 18:36:06 +01:00
Gwendal Roué 02ce13c858 v0.50.1 2016-03-12 18:04:32 +01:00
Gwendal Roué 523d111ec6 Documentation 2016-03-12 18:02:21 +01:00
Gwendal Roué dd6d186a08 README.md 2016-03-12 17:43:30 +01:00
Gwendal Roué 9b8aae29dd README.md 2016-03-12 17:40:39 +01:00
Gwendal Roué cf406c280d README.md 2016-03-12 17:30:46 +01:00
Gwendal Roué 7917343593 README.md 2016-03-12 17:20:19 +01:00
Gwendal Roué 588e0c9bbc README.md 2016-03-12 16:22:07 +01:00
Gwendal Roué f054a0f4fd README.md 2016-03-12 15:39:38 +01:00
Gwendal Roué dac5b6cae8 README.md 2016-03-12 15:35:04 +01:00
Gwendal Roué 4c1fe51786 README.md 2016-03-12 15:32:31 +01:00
Gwendal Roué bcafd3c9b9 README.md 2016-03-12 15:32:15 +01:00
Gwendal Roué 318a485a92 README.md 2016-03-12 15:31:19 +01:00
Gwendal Roué 1a46f37e92 README.md 2016-03-12 15:25:46 +01:00
Gwendal Roué f9484c1ba5 README.md 2016-03-12 15:09:22 +01:00
Gwendal Roué 6f3a3c9514 Unicode chapter 2016-03-12 15:07:12 +01:00
Gwendal Roué 2e9b009aa5 README.md 2016-03-12 14:52:34 +01:00
Gwendal Roué 4458ebd03e README.md 2016-03-12 14:51:49 +01:00
Gwendal Roué 84e5e488a9 DatabaseGenerator retain the database connection. Tests for various opportunities of memory leaking, and misuse of weak references. 2016-03-12 14:47:53 +01:00
Gwendal Roué 1df41fbd29 Tests for DatabaseQueue/Pool connection closing 2016-03-12 13:53:49 +01:00
Gwendal Roué b5d95fda22 TODO.md 2016-03-12 12:56:01 +01:00
Gwendal Roué 3c5e144493 README.md 2016-03-12 12:50:22 +01:00
Gwendal Roué b1e467d34f README.md 2016-03-12 12:46:52 +01:00
Gwendal Roué 390bc93e54 README.md 2016-03-12 12:43:42 +01:00
Gwendal Roué a7b2a1ed70 README.md 2016-03-12 12:41:21 +01:00
Gwendal Roué 7e7fd97075 README.md 2016-03-12 12:40:38 +01:00
Gwendal Roué 4bf97204d1 README.md organization 2016-03-12 12:36:14 +01:00
Gwendal Roué b9b2b179e1 v0.50.0 2016-03-12 12:04:49 +01:00
Gwendal Roué e3ef424a41 DatabaseReader and DatabaseWriter cleanup 2016-03-12 12:00:06 +01:00
Gwendal Roué 387e7bc2f5 Tour.playground 2016-03-12 11:09:35 +01:00
Gwendal Roué 328d21e526 Documentation 2016-03-12 10:07:01 +01:00
Gwendal Roué 85579403e9 CHANGELOG.md 2016-03-12 09:15:48 +01:00
Gwendal Roué 08358a52a7 Drop UserDefaults.registerDefaults() 2016-03-12 09:15:15 +01:00
Gwendal Roué 6d1c190a13 TODO.md 2016-03-12 09:03:58 +01:00
Gwendal Roué 4208c9f2ff Update UserDefaults.playground 2016-03-12 08:58:54 +01:00
Gwendal Roué a14c3a2a60 Documentation 2016-03-12 08:47:33 +01:00
Gwendal Roué c8afca6485 Tests for DatabaseQueue.execute() and DatabasePool.execute() 2016-03-12 08:46:58 +01:00
Gwendal Roué eecaa2a394 Documentation 2016-03-12 08:27:51 +01:00
Gwendal Roué 62a37ac1f4 Documentation 2016-03-12 08:25:58 +01:00
Gwendal Roué a8dd424211 DatabaseMigrator uses DatabaseWriter 2016-03-12 08:25:50 +01:00
Gwendal Roué 9e9fafcc5c Documentation 2016-03-12 08:21:17 +01:00
Gwendal Roué 78dc8c3188 Documentation 2016-03-12 07:36:35 +01:00
Gwendal Roué 6ddcc74697 Documentation 2016-03-12 07:35:34 +01:00
Gwendal Roué 79c34eb6d2 Documentation 2016-03-12 07:17:29 +01:00
Gwendal Roué cdf08821bb Documentation 2016-03-12 07:14:55 +01:00
Gwendal Roué e54e9068dc Documentation 2016-03-12 07:13:00 +01:00
Gwendal Roué 2af32c76eb TODO 2016-03-12 07:12:40 +01:00
Gwendal Roué ae8ffeabc9 Cleanup 2016-03-12 07:12:35 +01:00
Gwendal Roué e818d40c2a Documentation 2016-03-11 19:44:31 +01:00
Gwendal Roué e52a01abbe Documentation 2016-03-11 19:41:39 +01:00
Gwendal Roué b81f57f1c9 Documentation 2016-03-11 19:35:25 +01:00
Gwendal Roué 8221ff520c Tests for DatabasePool and DatabaseQueue as DatabaseWriter 2016-03-11 19:15:23 +01:00
Gwendal Roué b68f1e278e DatabasePool and DatabaseQueue adopt DatabaseWriter 2016-03-11 19:14:59 +01:00
Gwendal Roué 18b996e5bd Persistable.delete() uses DatabaseWriter instead of Database 2016-03-11 18:56:09 +01:00
Gwendal Roué 50cc857a3a Persistable.save() uses DatabaseWriter instead of Database 2016-03-11 18:51:34 +01:00
Gwendal Roué ea04588865 Persistable.update() uses DatabaseWriter instead of Database 2016-03-11 18:47:03 +01:00
Gwendal Roué 47d1202e57 Introduce DatabaseWriter 2016-03-11 18:42:02 +01:00
Gwendal Roué 1ab5b8ed9c Documentation 2016-03-11 18:24:40 +01:00
Gwendal Roué 61f944fdaa Cleanup 2016-03-11 18:12:42 +01:00
Gwendal Roué 5d2ee3140e v0.49.0 2016-03-11 17:43:23 +01:00
Gwendal Roué ba461c7e98 Documentation 2016-03-11 17:40:26 +01:00
Gwendal Roué 389ddefc1d Documentation 2016-03-11 17:39:24 +01:00
Gwendal Roué 2a2421896d Documentation 2016-03-11 17:36:07 +01:00
Gwendal Roué b3c0d021fd Documentation 2016-03-11 17:34:54 +01:00
Gwendal Roué f21ddc0f7f Documentation 2016-03-11 17:25:12 +01:00
Gwendal Roué 2e4dec741a Documentation 2016-03-11 17:24:08 +01:00
Gwendal Roué 2fc1253836 CHANGELOG.md 2016-03-11 17:21:21 +01:00
Gwendal Roué 479308637d Test that read-only DatabasePool has concurrent reads, without activating the WAL mode 2016-03-11 17:21:11 +01:00
Gwendal Roué eb513e87d2 Transaction observers are now added to database queues and pools 2016-03-11 17:08:31 +01:00
Gwendal Roué 96ead6d1c6 Documentation 2016-03-11 16:52:19 +01:00
Gwendal Roué a9db99c569 Documentation 2016-03-11 15:31:02 +01:00
Gwendal Roué 42084e1302 TODO.md 2016-03-11 14:34:51 +01:00
Gwendal Roué 3e75af7c14 Make DatabaseReader a class protocol 2016-03-11 14:34:49 +01:00
Gwendal Roué c7ad60522d Modernize Record.playground 2016-03-11 14:30:28 +01:00
Gwendal Roué 7d8834027d Documentation 2016-03-11 14:22:03 +01:00
Gwendal Roué 7a64719708 Documentation 2016-03-11 14:19:56 +01:00
Gwendal Roué 228c36d164 Documentation 2016-03-11 14:02:57 +01:00
Gwendal Roué 085a542b4b Documentation 2016-03-11 13:59:28 +01:00
Gwendal Roué db6546a959 Documentation 2016-03-11 13:48:17 +01:00
Gwendal Roué d47f443a25 Documentation 2016-03-11 13:37:25 +01:00
Gwendal Roué 4c261ff49e Documentation 2016-03-11 13:26:50 +01:00
Gwendal Roué 02d11108de Documentation 2016-03-11 13:26:08 +01:00
Gwendal Roué 3534325d7c Documentation 2016-03-11 13:24:29 +01:00
Gwendal Roué ce48a29499 Documentation 2016-03-11 13:23:40 +01:00
Gwendal Roué 4a34a610fe Documentation 2016-03-11 13:22:15 +01:00
Gwendal Roué 840e2b6b0b Documentation 2016-03-11 13:20:31 +01:00
Gwendal Roué f95b058b99 Read-only DatabasePool 2016-03-11 13:20:18 +01:00
Gwendal Roué cafe8b5953 Documentation 2016-03-11 12:27:09 +01:00
Gwendal Roué dbce44fe24 Documentation 2016-03-11 12:06:53 +01:00
Gwendal Roué 04289d5233 TODO.md 2016-03-11 09:56:08 +01:00
Gwendal Roué 67afe993a7 Documentation 2016-03-11 09:04:14 +01:00
Gwendal Roué fadfa11ea1 Documentation 2016-03-11 09:02:36 +01:00
Gwendal Roué decfcad2af Documentation 2016-03-11 09:01:31 +01:00
Gwendal Roué bb29f633c5 Documentation 2016-03-11 08:59:17 +01:00
Gwendal Roué 5fd2212278 DatabaseReader WIP 2016-03-11 08:13:10 +01:00
Gwendal Roué 6f4a29e6f8 DatabaseReader WIP 2016-03-11 07:34:44 +01:00
Gwendal Roué 517552fed8 Merge branch 'master' into DatabaseAccess 2016-03-11 06:41:46 +01:00
Gwendal Roué 9427c89456 README.md 2016-03-11 06:41:14 +01:00
Gwendal Roué 758663c3a1 README.md 2016-03-11 06:36:41 +01:00
Gwendal Roué 7364d99b6b WIP 2016-03-10 18:51:08 +01:00
Gwendal Roué 694c38dc62 README.md 2016-03-10 14:46:29 +01:00
Gwendal Roué 164a751f3e TODO.md 2016-03-10 14:02:56 +01:00
Gwendal Roué 4f8042a96b v0.48.0 2016-03-10 13:52:22 +01:00
Gwendal Roué 1fcc8c764f Custom SQL functions are collations are now added to database queues and pools. 2016-03-10 13:50:47 +01:00
Gwendal Roué eeb3580d42 README.md 2016-03-10 11:33:35 +01:00
Gwendal Roué 3165c2904b README.md 2016-03-10 11:32:53 +01:00
Gwendal Roué 3b7bbdcc7d CHANGELOG.md 2016-03-10 11:15:53 +01:00
Gwendal Roué 80024875ca Update CocoaPod description 2016-03-10 11:14:13 +01:00
Gwendal Roué 4ff679af11 Memory management documentation 2016-03-10 10:55:23 +01:00
Gwendal Roué e3a52f8c00 TODO.md 2016-03-10 10:32:14 +01:00
Gwendal Roué 4ac7dcf5b0 TODO.md 2016-03-10 09:04:58 +01:00
Gwendal Roué 6808b50e94 TODO.md 2016-03-10 09:01:23 +01:00
Gwendal Roué 5d229373e6 Memory management: clearMemory() and DatabasePool.closeReaderConnections() 2016-03-10 08:51:31 +01:00
Gwendal Roué d710e96f85 README.md 2016-03-10 07:44:44 +01:00
Gwendal Roué bd5be629e8 Typo 2016-03-10 06:44:51 +01:00
Gwendal Roué a5b25fadd5 v0.47.0 2016-03-10 06:31:06 +01:00
Gwendal Roué 06e2f3e5f8 Update GRDBDemoiOS7 demo app 2016-03-10 06:11:20 +01:00
Gwendal Roué c5923eef6a TODO.md 2016-03-10 06:06:24 +01:00
Gwendal Roué 6b344b8566 DatabasePool documentation 2016-03-10 06:06:21 +01:00
Gwendal Roué 953cea1318 DatabasePool documentation 2016-03-10 05:51:45 +01:00
Gwendal Roué c870ac47c2 README.md 2016-03-09 23:02:20 +01:00
Gwendal Roué 2dfd1925f3 README.md 2016-03-09 22:59:39 +01:00
Gwendal Roué 36fc5c85f8 README.md 2016-03-09 22:55:02 +01:00
Gwendal Roué b285c3e74c README.md 2016-03-09 22:51:52 +01:00
Gwendal Roué 1bb553d0c1 README.md 2016-03-09 22:46:22 +01:00
Gwendal Roué 95c122f50d README.md 2016-03-09 22:44:49 +01:00
Gwendal Roué 2242b4d117 CHANGELOG.md 2016-03-09 22:43:56 +01:00
Gwendal Roué 955199c238 README.md 2016-03-09 22:43:51 +01:00
Gwendal Roué 72dde7eb2f TODO.md 2016-03-09 22:36:32 +01:00
Gwendal Roué dcccbcfab2 README.md 2016-03-09 22:29:53 +01:00
Gwendal Roué 97f3161256 DatabaseMigrator support for DatabasePool 2016-03-09 22:28:47 +01:00
Gwendal Roué e0df528e0f README.md 2016-03-09 22:19:15 +01:00
Gwendal Roué de0d2487ab README.md 2016-03-09 22:06:36 +01:00
Gwendal Roué 71f306ebe3 TODO.md 2016-03-09 22:05:29 +01:00
Gwendal Roué cd99c661fa README.md 2016-03-09 22:04:13 +01:00
Gwendal Roué bc132769e3 TODO.md 2016-03-09 21:45:39 +01:00
Gwendal Roué 6bd8f79399 DatabasePool read() method opens a DEFERRED transaction so that it won’t let the writer alter the database state between two select statement. 2016-03-09 21:45:20 +01:00
Gwendal Roué fce55c836c DatabasePool documentation 2016-03-09 20:58:51 +01:00
Gwendal Roué 58a1118bfc DatabasePool documentation 2016-03-09 20:57:10 +01:00
Gwendal Roué d23fd9d2c1 TODO.md 2016-03-09 20:56:39 +01:00
Gwendal Roué b9fd23912d DatabasePool documentation 2016-03-09 20:56:35 +01:00
Gwendal Roué 122195156a DatabasePool documentation 2016-03-09 20:50:07 +01:00
Gwendal Roué 15b3809a50 DatabasePool: forbid transactions and savepoints in readers 2016-03-09 20:06:31 +01:00
Gwendal Roué e0031ddc42 DatabasePool concurrency tests 2016-03-09 19:29:45 +01:00
Gwendal Roué 526e065e7d Database schema cache tests for DatabasePool and DatabaseQueue 2016-03-09 18:15:18 +01:00
Gwendal Roué 5ac0eda8a6 Share database schema cache between DatabasePool readers and writer 2016-03-09 17:31:24 +01:00
Gwendal Roué 19336609d3 DatabasePool.checkpoint() 2016-03-09 16:07:36 +01:00
Gwendal Roué 1fee42bee9 Remove useless Statement.readOnly 2016-03-09 15:44:38 +01:00
Gwendal Roué 5acc3cd03f Test for SQLITE_READONLY error (when attempting to modify a read-only database) 2016-03-09 15:41:52 +01:00
Gwendal Roué c84521edf8 Crash tests organization 2016-03-09 15:27:39 +01:00
Gwendal Roué 648dbf7e25 Replace let _ = ... with _ = ... 2016-03-09 15:27:30 +01:00
Gwendal Roué 20f3ab8e2c TODO.md 2016-03-09 14:25:14 +01:00
Gwendal Roué d7a1c89b7d TODO.md 2016-03-09 09:48:58 +01:00
Gwendal Roué 52897e5888 DatabasePool WIP 2016-03-09 09:01:12 +01:00
Gwendal Roué 07652429a3 DatabasePoolTests WIP 2016-03-09 08:54:44 +01:00
Gwendal Roué fff402f2b1 Introduce DatabasePool which provides several readers and a single writer on a single database in WAL Mode 2016-03-09 08:21:36 +01:00
Gwendal Roué 0091de918b Extract SerializedDatabase from DatabaseQueue 2016-03-09 07:54:06 +01:00
Gwendal Roué d18d2a5921 Statement.readOnly 2016-03-08 20:40:12 +01:00
Gwendal Roué 44a7c8589c README.md 2016-03-08 09:04:43 +01:00
Gwendal Roué b6fd50c9cd README.md 2016-03-08 09:03:36 +01:00
Gwendal Roué b2ee415fba TODO.md 2016-03-08 09:01:56 +01:00
Gwendal Roué f863a263b7 Cleanup 2016-03-07 18:24:31 +01:00
Gwendal Roué 2cbfa16e53 Base for comparing records according to their primary key, and avoid ad hoc adoption of Equatable 2016-03-06 14:56:02 +01:00
Gwendal Roué 0d5bed389f TODO.md 2016-03-06 14:27:32 +01:00
Gwendal Roué e78191714a CHANGELOG.md 2016-03-05 15:29:18 +01:00
Gwendal Roué 375f169020 v0.46.0 2016-03-05 15:25:23 +01:00
Gwendal Roué ee81249c79 FetchRequest.fetchCount() can count all supported queries 2016-03-05 15:24:13 +01:00
Gwendal Roué b7a17b05e9 CHANGELOG.md 2016-03-04 09:17:03 +01:00
Gwendal Roué b7a7cd953e FetchRequest.fetchCount() traps when the intent of the developer can’t be satisfied (yet), as in Person.select(name).distinct.fetchCount(db). 2016-03-04 09:15:43 +01:00
Gwendal Roué 3d4ee9ee53 FAQ: How do I open a database stored as a resource of my application? 2016-03-03 14:42:57 +01:00
Gwendal Roué 63a6ef021a FAQ: How do I open a database stored as a resource of my application? 2016-03-03 14:33:21 +01:00
Gwendal Roué cfb987e7e3 FAQ: How do I open a database stored as a resource of my application? 2016-03-03 14:17:47 +01:00
Gwendal Roué 9aa629d36e FAQ: How do I open a database stored as a resource of my application? 2016-03-03 13:59:37 +01:00
Gwendal Roué 29b0de2210 FAQ: How do I close a database connection? 2016-03-03 13:49:24 +01:00
Gwendal Roué 49b30eb290 TODO.md 2016-03-03 09:04:39 +01:00
Gwendal Roué de9d8e65bb Add failing tests for Reader.select(Col.name).distinct.fetchCount(db) 2016-03-03 08:54:18 +01:00
Gwendal Roué cdc102de70 Remove DatabaseRawRepresentable since DatabaseValueConvertible is enough. 2016-02-28 22:14:49 +01:00
Gwendal Roué fd1067b41f Replace DatabaseIntRepresentable, DatabaseInt32Representable, DatabaseInt64Representable and DatabaseStringRepresentable with DatabaseRawRepresentable. 2016-02-28 20:28:10 +01:00
Gwendal Roué 06031d1c79 Merge pull request #22 from ReadmeCritic/master
Correct the spelling of CocoaPods in README
2016-02-13 08:55:09 -05:00
ReadmeCritic ecd0a36721 Correct the spelling of CocoaPods in README 2016-02-12 08:14:56 -08:00
Gwendal Roué e400d49ac9 README.md 2016-02-11 12:33:51 +01:00
Gwendal Roué c9da10c9cb README.md 2016-02-11 11:23:58 +01:00
Gwendal Roué 6600b52cf2 v0.45.1 2016-02-11 08:37:19 +01:00
Gwendal Roué cfb19d4ad7 Fix GRDBDemoiOS7 app 2016-02-11 08:34:34 +01:00
Gwendal Roué 4c37ad1f9f README.md 2016-02-11 08:24:28 +01:00
Gwendal Roué 1b99b50262 README.md 2016-02-11 08:23:35 +01:00
Gwendal Roué 544796917e A note about NSDecimalNumber 2016-02-11 08:19:58 +01:00
Gwendal Roué 03b89ea78f Typo 2016-02-11 00:10:54 +01:00
Gwendal Roué 44dddd28ef Use sqlite3.h stored in /Applications/Xcode-beta.app/ 2016-02-10 19:10:24 +01:00
Gwendal Roué d74cf435ed Swift2.2 2016-02-10 19:09:28 +01:00
Gwendal Roué 056eb22c7a README.md 2016-02-10 09:05:14 +01:00
Gwendal Roué 15a65cfe93 README.md 2016-02-10 08:59:45 +01:00
Gwendal Roué eeb00ce467 README.md 2016-02-10 08:57:37 +01:00
Gwendal Roué 10ac19db72 GRDBDemoiOS README 2016-02-10 08:53:24 +01:00
Gwendal Roué 48eff16ac7 Row cleanup 2016-02-10 08:33:54 +01:00
Gwendal Roué bb7fe8cd7d SQL support cleanup 2016-02-10 08:25:15 +01:00
Gwendal Roué 5d73bffd28 TODO.md 2016-02-10 07:58:15 +01:00
Gwendal Roué bb46b9c652 CHANGELOG.md 2016-02-09 21:06:19 +01:00
Gwendal Roué dafae3dfd3 v0.45.0 2016-02-09 21:02:48 +01:00
Gwendal Roué 1db2d6f5d0 Database holds weak references to its transaction observers 2016-02-09 21:02:09 +01:00
Gwendal Roué 0ed1bbf53c Only invalidate database schema cache after an invalidating statement has been executed. 2016-02-09 19:47:14 +01:00
Gwendal Roué 63f2c2a3aa TODO.md 2016-02-09 19:35:25 +01:00
Pascal Edmond 0808a10b03 merge 2016-02-09 17:44:33 +01:00
Gwendal Roué ba0e505d78 v0.44.0 2016-02-09 14:19:30 +01:00
Gwendal Roué 43a33a8303 Fix memory leak 2016-02-09 14:17:45 +01:00
Gwendal Roué 10fc730230 TODO.md 2016-02-09 09:14:29 +01:00
Gwendal Roué 18b01ca0c5 Add a preconditionValidQueue to Database.tableExists() 2016-02-09 08:53:41 +01:00
Gwendal Roué 48ad154079 Documentation 2016-02-09 08:27:03 +01:00
Gwendal Roué 24668267e8 Database automatically clears its schema cache 2016-02-09 08:24:37 +01:00
Gwendal Roué d6cf23ab78 Declare Database.selectStatement and Database.updateStatement as @warn_unused_result 2016-02-09 07:47:42 +01:00
Gwendal Roué e5009af67e Fix SelectStatement.sourceTables for invalid statements 2016-02-09 07:47:00 +01:00
Gwendal Roué 75e2edb471 Typo 2016-02-08 19:42:21 +01:00
Gwendal Roué ff8b580d17 SelectStatement.sourceTables 2016-02-08 19:15:57 +01:00
Gwendal Roué 0c68765e2d Add a FIXME comment 2016-02-08 09:10:51 +01:00
Gwendal Roué 3a7adaa247 Declare a constant value with let 2016-02-08 09:00:25 +01:00
Gwendal Roué 247d8a75f7 Support for EXISTS (subquery) 2016-02-08 08:37:58 +01:00
Gwendal Roué b60daca055 Fix case-insensitive lookup of the leftmost column in a row 2016-02-07 17:31:15 +01:00
Gwendal Roué fc3b175100 README.md 2016-02-07 16:27:43 +01:00
Gwendal Roué 8d54b587d0 README.md 2016-02-07 16:25:39 +01:00
Gwendal Roué a4c811dc43 IN (SELECT …) documentation 2016-02-07 16:19:22 +01:00
Gwendal Roué 4004d53da4 Support for comparing collated expressions with optionals 2016-02-07 16:18:30 +01:00
Gwendal Roué 8465332598 TODO.md 2016-02-07 16:00:36 +01:00
Gwendal Roué 9a2b7cbefc IN (SELECT …) documentation 2016-02-07 15:32:28 +01:00
Gwendal Roué 09c599cc62 !FetchRequest.contains() 2016-02-07 15:20:56 +01:00
Gwendal Roué 17aa9350c5 FetchRequest.contains() 2016-02-07 15:18:18 +01:00
Gwendal Roué f2481989c7 README.md 2016-02-07 13:43:14 +01:00
Gwendal Roué adbddf3299 Typo 2016-02-07 12:48:29 +01:00
Gwendal Roué 94e4fa42bf DatabaseValue adopts StatementColumnConvertible. Stronger tests for DatabaseValue adoption of StatementColumnConvertible and DatabaseValueConvertible. 2016-02-07 12:44:09 +01:00
Gwendal Roué 0ae37db4ec Typo 2016-02-07 12:13:33 +01:00
Gwendal Roué 8237ec8a2a Minor 2016-02-07 12:13:02 +01:00
Gwendal Roué 9396982fa7 README.md 2016-02-07 12:07:19 +01:00
Gwendal Roué aff72de4e1 README.md 2016-02-07 12:05:25 +01:00
Gwendal Roué 755fb1f4b6 Cleanup 2016-02-07 10:29:52 +01:00
Gwendal Roué 070f4276de Typo 2016-02-07 09:29:23 +01:00
Gwendal Roué d9626faaec FetchRequest: SQLSupport cleanup 2016-02-07 09:25:23 +01:00
Gwendal Roué 8cdacf3899 Rename SQLiteStatementConvertible to StatementColumnConvertible + Project organization 2016-02-07 08:51:28 +01:00
Gwendal Roué d8140b87d7 Record.playground formatting 2016-02-07 08:50:45 +01:00
Gwendal Roué 1cdc111e31 Record.playground formatting 2016-02-05 21:22:49 +01:00
Gwendal Roué 567d912bf7 Documentation 2016-02-05 19:54:21 +01:00
Gwendal Roué 2c482dab31 README.md 2016-02-04 13:29:57 +01:00
Gwendal Roué 11c6af9d82 README.md 2016-02-04 13:16:52 +01:00
Gwendal Roué d4e5dcea70 README.md 2016-02-04 13:14:53 +01:00
Gwendal Roué 438129689c README.md 2016-02-04 13:12:47 +01:00
Gwendal Roué 8a5109c0fd v0.43.1 2016-02-04 11:54:31 +01:00
Gwendal Roué 9cc0faee2f Ignore trailing whitespace in Database.execute(sql) and Database.updateStatement(sql) instead of letting SQLite parse it as erroneous SQL. 2016-02-04 11:49:45 +01:00
Gwendal Roué 25935e0323 Minor 2016-02-04 09:14:46 +01:00
Gwendal Roué 8f4840b564 README.md 2016-02-04 09:13:09 +01:00
Gwendal Roué 6e9276b55d README.md 2016-02-03 08:51:23 +01:00
Gwendal Roué 122f4c835a Minor 2016-02-03 08:34:01 +01:00
Gwendal Roué 49025734aa README.md 2016-02-02 19:14:43 +01:00
Gwendal Roué 06a3fa8338 Prefer declaring protocol adoptions in extensions 2016-02-01 08:14:28 +01:00
Gwendal Roué 02b6f0ac10 v0.43.0 2016-02-01 08:04:57 +01:00
Gwendal Roué e1e4dd0524 Documentation for RowConvertible.init(_:Row) 2016-02-01 08:00:32 +01:00
Gwendal Roué b85b958127 Turn RowConvertible.fromRow(_:Row) into RowConvertible.init(_:Row) 2016-02-01 07:57:54 +01:00
Gwendal Roué b5190d1eff README.md 2016-01-31 21:11:40 +01:00
Gwendal Roué 03edc362a9 README.md 2016-01-31 17:13:07 +01:00
Gwendal Roué 783fb7ff1a Fix UserDefaults.removeObject(_:forKey:) 2016-01-31 15:40:32 +01:00
Gwendal Roué c13d1a5d63 Fix UserDefaults.dictionaryRepresentation 2016-01-31 15:39:29 +01:00
Gwendal Roué 1997f9ab9e UserDefaults.dictionaryRepresentation 2016-01-31 15:37:38 +01:00
Gwendal Roué f55a8eb82f Fix UserDefaults.playground 2016-01-31 15:30:49 +01:00
Gwendal Roué 598fff8429 UserDefaults.playground sample code 2016-01-31 15:19:27 +01:00
Gwendal Roué 69834ef930 Minor 2016-01-31 14:48:29 +01:00
Gwendal Roué 316ab93660 Make DatabaseFunction and DatabaseCollation classes final 2016-01-31 14:24:55 +01:00
Gwendal Roué 55c056c52c Room for low-level DatabaseCollation and DatabaseFunction 2016-01-31 14:23:52 +01:00
Gwendal Roué ea07cba3fb Documentation formatting 2016-01-31 13:43:48 +01:00
Gwendal Roué 49b80a4f71 Documentation formatting 2016-01-31 13:38:41 +01:00
Gwendal Roué fe0bd6a0c0 Documentation formatting 2016-01-31 13:28:25 +01:00
Gwendal Roué 889b15a967 README.md 2016-01-30 15:37:54 +01:00
Gwendal Roué cdf960ff66 README.md 2016-01-30 15:33:22 +01:00
Gwendal Roué f0b80c72a5 README.md 2016-01-30 15:29:24 +01:00
Gwendal Roué b359543cdb README.md 2016-01-30 15:22:45 +01:00
Gwendal Roué e6d8c715e4 Document query interface for custom SQL functions 2016-01-30 15:01:45 +01:00
Gwendal Roué 10337967ea README.md 2016-01-30 14:55:21 +01:00
Gwendal Roué 24ad42f0d0 README.md 2016-01-30 14:46:52 +01:00
Gwendal Roué d0d2b0b6cc README.md 2016-01-30 14:13:49 +01:00
Gwendal Roué 4ed057677e README.md 2016-01-30 14:00:39 +01:00
Gwendal Roué e28817829c README.md 2016-01-30 13:58:52 +01:00
Gwendal Roué 841882510e README.md 2016-01-30 13:53:41 +01:00
Gwendal Roué 5ebf6899b3 README.md 2016-01-30 13:46:28 +01:00
Pascal Edmond 3ec52fa83d Use FetchedResultController with brand new FetchRequest 2016-01-29 16:08:41 +01:00
Pascal Edmond 46e44131d3 Add visible and position's columns to be used in FetchRequest 2016-01-29 16:05:06 +01:00
Pascal Edmond 3c28277f15 Merge branch 'master' of https://github.com/groue/GRDB.swift into FetchedRecordsController 2016-01-29 15:55:27 +01:00
Pascal Edmond 2c7334b1c1 Change<T> become ResultChange<T> + Prepare for FetchRequest 2016-01-29 15:55:09 +01:00
Gwendal Roué f055b9ee17 v0.42.1 2016-01-29 13:39:35 +01:00
Gwendal Roué 307008e9bc protocol<RowConvertible+TableMapping>.fetch() and TableMapping.reverse() 2016-01-29 13:38:30 +01:00
Gwendal Roué f08fc31e64 Remove request.fetchCount(db, expr) and request.fetchCount(db, distinct: expr) 2016-01-29 13:23:55 +01:00
Pascal Edmond 85e578f5ae Disable manual ordering for now 2016-01-29 12:12:07 +01:00
Pascal Edmond 7b31e75298 move FetchedResultsController tests 2016-01-29 11:56:18 +01:00
Pascal Edmond ccda6ba9ba DatabaseTableMapping protocol has been renamed TableMapping 2016-01-29 11:55:55 +01:00
Pascal Edmond 042163eb58 Merge branch 'master' of https://github.com/groue/GRDB.swift into FetchedRecordsController
Conflicts:
	DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj/project.pbxproj
	DemoApps/GRDBDemoiOS/GRDBDemoiOS/AppDelegate.swift
	DemoApps/GRDBDemoiOS/GRDBDemoiOS/MasterViewController.swift
	GRDB.xcodeproj/project.pbxproj
	Tests/Performance/fmdb
2016-01-29 11:49:57 +01:00
Pascal Edmond 3518b4d2de WIP 2016-01-29 11:33:09 +01:00
Pascal Edmond 07afc8a130 WIP 2016-01-29 11:30:09 +01:00
Pascal Edmond 9c7e13fc64 WIP 2016-01-29 11:13:00 +01:00
Pascal Edmond 45b184b628 Person order shuffle 2016-01-29 11:12:42 +01:00
Pascal Edmond c589080ef2 Person ordering 2016-01-29 10:57:40 +01:00
Gwendal Roué cc0f76d75b TODO.md 2016-01-29 09:15:12 +01:00
Gwendal Roué bc3be0f1ff README.md 2016-01-29 09:11:07 +01:00
Gwendal Roué b3c23c474a README.md 2016-01-29 08:19:31 +01:00
Gwendal Roué 0e7bee7a79 README.md 2016-01-29 08:17:58 +01:00
Gwendal Roué fb8af21c93 README.md 2016-01-29 08:14:54 +01:00
Gwendal Roué 754c38ced4 README.md 2016-01-29 08:13:34 +01:00
Gwendal Roué ae353dc771 README.md 2016-01-29 08:09:37 +01:00
Gwendal Roué 9417d11d37 README.md 2016-01-29 08:06:55 +01:00
Gwendal Roué 9ff1915e49 README.md 2016-01-29 06:52:17 +01:00
Gwendal Roué 7b5415ad0d README.md 2016-01-29 06:51:47 +01:00
Gwendal Roué 943247187c README.md 2016-01-29 06:49:11 +01:00
Gwendal Roué f4def1966b README.md 2016-01-29 06:47:24 +01:00
Gwendal Roué f5dc639211 README.md 2016-01-29 06:43:31 +01:00
Gwendal Roué 58929684d2 README.md 2016-01-29 06:39:53 +01:00
Gwendal Roué 042c0509d6 README.md 2016-01-28 19:55:54 +01:00
Gwendal Roué be4104c5cf Fixed path to Objective-C headers 2016-01-28 13:34:49 +01:00
Gwendal Roué dc1a16054b README.md 2016-01-28 13:18:28 +01:00
Gwendal Roué 9f3577b8b9 v0.42.0 2016-01-28 13:14:41 +01:00
Gwendal Roué cae8e00083 Project organization 2016-01-28 13:11:21 +01:00
Gwendal Roué 4c03aad795 CHANGELOG.md 2016-01-28 08:57:23 +01:00
Gwendal Roué e2eb73e546 CHANGELOG.md 2016-01-28 08:56:34 +01:00
Gwendal Roué f44ae2848f Project organization
Project organization

README.md

WIP QueryBuilder documentation

README.md

WIP QueryBuilder documentation

WIP QueryBuilder documentation

TODO.md
2016-01-28 08:43:25 +01:00
Gwendal Roué 0bb852a51c Project organization 2016-01-28 07:54:20 +01:00
Gwendal Roué 3b3cb6bdec WIP QueryBuilder
WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

Make all fetch() methods @warn_unused_result

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder documentation

WIP QueryBuilder

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder: better arithmetics

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder

WIP QueryBuilder documentation

WIP QueryBuilder documentation

TODO.md

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

TODO.md

TODO.md

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

Rename DatabasePersistable to Persistable

Rename DatabaseTableMapping to TableMapping

WIP QueryBuilder documentation

WIP QueryBuilder documentation

Update GRDBDemoiOS so that it uses the Query Interface, and sorts people by name with a custom collation.

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

Configuration documentation

WIP QueryBuilder

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder

WIP QueryBuilder documentation

WIP QueryBuilder

WIP QueryBuilder documentation

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder

WIP QueryBuilder

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder documentation

WIP QueryBuilder

README.md

README.md

README.md

README.md

README.md

README.md

README.md

README.md
2016-01-28 07:54:18 +01:00
Pascal Edmond 34850a89fa WIP 2016-01-21 18:03:01 +01:00
Pascal Edmond 469d398988 Refactoring + better descriptions 2016-01-21 18:02:48 +01:00
Pascal Edmond b127e90e93 Prepare for reordering 2016-01-21 18:01:45 +01:00
Pascal Edmond 0d49108cb1 GRDBiOSTests building again 2016-01-21 10:58:18 +01:00
Pascal Edmond 629a98bbb5 First tests passing 2016-01-20 19:34:35 +01:00
Gwendal Roué 7c9d379aba Cleanup 2016-01-20 18:13:47 +01:00
Gwendal Roué a4a8b5c93b Cleanup 2016-01-20 18:08:21 +01:00
Pascal Edmond 0cea2b2e3c Merge branch 'master' of https://github.com/groue/GRDB.swift into FetchedRecordsController 2016-01-20 16:50:10 +01:00
Gwendal Roué d70f112014 Cleanup 2016-01-20 09:13:35 +01:00
Gwendal Roué a1d21a07a1 README.md 2016-01-20 06:51:31 +01:00
Gwendal Roué baed5ce686 TODO.md 2016-01-19 22:29:30 +01:00
Gwendal Roué db73bf9295 Documentation 2016-01-19 20:03:25 +01:00
Pascal Edmond a336b44ddb Refactor FetchedResultsController 2016-01-19 15:33:02 +01:00
Gwendal Roué f8b2fa0cc8 Cleanup 2016-01-19 14:25:25 +01:00
Gwendal Roué 63a192ae8e Cleanup 2016-01-19 14:10:06 +01:00
Pascal Edmond 16c26c09fb Refactor : FetchedRecordsController > FetchedResultsController 2016-01-19 13:46:04 +01:00
Gwendal Roué d22beae5a2 README.md 2016-01-19 08:52:03 +01:00
Gwendal Roué 76fc3f896e Ignore performance test baselines 2016-01-18 14:08:47 +01:00
Gwendal Roué dfe71f0725 README.md 2016-01-18 08:39:28 +01:00
Gwendal Roué 103d7a94d2 README.md 2016-01-17 20:01:03 +01:00
Gwendal Roué fe0b5abee1 README.md 2016-01-17 19:54:42 +01:00
Gwendal Roué 4f03e5ee70 README.md 2016-01-17 18:44:16 +01:00
Gwendal Roué c07f7475ae Cleanup 2016-01-17 18:02:31 +01:00
Gwendal Roué 2028c064f1 README.md 2016-01-17 15:10:03 +01:00
Gwendal Roué f97cf7c38e v0.41.0 2016-01-17 14:47:53 +01:00
Gwendal Roué 3c692c59fe README.md 2016-01-17 14:37:43 +01:00
Gwendal Roué f7874bd745 Fix DatabaseValue.hashValue 2016-01-17 14:28:29 +01:00
Gwendal Roué 1345083f58 Cleanup 2016-01-17 14:18:50 +01:00
Gwendal Roué 2106d025a5 Cleanup 2016-01-17 10:16:59 +01:00
Gwendal Roué 46a767249c Cleanup 2016-01-16 19:01:29 +01:00
Gwendal Roué 8f50593aa8 Cleanup 2016-01-16 18:54:53 +01:00
Gwendal Roué 8da1812502 Cleanup 2016-01-16 18:29:59 +01:00
Gwendal Roué 831dbfbe4e DatabaseTimestamp playground 2016-01-16 17:22:30 +01:00
Gwendal Roué a8f98b7880 Extract DatabaseTimestamp to a gist 2016-01-16 17:14:07 +01:00
Gwendal Roué f2b59e06b2 Cleanup 2016-01-16 16:50:01 +01:00
Gwendal Roué a158f63b4d Cleanup 2016-01-16 16:04:20 +01:00
Gwendal Roué 82cfefc3d9 Cleanup 2016-01-16 15:37:01 +01:00
Gwendal Roué 995d3a4493 Cleanup 2016-01-16 15:23:02 +01:00
Gwendal Roué 2fae115531 Cleanup 2016-01-16 15:13:51 +01:00
Gwendal Roué 9bf81ef702 Don’t install transaction observer hooks unless there is at least one observer 2016-01-16 14:33:46 +01:00
Gwendal Roué 5ed2d4a1af Cleanup 2016-01-16 14:21:45 +01:00
Gwendal Roué a9792880e8 Cleanup 2016-01-16 14:08:21 +01:00
Gwendal Roué ba5e11cd69 Project organization 2016-01-16 12:37:44 +01:00
Gwendal Roué 6ab51cd207 README.md 2016-01-16 11:04:12 +01:00
Gwendal Roué efc1ed4151 README.md 2016-01-16 10:54:22 +01:00
Gwendal Roué d2e1670ffc README.md 2016-01-16 10:49:13 +01:00
Gwendal Roué b67797879f README.md 2016-01-16 10:46:02 +01:00
Gwendal Roué 1d63993604 README.md 2016-01-16 10:35:00 +01:00
Gwendal Roué a45cc1d6c9 README.md 2016-01-16 10:33:09 +01:00
Gwendal Roué 1bbf9960da README.md 2016-01-16 10:27:05 +01:00
Gwendal Roué c879ded4b4 README.md 2016-01-16 10:24:51 +01:00
Gwendal Roué 74edabe6ec README.md 2016-01-16 10:24:06 +01:00
Gwendal Roué 02c4373d08 README.md 2016-01-16 10:22:42 +01:00
Gwendal Roué fae1cdae93 TransactionObserver.playground 2016-01-15 20:32:41 +01:00
Gwendal Roué ca2fa83e80 TransactionObserverType documentation 2016-01-15 20:19:03 +01:00
Gwendal Roué 19e55a517c TransactionObserverType documentation 2016-01-15 20:18:31 +01:00
Gwendal Roué 8bffc01e76 CHANGELOG.md 2016-01-15 20:16:14 +01:00
Gwendal Roué a2728325f9 TransactionObserverType documentation 2016-01-15 19:43:59 +01:00
Gwendal Roué 318f5ad737 TransactionObserverType documentation 2016-01-15 19:42:38 +01:00
Gwendal Roué 5c64c3d49f TransactionObserverType documentation 2016-01-15 19:38:28 +01:00
Gwendal Roué d7cc7cdf5e Tests for multiple transaction observers 2016-01-15 19:35:58 +01:00
Pascal Edmond 55e251e74c Update Tests 2016-01-15 19:21:54 +01:00
Gwendal Roué d97f9c79ee propagateDatabaseWillCommit -> wilCommit, etc 2016-01-15 19:20:27 +01:00
Gwendal Roué b0d60cc9da Merge branch 'MultipleTransactionObservers' of github.com:groue/GRDB.swift into FetchedRecordsController
Conflicts:
	GRDB/Core/Configuration.swift
	GRDB/Core/Database.swift
2016-01-15 15:07:08 +01:00
Pascal Edmond b29869e0cd Database Transaction Observation : allow multiple observers 2016-01-15 14:56:22 +01:00
Pascal Edmond 56406d6ca5 WIP : Welcome FetchedRecordsController 2016-01-15 14:53:54 +01:00
Gwendal Roué 706f936831 Database.swift organization 2016-01-15 09:17:27 +01:00
Gwendal Roué 5d9363a61d Database.swift organization 2016-01-15 09:14:41 +01:00
Gwendal Roué 474b28366b Improve names of PrimaryKey enum cases 2016-01-15 08:35:08 +01:00
Gwendal Roué f7d4376147 Minor 2016-01-15 08:23:35 +01:00
Gwendal Roué 0a8111a34d Dictionary(sequence) documentation 2016-01-15 08:22:55 +01:00
Gwendal Roué a384051942 Remove all DatabaseValue initializers, but the low-level ones 2016-01-14 19:58:19 +01:00
Gwendal Roué 693add8df9 Drop too optimistic OptimisticDictionary 2016-01-14 18:14:45 +01:00
Gwendal Roué 2ec05fea85 Minor 2016-01-14 13:46:23 +01:00
Gwendal Roué a6a23615b3 v0.40.0 2016-01-14 10:38:31 +01:00
Gwendal Roué 42178355cb Performance tests: avoid Core Data warning 2016-01-14 10:38:17 +01:00
Gwendal Roué 4860ae6980 Performance tests 2016-01-14 10:34:03 +01:00
Gwendal Roué 6655b28810 Minor 2016-01-14 10:12:42 +01:00
Gwendal Roué cb89cde5f4 ShortDictionary behaves as a dictionary, but compares keys one by one 2016-01-14 10:02:50 +01:00
Gwendal Roué 5632e15006 Expose Statement.unsafeSetArguments() 2016-01-14 08:53:48 +01:00
Gwendal Roué 38cc0b14ce StatementArguments Documentation 2016-01-14 06:20:45 +01:00
Gwendal Roué 20b68c76fd Document StatementArguments initializer from any sequence of (key, value) pairs 2016-01-13 22:11:57 +01:00
Gwendal Roué b2eec3cba7 Minor 2016-01-13 21:40:46 +01:00
Gwendal Roué 7053632a72 Improve performance of binding named values 2016-01-13 21:26:26 +01:00
Gwendal Roué b85cf92ce7 Update JSONSynchronization.playground 2016-01-13 10:39:11 +01:00
Gwendal Roué 07081edafa v0.39.1 2016-01-13 09:56:09 +01:00
Gwendal Roué 35183f894c Fix tests for persistent changed values of Record class that mangles column cases. 2016-01-13 09:11:03 +01:00
Gwendal Roué 373f457b2c Improve performance of Record.insert() 2016-01-13 09:04:17 +01:00
Gwendal Roué 98cc352856 Improve performance of Row.value(named:) 2016-01-13 08:28:44 +01:00
Pascal Edmond fe2be594be merge 2016-01-12 14:15:59 +01:00
Gwendal Roué 88ffcd8c1c README.md 2016-01-12 13:53:32 +01:00
Gwendal Roué d74030917a TODO.md 2016-01-12 13:29:06 +01:00
Gwendal Roué 5c5397bf50 Minor 2016-01-12 13:24:14 +01:00
Gwendal Roué fb829423e7 README.md 2016-01-12 09:17:40 +01:00
Gwendal Roué 19d2203517 README.md 2016-01-12 09:14:21 +01:00
Gwendal Roué f722115cde README.md 2016-01-12 09:10:01 +01:00
Gwendal Roué 94d1958cae README.md 2016-01-12 09:08:34 +01:00
Gwendal Roué 1ab1336d6f README.md 2016-01-12 09:04:46 +01:00
Gwendal Roué 0ddea70420 README.md 2016-01-12 08:59:32 +01:00
Gwendal Roué f4d8570b9c README.md 2016-01-12 08:53:27 +01:00
Gwendal Roué fa73baea9e README.md 2016-01-12 08:50:52 +01:00
Gwendal Roué c83f4e7d88 README.md 2016-01-11 09:05:55 +01:00
Gwendal Roué 78e4d1349c v0.39.0 2016-01-11 07:37:34 +01:00
Gwendal Roué 338197ba3f Remove support for partial update 2016-01-11 07:36:02 +01:00
Gwendal Roué c3fdbd694f v0.38.2 2016-01-10 20:41:38 +01:00
Gwendal Roué edf6fd8a20 Upgrade SQLite.swift 2016-01-10 19:59:26 +01:00
Gwendal Roué 20d8b00ccf Doumentation 2016-01-10 19:03:56 +01:00
Gwendal Roué f6f991a2cb Statement arguments mismatch is always a programming error that crashes. 2016-01-10 19:03:06 +01:00
Gwendal Roué dd2f11988f Core Data performance tests 2016-01-10 17:33:11 +01:00
Gwendal Roué 52b6a2ecf9 Fix SQLite.swift performance test 2016-01-10 16:35:52 +01:00
Gwendal Roué 14a335fc49 v0.38.1 2016-01-10 16:22:13 +01:00
Gwendal Roué 3d96824174 TODO.md 2016-01-10 16:21:17 +01:00
Gwendal Roué 20c524d78c Statement.unsafeSetArguments() for dictionaries 2016-01-10 16:18:20 +01:00
Gwendal Roué 5cec72b77c Update performance tests and profiling target 2016-01-10 15:58:51 +01:00
Gwendal Roué 9bae2577a2 DatabasePersistable opts out arguments validation, and caches SQL queries 2016-01-10 15:58:20 +01:00
Gwendal Roué a8560c8fe1 Cache primary keys information 2016-01-10 15:57:44 +01:00
Gwendal Roué 01c21d8bb5 Improve Record.hasPersistentChangedValues = false performance 2016-01-10 15:56:44 +01:00
Gwendal Roué 5c7fa7e85a Statement: don’t validate arguments unless necessary 2016-01-10 15:55:30 +01:00
Gwendal Roué 4a3df80ecd Record.update() documentation 2016-01-10 15:54:57 +01:00
Gwendal Roué 6714e2bc7b DatabasePersistable uses the experimental support for prepared statement cache 2016-01-10 14:13:51 +01:00
Gwendal Roué 8c07d610ec Experimental support for prepared statement cache 2016-01-10 14:12:38 +01:00
Gwendal Roué ae917885e9 Revert "Turn Record.persistentDictionary into an abstract method"
This reverts commit 2483385c69.
2016-01-10 13:06:00 +01:00
Gwendal Roué 52a7947b14 TODO.md 2016-01-10 09:49:13 +01:00
Gwendal Roué 9ecba6691b Performance tests 2016-01-09 17:06:08 +01:00
Gwendal Roué 4b33b6f75c Performance tests: use FMDB statement caching, and remove meaningless raw SQLite tests 2016-01-09 16:47:28 +01:00
Gwendal Roué fb21ee098d Fix performance tests 2016-01-09 15:56:47 +01:00
Gwendal Roué f9f2371487 README.md 2016-01-09 14:12:16 +01:00
Gwendal Roué d6fb0d7187 README.md 2016-01-09 13:47:24 +01:00
Gwendal Roué 9f0b7df490 Compare insertion performance with FMDB & SQLite.swift 2016-01-09 13:30:05 +01:00
Gwendal Roué 2483385c69 Turn Record.persistentDictionary into an abstract method 2016-01-09 12:55:28 +01:00
Gwendal Roué 569166d836 Documentation 2016-01-09 11:40:41 +01:00
Gwendal Roué 1c9dea9f99 CHANGELOG.md 2016-01-09 10:49:49 +01:00
Gwendal Roué c8e66e82b2 CHANGELOG.md 2016-01-09 10:42:39 +01:00
Gwendal Roué 9454d35d4e CHANGELOG.md 2016-01-09 10:35:52 +01:00
Gwendal Roué 99b2946dbb CHANGELOG.md 2016-01-09 10:35:06 +01:00
Gwendal Roué a1eca43bb2 CHANGELOG.md 2016-01-09 09:57:45 +01:00
Gwendal Roué ebef2f0647 Minor 2016-01-09 07:29:55 +01:00
Gwendal Roué 55ead98e0e v0.38.0 2016-01-08 14:28:59 +01:00
Gwendal Roué 87ab0f55d8 DatabasePersistable.update accepts an optional list of columns to be updated. 2016-01-08 14:27:30 +01:00
Gwendal Roué 868636f313 Prefer SQLITE_MISUSE for statement argument validation errors 2016-01-08 13:48:33 +01:00
Gwendal Roué 0345d482b2 Statement.arguments is a non-optional StatementArguments. Remove StatementArguments.Default. 2016-01-08 10:33:30 +01:00
Gwendal Roué 32bb03f0eb TODO.md 2016-01-08 09:44:12 +01:00
Gwendal Roué 75a43f51e0 README.md 2016-01-08 09:10:40 +01:00
Gwendal Roué 9b8a407763 TODO.md 2016-01-08 09:08:57 +01:00
Gwendal Roué db005ab949 README.md 2016-01-08 08:28:14 +01:00
Gwendal Roué 68d9e8b472 README.md 2016-01-07 21:27:04 +01:00
Gwendal Roué 4455bd4f35 README.md 2016-01-07 20:45:23 +01:00
Gwendal Roué 3e59ff25a4 README.md 2016-01-07 19:06:54 +01:00
Gwendal Roué 344a5c068d README.md 2016-01-07 19:05:23 +01:00
Gwendal Roué 81b56daedf README.md 2016-01-07 19:02:18 +01:00
Gwendal Roué d328557927 README.md 2016-01-07 19:00:51 +01:00
Gwendal Roué c2e3723ce3 README.md 2016-01-07 18:56:50 +01:00
Gwendal Roué 475d018e07 README.md 2016-01-07 18:49:48 +01:00
Gwendal Roué 124397624f README.md 2016-01-07 18:35:57 +01:00
Gwendal Roué b589949bf4 README.md 2016-01-07 17:30:33 +01:00
Gwendal Roué eaa2314d9c How to run CrashTests.swift 2016-01-07 14:17:52 +01:00
Gwendal Roué ddf0b5de70 Update CrashTests.swift, and add GRDBOSXCrashTests target which runs crash tests only. 2016-01-07 14:11:30 +01:00
Gwendal Roué a435be1af2 Tests for errors thrown by prepared statement creation no longer require @testable import. 2016-01-07 13:23:00 +01:00
Gwendal Roué 238a918182 CHANGELOG.md 2016-01-07 09:11:58 +01:00
Gwendal Roué 9ad85cd826 v0.37.1 2016-01-07 09:01:03 +01:00
Gwendal Roué ea3ffbcd0b Remove legacy code that should have been removed when DatabaseValueConvertible stopped inheriting from RowConvertible. 2016-01-07 08:58:52 +01:00
Gwendal Roué ba67031ca0 Minor 2016-01-07 08:47:55 +01:00
Gwendal Roué 34acb8ad51 README.md 2016-01-07 07:54:52 +01:00
Gwendal Roué 8159e7ed8c README.md 2016-01-07 07:53:06 +01:00
Gwendal Roué a16d1c2e08 v0.37.0 2016-01-07 07:40:50 +01:00
Gwendal Roué 589647ca20 Robustness of Database.execute() with multiple statements. Remove Database.executeMultiStatement() introduced by #6. 2016-01-07 07:37:13 +01:00
Gwendal Roué aad3d5efa5 Database.execute() now accepts multiple statements 2016-01-06 23:37:35 +01:00
Gwendal Roué 9ef16fa008 Refactor statement arguments 2016-01-06 22:42:12 +01:00
Gwendal Roué f2a62947f8 README.md 2016-01-06 17:07:59 +01:00
Gwendal Roué 82eafb859b TODO 2016-01-06 17:07:30 +01:00
Gwendal Roué d7233583ed README.md 2016-01-06 14:22:08 +01:00
Gwendal Roué f1ac2fe022 README.md 2016-01-06 14:01:01 +01:00
Gwendal Roué 18ca125d8f README.md 2016-01-06 13:34:52 +01:00
Gwendal Roué 2dedb7400d README.md 2016-01-06 11:52:59 +01:00
Gwendal Roué e6ea48c8c9 README.md 2016-01-06 11:43:56 +01:00
Gwendal Roué fa27248aa3 README.md 2016-01-06 09:09:17 +01:00
Gwendal Roué 5ff53df075 README.md 2016-01-06 09:08:26 +01:00
Gwendal Roué 27f7085a3a Configuration: use explicit, auto-documenting, default values 2016-01-06 08:56:46 +01:00
Gwendal Roué 7bd21f499e Project organization 2016-01-06 08:54:09 +01:00
Gwendal Roué 5e1d8ee639 Statement.validateArguments() 2016-01-06 08:47:50 +01:00
Pascal Edmond dce273f714 Tests : disable all test but FetchedRecordsController's 2016-01-04 13:04:43 +01:00
Pascal Edmond 82813f57e1 Merge branch 'master' of https://github.com/groue/GRDB.swift into FetchedRecordsController 2016-01-04 13:03:37 +01:00
Pascal Edmond f76cb3bcba WIP 2016-01-04 13:03:22 +01:00
Pascal Edmond 9321bfa207 Tests : disable all test but FetchedRecordsController's 2016-01-04 13:03:17 +01:00
Gwendal Roué ea9ac052ee README.md 2015-12-28 21:51:47 +01:00
Gwendal Roué 585e08b210 README.md 2015-12-28 21:38:07 +01:00
Gwendal Roué 9697ab0e62 TODO.md 2015-12-28 21:35:03 +01:00
Gwendal Roué d20014c87c v0.36.0 2015-12-28 21:32:44 +01:00
Gwendal Roué 04d7c2b511 Methods that build prepared statement can now throw an error. 2015-12-28 21:29:29 +01:00
Gwendal Roué 055c01c467 TODO.md 2015-12-28 21:16:25 +01:00
Gwendal Roué dcc4b303f9 Database now traces all SQL statements, including setup statements. 2015-12-28 21:15:47 +01:00
Gwendal Roué 677686b83a UpdateStatement now accepts SQL queries that fetch rows (fixes #15) 2015-12-28 21:12:04 +01:00
Gwendal Roué 7fbba23e97 TODO.md 2015-12-28 19:02:54 +01:00
Gwendal Roué 5e2290d7c0 TODO.md 2015-12-28 13:43:21 +01:00
Gwendal Roué c630501011 Fix GRDBDemoiOS crash on iPad 2015-12-28 12:04:42 +01:00
Gwendal Roué ad54ef4793 README.md 2015-12-26 13:13:17 +01:00
Gwendal Roué 8a222ce032 CHANGELOG.md 2015-12-26 13:10:09 +01:00
Gwendal Roué b529b94e57 CHANGELOG.md 2015-12-26 13:09:42 +01:00
Gwendal Roué cf1b2fbc2e Rename Row(dictionary:) to Row(_:) 2015-12-26 13:07:40 +01:00
Gwendal Roué 84e7b6b3a9 TODO.md 2015-12-25 15:10:28 +01:00
Gwendal Roué 049c576864 RowConvertible.awakeFromFetch() now takes a database argument. 2015-12-25 14:30:05 +01:00
Gwendal Roué 1fea63a953 TODO.md 2015-12-25 13:33:52 +01:00
Gwendal Roué 809947cdd7 TODO.md 2015-12-25 13:26:37 +01:00
Gwendal Roué 85f872013b CHANGELOG.md 2015-12-25 13:26:23 +01:00
Gwendal Roué 0719b2a9ab DatabaseValueConvertible no longer inherits from RowConvertible.
This avoid the creation of rows in order to access the first column, and this also prevent calling awakeFromFetch for types that adopt databaseValueConvertible.
2015-12-25 13:17:30 +01:00
Gwendal Roué 9961146cd0 TODO.md 2015-12-24 14:04:39 +01:00
Pascal Edmond 6ecd147aad FetchedRecordsController : more tests 2015-12-23 17:03:59 +01:00
Pascal Edmond dc24c1faad FetchedRecordsController : bug fix 2015-12-23 17:03:46 +01:00
Pascal Edmond 03ce9602ea FetchedRecordsController : more Tests 2015-12-23 15:41:21 +01:00
Pascal Edmond 35772ab786 Database Transaction Observation : allow multiple observers 2015-12-23 15:03:06 +01:00
Gwendal Roué a8fc6df210 TODO.md 2015-12-23 13:45:27 +01:00
Gwendal Roué 350904ac3b README.md 2015-12-23 09:07:59 +01:00
Gwendal Roué 618212ea84 README.md 2015-12-23 09:00:34 +01:00
Gwendal Roué 97a7fad692 README.md 2015-12-23 08:59:48 +01:00
Gwendal Roué fb489f65fe TODO.md 2015-12-23 08:02:08 +01:00
Gwendal Roué f8ff42192b README.md 2015-12-23 07:54:08 +01:00
Gwendal Roué 24615358a0 Usage from LLDB 2015-12-22 18:02:00 +01:00
Gwendal Roué 21c3148afb Minor 2015-12-22 17:56:48 +01:00
Gwendal Roué eb469de2a3 TODO.md 2015-12-22 17:32:42 +01:00
Gwendal Roué bfe3759423 v0.35.0 2015-12-22 07:50:39 +01:00
Pascal Edmond 0dad966d26 WIP Tests 2015-12-21 12:32:27 +01:00
Pascal Edmond e43bbe79bd WIP Tests 2015-12-18 13:14:24 +01:00
Pascal Edmond cec026495f WIP Tests 2015-12-17 16:42:50 +01:00
Pascal Edmond 0225f481de Update Tests 2015-12-17 16:35:17 +01:00
Pascal Edmond 67f00e70a3 Merge branch 'master' of https://github.com/groue/GRDB.swift into FetchedRecordsController 2015-12-17 16:06:14 +01:00
Pascal Edmond 8146bbca65 WIP 2015-12-17 16:06:00 +01:00
Gwendal Roué eeff184daa CHANGELOG.md 2015-12-17 13:23:46 +01:00
Gwendal Roué e8f27a7f1a CHANGELOG.md 2015-12-17 12:03:28 +01:00
Gwendal Roué bbe9d9a390 CHANGELOG.md 2015-12-17 10:29:34 +01:00
Gwendal Roué f8ad2f2f6a Use precondition() when validating user input 2015-12-17 10:23:19 +01:00
Gwendal Roué 2bd9bdbf27 Faster Row.count 2015-12-17 10:21:24 +01:00
Gwendal Roué bfda4c78b3 Row.dataNoCopy(named:) returns nil if the column is missing. 2015-12-17 10:20:49 +01:00
Gwendal Roué ce41eba996 GRDBProfiling WIP 2015-12-17 09:59:11 +01:00
Gwendal Roué 243056a797 Improve SelectStatement.indexForColumn performance by assuming identical column casing is common. 2015-12-17 09:58:14 +01:00
Gwendal Roué a7d73217f7 Performance tests should run in Release configuration 2015-12-17 09:56:43 +01:00
Pascal Edmond e8d5d6a190 WIP tests 2015-12-16 16:47:57 +01:00
Pascal Edmond 32f73fb816 merge 2015-12-16 16:25:05 +01:00
Pascal Edmond e0dc84c14a wit report object changes if possible 2015-12-16 16:15:13 +01:00
Pascal Edmond 65414f2b55 Person update to adopt new protocols 2015-12-16 16:14:52 +01:00
Gwendal Roué 2cdc977064 README.md 2015-12-16 14:11:05 +01:00
Gwendal Roué 715373c086 CHANGELOG.md 2015-12-16 14:05:42 +01:00
Gwendal Roué 2550366c92 CHANGELOG.md 2015-12-16 13:59:37 +01:00
Gwendal Roué ae8e677e7e README.md 2015-12-16 13:56:39 +01:00
Gwendal Roué 1d80fd5802 README.md 2015-12-16 13:55:53 +01:00
Gwendal Roué 150e993130 README.md 2015-12-16 13:53:54 +01:00
Gwendal Roué dde89eda8c README.md 2015-12-16 13:51:37 +01:00
Gwendal Roué bcf9a7e0db Typo 2015-12-16 13:44:11 +01:00
Gwendal Roué 8f590b73fa CHANGELOG.md 2015-12-16 13:43:06 +01:00
Gwendal Roué ebb52d9486 Rename persistedDictionary to persistentDictionary 2015-12-16 13:41:22 +01:00
Gwendal Roué 97de742043 Rename databaseChanges to persistentChangedValues 2015-12-16 13:39:10 +01:00
Gwendal Roué 3deedffb77 Rename databaseEdited to hasPersistentChangedValues 2015-12-16 13:37:02 +01:00
Gwendal Roué 1534ac4828 Rename DatabasePersistable.storedDatabaseDictionary to persistedDictionary 2015-12-16 13:14:41 +01:00
Gwendal Roué 721b38ed7b TODO.md 2015-12-16 13:03:57 +01:00
Gwendal Roué 4c984985fa Record.databaseChanges now returns [String: DatabaseValue?] 2015-12-16 13:02:42 +01:00
Gwendal Roué 1e1f2c5c1f TODO.md 2015-12-16 12:57:53 +01:00
Gwendal Roué 4fcf4a8593 Rename DatabaseMigrator.registerMigrationWithoutForeignKeyChecks(_:_:) DatabaseMigrator.registerMigration(_:withDisabledForeignKeyChecks:migrate:) 2015-12-16 12:42:28 +01:00
Gwendal Roué 81dbbb0755 CHANGELOG.md 2015-12-16 12:27:51 +01:00
Gwendal Roué 6dc96d71ee DatabaseValue initializers from Int64, Double, String and NSData now have an unlabelled argument. 2015-12-16 12:26:55 +01:00
Gwendal Roué 5dc22f6dd7 More compliance to Swift 3 API Design Guidelines 2015-12-16 12:09:04 +01:00
Gwendal Roué 1e097361e1 TODO.md 2015-12-16 12:08:10 +01:00
Gwendal Roué 334fb00864 Record.init(row: Row) -> Record.init(_ row: Row) 2015-12-16 11:56:02 +01:00
Gwendal Roué d042db7964 TODO.md 2015-12-16 11:39:28 +01:00
Gwendal Roué 4cffa15a4b Update JSONSynchronisation.playground 2015-12-16 11:35:42 +01:00
Gwendal Roué f5129d2ab0 CHANGELOG.md 2015-12-16 05:36:49 +01:00
Gwendal Roué c5f686683f CHANGELOG.md 2015-12-16 05:35:41 +01:00
Gwendal Roué 6faf936e6c TODO.md 2015-12-16 05:34:47 +01:00
Gwendal Roué cbec030bc7 Restore demo apps 2015-12-16 05:34:06 +01:00
Pascal Edmond b3feaf91d4 Merge branch 'FetchedRecordsController' of github.com:pakko972/GRDB.swift into FetchedRecordsController 2015-12-15 12:01:31 +01:00
Pascal Edmond 587fc99023 Merge branch 'master' of https://github.com/groue/GRDB.swift into FetchedRecordsController 2015-12-15 12:01:14 +01:00
Pascal Edmond e1396673d9 Protocols 2015-12-15 12:00:50 +01:00
Gwendal Roué c2ba3da429 Update RowConvertible documentation 2015-12-15 09:10:30 +01:00
Gwendal Roué 6b75a8e143 TODO.md 2015-12-15 09:08:16 +01:00
Gwendal Roué e29994a131 CHANGELOG.md 2015-12-15 09:06:15 +01:00
Gwendal Roué eab6e54862 Update Record documentation 2015-12-15 09:03:03 +01:00
Gwendal Roué 6148a47f61 Update Record documentation 2015-12-15 09:02:29 +01:00
Gwendal Roué 302235138d Update Record documentation 2015-12-15 09:00:43 +01:00
Gwendal Roué 9040110608 Update Record documentation 2015-12-15 08:58:59 +01:00
Gwendal Roué 41c78d5411 Document that Row.value(named:) returns nil if column is not there. 2015-12-15 08:26:25 +01:00
Gwendal Roué 7a3795acc9 Row.value(atIndex:) reliably crashes when index is out of range. 2015-12-15 08:25:43 +01:00
Gwendal Roué 7444743ec5 Remove obsolete RecordUpdateFromRowTests.swift 2015-12-15 08:07:52 +01:00
Gwendal Roué 3d03b32487 Restore Record.init(row:) 2015-12-15 08:06:16 +01:00
Gwendal Roué b83a19c1fe Make Record closer to RowConvertible and DatabasePersistable 2015-12-15 06:51:24 +01:00
Gwendal Roué ca1ab4478b Row.value(named:) returns nil if column is not there. 2015-12-15 06:50:03 +01:00
Gwendal Roué fd96555a79 Drop Record.reload() 2015-12-14 18:35:17 +01:00
Gwendal Roué e5184d23c9 TODO.md 2015-12-14 14:31:47 +01:00
Gwendal Roué aa70017547 TODO.md 2015-12-14 14:28:30 +01:00
Gwendal Roué ec6bfb6280 CHANGELOG.md 2015-12-14 08:38:24 +01:00
Gwendal Roué c617b2aae1 v0.34.0 2015-12-14 08:28:31 +01:00
Gwendal Roué db11fa7a9b README.md 2015-12-14 08:23:55 +01:00
Gwendal Roué de56508914 README.md 2015-12-14 08:22:50 +01:00
Gwendal Roué d9dd955d69 README.md 2015-12-14 08:22:02 +01:00
Gwendal Roué 1a45f2cfc1 README.md 2015-12-14 08:09:24 +01:00
Gwendal Roué ce3cee68ec Typo 2015-12-14 08:06:21 +01:00
Gwendal Roué b00fcb2476 CHANGELOG.md 2015-12-14 08:05:40 +01:00
Gwendal Roué 28c2e2d0d3 Documentation 2015-12-14 07:59:44 +01:00
Gwendal Roué 77e8641c32 Documentation 2015-12-14 07:52:37 +01:00
Gwendal Roué e84a96d343 Minor 2015-12-14 07:52:34 +01:00
Gwendal Roué be2ea53bcc TODO.md 2015-12-14 07:42:30 +01:00
Gwendal Roué 6b22342bb5 Minor 2015-12-14 07:37:40 +01:00
Gwendal Roué a6299e7b9b Minor 2015-12-14 07:33:05 +01:00
Gwendal Roué 93e7dc8709 Make DatabaseValueConvertible a subprotocol of RowConvertible. Drop RowConvertible dictionary initializers. 2015-12-14 06:48:38 +01:00
Pascal EDMOND c490721d6a Merge branch 'master' of https://github.com/groue/GRDB.swift into FetchedRecordsController 2015-12-13 16:37:42 +01:00
Gwendal Roué 5d937a9d24 TODO.md 2015-12-12 14:53:52 +01:00
Gwendal Roué e33251e351 README.md 2015-12-11 19:42:38 +01:00
Gwendal Roué d93c3552c9 README.md 2015-12-11 19:21:15 +01:00
Gwendal Roué e106e5f8ec DESIGN.md 2015-12-11 19:10:34 +01:00
Gwendal Roué 5027504d73 README.md 2015-12-11 18:12:11 +01:00
Pascal Edmond 8fadc40656 Merge branch 'master' of https://github.com/groue/GRDB.swift into FetchedRecordsController 2015-12-11 14:22:21 +01:00
Pascal Edmond 5ee6ccdf48 Update FetchedRecordsController + make use of its update APIs 2015-12-11 14:21:56 +01:00
Gwendal Roué fe3b5073bc CHANGELOG.md 2015-12-11 13:36:23 +01:00
Gwendal Roué 833a5af74f v0.33.0 2015-12-11 13:24:01 +01:00
Gwendal Roué 6555881a79 Drop documentation for NSCoding support 2015-12-11 13:08:06 +01:00
Gwendal Roué 1f3f2d04eb Instead of disabling schema cache throughout the migrations, clear the schema cache after each migration. 2015-12-11 13:05:10 +01:00
Gwendal Roué de4a86ca50 DatabasePersistable tests WIP 2015-12-11 13:03:02 +01:00
Gwendal Roué ed80d02ee0 README.md 2015-12-11 10:47:30 +01:00
Gwendal Roué 1789b38dec README.md 2015-12-11 10:32:57 +01:00
Gwendal Roué 3081189517 README.md 2015-12-11 10:32:00 +01:00
Gwendal Roué 2f66dbfe8a README.md 2015-12-11 10:27:05 +01:00
Gwendal Roué ca98412dec README.md 2015-12-11 10:23:28 +01:00
Gwendal Roué 0658f454b3 README.md 2015-12-11 10:15:05 +01:00
Gwendal Roué 1f0fd28baa README.md 2015-12-11 09:10:03 +01:00
Gwendal Roué f6371ac1f6 README.md 2015-12-11 09:08:42 +01:00
Gwendal Roué d7c62c3022 "CRUD" -> "persistence" 2015-12-11 08:47:58 +01:00
Gwendal Roué 99a7ac1e13 "CRUD" -> "persistence" 2015-12-11 08:37:52 +01:00
Gwendal Roué 8422ff4e31 README.md 2015-12-11 08:25:07 +01:00
Gwendal Roué 7bea6d54c9 README.md 2015-12-11 08:23:43 +01:00
Gwendal Roué 372f698357 README.md 2015-12-11 08:20:03 +01:00
Gwendal Roué a10a504558 README.md 2015-12-11 08:18:23 +01:00
Gwendal Roué f5b7a05e28 README.md 2015-12-11 08:18:04 +01:00
Gwendal Roué b0e9011372 README.md 2015-12-11 08:16:34 +01:00
Gwendal Roué 6be37b9dc3 README.md 2015-12-11 08:13:55 +01:00
Gwendal Roué 430c239171 README.md 2015-12-11 08:12:41 +01:00
Gwendal Roué 99fb649ba7 TODO.md 2015-12-11 07:58:51 +01:00
Gwendal Roué 50057ec289 DatabasePersistable tests WIP 2015-12-11 07:58:11 +01:00
Gwendal Roué e870eceaca DatabasePersistable tests WIP 2015-12-11 07:52:31 +01:00
Gwendal Roué e0a1691621 DatabasePersistable tests WIP 2015-12-11 07:44:24 +01:00
Gwendal Roué 8891630f69 README.md 2015-12-11 07:27:23 +01:00
Gwendal Roué c5913542f0 DatabasePersistable WIP 2015-12-11 07:05:45 +01:00
Gwendal Roué 44cdadabca TODO.md 2015-12-11 06:18:01 +01:00
Gwendal Roué 2b8875d19d README.md 2015-12-10 22:54:49 +01:00
Gwendal Roué 2aa64bb2cd README.md 2015-12-10 22:48:18 +01:00
Gwendal Roué 164ad16328 README.md 2015-12-10 22:41:51 +01:00
Gwendal Roué f0c78b02df TODO.md 2015-12-10 22:39:47 +01:00
Gwendal Roué be8608eb47 TODO.md 2015-12-10 22:38:18 +01:00
Gwendal Roué ecb7bfc786 README.md 2015-12-10 22:35:14 +01:00
Gwendal Roué c07d9cc8cb README.md 2015-12-10 22:30:46 +01:00
Gwendal Roué 6c2431912e DatabasePersistable documentation 2015-12-10 22:22:03 +01:00
Gwendal Roué 7fc282a2d5 README.md: RecordError has been renamed PersistenceError. 2015-12-10 22:20:08 +01:00
Gwendal Roué 7782bcddac README.md 2015-12-10 22:17:25 +01:00
Gwendal Roué b67239ef3e README.md 2015-12-10 22:14:08 +01:00
Gwendal Roué 7f6a14131d MutableDatabasePersistable documentation 2015-12-10 22:12:29 +01:00
Gwendal Roué 21fc6938ca MutableDatabasePersistable documentation 2015-12-10 22:05:13 +01:00
Gwendal Roué ed22876b1d Introduce MutableDatabasePersistable 2015-12-10 21:50:46 +01:00
Gwendal Roué 00fb558db8 TODO.md 2015-12-10 18:20:47 +01:00
Gwendal Roué ccd5971445 DatabasePersistable tests 2015-12-10 18:02:09 +01:00
Gwendal Roué 03facd1765 README.md 2015-12-10 16:51:02 +01:00
Gwendal Roué d3ee18fe71 README.md 2015-12-10 16:19:26 +01:00
Gwendal Roué 592798b40f README.md 2015-12-10 16:12:55 +01:00
Gwendal Roué de305f9831 README.md 2015-12-10 16:12:18 +01:00
Gwendal Roué 75ee0d0ae2 README.md 2015-12-10 16:02:28 +01:00
Gwendal Roué 05956f8160 README.md 2015-12-10 14:32:29 +01:00
Gwendal Roué e9c55f47c6 Database.clearSchemaCache(). Migrations are run with disabled schema cache. 2015-12-10 14:24:55 +01:00
Gwendal Roué 1330726470 README.md 2015-12-10 14:02:13 +01:00
Gwendal Roué 3033868814 README.md 2015-12-10 14:00:19 +01:00
Gwendal Roué 9b2bd07074 DatabasePersistable documentation (#12) 2015-12-10 13:39:30 +01:00
Gwendal Roué 39ff90474c DatabasePersistable documentation (#12) 2015-12-10 13:33:25 +01:00
Gwendal Roué cfd5abc1a7 Documentation 2015-12-10 13:28:34 +01:00
Gwendal Roué 03d7d494fa TODO.MD 2015-12-10 13:28:13 +01:00
Gwendal Roué 52b13da2b3 DatabaseTableMapping.databaseTableName() now returns a non-optional String 2015-12-10 13:23:45 +01:00
Gwendal Roué e3b7269f3b Typo 2015-12-10 09:13:11 +01:00
Gwendal Roué 4e183439b5 DatabasePersistable.didInsertWithRowID(_:forColumn:) is called even when there is no INTEGER PRIMARY KEY column. DatabaseTableMapping no longer extends RowConvertible. (#12) 2015-12-10 09:06:00 +01:00
Gwendal Roué c4fa174fad DatabasePersistable documentation (#12) 2015-12-10 08:14:36 +01:00
Gwendal Roué cc59f62420 Refactor DatabasePersistable so that all CRUD methods are dynamically dispatched. The protocol exposes default implementation for CRUD methods as statically dispatched method that are available for adopting types in their own implementations of CRUD methods. Introduce DatabasePersistable.save() (#12) 2015-12-10 08:09:36 +01:00
Gwendal Roué 00b052bddf Record.playground update 2015-12-10 08:03:34 +01:00
Pascal Edmond 81c22fcbc2 Merge branch 'master' of https://github.com/groue/GRDB.swift 2015-12-09 18:15:49 +01:00
Pascal Edmond 0139618f37 WIP : Welcome FetchedRecordsController 2015-12-09 18:15:45 +01:00
Gwendal Roué 8ed4f47f82 Remove reference to the databaseEdited flag from the DatabasePersistable documentation. 2015-12-09 08:57:07 +01:00
Gwendal Roué 22dd8e1c3a Introduce DatabasePersistable that grants CRUD methods to any type 2015-12-09 08:53:08 +01:00
Gwendal Roué a6a0207718 Link to the Swift2.2 branch (including Swift Package Manager support) 2015-12-07 15:07:39 +01:00
Gwendal Roué b00d0dc083 Remove reference to non-existing plist file 2015-12-07 08:30:35 +01:00
Gwendal Roué 54d0442fe0 FMDB tests don't need GRDB 2015-12-03 14:34:23 +01:00
Gwendal Roué cf7c774b09 SQLite.swift tests don't need GRDB 2015-12-03 14:33:18 +01:00
Gwendal Roué eef059736f Update stephencelis/SQLite.swift to latest version 2015-12-03 14:32:57 +01:00
Gwendal Roué 17001129d1 Bridging header is only needed by performance tests 2015-12-03 14:11:25 +01:00
Gwendal Roué 434ea9b9ef Shared schemes 2015-12-03 14:08:46 +01:00
Gwendal Roué 61dd1b9a34 Carthage tests. Use carthage build --no-skip-current from the root of the repository. 2015-12-03 14:04:24 +01:00
Gwendal Roué 2cf0a44d5f Update JSONSynchronization.playground 2015-12-03 08:00:12 +01:00
Gwendal Roué 0853c1c419 v0.32.2 2015-12-03 07:58:35 +01:00
Gwendal Roué 20734d5162 Tests that errors thrown by UpdateStatement contain the correct arguments 2015-12-03 07:56:33 +01:00
Gwendal Roué c88440243f Fix error thrown by UpdateStatement 2015-12-03 07:48:25 +01:00
Gwendal Roué 5a2971fe6f README.md 2015-12-02 09:15:44 +01:00
Gwendal Roué bdd28b5cd4 README.md 2015-12-02 09:14:29 +01:00
Gwendal Roué bb9117bdb6 Better collation implementation 2015-12-02 08:48:55 +01:00
Gwendal Roué 921c66abf3 v0.32.1 2015-12-02 08:32:35 +01:00
Gwendal Roué da525b1856 Fix collations: sqlite does not provide \0 terminated C strings, but UTF8 buffers. 2015-12-02 08:29:55 +01:00
Gwendal Roué cc237560c6 Fix Statement.validateArguments: StatementArguments.Default is never valid. 2015-12-02 08:29:13 +01:00
Gwendal Roué 74f39fb080 Restore test target 2015-12-02 08:28:29 +01:00
Gwendal Roué 86e4541225 README.md 2015-12-02 07:52:53 +01:00
Gwendal Roué 9002502163 Minor 2015-12-01 23:07:17 +01:00
Gwendal Roué 49747c58f1 Performance tests for KVC-based objects 2015-12-01 21:59:34 +01:00
Gwendal Roué bf48bd6ac2 Remove a bunch of self. 2015-12-01 09:07:55 +01:00
Gwendal Roué b445471d76 README.md 2015-11-30 15:14:07 +01:00
Gwendal Roué d88f402a34 README.md 2015-11-30 10:37:33 +01:00
Gwendal Roué 6ee5f9201f README.md 2015-11-30 10:36:46 +01:00
Gwendal Roué d051785d20 README.md 2015-11-30 10:35:11 +01:00
Gwendal Roué 719f0d9442 README.md 2015-11-23 13:35:52 +01:00
Gwendal Roué 2065c6119b Typo 2015-11-23 13:33:40 +01:00
Gwendal Roué 6c1ee933f7 v0.32.0 2015-11-23 12:58:46 +01:00
Gwendal Roué 343f6727c6 Collations WIP 2015-11-23 12:56:24 +01:00
Gwendal Roué 346eb576f7 Merge pull request #11 from csexton/patch-1
Fix typo in README
2015-11-21 07:35:17 +01:00
Christopher Sexton 35ea453b06 Fix typo in README
Silly little typo, change "owns" to "owes".
2015-11-20 20:22:32 -05:00
Gwendal Roué c717c6932c Collations WIP 2015-11-20 18:06:12 +01:00
Gwendal Roué 0be1117bd0 Collations WIP 2015-11-20 14:17:33 +01:00
Gwendal Roué 186732fb05 Collations WIP 2015-11-20 14:12:03 +01:00
Gwendal Roué 54e901f881 Record documentation 2015-11-20 10:16:29 +01:00
Gwendal Roué c3330b85b8 Record documentation 2015-11-20 10:15:36 +01:00
Gwendal Roué 843fe39cdc Record documentation 2015-11-20 10:12:46 +01:00
Gwendal Roué 8eee7d590d Record documentation 2015-11-20 10:06:50 +01:00
Gwendal Roué 7839d2512f Record documentation 2015-11-20 10:06:15 +01:00
Gwendal Roué 195dbf518f Restore DatabaseValue and Row value() methods that return nil, Int64, Double, String or NSData. 2015-11-20 08:48:28 +01:00
Gwendal Roué cc1d6a300f Documentation 2015-11-20 08:41:59 +01:00
Gwendal Roué 4c8c9f8432 DatabaseValue exposes its SQLite storage, and adopts Hashable. 2015-11-20 08:34:22 +01:00
Gwendal Roué 03ab4a29a1 TODO.md 2015-11-20 07:44:07 +01:00
Gwendal Roué 6218ed2bac v0.31.0 2015-11-19 14:37:56 +01:00
Gwendal Roué 3bac806f61 README.md 2015-11-19 14:36:48 +01:00
Gwendal Roué ffaa1675e5 README.md 2015-11-19 14:33:56 +01:00
Gwendal Roué bed2acc7f1 README.md 2015-11-19 14:32:41 +01:00
Gwendal Roué f2a8d91b5d README.md 2015-11-19 14:31:56 +01:00
Gwendal Roué 999b98e1f0 README.md 2015-11-19 14:28:54 +01:00
Gwendal Roué 3eeaf8f300 README.md 2015-11-19 14:27:31 +01:00
Gwendal Roué 5a5a583ac6 README.md 2015-11-19 14:19:45 +01:00
Gwendal Roué 08eca9d1c2 Update functions documentation 2015-11-19 14:09:28 +01:00
Gwendal Roué 5f0f6745a8 Functions 2015-11-19 14:01:47 +01:00
Gwendal Roué 2d2c5bcb00 Function tests 2015-11-19 13:27:02 +01:00
Gwendal Roué 824035898b README.md 2015-11-19 09:59:06 +01:00
Gwendal Roué 2afb2fad56 Functions 2015-11-19 09:51:10 +01:00
Gwendal Roué 34edc88413 README.md 2015-11-19 09:15:53 +01:00
Gwendal Roué 5c8d1c2755 README.md 2015-11-19 09:14:57 +01:00
Gwendal Roué 0b276db586 README.md 2015-11-19 09:08:10 +01:00
Gwendal Roué c1f59da49d CHANGELOG.md 2015-11-19 09:06:30 +01:00
Gwendal Roué aa5b727cd2 Documentation 2015-11-19 08:53:34 +01:00
Gwendal Roué 6afcc59c05 Documentation 2015-11-19 08:29:05 +01:00
Gwendal Roué dbaff30da3 Documentation 2015-11-19 08:23:43 +01:00
Gwendal Roué ce42192334 Documentation 2015-11-19 08:20:28 +01:00
Gwendal Roué aad7218df6 Functions 2015-11-19 08:06:41 +01:00
Gwendal Roué 23a9322e5e Functions 2015-11-18 22:20:55 +01:00
Gwendal Roué a84014402b Functions 2015-11-18 20:54:18 +01:00
Gwendal Roué 865431c58a Functions 2015-11-18 18:18:31 +01:00
Gwendal Roué 6496f271d2 v0.30.0 2015-11-17 08:57:04 +01:00
Gwendal Roué 32b9971cfa minor 2015-11-17 08:28:25 +01:00
Gwendal Roué c8cf0df6e1 DatabaseValue.toAnyObject(), Row.toNSDictionary() 2015-11-17 08:27:48 +01:00
Gwendal Roué c987a0a9af Statement validates its arguments before execution, not only in arguments property setter. Nil arguments are validated as well. 2015-11-17 08:26:15 +01:00
Gwendal Roué 7b315f99bd minor 2015-11-15 13:27:22 +01:00
Gwendal Roué 0cdeb09ab0 minor 2015-11-15 13:27:14 +01:00
Gwendal Roué a92f1c5c40 documentation 2015-11-15 13:27:05 +01:00
Gwendal Roué b179ce2437 minor 2015-11-15 13:26:55 +01:00
Gwendal Roué be0b55ffe7 minor 2015-11-15 13:26:12 +01:00
Gwendal Roué 0ada90777a minor 2015-11-15 13:25:58 +01:00
Gwendal Roué 3006ee4764 minor 2015-11-15 13:25:50 +01:00
Gwendal Roué 2b31a22f09 v0.29.0 2015-11-14 13:50:39 +01:00
Gwendal Roué 02f852cb89 Prevent StatementArguments.Default from being used as actual arguments 2015-11-14 13:45:41 +01:00
Gwendal Roué 1e3d9f16df StatementArguments.Default is used in place of nil for default parameter values. 2015-11-13 11:46:25 +01:00
Gwendal Roué 561ae52422 Turn initializers of DatabaseValue, Row, RowConvertible and StatementArguments from AnyObject, NSArray and NSDictionary to failable initializers. 2015-11-13 10:04:08 +01:00
Gwendal Roué b81a1eb2d7 TODO.md 2015-11-13 09:29:55 +01:00
Gwendal Roué 12d786f810 v0.28.0 2015-11-13 07:58:36 +01:00
Gwendal Roué c7313e169c README.md 2015-11-12 08:48:03 +01:00
Gwendal Roué a3eede4d4e TODO.md 2015-11-12 08:48:01 +01:00
Gwendal Roué 13ae1bcdb9 README.md 2015-11-10 10:30:00 +01:00
Gwendal Roué 7820b82f6a README.md 2015-11-10 09:01:39 +01:00
Gwendal Roué f0e57cfa93 TODO.md 2015-11-10 08:29:26 +01:00
Gwendal Roué 283d125901 README.md 2015-11-10 08:27:05 +01:00
Gwendal Roué f127079c62 README.md 2015-11-10 08:24:12 +01:00
Gwendal Roué 81fdcba4c9 README.md 2015-11-10 08:12:58 +01:00
Gwendal Roué fcacd91f69 README.md 2015-11-10 07:21:04 +01:00
Gwendal Roué fe6fa0bb5a README.md 2015-11-09 20:15:56 +01:00
Gwendal Roué ea71dbe18b README.md 2015-11-09 19:50:59 +01:00
Gwendal Roué e86076c2e6 README.md 2015-11-09 19:49:16 +01:00
Gwendal Roué f6e0b94078 README.md 2015-11-09 19:48:00 +01:00
Gwendal Roué bbce8a072b Streamline README.md 2015-11-09 19:08:40 +01:00
Gwendal Roué 755327d721 Configuration documentation 2015-11-09 19:08:34 +01:00
Gwendal Roué 48207f17aa TODO.md 2015-11-09 18:18:02 +01:00
Gwendal Roué a0c5f7b65f Run all migrations in a single database queue block. 2015-11-08 08:03:00 +01:00
Gwendal Roué ae462cb4bf README.md 2015-11-06 13:46:21 +01:00
Gwendal Roué 8e7c040f51 README.md 2015-11-06 13:43:46 +01:00
Gwendal Roué d30febc151 README.md 2015-11-06 13:36:39 +01:00
Gwendal Roué b7147ba64c TransactionObserverType methods are no longer optional. 2015-11-05 14:37:39 +01:00
Gwendal Roué 0f698e1306 TODO.md 2015-11-05 09:10:49 +01:00
Gwendal Roué 8844967d5d TODO.md 2015-11-05 09:09:15 +01:00
Gwendal Roué 1e1f53a8fc README.md 2015-11-05 09:06:33 +01:00
Gwendal Roué 1338a12ac6 README.md 2015-11-05 09:04:29 +01:00
Gwendal Roué 77847d848c README.md 2015-11-05 09:03:54 +01:00
Gwendal Roué 599f6d8c89 DatabaseMigrator cleanup 2015-11-05 08:57:48 +01:00
Gwendal Roué c35979a69f DatabaseMigrator cleanup 2015-11-05 08:43:48 +01:00
Gwendal Roué 589e2e77b1 README.md 2015-11-05 08:20:14 +01:00
Gwendal Roué efddb39ff5 README.md 2015-11-05 08:08:12 +01:00
Gwendal Roué 1b4e1e5b51 DatabaseMigrator cleanup 2015-11-05 08:04:23 +01:00
Gwendal Roué 7b81eaea0c README.md 2015-11-04 22:58:17 +01:00
Gwendal Roué 110a61a92f v0.27.0 2015-11-04 22:52:25 +01:00
Gwendal Roué 1cfc143618 README.md 2015-11-04 22:50:22 +01:00
Gwendal Roué 993eaae2f7 README.md 2015-11-04 22:44:51 +01:00
Gwendal Roué 58cae8f526 DatabaseMigrator.registerMigrationWithoutForeignKeyChecks() 2015-11-04 22:34:52 +01:00
Gwendal Roué 9086c5b61d Fix documentation typo 2015-11-04 22:32:34 +01:00
Gwendal Roué 136a9fe6f6 Database.inTransaction() 2015-11-04 22:31:19 +01:00
Gwendal Roué 034b8b8a7c DatabaseQueue.inQueue is private 2015-11-04 22:13:20 +01:00
Gwendal Roué d358518ab5 README.md 2015-11-04 20:01:56 +01:00
Gwendal Roué 729ea4c26c README.md 2015-11-04 20:00:39 +01:00
Gwendal Roué 76548ad6a9 Record.insert, update and save return Void again. Record.delete returns a Bool. 2015-11-04 07:44:55 +01:00
Gwendal Roué 356d5e9d39 README.md 2015-11-03 19:30:35 +01:00
Gwendal Roué e493b724b4 README.md 2015-11-03 19:20:40 +01:00
Gwendal Roué 7cd383ab85 README.md 2015-11-03 19:16:33 +01:00
Gwendal Roué 63cecd884f README.md 2015-11-03 19:15:24 +01:00
Gwendal Roué 934b2022af README.md 2015-11-03 19:14:50 +01:00
Gwendal Roué 80827e9ef2 README.md 2015-11-03 19:05:43 +01:00
Gwendal Roué 50faf8dd64 README.md 2015-11-03 19:04:20 +01:00
Gwendal Roué 8c3903c086 README.md 2015-11-03 18:59:32 +01:00
Gwendal Roué c19800b3ed README.md 2015-11-03 18:57:21 +01:00
Gwendal Roué 1ca5830e5b README.md 2015-11-03 18:51:40 +01:00
Gwendal Roué 04553c014f README.md 2015-11-03 17:40:20 +01:00
Gwendal Roué 25d659de0a README.md 2015-11-03 14:21:16 +01:00
Gwendal Roué eac6d4c074 README.md 2015-11-03 14:15:45 +01:00
Gwendal Roué ce84b1ee2c README.md 2015-11-03 08:22:34 +01:00
Gwendal Roué 0f7fcad8ff README.md 2015-11-03 08:21:03 +01:00
Gwendal Roué 77521d91e5 README.md 2015-11-03 08:20:10 +01:00
Gwendal Roué 9f444293eb Record.insert, update, save and delete return a DatabaseChanges object. 2015-11-02 19:55:39 +01:00
Gwendal Roué 96fd4d95cc TODO.md 2015-11-02 19:34:17 +01:00
Gwendal Roué 5aae8e9134 README.md 2015-11-02 08:20:17 +01:00
Gwendal Roué 7e01297be8 README.md 2015-11-02 08:14:06 +01:00
Gwendal Roué 545118b4d3 README.md 2015-11-02 08:09:48 +01:00
Gwendal Roué e75f065191 README.md 2015-11-02 08:01:24 +01:00
Gwendal Roué 61e877b5c6 DatabaseCoder documentation 2015-10-31 10:50:05 +01:00
Gwendal Roué 3e31640a25 DatabaseCoder reads and stores objects that conform to NSCoding in the database. 2015-10-31 10:40:14 +01:00
Gwendal Roué a87bfe21c8 v0.26.1 2015-10-31 10:01:53 +01:00
Gwendal Roué d286d843dc Fixed GRDB.xcworkspace 2015-10-31 09:59:34 +01:00
Gwendal Roué 033f6dd057 v0.26.0 2015-10-31 09:56:00 +01:00
472 changed files with 75389 additions and 21881 deletions

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
source 'https://rubygems.org'
gem 'xcpretty'
gem 'xcpretty-travis-formatter'
+17 -3
View File
@@ -93,7 +93,21 @@ xcuserdata
*.hmap
*.ipa
# Performance test baselines
*.xcbaseline
##
GRDB Tests/Carthage/Carthage
GRDB Tests/Carthage/Cartfile.resolved
# GRDBCustomSQLite USER configuration files
SQLiteCustom/GRDBCustomSQLite-USER.h
SQLiteCustom/GRDBCustomSQLite-USER.xcconfig
# CocoaPods test
Podfile.lock
Pods
# SPM
.build
Package.resolved
Tests/SPM/Packages
# Ruby
.ruby-version
+13 -4
View File
@@ -1,6 +1,15 @@
[submodule "GRDB Tests/Performance/fmdb"]
path = GRDB Tests/Performance/fmdb
[submodule "Tests/Performance/fmdb"]
path = Tests/Performance/fmdb
url = https://github.com/ccgus/fmdb.git
[submodule "GRDB Tests/Performance/SQLite.swift"]
path = GRDB Tests/Performance/SQLite.swift
[submodule "Tests/Performance/SQLite.swift"]
path = Tests/Performance/SQLite.swift
url = https://github.com/stephencelis/SQLite.swift.git
[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
+1
View File
@@ -0,0 +1 @@
4.0
+151
View File
@@ -0,0 +1,151 @@
language: objective-c
xcode_project: GRDB.xcodeproj
# Disable the default Travis-CI submodule logic
# The various make commands ensure that the appropriate submodules are retrieved
git:
submodules: false
jobs:
include:
###########################################
## Test GRDB
# Test GRDBOSX (Xcode 9)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
env:
- TID=GRDBOSX (Xcode 9, macOS 10.12)
script: make test_framework_GRDBOSX
# Test GRDBWatchOS (Xcode 9)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
env:
- TID=GRDBWatchOS (Xcode 9, watchOS)
script: make test_framework_GRDBWatchOS
# Test GRDBiOS (Xcode 9, iOS <MAXIMUM VERSION>)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
env:
- TID=GRDBiOS (Xcode 9, iOS <MAX>)
script: make test_framework_GRDBiOS_maxTarget
# Test GRDBiOS (Xcode 9, iOS <MINIMUM VERSION>))
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
env:
- TID=GRDBiOS (Xcode 9, iOS <MIN>)
script: make test_framework_GRDBiOS_minTarget
# Test GRDB [SPM] (Xcode 9, macOS 10.12)
- stage: Test GRDB
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
env:
- TID=GRDB [SPM] (Xcode 9, macOS 10.12)
script: make test_SPM
###########################################
## Test GRDB (Custom SQLite)
# Test GRDBCustomSQLiteOSX (Xcode 9)
- stage: Test GRDB + Custom SQLite
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
env:
- TID=GRDBCustomSQLiteOSX (Xcode 9, macOS 10.12)
script: make test_framework_GRDBCustomSQLiteOSX
# Test GRDBCustomSQLiteiOS (Xcode 9, iOS <MAXIMUM VERSION>)
- stage: Test GRDB + Custom SQLite
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
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
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
env:
- TID=GRDBCustomSQLiteiOS (Xcode 9, iOS <MIN>)
script: make test_framework_GRDBCustomSQLiteiOS_minTarget
###########################################
## Test GRDB (SQLCipher)
# Test GRDBCipherOSX (Xcode 9)
- stage: Test GRDB + SQLCipher
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
env:
- TID=GRDBCipherOSX (Xcode 9, macOS 10.12)
script: make test_framework_GRDBCipherOSX
# Test GRDBCipheriOS (Xcode 9, iOS <MAXIMUM VERSION>)
- stage: Test GRDB + SQLCipher
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
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
###########################################
## Test Installation Methods
# Manual Install
- stage: Test Installation
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
env:
- TID=Manual Install
script: make test_install_manual
# Manual Install (GRDBCipher)
- stage: Test Installation
gemfile: .ci/gemfiles/Gemfile.travis
osx_image: xcode9
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
env:
- TID=Cocoapods
script: make test_CocoaPodsLint
# SPM Install
- stage: Test Installation
osx_image: xcode9
env:
- TID=SPM
script: make test_install_SPM
## 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
+3229 -5
View File
File diff suppressed because it is too large. Load diff
-120
View File
@@ -1,120 +0,0 @@
The Design of GRDB.swift
========================
More than caveats or defects, there are a few glitches, or surprises in the GRDB.swift API. We try to explain them here. The interested readers can take them as Swift challenges!
### Why is Record a class, when protocols are all the rage?
Easy: Swift protocols don't provide `super`, and `super` is what turns Record into the flexible base class you need when you implement your specific needs:
```swift
// A Record that makes sure its UUID is set before insertion:
class A : Record {
var UUID: NSString?
override func insert(db: Database) throws {
if UUID == nil {
UUID = NSUUID().UUIDString
}
try super.insert()
}
}
// A Record that validates itself before saving:
class B : Record {
override func insert(db: Database) throws {
try validate()
try super.insert(db)
}
override func update(db: Database) throws {
try validate()
try super.update(db)
}
func validate() throws {
...
}
}
// A Record that deletes an external resource after being deleted from
// the database:
class C : Record {
public func delete(db: Database) throws -> DeletionResult {
switch try super.delete(db) {
case .RowDeleted:
try NSFileManager.defaultManager().removeItemAtPath(...)
case .NoRowDeleted:
break
}
}
}
```
A second reason: the `databaseEdited` flag, which is true when a Record has unsaved changes, is easily provided by the base class Record. Record can manage its internal state *accross method calls*. Protocols could not provide this service without extra complexity.
Yet, don't miss the [RowConvertible](http://cocoadocs.org/docsets/GRDB.swift/0.12.0/Protocols/RowConvertible.html) and [DatabaseMapping](http://cocoadocs.org/docsets/GRDB.swift/0.12.0/Protocols/DatabaseTableMapping.html) protocols: they provide fetching from custom SQL queries and fetching by primary key for free.
### Why must we provide query arguments in an Array, when Swift provides variadic method parameters?
I admit that the array argument below looks odd:
```swift
Int.fetch(db,
"SELECT COUNT(*) FROM persons WHERE name = ?",
arguments: ["Arthur"])
```
Well, GRDB provides three fetching methods for each fetchable type:
```swift
// Row
Row.fetch(db, "SELECT ...", arguments: ...) // DatabaseSequence<Row>
Row.fetchAll(db, "SELECT ...", arguments: ...) // [Row]
Row.fetchOne(db, "SELECT ...", arguments: ...) // Row?
// DatabaseValueConvertible
String.fetch(db, "SELECT ...", arguments: ...) // DatabaseSequence<String>
String.fetchAll(db, "SELECT ...", arguments: ...) // [String]
String.fetchOne(db, "SELECT ...", arguments: ...) // String?
// Record (via RowConvertible)
Person.fetch(db, "SELECT ...", arguments: ...) // DatabaseSequence<Person>
Person.fetchAll(db, "SELECT ...", arguments: ...) // [Person]
Person.fetchOne(db, "SELECT ...", arguments: ...) // Person?
```
The `arguments` parameter type is StatementArguments, which is both ArrayLiteralConvertible and DictionaryLiteralConvertible, so that you can write both:
```swift
Int.fetch(db,
"SELECT COUNT(*) FROM persons WHERE name = ?",
arguments: ["Arthur"])
Int.fetch(db,
"SELECT COUNT(*) FROM persons WHERE name = :name",
arguments: ["name": "Arthur"])
```
Without StatementArguments, that number would be six (three for Array and three for Dictionary), or even nine (three more for variadic parameters). I prefer limiting the API footprint: three methods per fetchable type is just quite fine.
Moreover, one of my pet peeves with SQLite is that it is a pain to write an SQL query with the `IN` operator. SQLite won't natively feed a single `?` placeholder with an array of values, and this forces users to build their own `IN(?,?,?,...)` SQL snippets:
```swift
// Let's load persons whose name is in names:
let names = ["Arthur", "Barbara"]
let questionMarks = Array(count: names.count, repeatedValue: "?").joinWithSeparator(",") // OMG Swift come on
let sql = "SELECT * FROM persons WHERE name IN (\(questionMarks))"
let persons = Person.fetchAll(db, sql, arguments: StatementArguments(names))
```
I wish that in a future version of GRDB we can write instead:
```swift
Person.fetchAll(db,
"SELECT * FROM persons WHERE name IN (?)",
arguments: [["Arthur", "Barbara"]]) // one array argument
Person.fetchAll(db,
"SELECT * FROM persons WHERE name = ? OR name = ?",
arguments: ["Arthur", "Barbara"]) // two string arguments
```
This will require to distinguish arrays of values from arrays of arrays of values.
@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "watch",
"screenWidth" : "{130,145}",
"scale" : "2x"
},
{
"idiom" : "watch",
"screenWidth" : "{146,165}",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,28 @@
{
"assets" : [
{
"idiom" : "watch",
"filename" : "Circular.imageset",
"role" : "circular"
},
{
"idiom" : "watch",
"filename" : "Extra Large.imageset",
"role" : "extra-large"
},
{
"idiom" : "watch",
"filename" : "Modular.imageset",
"role" : "modular"
},
{
"idiom" : "watch",
"filename" : "Utilitarian.imageset",
"role" : "utilitarian"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "watch",
"screenWidth" : "{130,145}",
"scale" : "2x"
},
{
"idiom" : "watch",
"screenWidth" : "{146,165}",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "watch",
"screenWidth" : "{130,145}",
"scale" : "2x"
},
{
"idiom" : "watch",
"screenWidth" : "{146,165}",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "watch",
"screenWidth" : "{130,145}",
"scale" : "2x"
},
{
"idiom" : "watch",
"screenWidth" : "{146,165}",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,42 @@
import WatchKit
class ExtensionDelegate: NSObject, WKExtensionDelegate {
func applicationDidFinishLaunching() {
// Perform any final initialization of your application.
}
func applicationDidBecomeActive() {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillResignActive() {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, etc.
}
func handle(_ backgroundTasks: Set<WKRefreshBackgroundTask>) {
// Sent when the system needs to launch the application in the background to process tasks. Tasks arrive in a set, so loop through and process each one.
for task in backgroundTasks {
// Use a switch statement to check the task type
switch task {
case let backgroundTask as WKApplicationRefreshBackgroundTask:
// Be sure to complete the background task once you’re done.
backgroundTask.setTaskCompleted()
case let snapshotTask as WKSnapshotRefreshBackgroundTask:
// Snapshot tasks have a unique completion call, make sure to set your expiration date
snapshotTask.setTaskCompleted(restoredDefaultState: true, estimatedSnapshotExpiration: Date.distantFuture, userInfo: nil)
case let connectivityTask as WKWatchConnectivityRefreshBackgroundTask:
// Be sure to complete the connectivity task once you’re done.
connectivityTask.setTaskCompleted()
case let urlSessionTask as WKURLSessionRefreshBackgroundTask:
// Be sure to complete the URL session task once you’re done.
urlSessionTask.setTaskCompleted()
default:
// make sure to complete unhandled task types
task.setTaskCompleted()
}
}
}
}
@@ -4,6 +4,8 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>GRDBDemoWatchOS Extension</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
@@ -13,12 +15,22 @@
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>WKAppBundleIdentifier</key>
<string>com.github.groue.GRDBDemoiOS.watchkitapp</string>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.watchkit</string>
</dict>
<key>WKExtensionDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).ExtensionDelegate</string>
</dict>
</plist>
@@ -0,0 +1,16 @@
import WatchKit
import Foundation
import GRDB
import SQLite3
class InterfaceController: WKInterfaceController {
@IBOutlet var versionLabel: WKInterfaceLabel!
override func awake(withContext context: Any?) {
super.awake(withContext: context)
let sqliteVersion = String(cString: sqlite3_libversion(), encoding: .utf8)
versionLabel.setText(sqliteVersion)
}
}
@@ -0,0 +1,55 @@
{
"images" : [
{
"size" : "24x24",
"idiom" : "watch",
"scale" : "2x",
"role" : "notificationCenter",
"subtype" : "38mm"
},
{
"size" : "27.5x27.5",
"idiom" : "watch",
"scale" : "2x",
"role" : "notificationCenter",
"subtype" : "42mm"
},
{
"size" : "29x29",
"idiom" : "watch",
"role" : "companionSettings",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "watch",
"role" : "companionSettings",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "watch",
"scale" : "2x",
"role" : "appLauncher",
"subtype" : "38mm"
},
{
"size" : "86x86",
"idiom" : "watch",
"scale" : "2x",
"role" : "quickLook",
"subtype" : "38mm"
},
{
"size" : "98x98",
"idiom" : "watch",
"scale" : "2x",
"role" : "quickLook",
"subtype" : "42mm"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="12118" systemVersion="16E195" targetRuntime="watchKit" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="AgC-eL-Hgc">
<device id="watch38" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="watchOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="12029"/>
</dependencies>
<scenes>
<!--Interface Controller-->
<scene sceneID="aou-V4-d1y">
<objects>
<controller id="AgC-eL-Hgc" customClass="InterfaceController" customModule="GRDBDemoWatchOS" customModuleProvider="target">
<items>
<group width="1" alignment="left" verticalAlignment="center" layout="vertical" id="tkk-aG-QQF">
<items>
<label alignment="center" text="SQLite version" id="dGA-xX-x8V"/>
<label alignment="center" text="Label" id="whi-N6-h8U"/>
</items>
</group>
</items>
<connections>
<outlet property="versionLabel" destination="whi-N6-h8U" id="5xN-Gj-yNt"/>
</connections>
</controller>
</objects>
</scene>
</scenes>
</document>
@@ -4,6 +4,8 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>GRDBDemoiOS</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
@@ -13,12 +15,19 @@
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>WKCompanionAppBundleIdentifier</key>
<string>com.github.groue.GRDBDemoiOS</string>
<key>WKWatchKitApp</key>
<true/>
</dict>
</plist>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "568E5FBE1E926430002582E0"
BuildableName = "GRDBDemoWatchOS.app"
BlueprintName = "GRDBDemoWatchOS"
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "56B036021E8D9EBE003B6DA4"
BuildableName = "GRDBDemoiOS.app"
BlueprintName = "GRDBDemoiOS"
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "568E5FCA1E926430002582E0"
BuildableName = "GRDBDemoWatchOS Extension.appex"
BlueprintName = "GRDBDemoWatchOS Extension"
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "568E5FBE1E926430002582E0"
BuildableName = "GRDBDemoWatchOS.app"
BlueprintName = "GRDBDemoWatchOS"
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.carousel"
RemotePath = "/GRDBDemoiOS">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "568E5FBE1E926430002582E0"
BuildableName = "GRDBDemoWatchOS.app"
BlueprintName = "GRDBDemoWatchOS"
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
</BuildableReference>
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "568E5FBE1E926430002582E0"
BuildableName = "GRDBDemoWatchOS.app"
BlueprintName = "GRDBDemoWatchOS"
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.carousel"
RemotePath = "/GRDBDemoiOS">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "568E5FBE1E926430002582E0"
BuildableName = "GRDBDemoWatchOS.app"
BlueprintName = "GRDBDemoWatchOS"
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
</BuildableReference>
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "568E5FBE1E926430002582E0"
BuildableName = "GRDBDemoWatchOS.app"
BlueprintName = "GRDBDemoWatchOS"
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "56B036021E8D9EBE003B6DA4"
BuildableName = "GRDBDemoiOS.app"
BlueprintName = "GRDBDemoiOS"
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "56B036021E8D9EBE003B6DA4"
BuildableName = "GRDBDemoiOS.app"
BlueprintName = "GRDBDemoiOS"
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "56B036021E8D9EBE003B6DA4"
BuildableName = "GRDBDemoiOS.app"
BlueprintName = "GRDBDemoiOS"
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "56B036021E8D9EBE003B6DA4"
BuildableName = "GRDBDemoiOS.app"
BlueprintName = "GRDBDemoiOS"
ReferencedContainer = "container:GRDBDemoiOS.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -1,63 +1,11 @@
import UIKit
import GRDB
// The shared database queue, stored in a global.
// It is created in AppDelegate.application(_:didFinishLaunchingWithOptions:)
var dbQueue: DatabaseQueue!
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Connect to the database
let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).first! as NSString
let databasePath = documentsPath.stringByAppendingPathComponent("db.sqlite")
dbQueue = try! DatabaseQueue(path: databasePath)
// Use DatabaseMigrator to setup the database
var migrator = DatabaseMigrator()
migrator.registerMigration("createPersons") { db in
try db.execute(
"CREATE TABLE persons (" +
"id INTEGER PRIMARY KEY, " +
"firstName TEXT, " +
"lastName TEXT " +
")")
}
migrator.registerMigration("addPersons") { db in
try Person(firstName: "Arthur", lastName: "Miller").insert(db)
try Person(firstName: "Barbara", lastName: "Streisand").insert(db)
try Person(firstName: "Cinderella").insert(db)
}
try! migrator.migrate(dbQueue)
// Setup view controllers
let splitViewController = self.window!.rootViewController as! UISplitViewController
let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController
navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem()
splitViewController.delegate = self
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
try! setupDatabase(application)
return true
}
// MARK: - Split view
func splitViewController(splitViewController: UISplitViewController, collapseSecondaryViewController secondaryViewController:UIViewController, ontoPrimaryViewController primaryViewController:UIViewController) -> Bool {
guard let secondaryAsNavController = secondaryViewController as? UINavigationController else { return false }
guard let topAsDetailController = secondaryAsNavController.topViewController as? DetailViewController else { return false }
if topAsDetailController.person == nil {
// Return true to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded.
return true
}
return false
}
}
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
@@ -21,15 +31,27 @@
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-60@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-60@3x.png",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
@@ -59,6 +81,11 @@
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
}
],
"info" : {
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
</dependencies>
<scenes>
<!--View Controller-->
@@ -16,29 +15,8 @@
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright © 2015 Gwendal Roué. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
<rect key="frame" x="20" y="559" width="560" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="GRDBDemoiOS" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
<rect key="frame" x="20" y="180" width="560" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="obG-Y5-kRd" secondAttribute="centerX" id="5cz-MP-9tL"/>
<constraint firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
<constraint firstItem="obG-Y5-kRd" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" constant="20" symbolic="YES" id="SfN-ll-jLj"/>
<constraint firstAttribute="bottom" secondItem="obG-Y5-kRd" secondAttribute="bottom" constant="20" id="Y44-ml-fuU"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" constant="20" symbolic="YES" id="x7j-FC-K8j"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -1,131 +1,114 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="H1p-Uh-vWS">
<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>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
<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>
<!--Master-->
<scene sceneID="pY4-Hu-kfo">
<!--Hall Of Fame-->
<scene sceneID="8jG-C9-QsI">
<objects>
<navigationController title="Master" id="RMx-3f-FxP" sceneMemberID="viewController">
<navigationBar key="navigationBar" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="Pmd-2v-anx">
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="7bK-jq-Zjz" kind="relationship" relationship="rootViewController" id="tsl-Nk-0bq"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="8fS-aE-onr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-38" y="-630"/>
</scene>
<!--Detail-->
<scene sceneID="yUG-lL-AsK">
<objects>
<viewController title="Detail" id="JEX-9P-axG" customClass="DetailViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="SYR-Wa-9uf"/>
<viewControllerLayoutGuide type="bottom" id="GAO-Cl-Wes"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="svH-Pt-448">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<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"/>
<subviews>
<label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="Detail view content goes here" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="0XM-y9-sOw">
<rect key="frame" x="20" y="292" width="560" height="17"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" size="system"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="0XM-y9-sOw" firstAttribute="leading" secondItem="svH-Pt-448" secondAttribute="leading" constant="20" symbolic="YES" id="Tsc-yG-G1q"/>
<constraint firstItem="0XM-y9-sOw" firstAttribute="centerY" secondItem="svH-Pt-448" secondAttribute="centerY" id="jWN-iV-94e"/>
<constraint firstAttribute="trailing" secondItem="0XM-y9-sOw" secondAttribute="trailing" constant="20" symbolic="YES" id="tHV-ZD-HQj"/>
</constraints>
</view>
<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="Detail" id="mOI-FS-AaM"/>
<navigationItem key="navigationItem" title="Hall Of Fame" id="YLU-iz-PGw"/>
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
<connections>
<outlet property="detailDescriptionLabel" destination="0XM-y9-sOw" id="deQ-Na-JPF"/>
<segue destination="ein-Sr-i8w" kind="presentation" identifier="NewPerson" id="zii-bJ-cOA"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="FJe-Yq-33r" sceneMemberID="firstResponder"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="PrM-ex-2C8" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="709" y="129"/>
<point key="canvasLocation" x="630" y="640"/>
</scene>
<!--Person Edition View Controller-->
<scene sceneID="hZT-8U-F5G">
<scene sceneID="Juk-Ad-tZ2">
<objects>
<tableViewController id="yMU-Wr-YuI" customClass="PersonEditionViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="W7Z-fg-c9y">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<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" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<sections>
<tableViewSection id="jAm-13-xC3">
<tableViewSection id="Nzq-eO-jT3">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="M9a-av-50p">
<rect key="frame" x="0.0" y="99" width="600" height="44"/>
<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="M9a-av-50p" id="z18-Cs-DYr">
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
<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" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="right" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="BDD-vR-uvL">
<rect key="frame" x="106" y="11" width="479" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<textInputTraits key="textInputTraits" autocapitalizationType="words" autocorrectionType="no" spellCheckingType="no"/>
<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="yMU-Wr-YuI" id="kl9-oG-bcm"/>
<outlet property="delegate" destination="iNr-Oe-muq" id="K2p-7d-teD"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="1000" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" text="First Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fUF-iv-npM">
<rect key="frame" x="15" y="11" width="83" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.1137254902" green="0.47843137250000001" blue="0.98039215690000003" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="BDD-vR-uvL" firstAttribute="centerY" secondItem="z18-Cs-DYr" secondAttribute="centerY" id="9Rw-U2-gEE"/>
<constraint firstAttribute="trailing" secondItem="BDD-vR-uvL" secondAttribute="trailing" constant="15" id="nQF-Sy-r5l"/>
<constraint firstItem="fUF-iv-npM" firstAttribute="centerY" secondItem="z18-Cs-DYr" secondAttribute="centerY" id="ofb-oL-lAk"/>
<constraint firstItem="BDD-vR-uvL" firstAttribute="leading" secondItem="fUF-iv-npM" secondAttribute="trailing" constant="8" symbolic="YES" id="pL4-Tm-5q7"/>
<constraint firstItem="fUF-iv-npM" firstAttribute="leading" secondItem="z18-Cs-DYr" secondAttribute="leading" constant="15" id="tBn-VL-Q7E"/>
<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="TEu-C2-7tX">
<rect key="frame" x="0.0" y="143" width="600" height="44"/>
<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="TEu-C2-7tX" id="awh-JA-Hz6">
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
<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" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="right" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="iqx-ux-kA0">
<rect key="frame" x="105" y="11" width="480" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<textInputTraits key="textInputTraits" autocapitalizationType="words" autocorrectionType="no" spellCheckingType="no"/>
<connections>
<outlet property="delegate" destination="yMU-Wr-YuI" id="pIN-qZ-ntI"/>
</connections>
<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>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="1000" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" text="Last Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7dD-VT-wdQ">
<rect key="frame" x="15" y="11" width="82" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.1137254902" green="0.47843137250000001" blue="0.98039215690000003" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="iqx-ux-kA0" secondAttribute="trailing" constant="15" id="UVH-DD-pHC"/>
<constraint firstItem="7dD-VT-wdQ" firstAttribute="centerY" secondItem="awh-JA-Hz6" secondAttribute="centerY" id="Vwn-I3-e7h"/>
<constraint firstItem="iqx-ux-kA0" firstAttribute="centerY" secondItem="awh-JA-Hz6" secondAttribute="centerY" id="VzL-HK-apN"/>
<constraint firstItem="iqx-ux-kA0" firstAttribute="leading" secondItem="7dD-VT-wdQ" secondAttribute="trailing" constant="8" symbolic="YES" id="fDY-Ju-iSw"/>
<constraint firstItem="7dD-VT-wdQ" firstAttribute="leading" secondItem="awh-JA-Hz6" secondAttribute="leading" constant="15" id="j64-an-fjP"/>
<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>
@@ -133,129 +116,195 @@
</tableViewSection>
</sections>
<connections>
<outlet property="dataSource" destination="yMU-Wr-YuI" id="fDY-MJ-pJo"/>
<outlet property="delegate" destination="yMU-Wr-YuI" id="Un1-A3-CJp"/>
<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="Rwz-Rp-lmd">
<barButtonItem key="rightBarButtonItem" style="done" systemItem="done" id="NJu-k4-mIi">
<navigationItem key="navigationItem" id="U4g-xG-W8b">
<barButtonItem key="leftBarButtonItem" systemItem="cancel" id="VIN-Hi-Twt">
<connections>
<segue destination="FMm-Lo-i3b" kind="unwind" identifier="commit" unwindAction="commitPersonEdition:" id="dkC-cp-6iC"/>
<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="firstNameTableViewCell" destination="M9a-av-50p" id="vXh-ik-bqv"/>
<outlet property="firstNameTextField" destination="BDD-vR-uvL" id="BYU-BL-kha"/>
<outlet property="lastNameTableViewCell" destination="TEu-C2-7tX" id="wDv-if-Gkl"/>
<outlet property="lastNameTextField" destination="iqx-ux-kA0" id="wOu-gU-WlV"/>
<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="23u-wY-35e" userLabel="First Responder" sceneMemberID="firstResponder"/>
<exit id="FMm-Lo-i3b" userLabel="Exit" sceneMemberID="exit"/>
<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="2301" y="-630"/>
<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="GQC-vK-8JG">
<scene sceneID="2KX-IU-Z5Q">
<objects>
<navigationController id="IJV-AU-xKl" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="y7A-ea-ZFU">
<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="yMU-Wr-YuI" kind="relationship" relationship="rootViewController" id="1PW-hN-E5f"/>
<segue destination="iNr-Oe-muq" kind="relationship" relationship="rootViewController" id="e5b-3U-9Vz"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="4jR-xV-SBm" userLabel="First Responder" sceneMemberID="firstResponder"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="kNr-vk-I5l" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1481" y="-630"/>
</scene>
<!--Split View Controller-->
<scene sceneID="Nki-YV-4Qg">
<objects>
<splitViewController id="H1p-Uh-vWS" sceneMemberID="viewController">
<toolbarItems/>
<connections>
<segue destination="RMx-3f-FxP" kind="relationship" relationship="masterViewController" id="BlO-5A-QYV"/>
<segue destination="vC3-pB-5Vb" kind="relationship" relationship="detailViewController" id="Tll-UG-LXB"/>
</connections>
</splitViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="cZU-Oi-B1e" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-856" y="-330"/>
</scene>
<!--Master-->
<scene sceneID="smW-Zh-WAh">
<objects>
<tableViewController title="Master" clearsSelectionOnViewWillAppear="NO" id="7bK-jq-Zjz" customClass="MasterViewController" customModule="GRDBDemoiOS" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="r7i-6Z-zg0">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="Arm-wq-HPj" style="IBUITableViewCellStyleDefault" id="WCw-Qf-5nD">
<rect key="frame" x="0.0" y="86" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="WCw-Qf-5nD" id="37f-cq-3Eg">
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Arm-wq-HPj">
<rect key="frame" x="15" y="0.0" width="570" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</label>
</subviews>
</tableViewCellContentView>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<connections>
<segue destination="vC3-pB-5Vb" kind="showDetail" identifier="showPerson" id="vhz-QC-pld"/>
</connections>
</tableViewCell>
</prototypes>
<sections/>
<connections>
<outlet property="dataSource" destination="7bK-jq-Zjz" id="Gho-Na-rnu"/>
<outlet property="delegate" destination="7bK-jq-Zjz" id="RA6-mI-bju"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="Master" id="Zdf-7t-Un8">
<barButtonItem key="rightBarButtonItem" systemItem="add" id="q2y-Jp-QNL">
<connections>
<segue destination="IJV-AU-xKl" kind="popoverPresentation" identifier="editNewPerson" popoverAnchorBarButtonItem="q2y-Jp-QNL" id="KcV-Yc-DEu">
<popoverArrowDirection key="popoverArrowDirection" up="YES" down="YES" left="YES" right="YES"/>
</segue>
</connections>
</barButtonItem>
</navigationItem>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Rux-fX-hf1" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="709" y="-630"/>
<point key="canvasLocation" x="630" y="1435"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="r7l-gg-dq7">
<scene sceneID="N1X-4j-Re4">
<objects>
<navigationController id="vC3-pB-5Vb" sceneMemberID="viewController">
<navigationBar key="navigationBar" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="DjV-YW-jjY">
<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="JEX-9P-axG" kind="relationship" relationship="rootViewController" id="GKi-kA-LjT"/>
<segue destination="9kw-c5-KTk" kind="relationship" relationship="rootViewController" id="qDW-qI-Hyg"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="SLD-UC-DBI" userLabel="First Responder" sceneMemberID="firstResponder"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="sVt-e9-ghQ" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-45" y="129"/>
<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="vhz-QC-pld"/>
<segue reference="7PC-xN-zD4"/>
<segue reference="czF-1h-sYn"/>
</inferredMetricsTieBreakers>
</document>
@@ -0,0 +1,56 @@
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)
}
@@ -0,0 +1,10 @@
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)
}
}
@@ -1,24 +0,0 @@
import UIKit
class DetailViewController: UIViewController {
@IBOutlet weak var detailDescriptionLabel: UILabel!
var person: Person! {
didSet {
self.configureView()
}
}
func configureView() {
guard isViewLoaded() else {
return
}
detailDescriptionLabel.text = person.fullName
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
configureView()
}
}
Binary file not shown.
+2 -21
View File
@@ -4,6 +4,8 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>GRDB Demo</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
@@ -16,8 +18,6 @@
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
@@ -30,28 +30,9 @@
<array>
<string>armv7</string>
</array>
<key>UIStatusBarTintParameters</key>
<dict>
<key>UINavigationBar</key>
<dict>
<key>Style</key>
<string>UIBarStyleDefault</string>
<key>Translucent</key>
<false/>
</dict>
</dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
@@ -1,96 +0,0 @@
import UIKit
class MasterViewController: UITableViewController {
var detailViewController: DetailViewController? = nil
var persons = [Person]()
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.leftBarButtonItem = self.editButtonItem()
if let split = self.splitViewController {
let controllers = split.viewControllers
self.detailViewController = (controllers[controllers.count-1] as! UINavigationController).topViewController as? DetailViewController
}
}
override func viewWillAppear(animated: Bool) {
// Reload persons, and the tableView
reloadPersons()
tableView.reloadData()
self.clearsSelectionOnViewWillAppear = self.splitViewController!.collapsed
super.viewWillAppear(animated)
}
func reloadPersons() {
persons = dbQueue.inDatabase { db in
Person.fetchAll(db, "SELECT * FROM persons ORDER BY LOWER(firstName), LOWER(lastName)")
}
}
// MARK: - Segues
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "showPerson" {
let detailViewController = (segue.destinationViewController as! UINavigationController).topViewController as! DetailViewController
detailViewController.person = persons[self.tableView.indexPathForSelectedRow!.row]
detailViewController.navigationItem.leftBarButtonItem = self.splitViewController?.displayModeButtonItem()
detailViewController.navigationItem.leftItemsSupplementBackButton = true
}
else if segue.identifier == "editNewPerson" {
let personEditionViewController = (segue.destinationViewController as! UINavigationController).topViewController as! PersonEditionViewController
personEditionViewController.person = Person()
}
}
// Unwind action: commit person edition
@IBAction func commitPersonEdition(segue: UIStoryboardSegue) {
let personEditionViewController = segue.sourceViewController as! PersonEditionViewController
let person = personEditionViewController.person
// Ignore person with no name
guard (person.firstName ?? "").characters.count > 0 || (person.lastName ?? "").characters.count > 0 else {
return
}
// Save person
try! dbQueue.inDatabase { db in
try person.save(db)
}
// Reload persons, and insert a cell.
reloadPersons()
let index = persons.indexOf { $0.id == person.id }!
tableView.insertRowsAtIndexPaths([NSIndexPath(forRow: index, inSection: 0)], withRowAnimation: .Automatic)
}
// MARK: - Table View
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return persons.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
let person = persons[indexPath.row]
cell.textLabel!.text = person.fullName
return cell
}
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
// Delete the person
let person = persons[indexPath.row]
try! dbQueue.inTransaction { db in
try person.delete(db)
return .Commit
}
persons.removeAtIndex(indexPath.row)
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)
}
}
+35 -26
View File
@@ -1,40 +1,49 @@
import GRDB
class Person : Record {
var id: Int64!
var firstName: String?
var lastName: String?
var fullName: String {
return [firstName, lastName].flatMap { $0 }.joinWithSeparator(" ")
}
class Person: Record {
var id: Int64?
var name: String
var score: Int
init(firstName: String? = nil, lastName: String? = nil) {
self.firstName = firstName
self.lastName = lastName
init(name: String, score: Int) {
self.name = name
self.score = score
super.init()
}
// MARK: - Record
// MARK: Record overrides
override class func databaseTableName() -> String? {
override class var databaseTableName: String {
return "persons"
}
override func updateFromRow(row: Row) {
if let dbv = row["id"] { id = dbv.value() }
if let dbv = row["firstName"] { firstName = dbv.value() }
if let dbv = row["lastName"] { lastName = dbv.value() }
super.updateFromRow(row) // Subclasses are required to call super.
}
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
return [
"id": id,
"firstName": firstName,
"lastName": lastName]
}
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,61 +1,104 @@
import UIKit
class PersonEditionViewController: UITableViewController, UITextFieldDelegate {
@IBOutlet weak var firstNameTableViewCell: UITableViewCell!
@IBOutlet weak var firstNameTextField: UITextField!
@IBOutlet weak var lastNameTableViewCell: UITableViewCell!
@IBOutlet weak var lastNameTextField: UITextField!
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() } }
@IBOutlet fileprivate weak var cancelBarButtonItem: UIBarButtonItem!
@IBOutlet fileprivate weak var commitBarButtonItem: UIBarButtonItem!
@IBOutlet fileprivate weak var nameCell: UITableViewCell!
@IBOutlet fileprivate weak var nameTextField: UITextField!
@IBOutlet fileprivate weak var scoreCell: UITableViewCell!
@IBOutlet fileprivate weak var scoreTextField: UITextField!
// The edited person
var person: Person!
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()
// Initializes textFields with the person's names
firstNameTextField.text = person.firstName
lastNameTextField.text = person.lastName
configureView()
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
private func configureView() {
guard isViewLoaded else { return }
// Auto focus firstName
firstNameTextField.becomeFirstResponder()
nameTextField.text = person.name
if person.score == 0 && person.id == nil {
scoreTextField.text = ""
} else {
scoreTextField.text = "\(person.score)"
}
if cancelButtonHidden {
navigationItem.leftBarButtonItem = nil
} else {
navigationItem.leftBarButtonItem = cancelBarButtonItem
}
if cancelButtonHidden {
navigationItem.rightBarButtonItem = nil
} else {
navigationItem.rightBarButtonItem = commitBarButtonItem
}
}
}
// MARK: - Navigation
extension PersonEditionViewController {
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
// Force keyboard to dismiss early
view.endEditing(true)
return true
}
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
// Tapping a cell selects its text fields.
if indexPath == tableView.indexPathForCell(firstNameTableViewCell) {
firstNameTextField.becomeFirstResponder()
} else if indexPath == tableView.indexPathForCell(lastNameTableViewCell) {
lastNameTextField.becomeFirstResponder()
override func willMove(toParentViewController parent: UIViewController?) {
super.willMove(toParentViewController: parent)
if parent == nil {
// Self is popping from its navigation controller
delegate?.personEditionControllerDidComplete(self)
}
}
func textFieldShouldReturn(textField: UITextField) -> Bool {
// Tapping Return key focuses next text field.
if textField == firstNameTextField {
lastNameTextField.becomeFirstResponder()
} else {
textField.resignFirstResponder()
}
// MARK: - Form
extension PersonEditionViewController: UITextFieldDelegate {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
nameTextField.becomeFirstResponder()
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: false)
let cell = tableView.cellForRow(at: indexPath)
if cell === nameCell {
nameTextField.becomeFirstResponder()
} else if cell === scoreCell {
scoreTextField.becomeFirstResponder()
}
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
if textField == nameTextField {
scoreTextField.becomeFirstResponder()
}
return false
}
func textFieldDidEndEditing(textField: UITextField) {
// Update person when text field ends editing.
if textField == firstNameTextField {
person.firstName = textField.text
} else if textField == lastNameTextField {
person.lastName = textField.text
}
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// About to cancel or commit: end editing.
// This dismisses the keyboard early, and apply pending changes through
// textFieldDidEndEditing(_).
view.endEditing(true)
}
}
@@ -0,0 +1,234 @@
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"))
@@ -0,0 +1,114 @@
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)
}
}
-35
View File
@@ -1,35 +0,0 @@
GRDBDemoiOS
===========
This application runs an universal (iPhone + iPad) application that displays an editable list of persons.
**To manually integrate GRDB as a Framework in your iOS application:**
1. Drag the [GRDB project](../../GRDB.xcodeproj) in your own project.
2. In the **Build Phase** tab of your target, add `GRDBiOS` in the **Target Dependencies** section.
3. In the **Embedded Binaries** section of the **General** tab of your target, add GRDB.xcodeproj/Products/GRDB.framework (iOS).
4. Run.
**To see usage of GRDB, check the following files:**
- [AppDelegate.swift](GRDBDemoiOS/AppDelegate.swift)
AppDelegate sets up a global dbQueue that is accessible in the whole application.
It uses migrations to initialize the database.
- [MasterViewController.swift](GRDBDemoiOS/MasterViewController.swift)
MasterViewController is responsible for displaying the list of persons in a table view, deleting persons, and present a person edition form.
- [Person.swift](GRDBDemoiOS/Person.swift)
Person is a simple Record subclass.
- [DetailViewController.swift](GRDBDemoiOS/DetailViewController.swift) and [PersonEditionViewController.swift](GRDBDemoiOS/PersonEditionViewController.swift)
Those two view controllers display and edit a Person, in total isolation from the database.
@@ -1,526 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
562FF9951BCE8FA400759400 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9941BCE8FA400759400 /* AppDelegate.swift */; };
562FF9971BCE8FA400759400 /* PersonsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9961BCE8FA400759400 /* PersonsViewController.swift */; };
562FF99A1BCE8FA400759400 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 562FF9981BCE8FA400759400 /* Main.storyboard */; };
562FF99C1BCE8FA400759400 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 562FF99B1BCE8FA400759400 /* Assets.xcassets */; };
562FF99F1BCE8FA400759400 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 562FF99D1BCE8FA400759400 /* LaunchScreen.storyboard */; };
562FF9CD1BCE902400759400 /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9AA1BCE902400759400 /* Configuration.swift */; settings = {ASSET_TAGS = (); }; };
562FF9CE1BCE902400759400 /* Database.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9AB1BCE902400759400 /* Database.swift */; settings = {ASSET_TAGS = (); }; };
562FF9CF1BCE902400759400 /* DatabaseChanges.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9AC1BCE902400759400 /* DatabaseChanges.swift */; settings = {ASSET_TAGS = (); }; };
562FF9D01BCE902400759400 /* DatabaseError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9AD1BCE902400759400 /* DatabaseError.swift */; settings = {ASSET_TAGS = (); }; };
562FF9D11BCE902400759400 /* DatabaseQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9AE1BCE902400759400 /* DatabaseQueue.swift */; settings = {ASSET_TAGS = (); }; };
562FF9D21BCE902400759400 /* DatabaseValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9AF1BCE902400759400 /* DatabaseValue.swift */; settings = {ASSET_TAGS = (); }; };
562FF9D31BCE902400759400 /* DatabaseTableMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9B11BCE902400759400 /* DatabaseTableMapping.swift */; settings = {ASSET_TAGS = (); }; };
562FF9D41BCE902400759400 /* DatabaseValueConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9B21BCE902400759400 /* DatabaseValueConvertible.swift */; settings = {ASSET_TAGS = (); }; };
562FF9D51BCE902400759400 /* RowConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9B31BCE902400759400 /* RowConvertible.swift */; settings = {ASSET_TAGS = (); }; };
562FF9D61BCE902400759400 /* SQLiteStatementConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9B41BCE902400759400 /* SQLiteStatementConvertible.swift */; settings = {ASSET_TAGS = (); }; };
562FF9D71BCE902400759400 /* Row.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9B51BCE902400759400 /* Row.swift */; settings = {ASSET_TAGS = (); }; };
562FF9D81BCE902400759400 /* SelectStatement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9B61BCE902400759400 /* SelectStatement.swift */; settings = {ASSET_TAGS = (); }; };
562FF9D91BCE902400759400 /* Statement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9B71BCE902400759400 /* Statement.swift */; settings = {ASSET_TAGS = (); }; };
562FF9DA1BCE902400759400 /* StatementArguments.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9B81BCE902400759400 /* StatementArguments.swift */; settings = {ASSET_TAGS = (); }; };
562FF9DB1BCE902400759400 /* UpdateStatement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9B91BCE902400759400 /* UpdateStatement.swift */; settings = {ASSET_TAGS = (); }; };
562FF9DC1BCE902400759400 /* DatabaseDateComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9BB1BCE902400759400 /* DatabaseDateComponents.swift */; settings = {ASSET_TAGS = (); }; };
562FF9DD1BCE902400759400 /* NSData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9BC1BCE902400759400 /* NSData.swift */; settings = {ASSET_TAGS = (); }; };
562FF9DE1BCE902400759400 /* NSDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9BD1BCE902400759400 /* NSDate.swift */; settings = {ASSET_TAGS = (); }; };
562FF9DF1BCE902400759400 /* NSNull.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9BE1BCE902400759400 /* NSNull.swift */; settings = {ASSET_TAGS = (); }; };
562FF9E01BCE902400759400 /* NSNumber.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9BF1BCE902400759400 /* NSNumber.swift */; settings = {ASSET_TAGS = (); }; };
562FF9E11BCE902400759400 /* NSString.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9C01BCE902400759400 /* NSString.swift */; settings = {ASSET_TAGS = (); }; };
562FF9E21BCE902400759400 /* NSURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9C11BCE902400759400 /* NSURL.swift */; settings = {ASSET_TAGS = (); }; };
562FF9E31BCE902400759400 /* Row+Foundation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9C21BCE902400759400 /* Row+Foundation.swift */; settings = {ASSET_TAGS = (); }; };
562FF9E41BCE902400759400 /* RowConvertible+Foundation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9C31BCE902400759400 /* RowConvertible+Foundation.swift */; settings = {ASSET_TAGS = (); }; };
562FF9E51BCE902400759400 /* StatementArguments+Foundation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9C41BCE902400759400 /* StatementArguments+Foundation.swift */; settings = {ASSET_TAGS = (); }; };
562FF9E61BCE902400759400 /* DatabaseMigrator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9C61BCE902400759400 /* DatabaseMigrator.swift */; settings = {ASSET_TAGS = (); }; };
562FF9E71BCE902400759400 /* DatabaseStorable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9C81BCE902400759400 /* DatabaseStorable.swift */; settings = {ASSET_TAGS = (); }; };
562FF9E81BCE902400759400 /* Record.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9C91BCE902400759400 /* Record.swift */; settings = {ASSET_TAGS = (); }; };
562FF9E91BCE902400759400 /* RawRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9CB1BCE902400759400 /* RawRepresentable.swift */; settings = {ASSET_TAGS = (); }; };
562FF9EA1BCE902400759400 /* StandardLibraryTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9CC1BCE902400759400 /* StandardLibraryTypes.swift */; settings = {ASSET_TAGS = (); }; };
562FF9EC1BCE903D00759400 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 562FF9EB1BCE903D00759400 /* libsqlite3.tbd */; };
562FF9EF1BCE912C00759400 /* PersonEditionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9EE1BCE912C00759400 /* PersonEditionViewController.swift */; settings = {ASSET_TAGS = (); }; };
562FF9F21BCE914E00759400 /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = 562FF9F11BCE914E00759400 /* Person.swift */; settings = {ASSET_TAGS = (); }; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
562FF9911BCE8FA400759400 /* GRDBDemoiOS7.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GRDBDemoiOS7.app; sourceTree = BUILT_PRODUCTS_DIR; };
562FF9941BCE8FA400759400 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
562FF9961BCE8FA400759400 /* PersonsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersonsViewController.swift; sourceTree = "<group>"; };
562FF9991BCE8FA400759400 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
562FF99B1BCE8FA400759400 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
562FF99E1BCE8FA400759400 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
562FF9A01BCE8FA400759400 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
562FF9AA1BCE902400759400 /* Configuration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Configuration.swift; sourceTree = "<group>"; };
562FF9AB1BCE902400759400 /* Database.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Database.swift; sourceTree = "<group>"; };
562FF9AC1BCE902400759400 /* DatabaseChanges.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseChanges.swift; sourceTree = "<group>"; };
562FF9AD1BCE902400759400 /* DatabaseError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseError.swift; sourceTree = "<group>"; };
562FF9AE1BCE902400759400 /* DatabaseQueue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseQueue.swift; sourceTree = "<group>"; };
562FF9AF1BCE902400759400 /* DatabaseValue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseValue.swift; sourceTree = "<group>"; };
562FF9B11BCE902400759400 /* DatabaseTableMapping.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseTableMapping.swift; sourceTree = "<group>"; };
562FF9B21BCE902400759400 /* DatabaseValueConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseValueConvertible.swift; sourceTree = "<group>"; };
562FF9B31BCE902400759400 /* RowConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RowConvertible.swift; sourceTree = "<group>"; };
562FF9B41BCE902400759400 /* SQLiteStatementConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLiteStatementConvertible.swift; sourceTree = "<group>"; };
562FF9B51BCE902400759400 /* Row.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Row.swift; sourceTree = "<group>"; };
562FF9B61BCE902400759400 /* SelectStatement.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelectStatement.swift; sourceTree = "<group>"; };
562FF9B71BCE902400759400 /* Statement.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Statement.swift; sourceTree = "<group>"; };
562FF9B81BCE902400759400 /* StatementArguments.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatementArguments.swift; sourceTree = "<group>"; };
562FF9B91BCE902400759400 /* UpdateStatement.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UpdateStatement.swift; sourceTree = "<group>"; };
562FF9BB1BCE902400759400 /* DatabaseDateComponents.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseDateComponents.swift; sourceTree = "<group>"; };
562FF9BC1BCE902400759400 /* NSData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSData.swift; sourceTree = "<group>"; };
562FF9BD1BCE902400759400 /* NSDate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSDate.swift; sourceTree = "<group>"; };
562FF9BE1BCE902400759400 /* NSNull.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSNull.swift; sourceTree = "<group>"; };
562FF9BF1BCE902400759400 /* NSNumber.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSNumber.swift; sourceTree = "<group>"; };
562FF9C01BCE902400759400 /* NSString.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSString.swift; sourceTree = "<group>"; };
562FF9C11BCE902400759400 /* NSURL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSURL.swift; sourceTree = "<group>"; };
562FF9C21BCE902400759400 /* Row+Foundation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Row+Foundation.swift"; sourceTree = "<group>"; };
562FF9C31BCE902400759400 /* RowConvertible+Foundation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "RowConvertible+Foundation.swift"; sourceTree = "<group>"; };
562FF9C41BCE902400759400 /* StatementArguments+Foundation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "StatementArguments+Foundation.swift"; sourceTree = "<group>"; };
562FF9C61BCE902400759400 /* DatabaseMigrator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseMigrator.swift; sourceTree = "<group>"; };
562FF9C81BCE902400759400 /* DatabaseStorable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseStorable.swift; sourceTree = "<group>"; };
562FF9C91BCE902400759400 /* Record.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Record.swift; sourceTree = "<group>"; };
562FF9CB1BCE902400759400 /* RawRepresentable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RawRepresentable.swift; sourceTree = "<group>"; };
562FF9CC1BCE902400759400 /* StandardLibraryTypes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StandardLibraryTypes.swift; sourceTree = "<group>"; };
562FF9EB1BCE903D00759400 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; };
562FF9EE1BCE912C00759400 /* PersonEditionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PersonEditionViewController.swift; sourceTree = "<group>"; };
562FF9F11BCE914E00759400 /* Person.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Person.swift; sourceTree = "<group>"; };
562FF9F41BCE930C00759400 /* GRDBDemoiOS7-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "GRDBDemoiOS7-Bridging-Header.h"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
562FF98E1BCE8FA400759400 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
562FF9EC1BCE903D00759400 /* libsqlite3.tbd in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
562FF9881BCE8FA400759400 = {
isa = PBXGroup;
children = (
562FF9931BCE8FA400759400 /* GRDBDemoiOS7 */,
562FF9921BCE8FA400759400 /* Products */,
);
sourceTree = "<group>";
};
562FF9921BCE8FA400759400 /* Products */ = {
isa = PBXGroup;
children = (
562FF9911BCE8FA400759400 /* GRDBDemoiOS7.app */,
);
name = Products;
sourceTree = "<group>";
};
562FF9931BCE8FA400759400 /* GRDBDemoiOS7 */ = {
isa = PBXGroup;
children = (
562FF9941BCE8FA400759400 /* AppDelegate.swift */,
562FF9F01BCE913900759400 /* Controllers */,
562FF9F31BCE915B00759400 /* Models */,
562FF9A61BCE8FB000759400 /* Resources */,
562FF9ED1BCE904D00759400 /* Libraries */,
562FF9A71BCE8FB600759400 /* Supporting Files */,
);
path = GRDBDemoiOS7;
sourceTree = "<group>";
};
562FF9A61BCE8FB000759400 /* Resources */ = {
isa = PBXGroup;
children = (
562FF9981BCE8FA400759400 /* Main.storyboard */,
562FF99B1BCE8FA400759400 /* Assets.xcassets */,
562FF99D1BCE8FA400759400 /* LaunchScreen.storyboard */,
);
name = Resources;
sourceTree = "<group>";
};
562FF9A71BCE8FB600759400 /* Supporting Files */ = {
isa = PBXGroup;
children = (
562FF9A01BCE8FA400759400 /* Info.plist */,
562FF9F41BCE930C00759400 /* GRDBDemoiOS7-Bridging-Header.h */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
562FF9A81BCE900100759400 /* GRDB */ = {
isa = PBXGroup;
children = (
562FF9A91BCE902400759400 /* Core */,
562FF9BA1BCE902400759400 /* Foundation */,
562FF9C51BCE902400759400 /* Migrations */,
562FF9C71BCE902400759400 /* Record */,
562FF9CA1BCE902400759400 /* Swift */,
);
name = GRDB;
path = ../../GRDB;
sourceTree = SOURCE_ROOT;
};
562FF9A91BCE902400759400 /* Core */ = {
isa = PBXGroup;
children = (
562FF9AA1BCE902400759400 /* Configuration.swift */,
562FF9AB1BCE902400759400 /* Database.swift */,
562FF9AC1BCE902400759400 /* DatabaseChanges.swift */,
562FF9AD1BCE902400759400 /* DatabaseError.swift */,
562FF9AE1BCE902400759400 /* DatabaseQueue.swift */,
562FF9AF1BCE902400759400 /* DatabaseValue.swift */,
562FF9B01BCE902400759400 /* Protocols */,
562FF9B51BCE902400759400 /* Row.swift */,
562FF9B61BCE902400759400 /* SelectStatement.swift */,
562FF9B71BCE902400759400 /* Statement.swift */,
562FF9B81BCE902400759400 /* StatementArguments.swift */,
562FF9B91BCE902400759400 /* UpdateStatement.swift */,
);
path = Core;
sourceTree = "<group>";
};
562FF9B01BCE902400759400 /* Protocols */ = {
isa = PBXGroup;
children = (
562FF9B11BCE902400759400 /* DatabaseTableMapping.swift */,
562FF9B21BCE902400759400 /* DatabaseValueConvertible.swift */,
562FF9B31BCE902400759400 /* RowConvertible.swift */,
562FF9B41BCE902400759400 /* SQLiteStatementConvertible.swift */,
);
path = Protocols;
sourceTree = "<group>";
};
562FF9BA1BCE902400759400 /* Foundation */ = {
isa = PBXGroup;
children = (
562FF9BB1BCE902400759400 /* DatabaseDateComponents.swift */,
562FF9BC1BCE902400759400 /* NSData.swift */,
562FF9BD1BCE902400759400 /* NSDate.swift */,
562FF9BE1BCE902400759400 /* NSNull.swift */,
562FF9BF1BCE902400759400 /* NSNumber.swift */,
562FF9C01BCE902400759400 /* NSString.swift */,
562FF9C11BCE902400759400 /* NSURL.swift */,
562FF9C21BCE902400759400 /* Row+Foundation.swift */,
562FF9C31BCE902400759400 /* RowConvertible+Foundation.swift */,
562FF9C41BCE902400759400 /* StatementArguments+Foundation.swift */,
);
path = Foundation;
sourceTree = "<group>";
};
562FF9C51BCE902400759400 /* Migrations */ = {
isa = PBXGroup;
children = (
562FF9C61BCE902400759400 /* DatabaseMigrator.swift */,
);
path = Migrations;
sourceTree = "<group>";
};
562FF9C71BCE902400759400 /* Record */ = {
isa = PBXGroup;
children = (
562FF9C81BCE902400759400 /* DatabaseStorable.swift */,
562FF9C91BCE902400759400 /* Record.swift */,
);
path = Record;
sourceTree = "<group>";
};
562FF9CA1BCE902400759400 /* Swift */ = {
isa = PBXGroup;
children = (
562FF9CB1BCE902400759400 /* RawRepresentable.swift */,
562FF9CC1BCE902400759400 /* StandardLibraryTypes.swift */,
);
path = Swift;
sourceTree = "<group>";
};
562FF9ED1BCE904D00759400 /* Libraries */ = {
isa = PBXGroup;
children = (
562FF9EB1BCE903D00759400 /* libsqlite3.tbd */,
562FF9A81BCE900100759400 /* GRDB */,
);
name = Libraries;
sourceTree = "<group>";
};
562FF9F01BCE913900759400 /* Controllers */ = {
isa = PBXGroup;
children = (
562FF9EE1BCE912C00759400 /* PersonEditionViewController.swift */,
562FF9961BCE8FA400759400 /* PersonsViewController.swift */,
);
name = Controllers;
sourceTree = "<group>";
};
562FF9F31BCE915B00759400 /* Models */ = {
isa = PBXGroup;
children = (
562FF9F11BCE914E00759400 /* Person.swift */,
);
name = Models;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
562FF9901BCE8FA400759400 /* GRDBDemoiOS7 */ = {
isa = PBXNativeTarget;
buildConfigurationList = 562FF9A31BCE8FA400759400 /* Build configuration list for PBXNativeTarget "GRDBDemoiOS7" */;
buildPhases = (
562FF98D1BCE8FA400759400 /* Sources */,
562FF98E1BCE8FA400759400 /* Frameworks */,
562FF98F1BCE8FA400759400 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = GRDBDemoiOS7;
productName = GRDBDemoiOS7;
productReference = 562FF9911BCE8FA400759400 /* GRDBDemoiOS7.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
562FF9891BCE8FA400759400 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = "Gwendal Roué";
TargetAttributes = {
562FF9901BCE8FA400759400 = {
CreatedOnToolsVersion = 7.0;
};
};
};
buildConfigurationList = 562FF98C1BCE8FA400759400 /* Build configuration list for PBXProject "GRDBDemoiOS7" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 562FF9881BCE8FA400759400;
productRefGroup = 562FF9921BCE8FA400759400 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
562FF9901BCE8FA400759400 /* GRDBDemoiOS7 */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
562FF98F1BCE8FA400759400 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
562FF99F1BCE8FA400759400 /* LaunchScreen.storyboard in Resources */,
562FF99C1BCE8FA400759400 /* Assets.xcassets in Resources */,
562FF99A1BCE8FA400759400 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
562FF98D1BCE8FA400759400 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
562FF9D21BCE902400759400 /* DatabaseValue.swift in Sources */,
562FF9CD1BCE902400759400 /* Configuration.swift in Sources */,
562FF9E81BCE902400759400 /* Record.swift in Sources */,
562FF9D41BCE902400759400 /* DatabaseValueConvertible.swift in Sources */,
562FF9E31BCE902400759400 /* Row+Foundation.swift in Sources */,
562FF9D81BCE902400759400 /* SelectStatement.swift in Sources */,
562FF9D71BCE902400759400 /* Row.swift in Sources */,
562FF9EF1BCE912C00759400 /* PersonEditionViewController.swift in Sources */,
562FF9971BCE8FA400759400 /* PersonsViewController.swift in Sources */,
562FF9CE1BCE902400759400 /* Database.swift in Sources */,
562FF9E01BCE902400759400 /* NSNumber.swift in Sources */,
562FF9CF1BCE902400759400 /* DatabaseChanges.swift in Sources */,
562FF9E51BCE902400759400 /* StatementArguments+Foundation.swift in Sources */,
562FF9D61BCE902400759400 /* SQLiteStatementConvertible.swift in Sources */,
562FF9F21BCE914E00759400 /* Person.swift in Sources */,
562FF9D91BCE902400759400 /* Statement.swift in Sources */,
562FF9E91BCE902400759400 /* RawRepresentable.swift in Sources */,
562FF9951BCE8FA400759400 /* AppDelegate.swift in Sources */,
562FF9EA1BCE902400759400 /* StandardLibraryTypes.swift in Sources */,
562FF9D31BCE902400759400 /* DatabaseTableMapping.swift in Sources */,
562FF9DD1BCE902400759400 /* NSData.swift in Sources */,
562FF9D11BCE902400759400 /* DatabaseQueue.swift in Sources */,
562FF9DE1BCE902400759400 /* NSDate.swift in Sources */,
562FF9E41BCE902400759400 /* RowConvertible+Foundation.swift in Sources */,
562FF9E61BCE902400759400 /* DatabaseMigrator.swift in Sources */,
562FF9D01BCE902400759400 /* DatabaseError.swift in Sources */,
562FF9DB1BCE902400759400 /* UpdateStatement.swift in Sources */,
562FF9E21BCE902400759400 /* NSURL.swift in Sources */,
562FF9DA1BCE902400759400 /* StatementArguments.swift in Sources */,
562FF9E71BCE902400759400 /* DatabaseStorable.swift in Sources */,
562FF9E11BCE902400759400 /* NSString.swift in Sources */,
562FF9DC1BCE902400759400 /* DatabaseDateComponents.swift in Sources */,
562FF9DF1BCE902400759400 /* NSNull.swift in Sources */,
562FF9D51BCE902400759400 /* RowConvertible.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
562FF9981BCE8FA400759400 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
562FF9991BCE8FA400759400 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
562FF99D1BCE8FA400759400 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
562FF99E1BCE8FA400759400 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
562FF9A11BCE8FA400759400 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
562FF9A21BCE8FA400759400 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
562FF9A41BCE8FA400759400 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = GRDBDemoiOS7/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOS7;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "GRDBDemoiOS7/GRDBDemoiOS7-Bridging-Header.h";
};
name = Debug;
};
562FF9A51BCE8FA400759400 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = GRDBDemoiOS7/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoiOS7;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "GRDBDemoiOS7/GRDBDemoiOS7-Bridging-Header.h";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
562FF98C1BCE8FA400759400 /* Build configuration list for PBXProject "GRDBDemoiOS7" */ = {
isa = XCConfigurationList;
buildConfigurations = (
562FF9A11BCE8FA400759400 /* Debug */,
562FF9A21BCE8FA400759400 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
562FF9A31BCE8FA400759400 /* Build configuration list for PBXNativeTarget "GRDBDemoiOS7" */ = {
isa = XCConfigurationList;
buildConfigurations = (
562FF9A41BCE8FA400759400 /* Debug */,
562FF9A51BCE8FA400759400 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 562FF9891BCE8FA400759400 /* Project object */;
}
@@ -1,43 +0,0 @@
import UIKit
// The shared database queue, stored in a global.
// It is created in AppDelegate.application(_:didFinishLaunchingWithOptions:)
var dbQueue: DatabaseQueue!
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Connect to the database
let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).first! as NSString
let databasePath = documentsPath.stringByAppendingPathComponent("db.sqlite")
dbQueue = try! DatabaseQueue(path: databasePath)
// Use DatabaseMigrator to setup the database
var migrator = DatabaseMigrator()
migrator.registerMigration("createPersons") { db in
try db.execute(
"CREATE TABLE persons (" +
"id INTEGER PRIMARY KEY, " +
"firstName TEXT, " +
"lastName TEXT " +
")")
}
migrator.registerMigration("addPersons") { db in
try Person(firstName: "Arthur", lastName: "Miller").insert(db)
try Person(firstName: "Barbara", lastName: "Streisand").insert(db)
try Person(firstName: "Cinderella").insert(db)
}
try! migrator.migrate(dbQueue)
return true
}
}
@@ -1,190 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Xbj-yc-Aiu">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
</dependencies>
<scenes>
<!--Persons View Controller-->
<scene sceneID="1fE-hv-cjH">
<objects>
<tableViewController id="ynz-7l-fNg" customClass="PersonsViewController" customModule="GRDBDemoiOS7" 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="wb6-9X-0tl">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="0eG-T5-kyh" style="IBUITableViewCellStyleDefault" id="eJm-gh-sbD">
<rect key="frame" x="0.0" y="92" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="eJm-gh-sbD" id="njP-8B-rhM">
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="0eG-T5-kyh">
<rect key="frame" x="15" y="0.0" width="570" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</label>
</subviews>
</tableViewCellContentView>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="ynz-7l-fNg" id="5FA-Zc-cZO"/>
<outlet property="delegate" destination="ynz-7l-fNg" id="B8Y-qi-fJZ"/>
</connections>
</tableView>
<toolbarItems/>
<navigationItem key="navigationItem" id="gMJ-R9-ZaQ">
<barButtonItem key="rightBarButtonItem" systemItem="add" id="XY0-Dc-M7c">
<connections>
<segue destination="oMH-Sb-bab" kind="presentation" identifier="editNewPerson" id="i19-Bf-uNJ"/>
</connections>
</barButtonItem>
</navigationItem>
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="0kz-GI-OO0" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1195" y="377"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="cvq-JR-nHN">
<objects>
<navigationController id="Xbj-yc-Aiu" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="Hgn-6S-1iz">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="ynz-7l-fNg" kind="relationship" relationship="rootViewController" id="C4a-4A-4Md"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="OyF-YK-p9J" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="375" y="377"/>
</scene>
<!--Person Edition View Controller-->
<scene sceneID="nA8-Ek-eRe">
<objects>
<tableViewController id="8yj-TG-7Iv" customClass="PersonEditionViewController" customModule="GRDBDemoiOS7" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="jhE-wh-IDm">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<sections>
<tableViewSection id="9vV-wM-aZ9">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="oKc-Vh-GAg">
<rect key="frame" x="0.0" y="99" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="oKc-Vh-GAg" id="EWB-Ks-FwX">
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="right" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="eF9-yN-ByV">
<rect key="frame" x="106" y="11" width="479" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<textInputTraits key="textInputTraits" autocapitalizationType="words" autocorrectionType="no" spellCheckingType="no"/>
<connections>
<outlet property="delegate" destination="8yj-TG-7Iv" id="tG8-8g-5h8"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="1000" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" text="First Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xbk-eb-6vS">
<rect key="frame" x="15" y="11" width="83" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.1137254902" green="0.47843137250000001" blue="0.98039215690000003" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="eF9-yN-ByV" secondAttribute="trailing" constant="15" id="5YN-K6-y1e"/>
<constraint firstItem="xbk-eb-6vS" firstAttribute="leading" secondItem="EWB-Ks-FwX" secondAttribute="leading" constant="15" id="6ZF-52-FFn"/>
<constraint firstItem="xbk-eb-6vS" firstAttribute="centerY" secondItem="EWB-Ks-FwX" secondAttribute="centerY" id="9zo-vh-Z4q"/>
<constraint firstItem="eF9-yN-ByV" firstAttribute="leading" secondItem="xbk-eb-6vS" secondAttribute="trailing" constant="8" symbolic="YES" id="aKR-sh-Dh7"/>
<constraint firstItem="eF9-yN-ByV" firstAttribute="centerY" secondItem="EWB-Ks-FwX" secondAttribute="centerY" id="kqk-6N-RLq"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="jUE-io-HLU">
<rect key="frame" x="0.0" y="143" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="jUE-io-HLU" id="utc-hw-ReT">
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="right" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="D1U-mQ-lvp">
<rect key="frame" x="105" y="11" width="480" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<textInputTraits key="textInputTraits" autocapitalizationType="words" autocorrectionType="no" spellCheckingType="no"/>
<connections>
<outlet property="delegate" destination="8yj-TG-7Iv" id="2pv-xY-VtW"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="1000" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" text="Last Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oYd-Lu-Kgd">
<rect key="frame" x="15" y="11" width="82" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.1137254902" green="0.47843137250000001" blue="0.98039215690000003" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="D1U-mQ-lvp" firstAttribute="leading" secondItem="oYd-Lu-Kgd" secondAttribute="trailing" constant="8" symbolic="YES" id="FHD-Pe-EkI"/>
<constraint firstItem="oYd-Lu-Kgd" firstAttribute="centerY" secondItem="utc-hw-ReT" secondAttribute="centerY" id="Kdt-DU-1us"/>
<constraint firstItem="D1U-mQ-lvp" firstAttribute="centerY" secondItem="utc-hw-ReT" secondAttribute="centerY" id="RVU-rE-8Aq"/>
<constraint firstItem="oYd-Lu-Kgd" firstAttribute="leading" secondItem="utc-hw-ReT" secondAttribute="leading" constant="15" id="Wlm-uX-s7l"/>
<constraint firstAttribute="trailing" secondItem="D1U-mQ-lvp" secondAttribute="trailing" constant="15" id="fs6-Mj-Cug"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
</cells>
</tableViewSection>
</sections>
<connections>
<outlet property="dataSource" destination="8yj-TG-7Iv" id="DrV-HH-zW8"/>
<outlet property="delegate" destination="8yj-TG-7Iv" id="5Ta-JL-Sse"/>
</connections>
</tableView>
<toolbarItems/>
<navigationItem key="navigationItem" id="0rI-r6-PKi">
<barButtonItem key="rightBarButtonItem" style="done" systemItem="done" id="jGa-U1-8mj">
<connections>
<segue destination="eQQ-Mr-J7f" kind="unwind" identifier="commit" unwindAction="commitPersonEdition:" id="LQt-5H-hX8"/>
</connections>
</barButtonItem>
</navigationItem>
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
<connections>
<outlet property="firstNameTableViewCell" destination="oKc-Vh-GAg" id="GgP-dg-jJI"/>
<outlet property="firstNameTextField" destination="eF9-yN-ByV" id="CwB-oL-I3U"/>
<outlet property="lastNameTableViewCell" destination="jUE-io-HLU" id="8SU-t1-EJR"/>
<outlet property="lastNameTextField" destination="D1U-mQ-lvp" id="4b9-am-ANQ"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="sm8-PY-oAW" userLabel="First Responder" sceneMemberID="firstResponder"/>
<exit id="eQQ-Mr-J7f" userLabel="Exit" sceneMemberID="exit"/>
</objects>
<point key="canvasLocation" x="2843" y="377"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="n5c-pj-sKx">
<objects>
<navigationController id="oMH-Sb-bab" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="d5l-tl-lRt">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="8yj-TG-7Iv" kind="relationship" relationship="rootViewController" id="rAN-NO-1Mw"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="UxC-4D-edS" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2023" y="377"/>
</scene>
</scenes>
</document>
@@ -1,14 +0,0 @@
//
// GRDBDemoiOS7-Bridging-Header.h
// GRDBDemoiOS7
//
// Created by Gwendal Roué on 14/10/2015.
// Copyright © 2015 Gwendal Roué. All rights reserved.
//
#ifndef GRDBDemoiOS7_Bridging_Header_h
#define GRDBDemoiOS7_Bridging_Header_h
#import "sqlite3.h"
#endif /* GRDBDemoiOS7_Bridging_Header_h */
@@ -1,38 +0,0 @@
class Person : Record {
var id: Int64!
var firstName: String?
var lastName: String?
var fullName: String {
return [firstName, lastName].flatMap { $0 }.joinWithSeparator(" ")
}
init(firstName: String? = nil, lastName: String? = nil) {
self.firstName = firstName
self.lastName = lastName
super.init()
}
// MARK: - Record
override class func databaseTableName() -> String? {
return "persons"
}
override func updateFromRow(row: Row) {
if let dbv = row["id"] { id = dbv.value() }
if let dbv = row["firstName"] { firstName = dbv.value() }
if let dbv = row["lastName"] { lastName = dbv.value() }
super.updateFromRow(row) // Subclasses are required to call super.
}
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
return [
"id": id,
"firstName": firstName,
"lastName": lastName]
}
required init(row: Row) {
super.init(row: row)
}
}
@@ -1,61 +0,0 @@
import UIKit
class PersonEditionViewController: UITableViewController, UITextFieldDelegate {
@IBOutlet weak var firstNameTableViewCell: UITableViewCell!
@IBOutlet weak var firstNameTextField: UITextField!
@IBOutlet weak var lastNameTableViewCell: UITableViewCell!
@IBOutlet weak var lastNameTextField: UITextField!
// The edited person
var person: Person!
override func viewDidLoad() {
super.viewDidLoad()
// Initializes textFields with the person's names
firstNameTextField.text = person.firstName
lastNameTextField.text = person.lastName
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
// Auto focus firstName
firstNameTextField.becomeFirstResponder()
}
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
// Tapping a cell selects its text fields.
if indexPath == tableView.indexPathForCell(firstNameTableViewCell) {
firstNameTextField.becomeFirstResponder()
} else if indexPath == tableView.indexPathForCell(lastNameTableViewCell) {
lastNameTextField.becomeFirstResponder()
}
}
func textFieldShouldReturn(textField: UITextField) -> Bool {
// Tapping Return key focuses next text field.
if textField == firstNameTextField {
lastNameTextField.becomeFirstResponder()
} else {
textField.resignFirstResponder()
}
return false
}
func textFieldDidEndEditing(textField: UITextField) {
// Update person when text field ends editing.
if textField == firstNameTextField {
person.firstName = textField.text
} else if textField == lastNameTextField {
person.lastName = textField.text
}
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// About to cancel or commit: end editing.
// This dismisses the keyboard early, and apply pending changes through
// textFieldDidEndEditing(_).
view.endEditing(true)
}
}
@@ -1,80 +0,0 @@
import UIKit
class PersonsViewController: UITableViewController {
var persons = [Person]()
override func viewWillAppear(animated: Bool) {
// Reload persons, and the tableView
reloadPersons()
tableView.reloadData()
self.navigationItem.leftBarButtonItem = self.editButtonItem()
super.viewWillAppear(animated)
}
func reloadPersons() {
persons = dbQueue.inDatabase { db in
Person.fetchAll(db, "SELECT * FROM persons ORDER BY LOWER(firstName), LOWER(lastName)")
}
}
// MARK: - Segues
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "editNewPerson" {
let personEditionViewController = (segue.destinationViewController as! UINavigationController).topViewController as! PersonEditionViewController
personEditionViewController.person = Person()
}
}
// Unwind action: commit person edition
@IBAction func commitPersonEdition(segue: UIStoryboardSegue) {
let personEditionViewController = segue.sourceViewController as! PersonEditionViewController
let person = personEditionViewController.person
// Ignore person with no name
guard (person.firstName ?? "").characters.count > 0 || (person.lastName ?? "").characters.count > 0 else {
return
}
// Save person
try! dbQueue.inDatabase { db in
try person.save(db)
}
// Reload persons, and insert a cell.
reloadPersons()
let index = persons.indexOf { $0.id == person.id }!
tableView.insertRowsAtIndexPaths([NSIndexPath(forRow: index, inSection: 0)], withRowAnimation: .Automatic)
}
// MARK: - Table View
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return persons.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
let person = persons[indexPath.row]
cell.textLabel!.text = person.fullName
return cell
}
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
// Delete the person
let person = persons[indexPath.row]
try! dbQueue.inTransaction { db in
try person.delete(db)
return .Commit
}
persons.removeAtIndex(indexPath.row)
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)
}
}
-18
View File
@@ -1,18 +0,0 @@
GRDBDemoiOS7
============
This application runs an application that displays an editable list of persons and targets iOS7.
**To integrate GRDB in your iOS7 application:**
1. Drag all Swift files contained in the [GRDB folder](../../GRDB/) in your project.
2. In the **Build Phase** tab of your target, add `libsqlite3.tbd` in the **Link Binary With Libraries** section.
3. [Add a Bridging header to your project](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html) in which you add:
```objc
#import "sqlite3.h"
```
4. Run
+132
View File
@@ -0,0 +1,132 @@
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).**
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).
GRDB builds SQLite with [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfalling/SQLiteLib), which uses the same SQLite configuration as the one used by Apple in its operating systems, and lets you add extra compilation options that leverage the features you need.
**To install GRDB with a custom SQLite build:**
1. Clone the GRDB git repository, checkout the latest tagged version, and download SQLite sources:
```sh
cd [GRDB directory]
git checkout v2.0
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`.
3. Create a folder named `GRDBCustomSQLite` somewhere in your project directory.
4. Create four files in the `GRDBCustomSQLite` folder:
- `SQLiteLib-USER.xcconfig`: this file sets the extra SQLite compilation flags.
```xcconfig
// As many -D options as there are custom SQLite compilation options
// Note: there is no space between -D and the option name.
CUSTOM_SQLLIBRARY_CFLAGS = -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_PREUPDATE_HOOK
```
- `GRDBCustomSQLite-USER.xcconfig`: this file lets GRDB know about extra compilation flags, and enables extra GRDB APIs.
```xcconfig
// As many -D options as there are custom SQLite compilation options
// Note: there is one space between -D and the option name.
CUSTOM_OTHER_SWIFT_FLAGS = -D SQLITE_ENABLE_FTS5 -D SQLITE_ENABLE_PREUPDATE_HOOK
```
- `GRDBCustomSQLite-USER.h`: this file lets your application know about extra compilation flags.
```c
// As many #define as there are custom SQLite compilation options
#define SQLITE_ENABLE_FTS5
#define SQLITE_ENABLE_PREUPDATE_HOOK
```
- `GRDBCustomSQLite-INSTALL.sh`: this file installs the three other files.
```sh
# License: MIT License
# https://github.com/swiftlyfalling/SQLiteLib/blob/master/LICENSE
#
#######################################################
# PROJECT PATHS
# !! MODIFY THESE TO MATCH YOUR PROJECT HIERARCHY !!
#######################################################
# The path to the folder containing GRDB.xcodeproj:
GRDB_SOURCE_PATH="${PROJECT_DIR}/GRDB"
# The path to your custom "SQLiteLib-USER.xcconfig":
SQLITELIB_XCCONFIG_USER_PATH="${PROJECT_DIR}/GRDBCustomSQLite/SQLiteLib-USER.xcconfig"
# The path to your custom "GRDBCustomSQLite-USER.xcconfig":
CUSTOMSQLITE_XCCONFIG_USER_PATH="${PROJECT_DIR}/GRDBCustomSQLite/GRDBCustomSQLite-USER.xcconfig"
# The path to your custom "GRDBCustomSQLite-USER.h":
CUSTOMSQLITE_H_USER_PATH="${PROJECT_DIR}/GRDBCustomSQLite/GRDBCustomSQLite-USER.h"
#######################################################
#
#######################################################
if [ ! -d "$GRDB_SOURCE_PATH" ];
then
echo "error: Path to GRDB source (GRDB_SOURCE_PATH) missing/incorrect: $GRDB_SOURCE_PATH"
exit 1
fi
SyncFileChanges () {
SOURCE=$1
DESTINATIONPATH=$2
DESTINATIONFILENAME=$3
DESTINATION="${DESTINATIONPATH}/${DESTINATIONFILENAME}"
if [ ! -f "$SOURCE" ];
then
echo "error: Source file missing: $SOURCE"
exit 1
fi
rsync -a "$SOURCE" "$DESTINATION"
}
SyncFileChanges $SQLITELIB_XCCONFIG_USER_PATH "${GRDB_SOURCE_PATH}/SQLiteCustom/src" "SQLiteLib-USER.xcconfig"
SyncFileChanges $CUSTOMSQLITE_XCCONFIG_USER_PATH "${GRDB_SOURCE_PATH}/SQLiteCustom" "GRDBCustomSQLite-USER.xcconfig"
SyncFileChanges $CUSTOMSQLITE_H_USER_PATH "${GRDB_SOURCE_PATH}/SQLiteCustom" "GRDBCustomSQLite-USER.h"
echo "Finished syncing"
```
Modify the top of `GRDBCustomSQLite-INSTALL.sh` file so that it contains correct paths.
5. Embed the `GRDB.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**.
7. Add the `GRDBCustomSQLite.framework` from the targetted platform to the **Embedded Binaries** section of the **General** tab of your **application target**.
8. Add a Run Script phase for your target in the **Pre-actions** section of the **Build** tab of your **application scheme**:
```sh
source "${PROJECT_DIR}/GRDBCustomSQLite/GRDBCustomSQLite-INSTALL.sh"
```
The path should be the path to your `GRDBCustomSQLite-INSTALL.sh` file.
9. Check the "Shared" checkbox of your application scheme (this lets you commit the pre-action in your Version Control System).
Now you can use GRDB with your custom SQLite build:
```swift
import GRDBCustomSQLite
let dbQueue = try DatabaseQueue(...)
```
+591
View File
@@ -0,0 +1,591 @@
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.
+389
View File
@@ -0,0 +1,389 @@
FTS5 Tokenizers
===============
**[FTS5](https://www.sqlite.org/fts5.html) is an extensible full-text search engine.**
GRDB lets you define your own custom FST5 tokenizers, and extend SQLite built-in tokenizers. Possible use cases are:
- Have "fi" match the ligature "&#xfb01;" (U+FB01)
- Have "first" match "1st"
- Have "Encyclopaedia" match "Encyclopædia"
- Have "Mueller" match "Müller", and "Grossmann" match "Großmann"
- Have "romaji" match "ローマ字", and "pinyin" match "拼音"
- Prevent "the" and other stop words from matching any document
**Table of Contents**
- [Tokenizers and Full-Text Search](#tokenizers-and-full-text-search)
- [The Tokenizer Protocols](#the-tokenizer-protocols)
- [Using a Custom Tokenizer](#using-a-custom-tokenizer)
- [FTS5Tokenizer](#fts5tokenizer)
- [FTS5CustomTokenizer](#fts5customtokenizer)
- [FTS5WrapperTokenizer](#fts5wrappertokenizer)
- [Choosing the Wrapped Tokenizer](#choosing-the-wrapped-tokenizer)
- [Example: Synonyms](#example-synonyms)
- [Example: Latin Script](#example-latin-script)
## Tokenizers and Full-Text Search
**A Tokenizer splits text into tokens**. For example, a tokenizer can split "SQLite is a database engine" into the five tokens "SQLite", "is", "a", "database", and "engine".
FTS5 use tokenizers to tokenize both indexed documents and search patterns. **A match between a document and a search pattern happens when both produce *identical* tokens.**
All SQLite [built-in tokenizers](https://www.sqlite.org/fts5.html#tokenizers) tokenize both "SQLite" and "sqlite" into the common lowercase token "sqlite". This is why they are case-insensitive. Generally speaking, different tokenizers achieve different matching by applying different transformations to the input text.
- The [ascii](https://www.sqlite.org/fts5.html#ascii_tokenizer) tokenizer turns all ASCII characters to lowercase. "SQLite is a database engine" gives "sqlite", "is", "a", "database", and "engine". The query "SQLITE DATABASE" will match, because its tokens "sqlite" and "database" are found in the document.
- The [unicode61](https://www.sqlite.org/fts5.html#unicode61_tokenizer) tokenizer remove diacritics from latin characters. Unlike the ascii tokenizer, it will match "Jérôme" with "Jerome", as both produce the same "jerome" token.
- The [porter](https://www.sqlite.org/fts5.html#porter_tokenizer) tokenizer turns English words into their root: "database engine" gives the "databas" and "engin" tokens. The query "database engines" will match, because it produces the same tokens.
However, built-in tokenizers don't match "first" with "1st", because they produce the different "first" and "1st" tokens.
Nor do they match "Grossmann" with "Großmann", because they produce the different "grossmann" and "großmann" tokens.
Custom tokenizers help dealing with these situations. We'll see how to match "Grossmann" and "Großmann" by tokenizing them into "grossmann" (see [latin script](#example-latin-script)). We'll also see how to have "first" and "1st" emit *synonym tokens*, so that they can match too (see [synonyms](#example-synonyms)).
## The Tokenizer Protocols
GRDB lets you use and define FTS5 tokenizers through three protocols:
- [FTS5Tokenizer](#fts5tokenizer): the protocol for all FTS5 tokenizers, including the [built-in tokenizers](https://www.sqlite.org/fts5.html#tokenizers) ascii, unicode61, and porter.
- [FTS5CustomTokenizer](#fts5customtokenizer): the low-level protocol that lets custom tokenizers use the raw [FTS5 C API](https://www.sqlite.org/fts5.html#custom_tokenizers).
- [FTS5WrapperTokenizer](#fts5wrappertokenizer): the high-level protocol for custom tokenizers that post-processes the tokens produced by another FTS5Tokenizer.
## Using a Custom Tokenizer
Once you have a custom tokenizer type that adopts [FTS5CustomTokenizer](#fts5customtokenizer) or [FTS5WrapperTokenizer](#fts5wrappertokenizer), it can fuel the FTS5 engine.
**Register the custom tokenizer into the database:**
```swift
class MyTokenizer : FTS5CustomTokenizer { ... }
dbQueue.add(tokenizer: MyTokenizer.self) // or dbPool.add
```
**Create [full-text tables](../../../#create-fts5-virtual-tables) that use the custom tokenizer:**
```swift
try db.create(virtualTable: "documents", using: FTS5()) { t in
t.tokenizer = MyTokenizer.tokenizerDescriptor()
t.column("content")
}
```
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 Document(content: "...").insert(db)
let pattern = FTS5Pattern(matchingAnyTokenIn:"...")
let documents = try Document.matching(pattern).fetchAll(db)
```
## FTS5Tokenizer
**FST5Tokenizer** is the protocol for all FTS5 tokenizers.
It only requires a tokenization method that matches the low-level `xTokenize` C function documented at https://www.sqlite.org/fts5.html#custom_tokenizers. We'll discuss it more when describing custom tokenizers.
```swift
typealias FTS5TokenCallback = @convention(c) (
_ context: UnsafeMutableRawPointer?,
_ flags: Int32,
_ pToken: UnsafePointer<Int8>?,
_ nToken: Int32,
_ iStart: Int32,
_ iEnd: Int32) -> Int32
protocol FTS5Tokenizer : class {
func tokenize(
context: UnsafeMutableRawPointer?,
tokenization: FTS5Tokenization,
pText: UnsafePointer<Int8>?,
nText: Int32,
tokenCallback: FTS5TokenCallback?) -> Int32
}
```
You can instantiate tokenizers, including [built-in tokenizers](https://www.sqlite.org/fts5.html#tokenizers), with the `Database.makeTokenizer()` method:
```swift
let unicode61 = try db.makeTokenizer(.unicode61()) // FTS5Tokenizer
```
## FTS5CustomTokenizer
**FTS5CustomTokenizer** is the low-level protocol for your custom tokenizers.
```swift
protocol FTS5CustomTokenizer : FTS5Tokenizer {
static var name: String { get }
init(db: Database, arguments: [String]) throws
}
```
Custom tokenizers have a name, like built-in tokenizers have a name. Don't use "ascii", "porter", or "unicode61" since they are already taken!
```swift
final class MyTokenizer : FTS5CustomTokenizer {
static let name = "custom"
}
```
SQLite instantiates tokenizers when it needs tokens. The arguments parameter of the `init(db:arguments:)` initializer is an array of strings, which your custom tokenizer can use for its own purposes. In the example below, the arguments will be `["arg1", "arg2"]`.
```swift
// CREATE VIRTUAL TABLE documents USING fts5(
// tokenize='custom arg1 arg2',
// authors, title, body
// )
try db.create(virtualTable: "documents", using: FTS5()) { t in
t.tokenizer = MyTokenizer.tokenizerDescriptor(arguments: ["arg1", "arg2"])
t.column("authors")
t.column("title")
t.column("body")
}
```
FTS5CustomTokenizer inherits from [FTS5Tokenizer](#fts5tokenizer), and performs tokenization with its `tokenize(context:tokenization:pText:nText:tokenCallback:)` method. This low-level method matches the `xTokenize` C function documented at https://www.sqlite.org/fts5.html#custom_tokenizers.
This method arguments are:
- `context`: An opaque pointer that is the first argument to the `tokenCallback` function
- `tokenization`: The reason why FTS5 is requesting tokenization.
- `pText`: The tokenized text bytes. May or may not be nul-terminated.
- `nText`: The number of bytes in the tokenized text.
- `tokenCallback`: The function to call for each found token. It matches the `xToken` callback at https://www.sqlite.org/fts5.html#custom_tokenizers:
- `context`: An opaque pointer
- `flags`: Flags that tell FTS5 how to register the token
- `pToken`: The token bytes. May or may not be nul-terminated.
- `nToken`: The number of bytes in the token
- `iStart`: Byte offset of token within input text
- `iEnd`: Byte offset of end of token within input text
Since tokenization is hard, and pointers to byte buffers uneasy to deal with, you may enjoy the [FTS5WrapperTokenizer](#fts5wrappertokenizer) protocol.
## FTS5WrapperTokenizer
**FTS5WrapperTokenizer** is the high-level protocol for your custom tokenizers. It provides a default implementation for the low-level `tokenize(context:tokenization:pText:nText:tokenCallback:)` method, so that the adopting type does not have to deal with raw byte buffers of the raw [FTS5 C API](https://www.sqlite.org/fts5.html#custom_tokenizers).
A FTS5WrapperTokenizer lets the hard tokenization job to another tokenizer, the "wrapped tokenizer", and post-processes the tokens produced by this wrapped tokenizer.
```swift
protocol FTS5WrapperTokenizer : FTS5CustomTokenizer {
var wrappedTokenizer: FTS5Tokenizer { get }
func accept(
token: String,
flags: FTS5TokenFlags,
for tokenization: FTS5Tokenization,
tokenCallback: FTS5WrapperTokenCallback) throws
}
```
As all custom tokenizers, wrapper tokenizers must have a name:
```swift
final class MyTokenizer : FTS5WrapperTokenizer {
static let name = "custom"
}
```
The `wrappedTokenizer` property is the mandatory wrapped tokenizer. You instantiate it once, in the initializer:
```swift
final class MyTokenizer : FTS5WrapperTokenizer {
let wrappedTokenizer: FTS5Tokenizer
init(db: Database, arguments: [String]) throws {
// Wrap the unicode61 tokenizer
wrappedTokenizer = try db.makeTokenizer(.unicode61())
}
}
```
Wrapper tokenizers have to implement the `accept(token:flags:for:tokenCallback:)` method.
For example, a tokenizer that simply passes tokens through gives:
```swift
final class MyTokenizer : FTS5WrapperTokenizer {
func accept(
token: String,
flags: FTS5TokenFlags,
for tokenization: FTS5Tokenization,
tokenCallback: FTS5WrapperTokenCallback) throws
{
// pass through
try tokenCallback(token, flags)
}
}
```
The token argument is a token produced by the wrapped tokenizer, ready to be ignored, modified, or multiplied into several [synonyms](#example-synonyms).
The tokenization parameter tells the reason why tokens are produced, if FTS5 is tokenizing a document, or a search pattern. Some tokenizers may produce different tokens depending on this parameter.
Finally, the tokenCallback is a function you call to output a custom token.
There are a two rules to observe when implementing the accept method:
1. Errors thrown by the tokenCallback function must not be caught (they notify that FTS5 requires the tokenization process to stop immediately).
2. The flags parameter should be given unmodified to the tokenCallback function along with the custom token, unless you union it with the `.colocated` flag when the tokenizer produces [synonyms](#example-synonyms).
### Choosing the Wrapped Tokenizer
The wrapped tokenizer can be hard-coded, or chosen at runtime.
For example, your custom tokenizer can wrap [unicode61](https://www.sqlite.org/fts5.html#unicode61_tokenizer), unless arguments say otherwise (in a fashion similar to the [porter](https://www.sqlite.org/fts5.html#porter_tokenizer) tokenizer):
```swift
final class MyTokenizer : FTS5WrapperTokenizer {
static let name = "custom"
let wrappedTokenizer: FTS5Tokenizer
init(db: Database, arguments: [String]) throws {
if arguments.isEmpty {
wrappedTokenizer = try db.makeTokenizer(.unicode61())
} else {
let descriptor = FTS5TokenizerDescriptor(components: arguments)
wrappedTokenizer = try db.makeTokenizer(descriptor)
}
}
}
```
Arguments are provided when the virtual table is created:
```swift
// CREATE VIRTUAL TABLE documents USING fts5(
// tokenize='custom',
// content
// )
try db.create(virtualTable: "documents", using: FTS5()) { t in
// Wraps the default unicode61
t.tokenizer = MyTokenizer.tokenizerDescriptor()
t.column("content")
}
// CREATE VIRTUAL TABLE documents USING fts5(
// tokenize='custom ascii'
// content
// )
try db.create(virtualTable: "documents", using: FTS5()) { t in
// Wraps ascii
let ascii = FTS5TokenizerDescriptor.ascii()
t.tokenizer = MyTokenizer.tokenizerDescriptor(arguments: ascii.components)
t.column("content")
}
```
## Example: Synonyms
**FTS5 lets tokenizers produce synonyms**, so that, for example, "first" can match "1st".
The topic of synonyms is documented at https://www.sqlite.org/fts5.html#synonym_support, which describes several methods. You should carefully read this documentation, and pick the method you prefer.
In the example below, we'll pick method (3), and implement a tokenizer that adds multiple synonyms for a single term to the FTS index. Using this method, when tokenizing document text, the tokenizer provides multiple synonyms for each token. So that when a document such as "I won first place" is tokenized, entries are added to the FTS index for "i", "won", "first", "1st" and "place".
We'll also take care of the SQLite advice:
> When using methods (2) or (3), it is important that the tokenizer only provide synonyms when tokenizing document text or query text, not both. Doing so will not cause any errors, but is inefficient.
```swift
final class SynonymsTokenizer : FTS5WrapperTokenizer {
static let name = "synonyms"
let wrappedTokenizer: FTS5Tokenizer
let synonyms: [Set<String>] = [["first", "1st"]]
init(db: Database, arguments: [String]) throws {
wrappedTokenizer = try db.makeTokenizer(.unicode61())
}
func synonyms(for token: String) -> Set<String>? {
return synonyms.first { $0.contains(token) }
}
func accept(token: String, flags: FTS5TokenFlags, for tokenization: FTS5Tokenization, tokenCallback: FTS5WrapperTokenCallback) throws {
if tokenization.contains(.query) {
// Don't look for synonyms when tokenizing queries
try tokenCallback(token, flags)
return
}
guard let synonyms = synonyms(for: token) else {
// Token has no synonym
try tokenCallback(token, flags)
return
}
for (index, synonym) in synonyms.enumerated() {
// Notify each synonym, and set the colocated flag for all but the first
let synonymFlags = (index == 0) ? flags : flags.union(.colocated)
try tokenCallback(synonym, synonymFlags)
}
}
}
```
## Example: Latin Script
Languages that use the [latin script](https://en.wikipedia.org/wiki/Latin_script) offer a rich set of typographical, historical, and local features such as diacritics, ligatures, and dotless I: Großmann, fidélité (with the ligature "fi" U+FB01), Diyarbakır.
Full-text search in such a corpus often needs input tolerance, so that "encyclopaedia" can match "Encyclopædia", "Grossmann", "Großmann", and "Jerome", "Jérôme".
German has something specific in that both "Mueller" and "Muller" should match "Müller", when "Bauer" should not match "Baur" (only "ü" accepts both "u" and "ue"). A pull request that adds a chapter about German will be welcome.
A custom FTS5 tokenizer lets you provide fuzzy latin matching: after "Grossmann", "Großmann", and "GROSSMANN" have all been turned into "grossmann", they will all match together.
We'll wrap the built-in [unicode61](https://www.sqlite.org/fts5.html#unicode61_tokenizer) tokenizer (the one that knows how to split text on spaces and punctuations), and transform its tokens into their bare lowercase ascii form.
The tokenizer wrapping is provided by the [FTS5WrapperTokenizer](#fts5wrappertokenizer) protocol. The string transformation is provided by the [String.applyingTransform](https://developer.apple.com/reference/swift/string/1643133-applyingtransform) method:
```swift
final class LatinAsciiTokenizer : FTS5WrapperTokenizer {
static let name = "latinascii"
let wrappedTokenizer: FTS5Tokenizer
init(db: Database, arguments: [String]) throws {
wrappedTokenizer = try db.makeTokenizer(.unicode61())
}
func accept(token: String, flags: FTS5TokenFlags, for tokenization: FTS5Tokenization, tokenCallback: FTS5WrapperTokenCallback) throws {
if let token = token.applyingTransform(StringTransform("Latin-ASCII; Lower"), reverse: false) {
try tokenCallback(token, flags)
}
}
}
```
> :point_up: **Note**: String.applyingTransform is not available before iOS 9.0 and macOS 10.11. Use the Core Foundation function [CFStringTransform](https://developer.apple.com/reference/corefoundation/1542411-cfstringtransform) instead.
Remember to register LatinAsciiTokenizer before using it:
```swift
dbQueue.add(tokenizer: LatinAsciiTokenizer.self) // or dbPool.add
dbQueue.inDatabase { db in
try db.create(virtualTable: "documents", using: FTS5()) { t in
t.tokenizer = LatinAsciiTokenizer.tokenizerDescriptor()
t.column("authors")
t.column("title")
t.column("body")
}
}
```
+1
View File
@@ -0,0 +1 @@
The main documentation is available in [README.md](../../../#documentation).
+32
View File
@@ -0,0 +1,32 @@
Release Process
===============
**This is internal documentation.**
To release a new GRDB version:
- Tests
- `make test`
- Build and run GRDBDemoiOS in Release configuration on a device
- Archive GRDBDemoiOS
- Check for performance regression with GRDBOSXPerformanceTests
- On https://github.com/groue/sqlcipher.git upgrade, update SQLCipher version in README.md
- On https://github.com/swiftlyfalling/SQLiteLib upgrade, update SQLite version in README.md and Documentation/CustomSQLiteBuilds.md
- 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
-1
View File
@@ -1 +0,0 @@
github "groue/GRDB.swift" "master"
-542
View File
@@ -1,542 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
5673743C1B4D46600089DE44 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5673743B1B4D46600089DE44 /* AppDelegate.swift */; };
5673743E1B4D46600089DE44 /* MasterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5673743D1B4D46600089DE44 /* MasterViewController.swift */; };
567374401B4D46600089DE44 /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5673743F1B4D46600089DE44 /* DetailViewController.swift */; };
567374431B4D46600089DE44 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 567374411B4D46600089DE44 /* Main.storyboard */; };
567374451B4D46600089DE44 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 567374441B4D46600089DE44 /* Assets.xcassets */; };
567374481B4D46600089DE44 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 567374461B4D46600089DE44 /* LaunchScreen.storyboard */; };
567374531B4D46600089DE44 /* iOSTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567374521B4D46600089DE44 /* iOSTests.swift */; };
5673745E1B4D46600089DE44 /* iOSUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5673745D1B4D46600089DE44 /* iOSUITests.swift */; };
567374701B4D48AB0089DE44 /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5673746F1B4D48AB0089DE44 /* Person.swift */; };
567374731B4D7A2E0089DE44 /* GRDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 567374721B4D7A2E0089DE44 /* GRDB.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
5673744F1B4D46600089DE44 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 567374301B4D46600089DE44 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 567374371B4D46600089DE44;
remoteInfo = iOS;
};
5673745A1B4D46600089DE44 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 567374301B4D46600089DE44 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 567374371B4D46600089DE44;
remoteInfo = iOS;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
567374381B4D46600089DE44 /* iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
5673743B1B4D46600089DE44 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5673743D1B4D46600089DE44 /* MasterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterViewController.swift; sourceTree = "<group>"; };
5673743F1B4D46600089DE44 /* DetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = "<group>"; };
567374421B4D46600089DE44 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
567374441B4D46600089DE44 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
567374471B4D46600089DE44 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
567374491B4D46600089DE44 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5673744E1B4D46600089DE44 /* iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iOSTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
567374521B4D46600089DE44 /* iOSTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSTests.swift; sourceTree = "<group>"; };
567374541B4D46600089DE44 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
567374591B4D46600089DE44 /* iOSUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iOSUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
5673745D1B4D46600089DE44 /* iOSUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSUITests.swift; sourceTree = "<group>"; };
5673745F1B4D46600089DE44 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5673746F1B4D48AB0089DE44 /* Person.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Person.swift; sourceTree = "<group>"; };
567374721B4D7A2E0089DE44 /* GRDB.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GRDB.framework; path = ../Carthage/Build/iOS/GRDB.framework; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
567374351B4D46600089DE44 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
567374731B4D7A2E0089DE44 /* GRDB.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
5673744B1B4D46600089DE44 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
567374561B4D46600089DE44 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
5673742F1B4D46600089DE44 = {
isa = PBXGroup;
children = (
567374721B4D7A2E0089DE44 /* GRDB.framework */,
5673743A1B4D46600089DE44 /* iOS */,
567374511B4D46600089DE44 /* iOSTests */,
5673745C1B4D46600089DE44 /* iOSUITests */,
567374391B4D46600089DE44 /* Products */,
);
sourceTree = "<group>";
};
567374391B4D46600089DE44 /* Products */ = {
isa = PBXGroup;
children = (
567374381B4D46600089DE44 /* iOS.app */,
5673744E1B4D46600089DE44 /* iOSTests.xctest */,
567374591B4D46600089DE44 /* iOSUITests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
5673743A1B4D46600089DE44 /* iOS */ = {
isa = PBXGroup;
children = (
5673743B1B4D46600089DE44 /* AppDelegate.swift */,
5673743D1B4D46600089DE44 /* MasterViewController.swift */,
5673743F1B4D46600089DE44 /* DetailViewController.swift */,
5673746F1B4D48AB0089DE44 /* Person.swift */,
567374411B4D46600089DE44 /* Main.storyboard */,
567374441B4D46600089DE44 /* Assets.xcassets */,
567374461B4D46600089DE44 /* LaunchScreen.storyboard */,
567374491B4D46600089DE44 /* Info.plist */,
);
path = iOS;
sourceTree = "<group>";
};
567374511B4D46600089DE44 /* iOSTests */ = {
isa = PBXGroup;
children = (
567374521B4D46600089DE44 /* iOSTests.swift */,
567374541B4D46600089DE44 /* Info.plist */,
);
path = iOSTests;
sourceTree = "<group>";
};
5673745C1B4D46600089DE44 /* iOSUITests */ = {
isa = PBXGroup;
children = (
5673745D1B4D46600089DE44 /* iOSUITests.swift */,
5673745F1B4D46600089DE44 /* Info.plist */,
);
path = iOSUITests;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
567374371B4D46600089DE44 /* iOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 567374621B4D46600089DE44 /* Build configuration list for PBXNativeTarget "iOS" */;
buildPhases = (
567374341B4D46600089DE44 /* Sources */,
567374351B4D46600089DE44 /* Frameworks */,
567374361B4D46600089DE44 /* Resources */,
567374741B4D7A3B0089DE44 /* ShellScript */,
);
buildRules = (
);
dependencies = (
);
name = iOS;
productName = iOS;
productReference = 567374381B4D46600089DE44 /* iOS.app */;
productType = "com.apple.product-type.application";
};
5673744D1B4D46600089DE44 /* iOSTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 567374651B4D46600089DE44 /* Build configuration list for PBXNativeTarget "iOSTests" */;
buildPhases = (
5673744A1B4D46600089DE44 /* Sources */,
5673744B1B4D46600089DE44 /* Frameworks */,
5673744C1B4D46600089DE44 /* Resources */,
);
buildRules = (
);
dependencies = (
567374501B4D46600089DE44 /* PBXTargetDependency */,
);
name = iOSTests;
productName = iOSTests;
productReference = 5673744E1B4D46600089DE44 /* iOSTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
567374581B4D46600089DE44 /* iOSUITests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 567374681B4D46600089DE44 /* Build configuration list for PBXNativeTarget "iOSUITests" */;
buildPhases = (
567374551B4D46600089DE44 /* Sources */,
567374561B4D46600089DE44 /* Frameworks */,
567374571B4D46600089DE44 /* Resources */,
);
buildRules = (
);
dependencies = (
5673745B1B4D46600089DE44 /* PBXTargetDependency */,
);
name = iOSUITests;
productName = iOSUITests;
productReference = 567374591B4D46600089DE44 /* iOSUITests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
567374301B4D46600089DE44 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = "Gwendal Roué";
TargetAttributes = {
567374371B4D46600089DE44 = {
CreatedOnToolsVersion = 7.0;
};
5673744D1B4D46600089DE44 = {
CreatedOnToolsVersion = 7.0;
TestTargetID = 567374371B4D46600089DE44;
};
567374581B4D46600089DE44 = {
CreatedOnToolsVersion = 7.0;
TestTargetID = 567374371B4D46600089DE44;
};
};
};
buildConfigurationList = 567374331B4D46600089DE44 /* Build configuration list for PBXProject "iOS" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 5673742F1B4D46600089DE44;
productRefGroup = 567374391B4D46600089DE44 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
567374371B4D46600089DE44 /* iOS */,
5673744D1B4D46600089DE44 /* iOSTests */,
567374581B4D46600089DE44 /* iOSUITests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
567374361B4D46600089DE44 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
567374481B4D46600089DE44 /* LaunchScreen.storyboard in Resources */,
567374451B4D46600089DE44 /* Assets.xcassets in Resources */,
567374431B4D46600089DE44 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
5673744C1B4D46600089DE44 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
567374571B4D46600089DE44 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
567374741B4D7A3B0089DE44 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"$(SRCROOT)/../Carthage/Build/iOS/GRDB.framework",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/usr/local/bin/carthage copy-frameworks";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
567374341B4D46600089DE44 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
567374401B4D46600089DE44 /* DetailViewController.swift in Sources */,
5673743E1B4D46600089DE44 /* MasterViewController.swift in Sources */,
567374701B4D48AB0089DE44 /* Person.swift in Sources */,
5673743C1B4D46600089DE44 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
5673744A1B4D46600089DE44 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
567374531B4D46600089DE44 /* iOSTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
567374551B4D46600089DE44 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5673745E1B4D46600089DE44 /* iOSUITests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
567374501B4D46600089DE44 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 567374371B4D46600089DE44 /* iOS */;
targetProxy = 5673744F1B4D46600089DE44 /* PBXContainerItemProxy */;
};
5673745B1B4D46600089DE44 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 567374371B4D46600089DE44 /* iOS */;
targetProxy = 5673745A1B4D46600089DE44 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
567374411B4D46600089DE44 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
567374421B4D46600089DE44 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
567374461B4D46600089DE44 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
567374471B4D46600089DE44 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
567374601B4D46600089DE44 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
567374611B4D46600089DE44 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
567374631B4D46600089DE44 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../Carthage/Build/iOS",
);
INFOPLIST_FILE = iOS/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.iOS;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
567374641B4D46600089DE44 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../Carthage/Build/iOS",
);
INFOPLIST_FILE = iOS/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.iOS;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
567374661B4D46600089DE44 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
INFOPLIST_FILE = iOSTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.iOSTests;
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iOS.app/iOS";
};
name = Debug;
};
567374671B4D46600089DE44 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
INFOPLIST_FILE = iOSTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.iOSTests;
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iOS.app/iOS";
};
name = Release;
};
567374691B4D46600089DE44 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
INFOPLIST_FILE = iOSUITests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.iOSUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_TARGET_NAME = iOS;
USES_XCTRUNNER = YES;
};
name = Debug;
};
5673746A1B4D46600089DE44 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
INFOPLIST_FILE = iOSUITests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.iOSUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_TARGET_NAME = iOS;
USES_XCTRUNNER = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
567374331B4D46600089DE44 /* Build configuration list for PBXProject "iOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
567374601B4D46600089DE44 /* Debug */,
567374611B4D46600089DE44 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
567374621B4D46600089DE44 /* Build configuration list for PBXNativeTarget "iOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
567374631B4D46600089DE44 /* Debug */,
567374641B4D46600089DE44 /* Release */,
);
defaultConfigurationIsVisible = 0;
};
567374651B4D46600089DE44 /* Build configuration list for PBXNativeTarget "iOSTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
567374661B4D46600089DE44 /* Debug */,
567374671B4D46600089DE44 /* Release */,
);
defaultConfigurationIsVisible = 0;
};
567374681B4D46600089DE44 /* Build configuration list for PBXNativeTarget "iOSUITests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
567374691B4D46600089DE44 /* Debug */,
5673746A1B4D46600089DE44 /* Release */,
);
defaultConfigurationIsVisible = 0;
};
/* End XCConfigurationList section */
};
rootObject = 567374301B4D46600089DE44 /* Project object */;
}
-56
View File
@@ -1,56 +0,0 @@
//
// AppDelegate.swift
// iOS
//
// Created by Gwendal Roué on 08/07/2015.
// Copyright © 2015 Gwendal Roué. All rights reserved.
//
import UIKit
import GRDB
var dbQueue: DatabaseQueue!
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let splitViewController = self.window!.rootViewController as! UISplitViewController
let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController
navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem()
splitViewController.delegate = self
// Database
dbQueue = DatabaseQueue()
var migrator = DatabaseMigrator()
migrator.registerMigration("createPersons") { db in
try db.execute("CREATE TABLE persons (id INTEGER PRIMARY KEY, firstName TEXT, lastName TEXT)")
}
migrator.registerMigration("addPersons") { db in
try Person(firstName: "Arthur", lastName: "Miller").insert(db)
try Person(firstName: "Barbara", lastName: "Streisand").insert(db)
try Person(firstName: "Cinderella").insert(db)
}
try! migrator.migrate(dbQueue)
return true
}
// MARK: - Split view
func splitViewController(splitViewController: UISplitViewController, collapseSecondaryViewController secondaryViewController:UIViewController, ontoPrimaryViewController primaryViewController:UIViewController) -> Bool {
guard let secondaryAsNavController = secondaryViewController as? UINavigationController else { return false }
guard let topAsDetailController = secondaryAsNavController.topViewController as? DetailViewController else { return false }
if topAsDetailController.person == nil {
// Return true to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded.
return true
}
return false
}
}
@@ -1,38 +0,0 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8076" systemVersion="14D121" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8063"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright © 2015 Gwendal Roué. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
<rect key="frame" x="20" y="559" width="560" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="iOS" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
<rect key="frame" x="20" y="180" width="560" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="obG-Y5-kRd" secondAttribute="centerX" id="5cz-MP-9tL"/>
<constraint firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
<constraint firstItem="obG-Y5-kRd" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" constant="20" symbolic="YES" id="SfN-ll-jLj"/>
<constraint firstAttribute="bottom" secondItem="obG-Y5-kRd" secondAttribute="bottom" constant="20" id="Y44-ml-fuU"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" constant="20" symbolic="YES" id="x7j-FC-K8j"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
-135
View File
@@ -1,135 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8121.20" systemVersion="14E46" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="H1p-Uh-vWS">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8101.16"/>
</dependencies>
<scenes>
<!--Master-->
<scene sceneID="pY4-Hu-kfo">
<objects>
<navigationController title="Master" id="RMx-3f-FxP" sceneMemberID="viewController">
<navigationBar key="navigationBar" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="Pmd-2v-anx">
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="7bK-jq-Zjz" kind="relationship" relationship="rootViewController" id="tsl-Nk-0bq"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="8fS-aE-onr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-38" y="-630"/>
</scene>
<!--Detail-->
<scene sceneID="yUG-lL-AsK">
<objects>
<viewController title="Detail" id="JEX-9P-axG" customClass="DetailViewController" customModule="iOS" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="SYR-Wa-9uf"/>
<viewControllerLayoutGuide type="bottom" id="GAO-Cl-Wes"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="svH-Pt-448">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="Detail view content goes here" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="0XM-y9-sOw">
<rect key="frame" x="20" y="292" width="560" height="17"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" size="system"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="0XM-y9-sOw" firstAttribute="leading" secondItem="svH-Pt-448" secondAttribute="leading" constant="20" symbolic="YES" id="Tsc-yG-G1q"/>
<constraint firstItem="0XM-y9-sOw" firstAttribute="centerY" secondItem="svH-Pt-448" secondAttribute="centerY" id="jWN-iV-94e"/>
<constraint firstAttribute="trailing" secondItem="0XM-y9-sOw" secondAttribute="trailing" constant="20" symbolic="YES" id="tHV-ZD-HQj"/>
</constraints>
</view>
<toolbarItems/>
<navigationItem key="navigationItem" title="Detail" id="mOI-FS-AaM"/>
<connections>
<outlet property="detailDescriptionLabel" destination="0XM-y9-sOw" id="deQ-Na-JPF"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="FJe-Yq-33r" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="709" y="129"/>
</scene>
<!--Split View Controller-->
<scene sceneID="Nki-YV-4Qg">
<objects>
<splitViewController id="H1p-Uh-vWS" sceneMemberID="viewController">
<toolbarItems/>
<connections>
<segue destination="RMx-3f-FxP" kind="relationship" relationship="masterViewController" id="BlO-5A-QYV"/>
<segue destination="vC3-pB-5Vb" kind="relationship" relationship="detailViewController" id="Tll-UG-LXB"/>
</connections>
</splitViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="cZU-Oi-B1e" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-856" y="-330"/>
</scene>
<!--Master-->
<scene sceneID="smW-Zh-WAh">
<objects>
<tableViewController title="Master" clearsSelectionOnViewWillAppear="NO" id="7bK-jq-Zjz" customClass="MasterViewController" customModule="iOS" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="r7i-6Z-zg0">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" textLabel="Arm-wq-HPj" style="IBUITableViewCellStyleDefault" id="WCw-Qf-5nD">
<rect key="frame" x="0.0" y="86" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="WCw-Qf-5nD" id="37f-cq-3Eg">
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Arm-wq-HPj">
<rect key="frame" x="15" y="0.0" width="570" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</label>
</subviews>
</tableViewCellContentView>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<connections>
<segue destination="vC3-pB-5Vb" kind="showDetail" identifier="showDetail" id="6S0-TO-JiA"/>
</connections>
</tableViewCell>
</prototypes>
<sections/>
<connections>
<outlet property="dataSource" destination="7bK-jq-Zjz" id="Gho-Na-rnu"/>
<outlet property="delegate" destination="7bK-jq-Zjz" id="RA6-mI-bju"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="Master" id="Zdf-7t-Un8"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Rux-fX-hf1" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="709" y="-630"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="r7l-gg-dq7">
<objects>
<navigationController id="vC3-pB-5Vb" sceneMemberID="viewController">
<navigationBar key="navigationBar" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="DjV-YW-jjY">
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="JEX-9P-axG" kind="relationship" relationship="rootViewController" id="GKi-kA-LjT"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="SLD-UC-DBI" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-45" y="129"/>
</scene>
</scenes>
<inferredMetricsTieBreakers>
<segue reference="6S0-TO-JiA"/>
</inferredMetricsTieBreakers>
</document>
-34
View File
@@ -1,34 +0,0 @@
//
// DetailViewController.swift
// iOS
//
// Created by Gwendal Roué on 08/07/2015.
// Copyright © 2015 Gwendal Roué. All rights reserved.
//
import UIKit
class DetailViewController: UIViewController {
@IBOutlet weak var detailDescriptionLabel: UILabel!
var person: Person? {
didSet {
self.configureView()
}
}
func configureView() {
if let person = self.person {
if let label = self.detailDescriptionLabel {
label.text = person.fullName
}
}
}
override func viewDidLoad() {
super.viewDidLoad()
self.configureView()
}
}
-50
View File
@@ -1,50 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIStatusBarTintParameters</key>
<dict>
<key>UINavigationBar</key>
<dict>
<key>Style</key>
<string>UIBarStyleDefault</string>
<key>Translucent</key>
<false/>
</dict>
</dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
-80
View File
@@ -1,80 +0,0 @@
//
// MasterViewController.swift
// iOS
//
// Created by Gwendal Roué on 08/07/2015.
// Copyright © 2015 Gwendal Roué. All rights reserved.
//
import UIKit
class MasterViewController: UITableViewController {
var detailViewController: DetailViewController? = nil
var persons = [Person]()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.navigationItem.leftBarButtonItem = self.editButtonItem()
if let split = self.splitViewController {
let controllers = split.viewControllers
self.detailViewController = (controllers[controllers.count-1] as! UINavigationController).topViewController as? DetailViewController
}
}
override func viewWillAppear(animated: Bool) {
persons = dbQueue.inDatabase { db in
db.fetchAll(Person.self, "SELECT * FROM persons ORDER BY firstName, lastName")
}
self.clearsSelectionOnViewWillAppear = self.splitViewController!.collapsed
super.viewWillAppear(animated)
}
// MARK: - Segues
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "showDetail" {
if let indexPath = self.tableView.indexPathForSelectedRow {
let person = persons[indexPath.row]
let controller = (segue.destinationViewController as! UINavigationController).topViewController as! DetailViewController
controller.person = person
controller.navigationItem.leftBarButtonItem = self.splitViewController?.displayModeButtonItem()
controller.navigationItem.leftItemsSupplementBackButton = true
}
}
}
// MARK: - Table View
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return persons.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
let person = persons[indexPath.row]
cell.textLabel!.text = person.fullName
return cell
}
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
let person = persons[indexPath.row]
try! dbQueue.inTransaction { db in
try person.delete(db)
return .Commit
}
persons.removeAtIndex(indexPath.row)
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
}
}
-51
View File
@@ -1,51 +0,0 @@
//
// Person.swift
// iOS
//
// Created by Gwendal Roué on 08/07/2015.
// Copyright © 2015 Gwendal Roué. All rights reserved.
//
import Foundation
import GRDB
class Person : Record {
var id: Int64!
var firstName: String?
var lastName: String?
var fullName: String {
return " ".join([firstName, lastName].filter { $0 != nil }.map { $0! })
}
init(firstName: String? = nil, lastName: String? = nil) {
self.firstName = firstName
self.lastName = lastName
super.init()
}
// MARK: - Record
override class var databaseTable: Table? {
return Table(named: "persons", primaryKey: .RowID("id"))
}
override func setDatabaseValue(dbv: DatabaseValue, forColumn column: String) {
switch column {
case "id": id = dbv.value()
case "firstName": firstName = dbv.value()
case "lastName": lastName = dbv.value()
default: super.setDatabaseValue(dbv, forColumn: column)
}
}
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
return [
"id": id,
"firstName": firstName,
"lastName": lastName]
}
required init(row: Row) {
super.init(row: row)
}
}
-35
View File
@@ -1,35 +0,0 @@
//
// iOSTests.swift
// iOSTests
//
// Created by Gwendal Roué on 08/07/2015.
// Copyright © 2015 Gwendal Roué. All rights reserved.
//
import XCTest
class iOSTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
}
}
}
-35
View File
@@ -1,35 +0,0 @@
//
// iOSUITests.swift
// iOSUITests
//
// Created by Gwendal Roué on 08/07/2015.
// Copyright © 2015 Gwendal Roué. All rights reserved.
//
import Foundation
import XCTest
class iOSUITests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
@@ -1,385 +0,0 @@
import XCTest
import GRDB
// See if TransactionObserverType can provide robust NSData external storage.
//
// The answer is yes, we can.
//
// However this requires records to be *managed*. All instances of our
// RecordWithManagedData must be given their manager after instanciation.
class ManagedDataController : TransactionObserverType {
// Base directory
let path: String
// A magic testing data: ManagedDataController.databaseWillCommit() throws
// an error if this data wants to save.
let forbiddenData: NSData?
// ManagedData management
private var managedData: ManagedData? = nil
private var pendingManagedDatas: [Int64: ManagedData] = [:]
var movedManagedDatas: [ManagedData] = []
var storedManagedDatas: [ManagedData] = []
var restoreFileSystemAfterRollback: Bool = false
init(path: String, forbiddenData: NSData?) {
self.path = path
self.forbiddenData = forbiddenData
setupDirectories()
}
func willSaveManagedData(managedData: ManagedData?) {
// Next step: databaseDidChangeWithEvent() or databaseDidRollback()
self.managedData = managedData
}
func databaseDidChangeWithEvent(event: DatabaseEvent) {
guard let managedData = managedData else {
return
}
self.managedData = nil
switch event.kind {
case .Insert, .Update:
managedData.rowID = event.rowID
// Replace any existing managedData for this rowID.
pendingManagedDatas[event.rowID] = managedData
default:
break
}
}
func databaseWillCommit() throws {
do {
let fm = NSFileManager.defaultManager()
for (_, managedData) in pendingManagedDatas.sort({ $0.0 < $1.0 }) {
if let forbiddenData = forbiddenData, let data = managedData.data where forbiddenData == data {
throw NSError(domain: "ManagedDataController", code: 0, userInfo: nil)
}
let storagePath = storageDataPath(managedData)
let storageDir = (storagePath as NSString).stringByDeletingLastPathComponent
let tempPath = temporaryDataPath(managedData)
let tempDir = (tempPath as NSString).stringByDeletingLastPathComponent
// Move
if fm.fileExistsAtPath(storagePath) {
if fm.fileExistsAtPath(tempPath) {
try! fm.removeItemAtPath(tempPath)
}
if !fm.fileExistsAtPath(tempDir) {
try fm.createDirectoryAtPath(tempDir, withIntermediateDirectories: true, attributes: nil)
}
try fm.moveItemAtPath(storagePath, toPath: tempPath)
}
movedManagedDatas.append(managedData)
// Store
if let data = managedData.data {
if !fm.fileExistsAtPath(storageDir) {
try fm.createDirectoryAtPath(storageDir, withIntermediateDirectories: true, attributes: nil)
}
try data.writeToFile(storagePath, options: [])
}
storedManagedDatas.append(managedData)
}
} catch {
// Could not save the managed data.
//
// Let the database perform a rollback, and restore the
// file system later, in databaseDidRollback():
restoreFileSystemAfterRollback = true
throw error
}
}
func databaseDidCommit(db: Database) {
// TODO: clean up tmp directory
cleanup()
}
func databaseDidRollback(db: Database) {
if restoreFileSystemAfterRollback {
let fm = NSFileManager.defaultManager()
for managedData in storedManagedDatas {
if fm.fileExistsAtPath(storageDataPath(managedData)) {
try! fm.removeItemAtPath(storageDataPath(managedData))
}
}
for managedData in movedManagedDatas {
let storagePath = storageDataPath(managedData)
let storageDir = (storagePath as NSString).stringByDeletingLastPathComponent
let tempPath = temporaryDataPath(managedData)
if fm.fileExistsAtPath(tempPath) {
if !fm.fileExistsAtPath(storageDir) {
try! fm.createDirectoryAtPath(storageDir, withIntermediateDirectories: true, attributes: nil)
}
try! fm.moveItemAtPath(tempPath, toPath: storagePath)
}
}
}
cleanup()
}
func cleanup() {
managedData = nil
restoreFileSystemAfterRollback = false
movedManagedDatas = []
storedManagedDatas = []
pendingManagedDatas = [:]
}
func loadData(managedData: ManagedData) -> NSData? {
guard managedData.rowID != nil else {
return nil
}
let fm = NSFileManager.defaultManager()
if fm.fileExistsAtPath(storageDataPath(managedData)) {
return NSData(contentsOfFile: storageDataPath(managedData))!
} else {
return nil
}
}
private var temporaryDirectoryPath: String {
return (path as NSString).stringByAppendingPathComponent("tmp")
}
private func storageDataPath(managedData: ManagedData) -> String {
var path = self.path as NSString
path = path.stringByAppendingPathComponent(String(managedData.rowID!))
path = path.stringByAppendingPathComponent(managedData.name)
return path as String
}
private func temporaryDataPath(managedData: ManagedData) -> String {
var path = self.temporaryDirectoryPath as NSString
path = path.stringByAppendingPathComponent(String(managedData.rowID!))
path = path.stringByAppendingPathComponent(managedData.name)
return path as String
}
private func setupDirectories() {
let fm = NSFileManager.defaultManager()
try! fm.createDirectoryAtPath(path, withIntermediateDirectories: true, attributes: nil)
try! fm.createDirectoryAtPath(temporaryDirectoryPath, withIntermediateDirectories: true, attributes: nil)
}
}
final class ManagedData {
var controller: ManagedDataController?
var name: String
var rowID: Int64?
var data: NSData? {
if let _data = _data {
return _data
} else {
_data = controller!.loadData(self)
return _data!
}
}
var _data: NSData??
init(name: String) {
self.name = name
}
func copyWithData(data: NSData?) -> ManagedData {
let copy = ManagedData(name: name)
copy.controller = controller
copy._data = data
copy.rowID = rowID
return copy
}
func willSave() {
controller!.willSaveManagedData(self)
}
}
// OK
class RecordWithManagedData : Record {
// OK
var id: Int64?
// OK. Odd, but OK: data is accessed through managedData.
private var managedData = ManagedData(name: "data")
var data: NSData? {
get { return managedData.data }
set { managedData = managedData.copyWithData(newValue) } // Odd
}
// OK
override static func databaseTableName() -> String {
return "datas"
}
// Not OK: what is this useless "data" columns?
// Answer: this is an artificial column that makes our tests run despite
// the fact that Record.update() does nothing when there is nothing to
// update.
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
return ["id": id, "data": nil]
}
override func updateFromRow(row: Row) {
if let dbv = row["id"] {
id = dbv.value()
// Hmm. Sure this rowID must be linked to managedData at some point.
managedData.rowID = dbv.value()
}
super.updateFromRow(row)
}
override func insert(db: Database) throws {
// Hmm.
managedData.willSave()
try super.insert(db)
}
override func update(db: Database) throws {
// Hmm.
managedData.willSave()
try super.update(db)
}
// OK
static func setupInDatabase(db: Database) throws {
// TODO: make tests run with a single "id INTEGER PRIMARY KEY" column.
// The "update" method is doing nothing in this case, so we can expect troubles with managed data.
try db.execute(
"CREATE TABLE datas (id INTEGER PRIMARY KEY, data BLOB)")
}
}
class ManagedDataControllerTests : GRDBTestCase {
var managedDataController: ManagedDataController!
override var dbConfiguration: Configuration {
managedDataController = ManagedDataController(path: "/tmp/ManagedDataController", forbiddenData: "Bunny".dataUsingEncoding(NSUTF8StringEncoding))
var c = super.dbConfiguration
c.transactionObserver = managedDataController
return c
}
override func setUp() {
super.setUp()
assertNoError {
try dbQueue.inDatabase { db in
try RecordWithManagedData.setupInDatabase(db)
}
}
}
func testImplicitTransaction() {
assertNoError {
// Test that we can store data in the file system...
let record = RecordWithManagedData()
try dbQueue.inDatabase { db in
// TODO: this explicit line is a problem
record.managedData.controller = self.managedDataController
record.data = "foo".dataUsingEncoding(NSUTF8StringEncoding)
try record.save(db)
}
// ... and get it back after a fetch:
dbQueue.inDatabase { db in
let reloadedRecord = RecordWithManagedData.fetchOne(db, key: record.id)!
reloadedRecord.managedData.controller = self.managedDataController
XCTAssertEqual(reloadedRecord.data, "foo".dataUsingEncoding(NSUTF8StringEncoding))
}
}
}
func testExplicitTransaction() {
assertNoError {
// Test that we can stored data in the file system...
let record = RecordWithManagedData()
record.managedData.controller = self.managedDataController
try dbQueue.inDatabase { db in
record.data = "foo".dataUsingEncoding(NSUTF8StringEncoding)
try record.save(db)
}
try dbQueue.inTransaction { db in
// ... and that changes...
record.data = "bar".dataUsingEncoding(NSUTF8StringEncoding)
try record.save(db)
// ... after changes...
record.data = "baz".dataUsingEncoding(NSUTF8StringEncoding)
try record.save(db)
// ... are not applied in the file system...
let reloadedRecord = RecordWithManagedData.fetchOne(db, key: record.id)!
reloadedRecord.managedData.controller = self.managedDataController
XCTAssertEqual(reloadedRecord.data, "foo".dataUsingEncoding(NSUTF8StringEncoding))
// ... until database commit:
return .Commit
}
// We find our modified data after commit:
dbQueue.inDatabase { db in
let reloadedRecord = RecordWithManagedData.fetchOne(db, key: record.id)!
reloadedRecord.managedData.controller = self.managedDataController
XCTAssertEqual(reloadedRecord.data, "baz".dataUsingEncoding(NSUTF8StringEncoding))
}
}
}
func testCommitError() {
assertNoError {
// Test that we can stored data in the file system...
let record = RecordWithManagedData()
record.managedData.controller = self.managedDataController
try dbQueue.inDatabase { db in
record.data = "foo".dataUsingEncoding(NSUTF8StringEncoding)
try record.save(db)
}
do {
try dbQueue.inTransaction { db in
// ... and that changes...
record.data = "bar".dataUsingEncoding(NSUTF8StringEncoding)
try record.save(db)
// ... after changes...
record.data = "baz".dataUsingEncoding(NSUTF8StringEncoding)
try record.save(db)
// ... are not applied in the file system...
let reloadedRecord = RecordWithManagedData.fetchOne(db, key: record.id)!
reloadedRecord.managedData.controller = self.managedDataController
XCTAssertEqual(reloadedRecord.data, "foo".dataUsingEncoding(NSUTF8StringEncoding))
// ... until database commit, which may fail:
let forbiddenRecord = RecordWithManagedData()
forbiddenRecord.managedData.controller = self.managedDataController
forbiddenRecord.data = "Bunny".dataUsingEncoding(NSUTF8StringEncoding)
try forbiddenRecord.save(db)
return .Commit
}
XCTFail("Expected error")
} catch let error as NSError {
XCTAssertEqual(error.domain, "ManagedDataController")
}
// We find our original data back after failure:
dbQueue.inDatabase { db in
let reloadedRecord = RecordWithManagedData.fetchOne(db, key: record.id)!
reloadedRecord.managedData.controller = self.managedDataController
XCTAssertEqual(reloadedRecord.data, "foo".dataUsingEncoding(NSUTF8StringEncoding))
}
}
}
}
-161
View File
@@ -1,161 +0,0 @@
import XCTest
import GRDB
// Taking inspiration from https://github.com/LoganWright/Genome
class Mapping {
enum Direction {
case Fetch(Row)
case Save
}
let direction: Direction
var dictionary: [String: DatabaseValueConvertible?] = [:]
init() {
direction = .Save
}
init(row: Row) {
direction = .Fetch(row)
}
subscript(name: String) -> Binding {
switch direction {
case .Save:
return Binding(
name: name,
direction: .Save({ (value: DatabaseValueConvertible?) in
self.dictionary[name] = value
}))
case .Fetch(let row):
return Binding(name: name, direction: .Fetch(row[name]))
}
}
}
class Binding {
enum Direction {
case Fetch(DatabaseValue?)
case Save((DatabaseValueConvertible?) -> ())
}
let name: String
let direction: Direction
init(name: String, direction: Direction) {
self.name = name
self.direction = direction
}
func bind<Value: DatabaseValueConvertible>(inout value: Value) {
switch direction {
case .Fetch(let databaseValue):
if let databaseValue = databaseValue {
value = Value.fromDatabaseValue(databaseValue)!
}
case .Save(let f):
f(value)
}
}
func bind<Value: DatabaseValueConvertible>(inout value: Value?) {
switch direction {
case .Fetch(let databaseValue):
if let databaseValue = databaseValue {
value = Value.fromDatabaseValue(databaseValue)
}
case .Save(let f):
f(value)
}
}
func bind<Value: DatabaseValueConvertible>(inout value: Value!) {
switch direction {
case .Fetch(let databaseValue):
if let databaseValue = databaseValue {
value = Value.fromDatabaseValue(databaseValue)
}
case .Save(let f):
f(value)
}
}
}
infix operator <-> { associativity left precedence 160 }
func <-><Value: DatabaseValueConvertible>(inout value: Value, binding: Binding) {
binding.bind(&value)
}
func <-><Value: DatabaseValueConvertible>(inout value: Value?, binding: Binding) {
binding.bind(&value)
}
func <-><Value: DatabaseValueConvertible>(inout value: Value!, binding: Binding) {
binding.bind(&value)
}
class MappedRecord : Record {
var id: Int64!
var firstName: String?
var lastName: String?
var fullName: String {
return [firstName, lastName].flatMap { $0 }.joinWithSeparator(" ")
}
init(firstName: String? = nil, lastName: String? = nil) {
self.firstName = firstName
self.lastName = lastName
super.init()
}
// The experiment:
func map(mapping: Mapping) {
id <-> mapping["id"]
firstName <-> mapping["firstName"]
lastName <-> mapping["lastName"]
}
// Record overrides
override class func databaseTableName() -> String? {
return "persons"
}
override func updateFromRow(row: Row) {
map(Mapping(row: row))
super.updateFromRow(row) // Subclasses are required to call super.
}
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
let mapping = Mapping()
map(mapping)
return mapping.dictionary
}
required init(row: Row) {
super.init(row: row)
}
}
class MappingTests: GRDBTestCase {
func testExample() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE persons (" +
"id INTEGER PRIMARY KEY, " +
"firstName TEXT, " +
"lastName TEXT" +
")")
try MappedRecord(firstName: "Arthur", lastName: "Miller").insert(db)
try MappedRecord(firstName: "Barbara", lastName: "Streisand").insert(db)
try MappedRecord(firstName: "Cinderella").insert(db)
let records = MappedRecord.fetchAll(db, "SELECT * FROM persons ORDER BY firstName, lastName")
print(records)
print(records.map { $0.fullName })
}
}
}
}
@@ -1,41 +0,0 @@
//
// AppDelegate.swift
// GRDBProfiling
//
// Created by Gwendal Roué on 15/09/2015.
// Copyright © 2015 Gwendal Roué. All rights reserved.
//
import Cocoa
import GRDB
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
var dbQueue: DatabaseQueue!
func applicationDidFinishLaunching(aNotification: NSNotification) {
let databasePath = NSBundle.mainBundle().pathForResource("ProfilingDatabase", ofType: "sqlite")!
dbQueue = try! DatabaseQueue(path: databasePath)
readFromDatabase()
}
func readFromDatabase() {
for _ in 0..<100 {
dbQueue.inDatabase { db in
for row in Row.fetch(db, "SELECT * FROM items") {
let _: Int64 = row.value(atIndex: 0)
let _: Int64 = row.value(atIndex: 1)
let _: Int64 = row.value(atIndex: 2)
let _: Int64 = row.value(atIndex: 3)
let _: Int64 = row.value(atIndex: 4)
let _: Int64 = row.value(atIndex: 5)
let _: Int64 = row.value(atIndex: 6)
let _: Int64 = row.value(atIndex: 7)
let _: Int64 = row.value(atIndex: 8)
let _: Int64 = row.value(atIndex: 9)
}
}
}
}
}
@@ -1,27 +0,0 @@
//
// ViewController.swift
// GRDBProfiling
//
// Created by Gwendal Roué on 15/09/2015.
// Copyright © 2015 Gwendal Roué. All rights reserved.
//
import Cocoa
class ViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override var representedObject: AnyObject? {
didSet {
// Update the view, if already loaded.
}
}
}
-44
View File
@@ -1,44 +0,0 @@
import XCTest
import GRDB
class GRDBTestCase: XCTestCase {
var databasePath: String!
var dbQueue: DatabaseQueue!
var sqlQueries: [String]!
var dbConfiguration: Configuration {
var dbConfiguration = Configuration()
dbConfiguration.trace = { (sql) in
self.sqlQueries.append(sql)
// LogSQL(sql) // Uncomment for verbose tests
}
return dbConfiguration
}
override func setUp() {
super.setUp()
sqlQueries = []
databasePath = "/tmp/GRDB.sqlite"
do { try NSFileManager.defaultManager().removeItemAtPath(databasePath) } catch { }
dbQueue = try! DatabaseQueue(path: databasePath, configuration: dbConfiguration)
}
override func tearDown() {
super.tearDown()
dbQueue = nil
try! NSFileManager.defaultManager().removeItemAtPath(databasePath)
}
func assertNoError(@noescape test: (Void) throws -> Void) {
do {
try test()
} catch let error as DatabaseError {
XCTFail(error.description)
} catch let error as RecordError {
XCTFail(error.description)
} catch {
XCTFail("error: \(error)")
}
}
}
@@ -1,91 +0,0 @@
import XCTest
import GRDB
class FMDBPerformanceTests: XCTestCase {
func testValueAtIndexPerformance() {
// Here we test the extraction of values by column index.
let databasePath = NSBundle(forClass: self.dynamicType).pathForResource("FetchPerformanceTests", ofType: "sqlite")!
let dbQueue = FMDatabaseQueue(path: databasePath)
self.measureBlock {
dbQueue.inDatabase { db in
if let rs = db.executeQuery("SELECT * FROM items", withArgumentsInArray: nil) {
while rs.next() {
let _ = rs.longForColumnIndex(0)
let _ = rs.longForColumnIndex(1)
let _ = rs.longForColumnIndex(2)
let _ = rs.longForColumnIndex(3)
let _ = rs.longForColumnIndex(4)
let _ = rs.longForColumnIndex(5)
let _ = rs.longForColumnIndex(6)
let _ = rs.longForColumnIndex(7)
let _ = rs.longForColumnIndex(8)
let _ = rs.longForColumnIndex(9)
}
}
}
}
}
func testValueNamedPerformance() {
// Here we test the extraction of values by column name.
let databasePath = NSBundle(forClass: self.dynamicType).pathForResource("FetchPerformanceTests", ofType: "sqlite")!
let dbQueue = FMDatabaseQueue(path: databasePath)
self.measureBlock {
dbQueue.inDatabase { db in
if let rs = db.executeQuery("SELECT * FROM items", withArgumentsInArray: nil) {
while rs.next() {
let _ = rs.longForColumn("i0")
let _ = rs.longForColumn("i1")
let _ = rs.longForColumn("i2")
let _ = rs.longForColumn("i3")
let _ = rs.longForColumn("i4")
let _ = rs.longForColumn("i5")
let _ = rs.longForColumn("i6")
let _ = rs.longForColumn("i7")
let _ = rs.longForColumn("i8")
let _ = rs.longForColumn("i9")
}
}
}
}
}
func testRecordPerformance() {
// Here we test that we can load "records".
//
// Two constraints:
//
// 1. Records MUST be initialized from a row, or a row-like object like
// a dictionary: rows MUST be introspectable by column name, so that
// the record can pick the columns it wants.
//
// 2. Fetched records MUST be flagged as having no change.
let databasePath = NSBundle(forClass: self.dynamicType).pathForResource("FetchPerformanceTests", ofType: "sqlite")!
let dbQueue = FMDatabaseQueue(path: databasePath)
self.measureBlock {
var records = [PerformanceRecord]()
dbQueue.inDatabase { db in
if let rs = db.executeQuery("SELECT * FROM items", withArgumentsInArray: nil) {
while rs.next() {
// FMDB already provides a row-like object:
let dictionary = rs.resultDictionary()
let record = PerformanceRecord(dictionary: dictionary)
record.databaseEdited = false // Needs to be explicit: GRDB does it implicitly.
records.append(record)
}
}
}
XCTAssertEqual(records[4].i2, 1)
XCTAssertEqual(records[4].i3, 0)
XCTAssertEqual(records[5].i2, 2)
XCTAssertEqual(records[5].i3, 1)
}
}
}
Binary file not shown.
@@ -1,93 +0,0 @@
import XCTest
import GRDB
class GRDBPerformanceTests: XCTestCase {
// This is not a test, but a function which generates the FetchPerformanceTests.sqlite resource.
func populateDatabase() {
let databasePath = "/tmp/FetchPerformanceTests.sqlite"
do {
let dbQueue = try! DatabaseQueue(path: databasePath)
try! dbQueue.inTransaction { db in
try db.execute("CREATE TABLE items (i0 INT, i1 INT, i2 INT, i3 INT, i4 INT, i5 INT, i6 INT, i7 INT, i8 INT, i9 INT)")
for i in 0..<100_000 {
try db.execute("INSERT INTO items (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) VALUES (?,?,?,?,?,?,?,?,?,?)", arguments: [i%1, i%2, i%3, i%4, i%5, i%6, i%7, i%8, i%9, i%10])
}
return .Commit
}
}
}
func testValueAtIndexPerformance() {
// Here we test the extraction of values by column index.
let databasePath = NSBundle(forClass: self.dynamicType).pathForResource("FetchPerformanceTests", ofType: "sqlite")!
let dbQueue = try! DatabaseQueue(path: databasePath)
self.measureBlock {
dbQueue.inDatabase { db in
for row in Row.fetch(db, "SELECT * FROM items") {
let _: Int = row.value(atIndex: 0)
let _: Int = row.value(atIndex: 1)
let _: Int = row.value(atIndex: 2)
let _: Int = row.value(atIndex: 3)
let _: Int = row.value(atIndex: 4)
let _: Int = row.value(atIndex: 5)
let _: Int = row.value(atIndex: 6)
let _: Int = row.value(atIndex: 7)
let _: Int = row.value(atIndex: 8)
let _: Int = row.value(atIndex: 9)
}
}
}
}
func testValueNamedPerformance() {
// Here we test the extraction of values by column name.
let databasePath = NSBundle(forClass: self.dynamicType).pathForResource("FetchPerformanceTests", ofType: "sqlite")!
let dbQueue = try! DatabaseQueue(path: databasePath)
self.measureBlock {
dbQueue.inDatabase { db in
for row in Row.fetch(db, "SELECT * FROM items") {
let _: Int = row.value(named: "i0")
let _: Int = row.value(named: "i1")
let _: Int = row.value(named: "i2")
let _: Int = row.value(named: "i3")
let _: Int = row.value(named: "i4")
let _: Int = row.value(named: "i5")
let _: Int = row.value(named: "i6")
let _: Int = row.value(named: "i7")
let _: Int = row.value(named: "i8")
let _: Int = row.value(named: "i9")
}
}
}
}
func testRecordPerformance() {
// Here we test that we can load "records".
//
// Two constraints:
//
// 1. Records MUST be initialized from a row, or a row-like object like
// a dictionary: rows MUST be introspectable by column name, so that
// the record can pick the columns it wants.
//
// 2. Fetched records MUST be flagged as having no change.
let databasePath = NSBundle(forClass: self.dynamicType).pathForResource("FetchPerformanceTests", ofType: "sqlite")!
let dbQueue = try! DatabaseQueue(path: databasePath)
self.measureBlock {
let records = dbQueue.inDatabase { db in
PerformanceRecord.fetchAll(db, "SELECT * FROM items")
}
XCTAssertEqual(records[4].i2, 1)
XCTAssertEqual(records[4].i3, 0)
XCTAssertEqual(records[5].i2, 2)
XCTAssertEqual(records[5].i3, 1)
}
}
}
@@ -1,47 +0,0 @@
import GRDB
class PerformanceRecord : Record {
var i0: Int?
var i1: Int?
var i2: Int?
var i3: Int?
var i4: Int?
var i5: Int?
var i6: Int?
var i7: Int?
var i8: Int?
var i9: Int?
required init(row: Row) {
super.init(row: row)
}
// Targets FMDB
init(dictionary: [NSObject: AnyObject]) {
super.init()
if let n = dictionary["i0"] as? NSNumber { i0 = n.longValue }
if let n = dictionary["i1"] as? NSNumber { i1 = n.longValue }
if let n = dictionary["i2"] as? NSNumber { i2 = n.longValue }
if let n = dictionary["i3"] as? NSNumber { i3 = n.longValue }
if let n = dictionary["i4"] as? NSNumber { i4 = n.longValue }
if let n = dictionary["i5"] as? NSNumber { i5 = n.longValue }
if let n = dictionary["i6"] as? NSNumber { i6 = n.longValue }
if let n = dictionary["i7"] as? NSNumber { i7 = n.longValue }
if let n = dictionary["i8"] as? NSNumber { i8 = n.longValue }
if let n = dictionary["i9"] as? NSNumber { i9 = n.longValue }
}
override func updateFromRow(row: Row) {
if let dbv = row["i0"] { i0 = dbv.value() }
if let dbv = row["i1"] { i1 = dbv.value() }
if let dbv = row["i2"] { i2 = dbv.value() }
if let dbv = row["i3"] { i3 = dbv.value() }
if let dbv = row["i4"] { i4 = dbv.value() }
if let dbv = row["i5"] { i5 = dbv.value() }
if let dbv = row["i6"] { i6 = dbv.value() }
if let dbv = row["i7"] { i7 = dbv.value() }
if let dbv = row["i8"] { i8 = dbv.value() }
if let dbv = row["i9"] { i9 = dbv.value() }
super.updateFromRow(row)
}
}
@@ -1,123 +0,0 @@
import XCTest
import SQLite
import GRDB
class StephenCelisSQLitePerformanceTests: XCTestCase {
func testValueAtIndexPerformance() {
// Here we test the extraction of values by column index.
let databasePath = NSBundle(forClass: self.dynamicType).pathForResource("FetchPerformanceTests", ofType: "sqlite")!
let db = try! Connection(databasePath)
self.measureBlock {
// Column access by index requires raw SQL (unlike extraction of values by column name).
for row in db.prepare("SELECT * FROM items") {
// Direct Int extraction is not supported.
let _ = Int(row[0] as! Int64)
let _ = Int(row[1] as! Int64)
let _ = Int(row[2] as! Int64)
let _ = Int(row[3] as! Int64)
let _ = Int(row[4] as! Int64)
let _ = Int(row[5] as! Int64)
let _ = Int(row[6] as! Int64)
let _ = Int(row[7] as! Int64)
let _ = Int(row[8] as! Int64)
let _ = Int(row[9] as! Int64)
}
}
}
func testValueNamedPerformance() {
// Here we test the extraction of values by column name.
let databasePath = NSBundle(forClass: self.dynamicType).pathForResource("FetchPerformanceTests", ofType: "sqlite")!
let db = try! Connection(databasePath)
// Column access by name requires query builder (unlike extraction of values by column index).
let items = Table("items")
let i0 = Expression<Int>("i0")
let i1 = Expression<Int>("i1")
let i2 = Expression<Int>("i2")
let i3 = Expression<Int>("i3")
let i4 = Expression<Int>("i4")
let i5 = Expression<Int>("i5")
let i6 = Expression<Int>("i6")
let i7 = Expression<Int>("i7")
let i8 = Expression<Int>("i8")
let i9 = Expression<Int>("i9")
self.measureBlock {
for item in db.prepare(items) {
let _ = item[i0]
let _ = item[i1]
let _ = item[i2]
let _ = item[i3]
let _ = item[i4]
let _ = item[i5]
let _ = item[i6]
let _ = item[i7]
let _ = item[i8]
let _ = item[i9]
}
}
}
func testRecordPerformance() {
// Here we test that we can load "records".
//
// Two constraints:
//
// 1. Records MUST be initialized from a row, or a row-like object like
// a dictionary: rows MUST be introspectable by column name, so that
// the record can pick the columns it wants.
//
// 2. Fetched records MUST be flagged as having no change.
let databasePath = NSBundle(forClass: self.dynamicType).pathForResource("FetchPerformanceTests", ofType: "sqlite")!
let db = try! Connection(databasePath)
// Column access by name requires query builder.
let items = Table("items")
let i0 = Expression<Int>("i0")
let i1 = Expression<Int>("i1")
let i2 = Expression<Int>("i2")
let i3 = Expression<Int>("i3")
let i4 = Expression<Int>("i4")
let i5 = Expression<Int>("i5")
let i6 = Expression<Int>("i6")
let i7 = Expression<Int>("i7")
let i8 = Expression<Int>("i8")
let i9 = Expression<Int>("i9")
func dictionaryFromRow(row: SQLite.Row) -> [NSObject: AnyObject] {
return [
"i0": row[i0],
"i1": row[i1],
"i2": row[i2],
"i3": row[i3],
"i4": row[i4],
"i5": row[i5],
"i6": row[i6],
"i7": row[i7],
"i8": row[i8],
"i9": row[i9]] as [NSObject: AnyObject]
}
self.measureBlock {
var records = [PerformanceRecord]()
for row in db.prepare(items) {
// SQLite.swift does not provide rows that are introspectable:
// build our own Row.
let dictionary = dictionaryFromRow(row)
let record = PerformanceRecord(dictionary: dictionary)
record.databaseEdited = false // Needs to be explicit: GRDB does it implicitly.
records.append(record)
}
XCTAssertEqual(records[4].i2, 1)
XCTAssertEqual(records[4].i3, 0)
XCTAssertEqual(records[5].i2, 2)
XCTAssertEqual(records[5].i3, 1)
}
}
}
@@ -1,37 +0,0 @@
//import XCTest
//@testable import GRDB
//
//class DatabaseErrorFromStatementCreationTests: GRDBTestCase {
//
// func testDatabaseErrorThrownBySelectStatementContainSQL() {
// dbQueue.inDatabase { db in
// do {
// let _ = try SelectStatement(database: db, sql: "SELECT * FROM blah")
// XCTFail()
// } catch let error as DatabaseError {
// XCTAssertEqual(error.code, 1)
// XCTAssertEqual(error.message!, "no such table: blah")
// XCTAssertEqual(error.sql!, "SELECT * FROM blah")
// XCTAssertEqual(error.description, "SQLite error 1 with statement `SELECT * FROM blah`: no such table: blah")
// } catch {
// XCTFail("\(error)")
// }
// }
// }
//
// func testDatabaseErrorThrownByUpdateStatementContainSQL() {
// dbQueue.inDatabase { db in
// do {
// let _ = try UpdateStatement(database: db, sql: "UPDATE blah SET id = 12")
// XCTFail()
// } catch let error as DatabaseError {
// XCTAssertEqual(error.code, 1)
// XCTAssertEqual(error.message!, "no such table: blah")
// XCTAssertEqual(error.sql!, "UPDATE blah SET id = 12")
// XCTAssertEqual(error.description, "SQLite error 1 with statement `UPDATE blah SET id = 12`: no such table: blah")
// } catch {
// XCTFail("\(error)")
// }
// }
// }
//}
@@ -1,56 +0,0 @@
import XCTest
@testable import GRDB
class NSDataMemoryTests: GRDBTestCase {
func testMemoryBehavior() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE datas (data BLOB)")
let data = "foo".dataUsingEncoding(NSUTF8StringEncoding)
try db.execute("INSERT INTO datas (data) VALUES (?)", arguments: [data])
for row in Row.fetch(db, "SELECT * FROM datas") {
let sqliteStatement = row.sqliteStatement
let sqliteBytes = sqlite3_column_blob(sqliteStatement, 0)
do {
// This data should be copied:
let copiedData: NSData = row.value(atIndex: 0)
XCTAssertNotEqual(copiedData.bytes, sqliteBytes)
XCTAssertEqual(copiedData, data)
}
do {
// This data should not be copied
let nonCopiedData = row.dataNoCopy(atIndex: 0)!
XCTAssertEqual(nonCopiedData.bytes, sqliteBytes)
XCTAssertEqual(nonCopiedData, data)
}
}
let row = Row.fetchOne(db, "SELECT * FROM datas")!
let databaseValue = row.first!.1
switch databaseValue.storage {
case .Blob(let data):
do {
// This data should not be copied:
let nonCopiedData: NSData = row.value(atIndex: 0)
XCTAssertEqual(nonCopiedData.bytes, data.bytes)
XCTAssertEqual(nonCopiedData, data)
}
do {
// This data should not be copied:
let nonCopiedData = row.dataNoCopy(atIndex: 0)!
XCTAssertEqual(nonCopiedData.bytes, data.bytes)
XCTAssertEqual(nonCopiedData, data)
}
default:
XCTFail("Not a blob")
}
}
}
}
}
@@ -1,408 +0,0 @@
import XCTest
import GRDB
class ConcurrencyTests: XCTestCase {
var databasePath: String!
var busyCallback: BusyCallback?
var dbQueue1: DatabaseQueue!
var dbLog1: [String]!
var dbQueue2: DatabaseQueue!
var dbLog2: [String]!
override func setUp() {
super.setUp()
databasePath = "/tmp/GRDBConcurrencyTests.sqlite"
do { try NSFileManager.defaultManager().removeItemAtPath(databasePath) } catch { }
self.busyCallback = nil
let busyCallback: BusyCallback = {
if let busyCallback = self.busyCallback {
return busyCallback(numberOfTries: $0)
} else {
// Default give up
return false
}
}
var baseConfiguration = Configuration()
baseConfiguration.trace = LogSQL
baseConfiguration.busyMode = .Callback(busyCallback)
dbLog1 = []
var configuration1 = baseConfiguration
configuration1.trace = { (sql) in
// NSLog("Queue 1: %@", sql)
self.dbLog1.append(sql)
}
dbQueue1 = try! DatabaseQueue(path: databasePath, configuration: configuration1)
dbLog2 = []
var configuration2 = baseConfiguration
configuration2.trace = { (sql) in
// NSLog("Queue 2: %@", sql)
self.dbLog2.append(sql)
}
dbQueue2 = try! DatabaseQueue(path: databasePath, configuration: configuration2)
}
override func tearDown() {
super.tearDown()
dbQueue1 = nil
dbQueue2 = nil
try! NSFileManager.defaultManager().removeItemAtPath(databasePath)
}
func testDeferredTransactionConcurrency() {
// Queue 1 Queue 2
// BEGIN DEFERRED TRANSACTION
let s1 = dispatch_semaphore_create(0)
// BEGIN DEFERRED TRANSACTION
let s2 = dispatch_semaphore_create(0)
// INSERT INTO stuffs (id) VALUES (NULL)
let s3 = dispatch_semaphore_create(0)
// INSERT INTO stuffs (id) VALUES (NULL) <--- Error
// ROLLBACK
let s4 = dispatch_semaphore_create(0)
// COMMIT
try! dbQueue1.inDatabase { db in
try db.execute("CREATE TABLE stuffs (id INTEGER PRIMARY KEY)")
}
let queue = dispatch_queue_create("com.github.groue.GRDB", DISPATCH_QUEUE_CONCURRENT)
let group = dispatch_group_create()
// Queue 1
dispatch_group_async(group, queue) {
do {
try self.dbQueue1.inTransaction(.Deferred) { db in
dispatch_semaphore_signal(s1)
dispatch_semaphore_wait(s2, DISPATCH_TIME_FOREVER)
try db.execute("INSERT INTO stuffs (id) VALUES (NULL)")
dispatch_semaphore_signal(s3)
dispatch_semaphore_wait(s4, DISPATCH_TIME_FOREVER)
return .Commit
}
}
catch {
XCTFail("\(error)")
}
}
// Queue 2
var concurrencyError: DatabaseError? = nil
dispatch_group_async(group, queue) {
do {
dispatch_semaphore_wait(s1, DISPATCH_TIME_FOREVER)
try self.dbQueue2.inTransaction(.Deferred) { db in
dispatch_semaphore_signal(s2)
dispatch_semaphore_wait(s3, DISPATCH_TIME_FOREVER)
try db.execute("INSERT INTO stuffs (id) VALUES (NULL)")
return .Commit
}
}
catch let error as DatabaseError {
dispatch_semaphore_signal(s4)
concurrencyError = error
}
catch {
XCTFail("\(error)")
}
}
dispatch_group_wait(group, DISPATCH_TIME_FOREVER)
if let concurrencyError = concurrencyError {
XCTAssertEqual(concurrencyError.code, 5) // SQLITE_BUSY
XCTAssertEqual(concurrencyError.sql, "INSERT INTO stuffs (id) VALUES (NULL)")
} else {
XCTFail("Expected concurrency error")
}
}
func testExclusiveTransactionConcurrency() {
// Queue 1 Queue 2
// BEGIN EXCLUSIVE TRANSACTION
let s1 = dispatch_semaphore_create(0)
// BEGIN EXCLUSIVE TRANSACTION <--- Error
let s2 = dispatch_semaphore_create(0)
// COMMIT
let queue = dispatch_queue_create("com.github.groue.GRDB", DISPATCH_QUEUE_CONCURRENT)
let group = dispatch_group_create()
// Queue 1
dispatch_group_async(group, queue) {
do {
try self.dbQueue1.inTransaction(.Exclusive) { db in
dispatch_semaphore_signal(s1)
dispatch_semaphore_wait(s2, DISPATCH_TIME_FOREVER)
return .Commit
}
}
catch {
XCTFail("\(error)")
}
}
// Queue 2
var concurrencyError: DatabaseError? = nil
dispatch_group_async(group, queue) {
do {
dispatch_semaphore_wait(s1, DISPATCH_TIME_FOREVER)
try self.dbQueue2.inTransaction(.Exclusive) { db in
return .Commit
}
}
catch let error as DatabaseError {
dispatch_semaphore_signal(s2)
concurrencyError = error
}
catch {
XCTFail("\(error)")
}
}
dispatch_group_wait(group, DISPATCH_TIME_FOREVER)
if let concurrencyError = concurrencyError {
XCTAssertEqual(concurrencyError.code, 5) // SQLITE_BUSY
XCTAssertEqual(concurrencyError.sql, "BEGIN EXCLUSIVE TRANSACTION")
} else {
XCTFail("Expected concurrency error")
}
}
func testImmediateTransactionConcurrency() {
// Queue 1 Queue 2
// BEGIN IMMEDIATE TRANSACTION
let s1 = dispatch_semaphore_create(0)
// BEGIN IMMEDIATE TRANSACTION <--- Error
let s2 = dispatch_semaphore_create(0)
// COMMIT
let queue = dispatch_queue_create("com.github.groue.GRDB", DISPATCH_QUEUE_CONCURRENT)
let group = dispatch_group_create()
// Queue 1
dispatch_group_async(group, queue) {
do {
try self.dbQueue1.inTransaction(.Immediate) { db in
dispatch_semaphore_signal(s1)
dispatch_semaphore_wait(s2, DISPATCH_TIME_FOREVER)
return .Commit
}
}
catch {
XCTFail("\(error)")
}
}
// Queue 2
var concurrencyError: DatabaseError? = nil
dispatch_group_async(group, queue) {
do {
dispatch_semaphore_wait(s1, DISPATCH_TIME_FOREVER)
try self.dbQueue2.inTransaction(.Immediate) { db in
return .Commit
}
}
catch let error as DatabaseError {
dispatch_semaphore_signal(s2)
concurrencyError = error
}
catch {
XCTFail("\(error)")
}
}
dispatch_group_wait(group, DISPATCH_TIME_FOREVER)
if let concurrencyError = concurrencyError {
XCTAssertEqual(concurrencyError.code, 5) // SQLITE_BUSY
XCTAssertEqual(concurrencyError.sql, "BEGIN IMMEDIATE TRANSACTION")
} else {
XCTFail("Expected concurrency error")
}
}
func testBusyCallback() {
// Queue 1 Queue 2
// BEGIN EXCLUSIVE TRANSACTION
let s1 = dispatch_semaphore_create(0)
// (Waiting) BEGIN EXCLUSIVE TRANSACTION <--- Busy
// (Waiting) BEGIN EXCLUSIVE TRANSACTION <--- Busy
// (Waiting) BEGIN EXCLUSIVE TRANSACTION <--- Busy
// COMMIT
// BEGIN EXCLUSIVE TRANSACTION
// COMMIT
var numberOfTries = 0
self.busyCallback = { n in
numberOfTries = n
usleep(10_000) // 0.01s
return true
}
let queue = dispatch_queue_create("com.github.groue.GRDB", DISPATCH_QUEUE_CONCURRENT)
let group = dispatch_group_create()
// Queue 1
dispatch_group_async(group, queue) {
do {
try self.dbQueue1.inTransaction(.Exclusive) { db in
dispatch_semaphore_signal(s1)
usleep(100_000) // 0.1s
return .Commit
}
}
catch {
XCTFail("\(error)")
}
}
// Queue 2
dispatch_group_async(group, queue) {
do {
dispatch_semaphore_wait(s1, DISPATCH_TIME_FOREVER)
try self.dbQueue2.inTransaction(.Exclusive) { db in
return .Commit
}
}
catch {
XCTFail("\(error)")
}
}
dispatch_group_wait(group, DISPATCH_TIME_FOREVER)
XCTAssertTrue(numberOfTries > 0) // Busy handler has been used.
}
func testReaderDuringDefaultTransaction() {
// Here we test that a reader can read while a writer is writing.
// Queue 1 Queue 2
// BEGIN IMMEDIATE TRANSACTION
// INSERT INTO stuffs (id) VALUES (NULL)
let s1 = dispatch_semaphore_create(0)
// SELECT * FROM stuffs <--- 0 result
let s2 = dispatch_semaphore_create(0)
// COMMIT
let s3 = dispatch_semaphore_create(0)
// SELECT * FROM stuffs <--- 1 result
try! dbQueue1.inDatabase { db in
try db.execute("CREATE TABLE stuffs (id INTEGER PRIMARY KEY)")
}
let queue = dispatch_queue_create("com.github.groue.GRDB", DISPATCH_QUEUE_CONCURRENT)
let group = dispatch_group_create()
// Queue 1
dispatch_group_async(group, queue) {
do {
try self.dbQueue1.inTransaction { db in
try db.execute("INSERT INTO stuffs (id) VALUES (NULL)")
dispatch_semaphore_signal(s1)
dispatch_semaphore_wait(s2, DISPATCH_TIME_FOREVER)
return .Commit
}
}
catch {
XCTFail("\(error)")
}
dispatch_semaphore_signal(s3)
}
// Queue 2
var rows1: [Row]?
var rows2: [Row]?
dispatch_group_async(group, queue) {
self.dbQueue2.inDatabase { db in
dispatch_semaphore_wait(s1, DISPATCH_TIME_FOREVER)
rows1 = Row.fetchAll(db, "SELECT * FROM stuffs")
dispatch_semaphore_signal(s2)
dispatch_semaphore_wait(s3, DISPATCH_TIME_FOREVER)
rows2 = Row.fetchAll(db, "SELECT * FROM stuffs")
}
}
dispatch_group_wait(group, DISPATCH_TIME_FOREVER)
XCTAssertEqual(rows1!.count, 0) // uncommitted changes are not visible
XCTAssertEqual(rows2!.count, 1) // committed changes are visible
}
func testReaderInDeferredTransactionDuringDefaultTransaction() {
// The `SELECT * FROM stuffs` statement of Queue 2 prevents Queue 1
// from committing with SQLITE_BUSY.
//
// Without this select, the Queue 2 COMMIT succeeds right away.
//
// Both facts are unexpected.
//
//
// Queue 1 Queue 2
// BEGIN IMMEDIATE TRANSACTION
// INSERT INTO stuffs (id) VALUES (NULL)
let s1 = dispatch_semaphore_create(0)
// BEGIN DEFERRED TRANSACTION
// SELECT * FROM stuffs
let s2 = dispatch_semaphore_create(0)
// COMMIT <--- Busy (Waiting)
// COMMIT <--- Busy (Waiting)
// COMMIT
// COMMIT
var numberOfTries = 0
self.busyCallback = { n in
numberOfTries = n
usleep(10_000) // 0.01s
return true
}
try! dbQueue1.inDatabase { db in
try db.execute("CREATE TABLE stuffs (id INTEGER PRIMARY KEY)")
}
let queue = dispatch_queue_create("com.github.groue.GRDB", DISPATCH_QUEUE_CONCURRENT)
let group = dispatch_group_create()
// Queue 1
dispatch_group_async(group, queue) {
do {
try self.dbQueue1.inTransaction { db in
try db.execute("INSERT INTO stuffs (id) VALUES (NULL)")
dispatch_semaphore_signal(s1)
dispatch_semaphore_wait(s2, DISPATCH_TIME_FOREVER)
return .Commit
}
}
catch {
XCTFail("\(error)")
}
}
// Queue 2
dispatch_group_async(group, queue) {
do {
dispatch_semaphore_wait(s1, DISPATCH_TIME_FOREVER)
try self.dbQueue2.inTransaction(.Deferred) { db in
Row.fetchAll(db, "SELECT * FROM stuffs")
dispatch_semaphore_signal(s2)
usleep(100_000) // 0.1s
return .Commit
}
}
catch {
XCTFail("\(error)")
}
}
dispatch_group_wait(group, DISPATCH_TIME_FOREVER)
XCTAssertTrue(numberOfTries > 0) // Busy handler has been used.
}
}
@@ -1,291 +0,0 @@
import XCTest
import GRDB
class DatabaseTests : GRDBTestCase {
func testCreateTable() {
assertNoError {
try dbQueue.inDatabase { db in
XCTAssertFalse(db.tableExists("persons"))
try db.execute(
"CREATE TABLE persons (" +
"id INTEGER PRIMARY KEY, " +
"name TEXT, " +
"age INT)")
XCTAssertTrue(db.tableExists("persons"))
}
}
}
func testMultipleStatementsWithoutArguments() {
assertNoError {
try dbQueue.inDatabase { db in
XCTAssertFalse(db.tableExists("persons"))
XCTAssertFalse(db.tableExists("pets"))
try db.executeMultiStatement(
"CREATE TABLE persons (id INTEGER PRIMARY KEY, name TEXT, age INT);" +
"CREATE TABLE pets (id INTEGER PRIMARY KEY, name TEXT, age INT);")
XCTAssertTrue(db.tableExists("persons"))
XCTAssertTrue(db.tableExists("pets"))
}
}
}
func testUpdateStatement() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
// The tested function:
let statement = db.updateStatement("INSERT INTO persons (name, age) VALUES ('Arthur', 41)")
try statement.execute()
let row = Row.fetchOne(db, "SELECT * FROM persons")!
XCTAssertEqual(row.value(atIndex: 0) as String, "Arthur")
XCTAssertEqual(row.value(atIndex: 1) as Int, 41)
}
}
}
func testUpdateStatementWithArrayBinding() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
let statement = db.updateStatement("INSERT INTO persons (name, age) VALUES (?, ?)")
try statement.execute(arguments: ["Arthur", 41])
let row = Row.fetchOne(db, "SELECT * FROM persons")!
XCTAssertEqual(row.value(atIndex: 0) as String, "Arthur")
XCTAssertEqual(row.value(atIndex: 1) as Int, 41)
}
}
}
func testUpdateStatementWithDictionaryBinding() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
let statement = db.updateStatement("INSERT INTO persons (name, age) VALUES (:name, :age)")
try statement.execute(arguments: ["name": "Arthur", "age": 41])
let row = Row.fetchOne(db, "SELECT * FROM persons")!
XCTAssertEqual(row.value(atIndex: 0) as String, "Arthur")
XCTAssertEqual(row.value(atIndex: 1) as Int, 41)
}
}
}
func testDatabaseExecute() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
// The tested function:
try db.execute("INSERT INTO persons (name, age) VALUES ('Arthur', 41)")
let row = Row.fetchOne(db, "SELECT * FROM persons")!
XCTAssertEqual(row.value(atIndex: 0) as String, "Arthur")
XCTAssertEqual(row.value(atIndex: 1) as Int, 41)
}
}
}
func testChangesReturnedByDatabaseExecute() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE persons (id INTEGER PRIMARY KEY, name TEXT)")
let changes1 = try db.execute("INSERT INTO persons (name) VALUES ('Arthur')")
XCTAssertEqual(changes1.changedRowCount, 1)
XCTAssertEqual(changes1.insertedRowID, 1)
let changes2 = try db.execute("INSERT INTO persons (name) VALUES (?)", arguments: ["Barbara"])
XCTAssertEqual(changes2.changedRowCount, 1)
XCTAssertEqual(changes2.insertedRowID, 2)
let changes3 = try db.execute("DELETE FROM persons")
XCTAssertEqual(changes3.changedRowCount, 2)
}
}
}
func testDatabaseExecuteWithArrayBinding() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
// The tested function:
try db.execute("INSERT INTO persons (name, age) VALUES (?, ?)", arguments: ["Arthur", 41])
let row = Row.fetchOne(db, "SELECT * FROM persons")!
XCTAssertEqual(row.value(atIndex: 0) as String, "Arthur")
XCTAssertEqual(row.value(atIndex: 1) as Int, 41)
}
}
}
func testDatabaseExecuteWithDictionaryBinding() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
// The tested function:
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Arthur", "age": 41])
let row = Row.fetchOne(db, "SELECT * FROM persons")!
XCTAssertEqual(row.value(atIndex: 0) as String, "Arthur")
XCTAssertEqual(row.value(atIndex: 1) as Int, 41)
}
}
}
func testSelectStatement() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Arthur", "age": 41])
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Barbara", "age": nil])
let statement = db.selectStatement("SELECT * FROM persons")
let rows = Row.fetchAll(statement)
XCTAssertEqual(rows.count, 2)
}
}
}
func testSelectStatementWithArrayBinding() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Arthur", "age": 41])
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Barbara", "age": nil])
let statement = db.selectStatement("SELECT * FROM persons WHERE name = ?")
let rows = Row.fetchAll(statement, arguments: ["Arthur"])
XCTAssertEqual(rows.count, 1)
}
}
}
func testSelectStatementWithDictionaryBinding() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Arthur", "age": 41])
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Barbara", "age": nil])
let statement = db.selectStatement("SELECT * FROM persons WHERE name = :name")
let rows = Row.fetchAll(statement, arguments: ["name": "Arthur"])
XCTAssertEqual(rows.count, 1)
}
}
}
func testRowValueAtIndex() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Arthur", "age": 41])
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Barbara", "age": nil])
var names: [String?] = []
var ages: [Int?] = []
let rows = Row.fetch(db, "SELECT * FROM persons ORDER BY name")
for row in rows {
// The tested function:
let name: String? = row.value(atIndex: 0)
let age: Int? = row.value(atIndex: 1)
names.append(name)
ages.append(age)
}
XCTAssertEqual(names[0]!, "Arthur")
XCTAssertEqual(names[1]!, "Barbara")
XCTAssertEqual(ages[0]!, 41)
XCTAssertNil(ages[1])
}
}
}
func testRowValueNamed() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Arthur", "age": 41])
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["name": "Barbara", "age": nil])
var names: [String?] = []
var ages: [Int?] = []
let rows = Row.fetch(db, "SELECT * FROM persons ORDER BY name")
for row in rows {
// The tested function:
let name: String? = row.value(named: "name")
let age: Int? = row.value(named: "age")
names.append(name)
ages.append(age)
}
XCTAssertEqual(names[0]!, "Arthur")
XCTAssertEqual(names[1]!, "Barbara")
XCTAssertEqual(ages[0]!, 41)
XCTAssertNil(ages[1])
}
}
}
func testRowSequenceCanBeIteratedTwice() {
assertNoError {
try dbQueue.inTransaction { db in
try db.execute("CREATE TABLE persons (name TEXT)")
try db.execute("INSERT INTO persons (name) VALUES (:name)", arguments: ["name": "Arthur"])
try db.execute("INSERT INTO persons (name) VALUES (:name)", arguments: ["name": "Barbara"])
let rows = Row.fetch(db, "SELECT * FROM persons ORDER BY name")
var names1: [String?] = rows.map { $0.value(named: "name") as String? }
var names2: [String?] = rows.map { $0.value(named: "name") as String? }
XCTAssertEqual(names1[0]!, "Arthur")
XCTAssertEqual(names1[1]!, "Barbara")
XCTAssertEqual(names2[0]!, "Arthur")
XCTAssertEqual(names2[1]!, "Barbara")
return .Commit
}
}
}
func testValueSequenceCanBeIteratedTwice() {
assertNoError {
try dbQueue.inTransaction { db in
try db.execute("CREATE TABLE persons (name TEXT)")
try db.execute("INSERT INTO persons (name) VALUES (:name)", arguments: ["name": "Arthur"])
try db.execute("INSERT INTO persons (name) VALUES (:name)", arguments: ["name": "Barbara"])
let nameSequence = String.fetch(db, "SELECT name FROM persons ORDER BY name")
var names1 = Array(nameSequence)
var names2 = Array(nameSequence)
XCTAssertEqual(names1[0], "Arthur")
XCTAssertEqual(names1[1], "Barbara")
XCTAssertEqual(names2[0], "Arthur")
XCTAssertEqual(names2[1], "Barbara")
return .Commit
}
}
}
func testDatabaseCanBeUsedOutsideOfDatabaseQueueBlockAsLongAsTheQueueIsCorrect() {
assertNoError {
var database: Database? = nil
dbQueue.inDatabase { db in
database = db
}
try dbQueue.inDatabase { _ in
try database!.execute("CREATE TABLE persons (name TEXT)")
}
}
}
}
@@ -1,18 +0,0 @@
import XCTest
import GRDB
class InMemoryDatabaseTests : GRDBTestCase
{
func testInMemoryDatabase() {
assertNoError {
let dbQueue = DatabaseQueue()
try dbQueue.inTransaction { db in
try db.execute("CREATE TABLE foo (bar TEXT)")
try db.execute("INSERT INTO foo (bar) VALUES ('baz')")
let baz = String.fetchOne(db, "SELECT bar FROM foo")!
XCTAssertEqual(baz, "baz")
return .Rollback
}
}
}
}
@@ -1,66 +0,0 @@
import XCTest
import GRDB
class DatabaseErrorTests: GRDBTestCase {
func testDatabaseErrorInTransaction() {
do {
try dbQueue.inTransaction { db in
try db.execute("CREATE TABLE persons (id INTEGER PRIMARY KEY)")
try db.execute("CREATE TABLE pets (masterId INTEGER NOT NULL REFERENCES persons(id), name TEXT)")
self.sqlQueries.removeAll()
try db.execute("INSERT INTO pets (masterId, name) VALUES (?, ?)", arguments: [1, "Bobby"])
return .Commit
}
} catch let error as DatabaseError {
XCTAssertEqual(error.code, 19) // SQLITE_CONSTRAINT
XCTAssertEqual(error.message!, "FOREIGN KEY constraint failed")
XCTAssertEqual(error.sql!, "INSERT INTO pets (masterId, name) VALUES (?, ?)")
XCTAssertEqual(error.description, "SQLite error 19 with statement `INSERT INTO pets (masterId, name) VALUES (?, ?)` arguments [1, \"Bobby\"]: FOREIGN KEY constraint failed")
XCTAssertEqual(sqlQueries.count, 2)
XCTAssertEqual(sqlQueries[0], "INSERT INTO pets (masterId, name) VALUES (1, 'Bobby')")
XCTAssertEqual(sqlQueries[1], "ROLLBACK TRANSACTION")
} catch {
XCTFail("\(error)")
}
}
func testDatabaseErrorThrownByUpdateStatementContainSQLAndArguments() {
dbQueue.inDatabase { db in
do {
try db.execute("CREATE TABLE persons (id INTEGER PRIMARY KEY)")
try db.execute("CREATE TABLE pets (masterId INTEGER NOT NULL REFERENCES persons(id), name TEXT)")
try db.execute("INSERT INTO pets (masterId, name) VALUES (?, ?)", arguments: [1, "Bobby"])
XCTFail()
} catch let error as DatabaseError {
XCTAssertEqual(error.code, 19) // SQLITE_CONSTRAINT
XCTAssertEqual(error.message!, "FOREIGN KEY constraint failed")
XCTAssertEqual(error.sql!, "INSERT INTO pets (masterId, name) VALUES (?, ?)")
XCTAssertEqual(error.description, "SQLite error 19 with statement `INSERT INTO pets (masterId, name) VALUES (?, ?)` arguments [1, \"Bobby\"]: FOREIGN KEY constraint failed")
} catch {
XCTFail("\(error)")
}
}
}
func testDatabaseErrorThrownByExecuteMultiStatementContainSQL() {
dbQueue.inDatabase { db in
do {
try db.executeMultiStatement(
"CREATE TABLE persons (id INTEGER PRIMARY KEY, name TEXT, age INT);" +
"CREATE TABLE pets (masterId INTEGER NOT NULL REFERENCES persons(id), name TEXT);" +
"INSERT INTO pets (masterId, name) VALUES (1, 'Bobby')")
XCTFail()
} catch let error as DatabaseError {
XCTAssertEqual(error.code, 19) // SQLITE_CONSTRAINT
XCTAssertEqual(error.message!, "FOREIGN KEY constraint failed")
XCTAssertEqual(error.sql!, "CREATE TABLE persons (id INTEGER PRIMARY KEY, name TEXT, age INT);CREATE TABLE pets (masterId INTEGER NOT NULL REFERENCES persons(id), name TEXT);INSERT INTO pets (masterId, name) VALUES (1, \'Bobby\')")
XCTAssertEqual(error.description, "SQLite error 19 with statement `CREATE TABLE persons (id INTEGER PRIMARY KEY, name TEXT, age INT);CREATE TABLE pets (masterId INTEGER NOT NULL REFERENCES persons(id), name TEXT);INSERT INTO pets (masterId, name) VALUES (1, \'Bobby\')`: FOREIGN KEY constraint failed")
} catch {
XCTFail("\(error)")
}
}
}
}
@@ -1,72 +0,0 @@
import XCTest
import GRDB
class DatabaseValueTests: GRDBTestCase {
func testDatabaseValueAdoptsDatabaseValueConvertible() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE integers (integer INTEGER)")
try db.execute("INSERT INTO integers (integer) VALUES (1)")
let databaseValue: DatabaseValue = Row.fetchOne(db, "SELECT * FROM integers")!.value(named: "integer")! // Triggers DatabaseValue.init?(databaseValue: DatabaseValue)
let count = Int.fetchOne(db, "SELECT COUNT(*) FROM integers WHERE integer = ?", arguments: [databaseValue])! // Triggers DatabaseValue.databaseValue
XCTAssertEqual(count, 1)
}
}
}
func testDatabaseValueEquatable() {
let fooData = "foo".dataUsingEncoding(NSUTF8StringEncoding)!
let barData = "bar".dataUsingEncoding(NSUTF8StringEncoding)!
XCTAssertEqual(DatabaseValue.Null, DatabaseValue.Null)
XCTAssertNotEqual(DatabaseValue.Null, DatabaseValue(int64: 1))
XCTAssertNotEqual(DatabaseValue.Null, DatabaseValue(double: 1.0))
XCTAssertNotEqual(DatabaseValue.Null, DatabaseValue(string: "foo"))
XCTAssertNotEqual(DatabaseValue.Null, DatabaseValue(data: fooData))
XCTAssertNotEqual(DatabaseValue(int64: 1), DatabaseValue.Null)
XCTAssertEqual(DatabaseValue(int64: 1), DatabaseValue(int64: 1))
XCTAssertNotEqual(DatabaseValue(int64: 1), DatabaseValue(int64: 2))
XCTAssertEqual(DatabaseValue(int64: 1), DatabaseValue(double: 1.0))
XCTAssertNotEqual(DatabaseValue(int64: 1), DatabaseValue(double: 1.1))
XCTAssertNotEqual(DatabaseValue(int64: 1), DatabaseValue(double: 2.0))
XCTAssertEqual(DatabaseValue(int64: 1 << 53), DatabaseValue(double: Double(1 << 53))) // Any integer up to 2^53 has an exact representation as a IEEE-754 double...
XCTAssertNotEqual(DatabaseValue(int64: 1 << 53 + 1), DatabaseValue(double: Double(1 << 53 + 1))) // ... 2^53 + 1 does not....
XCTAssertEqual(DatabaseValue(int64: 1 << 54), DatabaseValue(double: Double(1 << 54))) // ... but 2^54 does.
XCTAssertNotEqual(DatabaseValue(int64: Int64.max), DatabaseValue(double: Double(Int64.max))) // ... and Int64.max does not.
XCTAssertNotEqual(DatabaseValue(int64: 1), DatabaseValue(string: "foo"))
XCTAssertNotEqual(DatabaseValue(int64: 1), DatabaseValue(string: "1"))
XCTAssertNotEqual(DatabaseValue(int64: 1), DatabaseValue(string: "1.0"))
XCTAssertNotEqual(DatabaseValue(int64: 1), DatabaseValue(data: fooData))
XCTAssertNotEqual(DatabaseValue(double: 1.0), DatabaseValue.Null)
XCTAssertEqual(DatabaseValue(double: 1.0), DatabaseValue(int64: 1))
XCTAssertNotEqual(DatabaseValue(double: 1.1), DatabaseValue(int64: 1))
XCTAssertNotEqual(DatabaseValue(double: 1.0), DatabaseValue(int64: 2))
XCTAssertEqual(DatabaseValue(double: 1.0), DatabaseValue(double: 1.0))
XCTAssertNotEqual(DatabaseValue(double: 1.0), DatabaseValue(double: 2.0))
XCTAssertEqual(DatabaseValue(double: Double(1 << 53)), DatabaseValue(int64: 1 << 53)) // Any integer up to 2^53 has an exact representation as a IEEE-754 double...
XCTAssertNotEqual(DatabaseValue(double: Double(1 << 53 + 1)), DatabaseValue(int64: 1 << 53 + 1)) // ... 2^53 + 1 does not....
XCTAssertEqual(DatabaseValue(double: Double(1 << 54)), DatabaseValue(int64: 1 << 54)) // ... but 2^54 does.
XCTAssertNotEqual(DatabaseValue(double: Double(Int64.max)), DatabaseValue(int64: Int64.max)) // ... and Int64.max does not.
XCTAssertNotEqual(DatabaseValue(double: 1.0), DatabaseValue(string: "foo"))
XCTAssertNotEqual(DatabaseValue(double: 1.0), DatabaseValue(string: "1"))
XCTAssertNotEqual(DatabaseValue(double: 1.0), DatabaseValue(string: "1.0"))
XCTAssertNotEqual(DatabaseValue(double: 1.0), DatabaseValue(data: fooData))
XCTAssertNotEqual(DatabaseValue(string: "foo"), DatabaseValue.Null)
XCTAssertNotEqual(DatabaseValue(string: "foo"), DatabaseValue(int64: 1))
XCTAssertNotEqual(DatabaseValue(string: "foo"), DatabaseValue(double: 1.0))
XCTAssertEqual(DatabaseValue(string: "foo"), DatabaseValue(string: "foo"))
XCTAssertNotEqual(DatabaseValue(string: "foo"), DatabaseValue(string: "bar"))
XCTAssertNotEqual(DatabaseValue(string: "foo"), DatabaseValue(data: fooData))
XCTAssertNotEqual(DatabaseValue(data: fooData), DatabaseValue.Null)
XCTAssertNotEqual(DatabaseValue(data: fooData), DatabaseValue(int64: 1))
XCTAssertNotEqual(DatabaseValue(data: fooData), DatabaseValue(double: 1.0))
XCTAssertNotEqual(DatabaseValue(data: fooData), DatabaseValue(string: "foo"))
XCTAssertEqual(DatabaseValue(data: fooData), DatabaseValue(data: fooData))
XCTAssertNotEqual(DatabaseValue(data: fooData), DatabaseValue(data: barData))
}
}
@@ -1,59 +0,0 @@
import XCTest
import GRDB
struct DatabaseTimestamp: DatabaseValueConvertible {
// NSDate conversion
//
// We consistently use the Swift nil to represent the database NULL: the
// date property is a non-optional NSDate, and the NSDate initializer is
// failable:
/// The represented date
let date: NSDate
/// Creates a DatabaseTimestamp from an NSDate.
/// The result is nil if and only if *date* is nil.
init?(_ date: NSDate?) {
guard let date = date else {
return nil
}
self.date = date
}
// DatabaseValueConvertible adoption
/// Returns a value that can be stored in the database.
var databaseValue: DatabaseValue {
return DatabaseValue(double: date.timeIntervalSince1970)
}
/// Returns an instance initialized from *databaseValue*, if possible.
static func fromDatabaseValue(databaseValue: DatabaseValue) -> DatabaseTimestamp? {
// Double itself adopts DatabaseValueConvertible. So let's avoid
// handling the raw DatabaseValue, and use built-in Double conversion:
guard let timeInterval = Double.fromDatabaseValue(databaseValue) else {
// No Double, no NSDate!
return nil
}
return DatabaseTimestamp(NSDate(timeIntervalSince1970: timeInterval))
}
}
class DatabaseTimestampTests: GRDBTestCase {
func testDatabaseTimestamp() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE dates (date DATETIME)")
let storedDate = NSDate()
try db.execute("INSERT INTO dates (date) VALUES (?)", arguments: [DatabaseTimestamp(storedDate)])
let fetchedDate = DatabaseTimestamp.fetchOne(db, "SELECT date FROM dates")!.date
let delta = storedDate.timeIntervalSinceDate(fetchedDate)
XCTAssertTrue(abs(delta) < 0.1)
}
}
}
}
@@ -1,817 +0,0 @@
import XCTest
import GRDB
enum SQLiteStorageClass {
case Null
case Integer
case Real
case Text
case Blob
}
extension DatabaseValue {
var storageClass: SQLiteStorageClass {
switch value() {
case nil:
return .Null
case is Int64:
return .Integer
case is Double:
return .Real
case is String:
return .Text
case is NSData:
return .Blob
default:
fatalError("Unexpected type")
}
}
}
class DatabaseValueConversionTests : GRDBTestCase {
// Datatypes In SQLite Version 3: https://www.sqlite.org/datatype3.html
override func setUp() {
super.setUp()
var migrator = DatabaseMigrator()
migrator.registerMigration("createPersons") { db in
try db.execute(
"CREATE TABLE `values` (" +
"integerAffinity INTEGER, " +
"textAffinity TEXT, " +
"noneAffinity BLOB, " +
"realAffinity DOUBLE, " +
"numericAffinity NUMERIC" +
")")
}
assertNoError {
try migrator.migrate(dbQueue)
}
}
func testTextAffinity() {
// https://www.sqlite.org/datatype3.html
//
// > A column with TEXT affinity stores all data using storage classes
// > NULL, TEXT or BLOB. If numerical data is inserted into a column
// > with TEXT affinity it is converted into text form before being
// > stored.
assertNoError {
// Int is turned to Text
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (textAffinity) VALUES (?)", arguments: [0 as Int])
let dbv = Row.fetchOne(db, "SELECT textAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Text)
// Check GRDB conversions from Text storage:
XCTAssertTrue((dbv.value() as Bool?) == nil)
XCTAssertTrue((dbv.value() as Int?) == nil)
XCTAssertTrue((dbv.value() as Int32?) == nil)
XCTAssertTrue((dbv.value() as Int64?) == nil)
XCTAssertTrue((dbv.value() as Double?) == nil)
XCTAssertEqual((dbv.value() as String?)!, "0")
XCTAssertEqual((dbv.value() as String), "0")
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// Int64 is turned to Text
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (textAffinity) VALUES (?)", arguments: [0 as Int64])
let dbv = Row.fetchOne(db, "SELECT textAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Text)
// Check GRDB conversions from Text storage:
XCTAssertTrue((dbv.value() as Bool?) == nil)
XCTAssertTrue((dbv.value() as Int?) == nil)
XCTAssertTrue((dbv.value() as Int32?) == nil)
XCTAssertTrue((dbv.value() as Int64?) == nil)
XCTAssertTrue((dbv.value() as Double?) == nil)
XCTAssertEqual((dbv.value() as String?)!, "0")
XCTAssertEqual((dbv.value() as String), "0")
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// Int32 is turned to Text
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (textAffinity) VALUES (?)", arguments: [0 as Int32])
let dbv = Row.fetchOne(db, "SELECT textAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Text)
// Check GRDB conversions from Text storage:
XCTAssertTrue((dbv.value() as Bool?) == nil)
XCTAssertTrue((dbv.value() as Int?) == nil)
XCTAssertTrue((dbv.value() as Int32?) == nil)
XCTAssertTrue((dbv.value() as Int64?) == nil)
XCTAssertTrue((dbv.value() as Double?) == nil)
XCTAssertEqual((dbv.value() as String?)!, "0")
XCTAssertEqual((dbv.value() as String), "0")
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// Double is turned to Real
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (textAffinity) VALUES (?)", arguments: [0.0])
let dbv = Row.fetchOne(db, "SELECT textAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Text)
// Check GRDB conversions from Text storage:
XCTAssertTrue((dbv.value() as Bool?) == nil)
XCTAssertTrue((dbv.value() as Int?) == nil)
XCTAssertTrue((dbv.value() as Int32?) == nil)
XCTAssertTrue((dbv.value() as Int64?) == nil)
XCTAssertTrue((dbv.value() as Double?) == nil)
XCTAssertEqual((dbv.value() as String?)!, "0.0")
XCTAssertEqual((dbv.value() as String), "0.0")
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// "3.0e+5" is turned to Text
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (textAffinity) VALUES (?)", arguments: ["3.0e+5"])
let dbv = Row.fetchOne(db, "SELECT textAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Text)
// Check GRDB conversions from Text storage:
XCTAssertTrue((dbv.value() as Bool?) == nil)
XCTAssertTrue((dbv.value() as Int?) == nil)
XCTAssertTrue((dbv.value() as Int32?) == nil)
XCTAssertTrue((dbv.value() as Int64?) == nil)
XCTAssertTrue((dbv.value() as Double?) == nil)
XCTAssertEqual((dbv.value() as String?)!, "3.0e+5")
XCTAssertEqual((dbv.value() as String), "3.0e+5")
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// "foo" is turned to Text
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (textAffinity) VALUES (?)", arguments: ["foo"])
let dbv = Row.fetchOne(db, "SELECT textAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Text)
// Check GRDB conversions from Text storage:
XCTAssertTrue((dbv.value() as Bool?) == nil)
XCTAssertTrue((dbv.value() as Int?) == nil)
XCTAssertTrue((dbv.value() as Int32?) == nil)
XCTAssertTrue((dbv.value() as Int64?) == nil)
XCTAssertTrue((dbv.value() as Double?) == nil)
XCTAssertEqual((dbv.value() as String?)!, "foo")
XCTAssertEqual((dbv.value() as String), "foo")
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// Blob is turned to Blob
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (textAffinity) VALUES (?)", arguments: ["foo".dataUsingEncoding(NSUTF8StringEncoding)])
let dbv = Row.fetchOne(db, "SELECT textAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Blob)
// Check GRDB conversions from Blob storage:
XCTAssertTrue((dbv.value() as Bool?) == nil)
XCTAssertTrue((dbv.value() as Int?) == nil)
XCTAssertTrue((dbv.value() as Int32?) == nil)
XCTAssertTrue((dbv.value() as Int64?) == nil)
XCTAssertTrue((dbv.value() as Double?) == nil)
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertEqual((dbv.value() as NSData?), "foo".dataUsingEncoding(NSUTF8StringEncoding))
return .Rollback
}
}
}
func testNumericAffinity() {
// https://www.sqlite.org/datatype3.html
//
// > A column with NUMERIC affinity may contain values using all five
// > storage classes. When text data is inserted into a NUMERIC column,
// > the storage class of the text is converted to INTEGER or REAL (in
// > order of preference) if such conversion is lossless and reversible.
// > For conversions between TEXT and REAL storage classes, SQLite
// > considers the conversion to be lossless and reversible if the first
// > 15 significant decimal digits of the number are preserved. If the
// > lossless conversion of TEXT to INTEGER or REAL is not possible then
// > the value is stored using the TEXT storage class. No attempt is
// > made to convert NULL or BLOB values.
// >
// > A string might look like a floating-point literal with a decimal
// > point and/or exponent notation but as long as the value can be
// > expressed as an integer, the NUMERIC affinity will convert it into
// > an integer. Hence, the string '3.0e+5' is stored in a column with
// > NUMERIC affinity as the integer 300000, not as the floating point
// > value 300000.0.
testNumericAffinity("numericAffinity")
}
func testIntegerAffinity() {
// https://www.sqlite.org/datatype3.html
//
// > A column that uses INTEGER affinity behaves the same as a column
// > with NUMERIC affinity. The difference between INTEGER and NUMERIC
// > affinity is only evident in a CAST expression.
testNumericAffinity("integerAffinity")
}
func testRealAffinity() {
// https://www.sqlite.org/datatype3.html
//
// > A column with REAL affinity behaves like a column with NUMERIC
// > affinity except that it forces integer values into floating point
// > representation. (As an internal optimization, small floating point
// > values with no fractional component and stored in columns with REAL
// > affinity are written to disk as integers in order to take up less
// > space and are automatically converted back into floating point as
// > the value is read out. This optimization is completely invisible at
// > the SQL level and can only be detected by examining the raw bits of
// > the database file.)
assertNoError {
// Int is turned to Real
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: [0 as Int])
let dbv = Row.fetchOne(db, "SELECT realAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
// Check GRDB conversions from Real storage
XCTAssertEqual((dbv.value() as Bool?)!, false)
XCTAssertEqual((dbv.value() as Bool), false)
XCTAssertEqual((dbv.value() as Int?)!, 0)
XCTAssertEqual((dbv.value() as Int), 0)
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
XCTAssertEqual((dbv.value() as Int32), Int32(0))
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
XCTAssertEqual((dbv.value() as Int64), Int64(0))
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
XCTAssertEqual((dbv.value() as Double), 0.0)
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// Int64 is turned to Real
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: [0 as Int64])
let dbv = Row.fetchOne(db, "SELECT realAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
// Check GRDB conversions from Real storage
XCTAssertEqual((dbv.value() as Bool?)!, false)
XCTAssertEqual((dbv.value() as Bool), false)
XCTAssertEqual((dbv.value() as Int?)!, 0)
XCTAssertEqual((dbv.value() as Int), 0)
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
XCTAssertEqual((dbv.value() as Int32), Int32(0))
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
XCTAssertEqual((dbv.value() as Int64), Int64(0))
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
XCTAssertEqual((dbv.value() as Double), 0.0)
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// Int32 is turned to Real
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: [0 as Int32])
let dbv = Row.fetchOne(db, "SELECT realAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
// Check GRDB conversions from Real storage
XCTAssertEqual((dbv.value() as Bool?)!, false)
XCTAssertEqual((dbv.value() as Bool), false)
XCTAssertEqual((dbv.value() as Int?)!, 0)
XCTAssertEqual((dbv.value() as Int), 0)
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
XCTAssertEqual((dbv.value() as Int32), Int32(0))
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
XCTAssertEqual((dbv.value() as Int64), Int64(0))
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
XCTAssertEqual((dbv.value() as Double), 0.0)
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// 3.0e5 Double is turned to Real
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: [3.0e5])
let dbv = Row.fetchOne(db, "SELECT realAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
// Check GRDB conversions from Real storage
XCTAssertEqual((dbv.value() as Bool?)!, true)
XCTAssertEqual((dbv.value() as Bool), true)
XCTAssertEqual((dbv.value() as Int?)!, 300000)
XCTAssertEqual((dbv.value() as Int), 300000)
XCTAssertEqual((dbv.value() as Int32?)!, Int32(300000))
XCTAssertEqual((dbv.value() as Int32), Int32(300000))
XCTAssertEqual((dbv.value() as Int64?)!, Int64(300000))
XCTAssertEqual((dbv.value() as Int64), Int64(300000))
XCTAssertEqual((dbv.value() as Double?)!, Double(300000))
XCTAssertEqual((dbv.value() as Double), Double(300000))
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// 1.0e20 Double is turned to Real
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: [1.0e20])
let dbv = Row.fetchOne(db, "SELECT realAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
// Check GRDB conversions from Real storage (avoid Int, Int32 and Int64 since 1.0e20 does not fit)
XCTAssertEqual((dbv.value() as Bool?)!, true)
XCTAssertEqual((dbv.value() as Bool), true)
XCTAssertEqual((dbv.value() as Double?)!, 1e20)
XCTAssertEqual((dbv.value() as Double), 1e20)
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// "3.0e+5" is turned to Real
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: ["3.0e+5"])
let dbv = Row.fetchOne(db, "SELECT realAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
// Check GRDB conversions from Real storage
XCTAssertEqual((dbv.value() as Bool?)!, true)
XCTAssertEqual((dbv.value() as Bool), true)
XCTAssertEqual((dbv.value() as Int?)!, 300000)
XCTAssertEqual((dbv.value() as Int), 300000)
XCTAssertEqual((dbv.value() as Int32?)!, Int32(300000))
XCTAssertEqual((dbv.value() as Int32), Int32(300000))
XCTAssertEqual((dbv.value() as Int64?)!, Int64(300000))
XCTAssertEqual((dbv.value() as Int64), Int64(300000))
XCTAssertEqual((dbv.value() as Double?)!, Double(300000))
XCTAssertEqual((dbv.value() as Double), Double(300000))
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// "1.0e+20" is turned to Real
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: ["1.0e+20"])
let dbv = Row.fetchOne(db, "SELECT realAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
// Check GRDB conversions from Real storage: (avoid Int, Int32 and Int64 since 1.0e20 does not fit)
XCTAssertEqual((dbv.value() as Bool?)!, true)
XCTAssertEqual((dbv.value() as Bool), true)
XCTAssertEqual((dbv.value() as Double?)!, 1e20)
XCTAssertEqual((dbv.value() as Double), 1e20)
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// "foo" is turned to Text
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: ["foo"])
let dbv = Row.fetchOne(db, "SELECT realAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Text)
// Check GRDB conversions from Text storage:
XCTAssertTrue((dbv.value() as Bool?) == nil)
XCTAssertTrue((dbv.value() as Int?) == nil)
XCTAssertTrue((dbv.value() as Int32?) == nil)
XCTAssertTrue((dbv.value() as Int64?) == nil)
XCTAssertTrue((dbv.value() as Double?) == nil)
XCTAssertEqual((dbv.value() as String?)!, "foo")
XCTAssertEqual((dbv.value() as String), "foo")
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// Blob is turned to Blob
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (realAffinity) VALUES (?)", arguments: ["foo".dataUsingEncoding(NSUTF8StringEncoding)])
let dbv = Row.fetchOne(db, "SELECT realAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Blob)
// Check GRDB conversions from Blob storage:
XCTAssertTrue((dbv.value() as Bool?) == nil)
XCTAssertTrue((dbv.value() as Int?) == nil)
XCTAssertTrue((dbv.value() as Int32?) == nil)
XCTAssertTrue((dbv.value() as Int64?) == nil)
XCTAssertTrue((dbv.value() as Double?) == nil)
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertEqual((dbv.value() as NSData?), "foo".dataUsingEncoding(NSUTF8StringEncoding))
return .Rollback
}
}
}
func testNoneAffinity() {
// https://www.sqlite.org/datatype3.html
//
// > A column with affinity NONE does not prefer one storage class over
// > another and no attempt is made to coerce data from one storage
// > class into another.
assertNoError {
// Int is turned to Integer
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (noneAffinity) VALUES (?)", arguments: [0 as Int])
let dbv = Row.fetchOne(db, "SELECT noneAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Integer)
// Check GRDB conversions from Integer storage
XCTAssertEqual((dbv.value() as Bool?)!, false)
XCTAssertEqual((dbv.value() as Bool), false)
XCTAssertEqual((dbv.value() as Int?)!, 0)
XCTAssertEqual((dbv.value() as Int), 0)
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
XCTAssertEqual((dbv.value() as Int32), Int32(0))
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
XCTAssertEqual((dbv.value() as Int64), Int64(0))
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
XCTAssertEqual((dbv.value() as Double), 0.0)
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// Int64 is turned to Integer
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (noneAffinity) VALUES (?)", arguments: [0 as Int64])
let dbv = Row.fetchOne(db, "SELECT noneAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Integer)
// Check GRDB conversions from Integer storage
XCTAssertEqual((dbv.value() as Bool?)!, false)
XCTAssertEqual((dbv.value() as Bool), false)
XCTAssertEqual((dbv.value() as Int?)!, 0)
XCTAssertEqual((dbv.value() as Int), 0)
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
XCTAssertEqual((dbv.value() as Int32), Int32(0))
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
XCTAssertEqual((dbv.value() as Int64), Int64(0))
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
XCTAssertEqual((dbv.value() as Double), 0.0)
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// Int32 is turned to Integer
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (noneAffinity) VALUES (?)", arguments: [0 as Int32])
let dbv = Row.fetchOne(db, "SELECT noneAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Integer)
// Check GRDB conversions from Integer storage
XCTAssertEqual((dbv.value() as Bool?)!, false)
XCTAssertEqual((dbv.value() as Bool), false)
XCTAssertEqual((dbv.value() as Int?)!, 0)
XCTAssertEqual((dbv.value() as Int), 0)
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
XCTAssertEqual((dbv.value() as Int32), Int32(0))
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
XCTAssertEqual((dbv.value() as Int64), Int64(0))
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
XCTAssertEqual((dbv.value() as Double), 0.0)
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// Double is turned to Real
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (noneAffinity) VALUES (?)", arguments: [0.0])
let dbv = Row.fetchOne(db, "SELECT noneAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
// Check GRDB conversions from Real storage
XCTAssertEqual((dbv.value() as Bool?)!, false)
XCTAssertEqual((dbv.value() as Bool), false)
XCTAssertEqual((dbv.value() as Int?)!, 0)
XCTAssertEqual((dbv.value() as Int), 0)
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
XCTAssertEqual((dbv.value() as Int32), Int32(0))
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
XCTAssertEqual((dbv.value() as Int64), Int64(0))
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
XCTAssertEqual((dbv.value() as Double), 0.0)
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// "3.0e+5" is turned to Text
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (noneAffinity) VALUES (?)", arguments: ["3.0e+5"])
let dbv = Row.fetchOne(db, "SELECT noneAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Text)
// Check GRDB conversions from Text storage
XCTAssertTrue((dbv.value() as Bool?) == nil)
XCTAssertTrue((dbv.value() as Int?) == nil)
XCTAssertTrue((dbv.value() as Int32?) == nil)
XCTAssertTrue((dbv.value() as Int64?) == nil)
XCTAssertTrue((dbv.value() as Double?) == nil)
XCTAssertEqual((dbv.value() as String?)!, "3.0e+5")
XCTAssertEqual((dbv.value() as String), "3.0e+5")
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// Blob is turned to Blob
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (noneAffinity) VALUES (?)", arguments: ["foo".dataUsingEncoding(NSUTF8StringEncoding)])
let dbv = Row.fetchOne(db, "SELECT noneAffinity FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Blob)
// Check GRDB conversions from Blob storage
XCTAssertTrue((dbv.value() as Bool?) == nil)
XCTAssertTrue((dbv.value() as Int?) == nil)
XCTAssertTrue((dbv.value() as Int32?) == nil)
XCTAssertTrue((dbv.value() as Int64?) == nil)
XCTAssertTrue((dbv.value() as Double?) == nil)
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertEqual((dbv.value() as NSData?), "foo".dataUsingEncoding(NSUTF8StringEncoding))
return .Rollback
}
}
}
func testNumericAffinity(columnName: String) {
// https://www.sqlite.org/datatype3.html
//
// > A column with NUMERIC affinity may contain values using all five
// > storage classes. When text data is inserted into a NUMERIC column,
// > the storage class of the text is converted to INTEGER or REAL (in
// > order of preference) if such conversion is lossless and reversible.
// > For conversions between TEXT and REAL storage classes, SQLite
// > considers the conversion to be lossless and reversible if the first
// > 15 significant decimal digits of the number are preserved. If the
// > lossless conversion of TEXT to INTEGER or REAL is not possible then
// > the value is stored using the TEXT storage class. No attempt is
// > made to convert NULL or BLOB values.
// >
// > A string might look like a floating-point literal with a decimal
// > point and/or exponent notation but as long as the value can be
// > expressed as an integer, the NUMERIC affinity will convert it into
// > an integer. Hence, the string '3.0e+5' is stored in a column with
// > NUMERIC affinity as the integer 300000, not as the floating point
// > value 300000.0.
assertNoError {
// Int is turned to Integer
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (\(columnName)) VALUES (?)", arguments: [0 as Int])
let dbv = Row.fetchOne(db, "SELECT \(columnName) FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Integer)
// Check GRDB conversions from Integer storage
XCTAssertEqual((dbv.value() as Bool?)!, false)
XCTAssertEqual((dbv.value() as Bool), false)
XCTAssertEqual((dbv.value() as Int?)!, 0)
XCTAssertEqual((dbv.value() as Int), 0)
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
XCTAssertEqual((dbv.value() as Int32), Int32(0))
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
XCTAssertEqual((dbv.value() as Int64), Int64(0))
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
XCTAssertEqual((dbv.value() as Double), 0.0)
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// Int64 is turned to Integer
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (\(columnName)) VALUES (?)", arguments: [0 as Int64])
let dbv = Row.fetchOne(db, "SELECT \(columnName) FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Integer)
// Check GRDB conversions from Integer storage
XCTAssertEqual((dbv.value() as Bool?)!, false)
XCTAssertEqual((dbv.value() as Bool), false)
XCTAssertEqual((dbv.value() as Int?)!, 0)
XCTAssertEqual((dbv.value() as Int), 0)
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
XCTAssertEqual((dbv.value() as Int32), Int32(0))
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
XCTAssertEqual((dbv.value() as Int64), Int64(0))
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
XCTAssertEqual((dbv.value() as Double), 0.0)
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// Int32 is turned to Integer
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (\(columnName)) VALUES (?)", arguments: [0 as Int32])
let dbv = Row.fetchOne(db, "SELECT \(columnName) FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Integer)
// Check GRDB conversions from Integer storage
XCTAssertEqual((dbv.value() as Bool?)!, false)
XCTAssertEqual((dbv.value() as Bool), false)
XCTAssertEqual((dbv.value() as Int?)!, 0)
XCTAssertEqual((dbv.value() as Int), 0)
XCTAssertEqual((dbv.value() as Int32?)!, Int32(0))
XCTAssertEqual((dbv.value() as Int32), Int32(0))
XCTAssertEqual((dbv.value() as Int64?)!, Int64(0))
XCTAssertEqual((dbv.value() as Int64), Int64(0))
XCTAssertEqual((dbv.value() as Double?)!, 0.0)
XCTAssertEqual((dbv.value() as Double), 0.0)
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// 3.0e5 Double is turned to Integer
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (\(columnName)) VALUES (?)", arguments: [3.0e5])
let dbv = Row.fetchOne(db, "SELECT \(columnName) FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Integer)
// Check GRDB conversions from Integer storage
XCTAssertEqual((dbv.value() as Bool?)!, true)
XCTAssertEqual((dbv.value() as Bool), true)
XCTAssertEqual((dbv.value() as Int?)!, 300000)
XCTAssertEqual((dbv.value() as Int), 300000)
XCTAssertEqual((dbv.value() as Int32?)!, Int32(300000))
XCTAssertEqual((dbv.value() as Int32), Int32(300000))
XCTAssertEqual((dbv.value() as Int64?)!, Int64(300000))
XCTAssertEqual((dbv.value() as Int64), Int64(300000))
XCTAssertEqual((dbv.value() as Double?)!, Double(300000))
XCTAssertEqual((dbv.value() as Double), Double(300000))
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// 1.0e20 Double is turned to Real
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (\(columnName)) VALUES (?)", arguments: [1.0e20])
let dbv = Row.fetchOne(db, "SELECT \(columnName) FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
// Check GRDB conversions from Real storage (avoid Int, Int32 and Int64 since 1.0e20 does not fit)
XCTAssertEqual((dbv.value() as Bool?)!, true)
XCTAssertEqual((dbv.value() as Bool), true)
XCTAssertEqual((dbv.value() as Double?)!, 1e20)
XCTAssertEqual((dbv.value() as Double), 1e20)
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// "3.0e+5" is turned to Integer
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (\(columnName)) VALUES (?)", arguments: ["3.0e+5"])
let dbv = Row.fetchOne(db, "SELECT \(columnName) FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Integer)
// Check GRDB conversions from Integer storage
XCTAssertEqual((dbv.value() as Bool?)!, true)
XCTAssertEqual((dbv.value() as Bool), true)
XCTAssertEqual((dbv.value() as Int?)!, 300000)
XCTAssertEqual((dbv.value() as Int), 300000)
XCTAssertEqual((dbv.value() as Int32?)!, Int32(300000))
XCTAssertEqual((dbv.value() as Int32), Int32(300000))
XCTAssertEqual((dbv.value() as Int64?)!, Int64(300000))
XCTAssertEqual((dbv.value() as Int64), Int64(300000))
XCTAssertEqual((dbv.value() as Double?)!, Double(300000))
XCTAssertEqual((dbv.value() as Double), Double(300000))
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// "1.0e+20" is turned to Real
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (\(columnName)) VALUES (?)", arguments: ["1.0e+20"])
let dbv = Row.fetchOne(db, "SELECT \(columnName) FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Real)
// Check GRDB conversions from Real storage: (avoid Int, Int32 and Int64 since 1.0e20 does not fit)
XCTAssertEqual((dbv.value() as Bool?)!, true)
XCTAssertEqual((dbv.value() as Bool), true)
XCTAssertEqual((dbv.value() as Double?)!, 1e20)
XCTAssertEqual((dbv.value() as Double), 1e20)
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// "foo" is turned to Text
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (\(columnName)) VALUES (?)", arguments: ["foo"])
let dbv = Row.fetchOne(db, "SELECT \(columnName) FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Text)
// Check GRDB conversions from Text storage:
XCTAssertTrue((dbv.value() as Bool?) == nil)
XCTAssertTrue((dbv.value() as Int?) == nil)
XCTAssertTrue((dbv.value() as Int32?) == nil)
XCTAssertTrue((dbv.value() as Int64?) == nil)
XCTAssertTrue((dbv.value() as Double?) == nil)
XCTAssertEqual((dbv.value() as String?)!, "foo")
XCTAssertEqual((dbv.value() as String), "foo")
XCTAssertTrue((dbv.value() as NSData?) == nil)
return .Rollback
}
// Blob is turned to Blob
try dbQueue.inTransaction { db in
try db.execute("INSERT INTO `values` (\(columnName)) VALUES (?)", arguments: ["foo".dataUsingEncoding(NSUTF8StringEncoding)])
let dbv = Row.fetchOne(db, "SELECT \(columnName) FROM `values`")!.first!.1 // first is (columnName, dbv)
XCTAssertEqual(dbv.storageClass, SQLiteStorageClass.Blob)
// Check GRDB conversions from Blob storage:
XCTAssertTrue((dbv.value() as Bool?) == nil)
XCTAssertTrue((dbv.value() as Int?) == nil)
XCTAssertTrue((dbv.value() as Int32?) == nil)
XCTAssertTrue((dbv.value() as Int64?) == nil)
XCTAssertTrue((dbv.value() as Double?) == nil)
XCTAssertTrue((dbv.value() as String?) == nil)
XCTAssertEqual((dbv.value() as NSData?), "foo".dataUsingEncoding(NSUTF8StringEncoding))
return .Rollback
}
}
}
}
@@ -1,191 +0,0 @@
import XCTest
import GRDB
// A type that adopts DatabaseValueConvertible but does not adopt SQLiteStatementConvertible
struct WrappedInt: DatabaseValueConvertible {
let int: Int
init(int: Int) {
self.int = int
}
var databaseValue: DatabaseValue {
return DatabaseValue(int64: Int64(int))
}
static func fromDatabaseValue(databaseValue: DatabaseValue) -> WrappedInt? {
guard let int = Int.fromDatabaseValue(databaseValue) else {
return nil
}
return WrappedInt(int: int)
}
}
class DatabaseValueConvertibleFetchTests: GRDBTestCase {
func testFetchFromStatement() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (2)")
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
let sequence = WrappedInt.fetch(statement)
XCTAssertEqual(sequence.map { $0.int }, [1,2])
}
}
}
func testFetchAllFromStatement() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (2)")
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
let array = WrappedInt.fetchAll(statement)
XCTAssertEqual(array.map { $0.int }, [1,2])
}
}
}
func testFetchOneFromStatement() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
let nilBecauseMissingRow = WrappedInt.fetchOne(statement)
XCTAssertTrue(nilBecauseMissingRow == nil)
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let nilBecauseMissingNULL = WrappedInt.fetchOne(statement)
XCTAssertTrue(nilBecauseMissingNULL == nil)
try db.execute("DELETE FROM ints")
try db.execute("INSERT INTO ints (int) VALUES (1)")
let one = WrappedInt.fetchOne(statement)!
XCTAssertEqual(one.int, 1)
}
}
}
func testFetchFromDatabaes() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (2)")
let sequence = WrappedInt.fetch(db, "SELECT int FROM ints ORDER BY int")
XCTAssertEqual(sequence.map { $0.int }, [1,2])
}
}
}
func testFetchAllFromDatabase() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (2)")
let array = WrappedInt.fetchAll(db, "SELECT int FROM ints ORDER BY int")
XCTAssertEqual(array.map { $0.int }, [1,2])
}
}
}
func testFetchOneFromDatabase() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
let nilBecauseMissingRow = WrappedInt.fetchOne(db, "SELECT int FROM ints ORDER BY int")
XCTAssertTrue(nilBecauseMissingRow == nil)
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let nilBecauseMissingNULL = WrappedInt.fetchOne(db, "SELECT int FROM ints ORDER BY int")
XCTAssertTrue(nilBecauseMissingNULL == nil)
try db.execute("DELETE FROM ints")
try db.execute("INSERT INTO ints (int) VALUES (1)")
let one = WrappedInt.fetchOne(db, "SELECT int FROM ints ORDER BY int")!
XCTAssertEqual(one.int, 1)
}
}
}
func testOptionalFetchFromStatement() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
let sequence = Optional<WrappedInt>.fetch(statement)
let ints = sequence.map { $0?.int }
XCTAssertEqual(ints.count, 2)
XCTAssertTrue(ints[0] == nil)
XCTAssertEqual(ints[1]!, 1)
}
}
}
func testOptionalFetchAllFromStatement() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
let array = Optional<WrappedInt>.fetchAll(statement)
let ints = array.map { $0?.int }
XCTAssertEqual(ints.count, 2)
XCTAssertTrue(ints[0] == nil)
XCTAssertEqual(ints[1]!, 1)
}
}
}
func testOptionalFetchFromDatabaes() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let sequence = Optional<WrappedInt>.fetch(db, "SELECT int FROM ints ORDER BY int")
let ints = sequence.map { $0?.int }
XCTAssertEqual(ints.count, 2)
XCTAssertTrue(ints[0] == nil)
XCTAssertEqual(ints[1]!, 1)
}
}
}
func testOptionalFetchAllFromDatabase() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let array = Optional<WrappedInt>.fetchAll(db, "SELECT int FROM ints ORDER BY int")
let ints = array.map { $0?.int }
XCTAssertEqual(ints.count, 2)
XCTAssertTrue(ints[0] == nil)
XCTAssertEqual(ints[1]!, 1)
}
}
}
}
@@ -1,55 +0,0 @@
import XCTest
import GRDB
class FetchableParent : DatabaseValueConvertible, CustomStringConvertible {
var databaseValue: DatabaseValue {
return DatabaseValue(string: "Parent")
}
class func fromDatabaseValue(databaseValue: DatabaseValue) -> Self? {
return self.init()
}
required init() {
}
var description: String { return "Parent" }
}
class FetchableChild : FetchableParent {
/// Returns a value that can be stored in the database.
override var databaseValue: DatabaseValue {
return DatabaseValue(string: "Child")
}
override var description: String { return "Child" }
}
class DatabaseValueConvertibleSubclassTests: GRDBTestCase {
func testParent() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE parents (name TEXT)")
try db.execute("INSERT INTO parents (name) VALUES (?)", arguments: [FetchableParent()])
let string = String.fetchOne(db, "SELECT * FROM parents")!
XCTAssertEqual(string, "Parent")
let parent = FetchableParent.fetchOne(db, "SELECT * FROM parents")!
XCTAssertEqual(parent.description, "Parent")
}
}
}
func testChild() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE children (name TEXT)")
try db.execute("INSERT INTO children (name) VALUES (?)", arguments: [FetchableChild()])
let string = String.fetchOne(db, "SELECT * FROM children")!
XCTAssertEqual(string, "Child")
let child = FetchableChild.fetchOne(db, "SELECT * FROM children")!
XCTAssertEqual(child.description, "Child")
}
}
}
}
@@ -1,11 +0,0 @@
import XCTest
import GRDB
class NSDataTests: GRDBTestCase {
func testDatabaseValueCanNotStoreEmptyData() {
// SQLite can't store zero-length blob.
let databaseValue = DatabaseValue(data: NSData())
XCTAssertEqual(databaseValue, DatabaseValue.Null)
}
}
@@ -1,190 +0,0 @@
import XCTest
import GRDB
enum Color32 : Int32 {
case Red
case White
case Rose
}
enum Color64 : Int64 {
case Red
case White
case Rose
}
enum Color : Int {
case Red
case White
case Rose
}
enum Grape : String {
case Chardonnay
case Merlot
case Riesling
}
extension Color32 : DatabaseInt32Representable { }
extension Color64 : DatabaseInt64Representable { }
extension Color : DatabaseIntRepresentable { }
extension Grape : DatabaseStringRepresentable { }
class RawRepresentableTests: GRDBTestCase {
override func setUp() {
super.setUp()
var migrator = DatabaseMigrator()
migrator.registerMigration("createPersons") { db in
try db.execute("CREATE TABLE wines (grape TEXT, color INTEGER)")
}
assertNoError {
try migrator.migrate(dbQueue)
}
}
func testColor32() {
assertNoError {
try dbQueue.inTransaction { db in
do {
for color in [Color32.Red, Color32.White, Color32.Rose] {
try db.execute("INSERT INTO wines (color) VALUES (?)", arguments: [color])
}
try db.execute("INSERT INTO wines (color) VALUES (?)", arguments: [4])
try db.execute("INSERT INTO wines (color) VALUES (NULL)")
}
do {
let rows = Row.fetchAll(db, "SELECT color FROM wines ORDER BY color")
let colors = rows.map { $0.value(atIndex: 0) as Color32? }
XCTAssertTrue(colors[0] == nil)
XCTAssertEqual(colors[1]!, Color32.Red)
XCTAssertEqual(colors[2]!, Color32.White)
XCTAssertEqual(colors[3]!, Color32.Rose)
XCTAssertTrue(colors[4] == nil)
}
do {
let colors = Optional<Color32>.fetchAll(db, "SELECT color FROM wines ORDER BY color")
XCTAssertTrue(colors[0] == nil)
XCTAssertEqual(colors[1]!, Color32.Red)
XCTAssertEqual(colors[2]!, Color32.White)
XCTAssertEqual(colors[3]!, Color32.Rose)
XCTAssertTrue(colors[4] == nil)
}
return .Rollback
}
}
}
func testColor64() {
assertNoError {
try dbQueue.inTransaction { db in
do {
for color in [Color64.Red, Color64.White, Color64.Rose] {
try db.execute("INSERT INTO wines (color) VALUES (?)", arguments: [color])
}
try db.execute("INSERT INTO wines (color) VALUES (?)", arguments: [4])
try db.execute("INSERT INTO wines (color) VALUES (NULL)")
}
do {
let rows = Row.fetchAll(db, "SELECT color FROM wines ORDER BY color")
let colors = rows.map { $0.value(atIndex: 0) as Color64? }
XCTAssertTrue(colors[0] == nil)
XCTAssertEqual(colors[1]!, Color64.Red)
XCTAssertEqual(colors[2]!, Color64.White)
XCTAssertEqual(colors[3]!, Color64.Rose)
XCTAssertTrue(colors[4] == nil)
}
do {
let colors = Optional<Color64>.fetchAll(db, "SELECT color FROM wines ORDER BY color")
XCTAssertTrue(colors[0] == nil)
XCTAssertEqual(colors[1]!, Color64.Red)
XCTAssertEqual(colors[2]!, Color64.White)
XCTAssertEqual(colors[3]!, Color64.Rose)
XCTAssertTrue(colors[4] == nil)
}
return .Rollback
}
}
}
func testColor() {
assertNoError {
try dbQueue.inTransaction { db in
do {
for color in [Color.Red, Color.White, Color.Rose] {
try db.execute("INSERT INTO wines (color) VALUES (?)", arguments: [color])
}
try db.execute("INSERT INTO wines (color) VALUES (?)", arguments: [4])
try db.execute("INSERT INTO wines (color) VALUES (NULL)")
}
do {
let rows = Row.fetchAll(db, "SELECT color FROM wines ORDER BY color")
let colors = rows.map { $0.value(atIndex: 0) as Color? }
XCTAssertTrue(colors[0] == nil)
XCTAssertEqual(colors[1]!, Color.Red)
XCTAssertEqual(colors[2]!, Color.White)
XCTAssertEqual(colors[3]!, Color.Rose)
XCTAssertTrue(colors[4] == nil)
}
do {
let colors = Optional<Color>.fetchAll(db, "SELECT color FROM wines ORDER BY color")
XCTAssertTrue(colors[0] == nil)
XCTAssertEqual(colors[1]!, Color.Red)
XCTAssertEqual(colors[2]!, Color.White)
XCTAssertEqual(colors[3]!, Color.Rose)
XCTAssertTrue(colors[4] == nil)
}
return .Rollback
}
}
}
func testGrape() {
assertNoError {
try dbQueue.inTransaction { db in
do {
for grape in [Grape.Chardonnay, Grape.Merlot, Grape.Riesling] {
try db.execute("INSERT INTO wines (grape) VALUES (?)", arguments: [grape])
}
try db.execute("INSERT INTO wines (grape) VALUES (?)", arguments: ["Syrah"])
try db.execute("INSERT INTO wines (grape) VALUES (NULL)")
}
do {
let rows = Row.fetchAll(db, "SELECT grape FROM wines ORDER BY grape")
let grapes = rows.map { $0.value(atIndex: 0) as Grape? }
XCTAssertTrue(grapes[0] == nil)
XCTAssertEqual(grapes[1]!, Grape.Chardonnay)
XCTAssertEqual(grapes[2]!, Grape.Merlot)
XCTAssertEqual(grapes[3]!, Grape.Riesling)
XCTAssertTrue(grapes[4] == nil)
}
do {
let grapes = Optional<Grape>.fetchAll(db, "SELECT grape FROM wines ORDER BY grape")
XCTAssertTrue(grapes[0] == nil)
XCTAssertEqual(grapes[1]!, Grape.Chardonnay)
XCTAssertEqual(grapes[2]!, Grape.Merlot)
XCTAssertEqual(grapes[3]!, Grape.Riesling)
XCTAssertTrue(grapes[4] == nil)
}
return .Rollback
}
}
}
}
@@ -1,194 +0,0 @@
import XCTest
import GRDB
class DetachedRowTests: GRDBTestCase {
func testRowAsSequence() {
assertNoError {
let dbQueue = DatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
let row = Row.fetchOne(db, "SELECT * FROM ints")!
var columnNames = [String]()
var ints = [Int]()
var bools = [Bool]()
for (columnName, databaseValue) in row {
columnNames.append(columnName)
ints.append(databaseValue.value() as Int)
bools.append(databaseValue.value() as Bool)
}
XCTAssertEqual(columnNames, ["a", "b", "c"])
XCTAssertEqual(ints, [0, 1, 2])
XCTAssertEqual(bools, [false, true, true])
}
}
}
func testRowValueAtIndex() {
assertNoError {
let dbQueue = DatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
let row = Row.fetchOne(db, "SELECT * FROM ints")!
// Int extraction, form 1
XCTAssertEqual(row.value(atIndex: 0) as Int, 0)
XCTAssertEqual(row.value(atIndex: 1) as Int, 1)
XCTAssertEqual(row.value(atIndex: 2) as Int, 2)
// Int extraction, form 2
XCTAssertEqual(row.value(atIndex: 0)! as Int, 0)
XCTAssertEqual(row.value(atIndex: 1)! as Int, 1)
XCTAssertEqual(row.value(atIndex: 2)! as Int, 2)
// Int? extraction
XCTAssertEqual((row.value(atIndex: 0) as Int?), 0)
XCTAssertEqual((row.value(atIndex: 1) as Int?), 1)
XCTAssertEqual((row.value(atIndex: 2) as Int?), 2)
// Bool extraction, form 1
XCTAssertEqual(row.value(atIndex: 0) as Bool, false)
XCTAssertEqual(row.value(atIndex: 1) as Bool, true)
XCTAssertEqual(row.value(atIndex: 2) as Bool, true)
// Bool extraction, form 2
XCTAssertEqual(row.value(atIndex: 0)! as Bool, false)
XCTAssertEqual(row.value(atIndex: 1)! as Bool, true)
XCTAssertEqual(row.value(atIndex: 2)! as Bool, true)
// Bool? extraction
XCTAssertEqual((row.value(atIndex: 0) as Bool?), false)
XCTAssertEqual((row.value(atIndex: 1) as Bool?), true)
XCTAssertEqual((row.value(atIndex: 2) as Bool?), true)
// Expect fatal error:
//
// row.value(atIndex: -1)
// row.value(atIndex: 3)
}
}
}
func testRowValueNamed() {
assertNoError {
let dbQueue = DatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
let row = Row.fetchOne(db, "SELECT * FROM ints")!
// Int extraction, form 1
XCTAssertEqual(row.value(named: "a") as Int, 0)
XCTAssertEqual(row.value(named: "b") as Int, 1)
XCTAssertEqual(row.value(named: "c") as Int, 2)
// Int extraction, form 2
XCTAssertEqual(row.value(named: "a")! as Int, 0)
XCTAssertEqual(row.value(named: "b")! as Int, 1)
XCTAssertEqual(row.value(named: "c")! as Int, 2)
// Int? extraction
XCTAssertEqual((row.value(named: "a") as Int?)!, 0)
XCTAssertEqual((row.value(named: "b") as Int?)!, 1)
XCTAssertEqual((row.value(named: "c") as Int?)!, 2)
// Bool extraction, form 1
XCTAssertEqual(row.value(named: "a") as Bool, false)
XCTAssertEqual(row.value(named: "b") as Bool, true)
XCTAssertEqual(row.value(named: "c") as Bool, true)
// Bool extraction, form 2
XCTAssertEqual(row.value(named: "a")! as Bool, false)
XCTAssertEqual(row.value(named: "b")! as Bool, true)
XCTAssertEqual(row.value(named: "c")! as Bool, true)
// Bool? extraction
XCTAssertEqual((row.value(named: "a") as Bool?)!, false)
XCTAssertEqual((row.value(named: "b") as Bool?)!, true)
XCTAssertEqual((row.value(named: "c") as Bool?)!, true)
// Expect fatal error:
// row.value(named: "foo")
// row.value(named: "foo") as Int?
}
}
}
func testRowCount() {
assertNoError {
let dbQueue = DatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
let row = Row.fetchOne(db, "SELECT * FROM ints")!
XCTAssertEqual(row.count, 3)
}
}
}
func testRowColumnNames() {
assertNoError {
let dbQueue = DatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
let row = Row.fetchOne(db, "SELECT a, b, c FROM ints")!
XCTAssertEqual(Array(row.columnNames), ["a", "b", "c"])
}
}
}
func testRowDatabaseValues() {
assertNoError {
let dbQueue = DatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
let row = Row.fetchOne(db, "SELECT a, b, c FROM ints")!
XCTAssertEqual(Array(row.databaseValues), [0.databaseValue, 1.databaseValue, 2.databaseValue])
}
}
}
func testRowSubscriptIsCaseInsensitive() {
assertNoError {
let dbQueue = DatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE stuffs (name TEXT)")
try db.execute("INSERT INTO stuffs (name) VALUES ('foo')")
let row = Row.fetchOne(db, "SELECT nAmE FROM stuffs")!
XCTAssertEqual(row["name"], "foo".databaseValue)
XCTAssertEqual(row["NAME"], "foo".databaseValue)
XCTAssertEqual(row["NaMe"], "foo".databaseValue)
XCTAssertEqual(row.value(named: "name") as String, "foo")
XCTAssertEqual(row.value(named: "NAME") as String, "foo")
XCTAssertEqual(row.value(named: "NaMe") as String, "foo")
}
}
}
func testRowHasColumnIsCaseInsensitive() {
assertNoError {
let dbQueue = DatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE stuffs (name TEXT)")
try db.execute("INSERT INTO stuffs (name) VALUES ('foo')")
let row = Row.fetchOne(db, "SELECT nAmE, 1 AS foo FROM stuffs")!
XCTAssertTrue(row.hasColumn("name"))
XCTAssertTrue(row.hasColumn("NAME"))
XCTAssertTrue(row.hasColumn("Name"))
XCTAssertTrue(row.hasColumn("NaMe"))
XCTAssertTrue(row.hasColumn("foo"))
XCTAssertTrue(row.hasColumn("Foo"))
XCTAssertTrue(row.hasColumn("FOO"))
}
}
}
}
@@ -1,140 +0,0 @@
import XCTest
import GRDB
class DictionaryRowTests: GRDBTestCase {
func testRowAsSequence() {
let row = Row(dictionary: ["a": 0, "b": 1, "c": 2])
var columnNames = Set<String>()
var ints = Set<Int>()
var bools = Set<Bool>()
for (columnName, databaseValue) in row {
columnNames.insert(columnName)
ints.insert(databaseValue.value() as Int)
bools.insert(databaseValue.value() as Bool)
}
XCTAssertEqual(columnNames, ["a", "b", "c"])
XCTAssertEqual(ints, [0, 1, 2])
XCTAssertEqual(bools, [false, true, true])
}
func testRowValueAtIndex() {
let dictionary: [String: DatabaseValueConvertible?] = ["a": 0, "b": 1, "c": 2]
let row = Row(dictionary: dictionary)
let aIndex = dictionary.startIndex.distanceTo(dictionary.indexForKey("a")!)
let bIndex = dictionary.startIndex.distanceTo(dictionary.indexForKey("b")!)
let cIndex = dictionary.startIndex.distanceTo(dictionary.indexForKey("c")!)
// Int extraction, form 1
XCTAssertEqual(row.value(atIndex: aIndex) as Int, 0)
XCTAssertEqual(row.value(atIndex: bIndex) as Int, 1)
XCTAssertEqual(row.value(atIndex: cIndex) as Int, 2)
// Int extraction, form 2
XCTAssertEqual(row.value(atIndex: aIndex)! as Int, 0)
XCTAssertEqual(row.value(atIndex: bIndex)! as Int, 1)
XCTAssertEqual(row.value(atIndex: cIndex)! as Int, 2)
// Int? extraction
XCTAssertEqual((row.value(atIndex: aIndex) as Int?), 0)
XCTAssertEqual((row.value(atIndex: bIndex) as Int?), 1)
XCTAssertEqual((row.value(atIndex: cIndex) as Int?), 2)
// Bool extraction, form 1
XCTAssertEqual(row.value(atIndex: aIndex) as Bool, false)
XCTAssertEqual(row.value(atIndex: bIndex) as Bool, true)
XCTAssertEqual(row.value(atIndex: cIndex) as Bool, true)
// Bool extraction, form 2
XCTAssertEqual(row.value(atIndex: aIndex)! as Bool, false)
XCTAssertEqual(row.value(atIndex: bIndex)! as Bool, true)
XCTAssertEqual(row.value(atIndex: cIndex)! as Bool, true)
// Bool? extraction
XCTAssertEqual((row.value(atIndex: aIndex) as Bool?), false)
XCTAssertEqual((row.value(atIndex: bIndex) as Bool?), true)
XCTAssertEqual((row.value(atIndex: cIndex) as Bool?), true)
// Expect fatal error:
//
// row.value(atIndex: -1)
// row.value(atIndex: 3)
}
func testRowValueNamed() {
let row = Row(dictionary: ["a": 0, "b": 1, "c": 2])
// Int extraction, form 1
XCTAssertEqual(row.value(named: "a") as Int, 0)
XCTAssertEqual(row.value(named: "b") as Int, 1)
XCTAssertEqual(row.value(named: "c") as Int, 2)
// Int extraction, form 2
XCTAssertEqual(row.value(named: "a")! as Int, 0)
XCTAssertEqual(row.value(named: "b")! as Int, 1)
XCTAssertEqual(row.value(named: "c")! as Int, 2)
// Int? extraction
XCTAssertEqual((row.value(named: "a") as Int?)!, 0)
XCTAssertEqual((row.value(named: "b") as Int?)!, 1)
XCTAssertEqual((row.value(named: "c") as Int?)!, 2)
// Bool extraction, form 1
XCTAssertEqual(row.value(named: "a") as Bool, false)
XCTAssertEqual(row.value(named: "b") as Bool, true)
XCTAssertEqual(row.value(named: "c") as Bool, true)
// Bool extraction, form 2
XCTAssertEqual(row.value(named: "a")! as Bool, false)
XCTAssertEqual(row.value(named: "b")! as Bool, true)
XCTAssertEqual(row.value(named: "c")! as Bool, true)
// Bool? extraction
XCTAssertEqual((row.value(named: "a") as Bool?)!, false)
XCTAssertEqual((row.value(named: "b") as Bool?)!, true)
XCTAssertEqual((row.value(named: "c") as Bool?)!, true)
// Expect fatal error:
// row.value(named: "foo")
// row.value(named: "foo") as Int?
}
func testRowCount() {
let row = Row(dictionary: ["a": 0, "b": 1, "c": 2])
XCTAssertEqual(row.count, 3)
}
func testRowColumnNames() {
let row = Row(dictionary: ["a": 0, "b": 1, "c": 2])
XCTAssertEqual(Array(row.columnNames).sort(), ["a", "b", "c"])
}
func testRowDatabaseValues() {
let row = Row(dictionary: ["a": 0, "b": 1, "c": 2])
XCTAssertEqual(row.databaseValues.sort { ($0.value() as Int!) < ($1.value() as Int!) }, [0.databaseValue, 1.databaseValue, 2.databaseValue])
}
func testRowSubscriptIsCaseInsensitive() {
let row = Row(dictionary: ["name": "foo"])
XCTAssertEqual(row["name"], "foo".databaseValue)
XCTAssertEqual(row["NAME"], "foo".databaseValue)
XCTAssertEqual(row["NaMe"], "foo".databaseValue)
XCTAssertEqual(row.value(named: "name") as String, "foo")
XCTAssertEqual(row.value(named: "NAME") as String, "foo")
XCTAssertEqual(row.value(named: "NaMe") as String, "foo")
}
func testRowHasColumnIsCaseInsensitive() {
let row = Row(dictionary: ["nAmE": "foo", "foo": 1])
XCTAssertTrue(row.hasColumn("name"))
XCTAssertTrue(row.hasColumn("NAME"))
XCTAssertTrue(row.hasColumn("Name"))
XCTAssertTrue(row.hasColumn("NaMe"))
XCTAssertTrue(row.hasColumn("foo"))
XCTAssertTrue(row.hasColumn("Foo"))
XCTAssertTrue(row.hasColumn("FOO"))
}
}
@@ -1,222 +0,0 @@
import XCTest
import GRDB
class MetalRowTests: GRDBTestCase {
func testRowAsSequence() {
assertNoError {
let dbQueue = DatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
var rowFetched = false
for row in Row.fetch(db, "SELECT * FROM ints") {
rowFetched = true
var columnNames = [String]()
var ints = [Int]()
var bools = [Bool]()
for (columnName, databaseValue) in row {
columnNames.append(columnName)
ints.append(databaseValue.value() as Int)
bools.append(databaseValue.value() as Bool)
}
XCTAssertEqual(columnNames, ["a", "b", "c"])
XCTAssertEqual(ints, [0, 1, 2])
XCTAssertEqual(bools, [false, true, true])
}
XCTAssertTrue(rowFetched)
}
}
}
func testRowValueAtIndex() {
assertNoError {
let dbQueue = DatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
var rowFetched = false
for row in Row.fetch(db, "SELECT * FROM ints") {
rowFetched = true
// Int extraction, form 1
XCTAssertEqual(row.value(atIndex: 0) as Int, 0)
XCTAssertEqual(row.value(atIndex: 1) as Int, 1)
XCTAssertEqual(row.value(atIndex: 2) as Int, 2)
// Int extraction, form 2
XCTAssertEqual(row.value(atIndex: 0)! as Int, 0)
XCTAssertEqual(row.value(atIndex: 1)! as Int, 1)
XCTAssertEqual(row.value(atIndex: 2)! as Int, 2)
// Int? extraction
XCTAssertEqual((row.value(atIndex: 0) as Int?), 0)
XCTAssertEqual((row.value(atIndex: 1) as Int?), 1)
XCTAssertEqual((row.value(atIndex: 2) as Int?), 2)
// Bool extraction, form 1
XCTAssertEqual(row.value(atIndex: 0) as Bool, false)
XCTAssertEqual(row.value(atIndex: 1) as Bool, true)
XCTAssertEqual(row.value(atIndex: 2) as Bool, true)
// Bool extraction, form 2
XCTAssertEqual(row.value(atIndex: 0)! as Bool, false)
XCTAssertEqual(row.value(atIndex: 1)! as Bool, true)
XCTAssertEqual(row.value(atIndex: 2)! as Bool, true)
// Bool? extraction
XCTAssertEqual((row.value(atIndex: 0) as Bool?), false)
XCTAssertEqual((row.value(atIndex: 1) as Bool?), true)
XCTAssertEqual((row.value(atIndex: 2) as Bool?), true)
// Expect fatal error:
//
// row.value(atIndex: -1)
// row.value(atIndex: 3)
}
XCTAssertTrue(rowFetched)
}
}
}
func testRowValueNamed() {
assertNoError {
let dbQueue = DatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
var rowFetched = false
for row in Row.fetch(db, "SELECT * FROM ints") {
rowFetched = true
// Int extraction, form 1
XCTAssertEqual(row.value(named: "a") as Int, 0)
XCTAssertEqual(row.value(named: "b") as Int, 1)
XCTAssertEqual(row.value(named: "c") as Int, 2)
// Int extraction, form 2
XCTAssertEqual(row.value(named: "a")! as Int, 0)
XCTAssertEqual(row.value(named: "b")! as Int, 1)
XCTAssertEqual(row.value(named: "c")! as Int, 2)
// Int? extraction
XCTAssertEqual((row.value(named: "a") as Int?)!, 0)
XCTAssertEqual((row.value(named: "b") as Int?)!, 1)
XCTAssertEqual((row.value(named: "c") as Int?)!, 2)
// Bool extraction, form 1
XCTAssertEqual(row.value(named: "a") as Bool, false)
XCTAssertEqual(row.value(named: "b") as Bool, true)
XCTAssertEqual(row.value(named: "c") as Bool, true)
// Bool extraction, form 2
XCTAssertEqual(row.value(named: "a")! as Bool, false)
XCTAssertEqual(row.value(named: "b")! as Bool, true)
XCTAssertEqual(row.value(named: "c")! as Bool, true)
// Bool? extraction
XCTAssertEqual((row.value(named: "a") as Bool?)!, false)
XCTAssertEqual((row.value(named: "b") as Bool?)!, true)
XCTAssertEqual((row.value(named: "c") as Bool?)!, true)
// Expect fatal error:
// row.value(named: "foo")
// row.value(named: "foo") as Int?
}
XCTAssertTrue(rowFetched)
}
}
}
func testRowCount() {
assertNoError {
let dbQueue = DatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
var rowFetched = false
for row in Row.fetch(db, "SELECT * FROM ints") {
rowFetched = true
XCTAssertEqual(row.count, 3)
}
XCTAssertTrue(rowFetched)
}
}
}
func testRowColumnNames() {
assertNoError {
let dbQueue = DatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
var rowFetched = false
for row in Row.fetch(db, "SELECT a, b, c FROM ints") {
rowFetched = true
XCTAssertEqual(Array(row.columnNames), ["a", "b", "c"])
}
XCTAssertTrue(rowFetched)
}
}
}
func testRowDatabaseValues() {
assertNoError {
let dbQueue = DatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (a INTEGER, b INTEGER, c INTEGER)")
try db.execute("INSERT INTO ints (a,b,c) VALUES (0, 1, 2)")
var rowFetched = false
for row in Row.fetch(db, "SELECT a, b, c FROM ints") {
rowFetched = true
XCTAssertEqual(Array(row.databaseValues), [0.databaseValue, 1.databaseValue, 2.databaseValue])
}
XCTAssertTrue(rowFetched)
}
}
}
func testRowSubscriptIsCaseInsensitive() {
assertNoError {
let dbQueue = DatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE stuffs (name TEXT)")
try db.execute("INSERT INTO stuffs (name) VALUES ('foo')")
var rowFetched = false
for row in Row.fetch(db, "SELECT nAmE FROM stuffs") {
rowFetched = true
XCTAssertEqual(row["name"], "foo".databaseValue)
XCTAssertEqual(row["NAME"], "foo".databaseValue)
XCTAssertEqual(row["NaMe"], "foo".databaseValue)
XCTAssertEqual(row.value(named: "name") as String, "foo")
XCTAssertEqual(row.value(named: "NAME") as String, "foo")
XCTAssertEqual(row.value(named: "NaMe") as String, "foo")
}
XCTAssertTrue(rowFetched)
}
}
}
func testRowHasColumnIsCaseInsensitive() {
assertNoError {
let dbQueue = DatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE stuffs (name TEXT)")
try db.execute("INSERT INTO stuffs (name) VALUES ('foo')")
var rowFetched = false
for row in Row.fetch(db, "SELECT nAmE, 1 AS foo FROM stuffs") {
rowFetched = true
XCTAssertTrue(row.hasColumn("name"))
XCTAssertTrue(row.hasColumn("NAME"))
XCTAssertTrue(row.hasColumn("Name"))
XCTAssertTrue(row.hasColumn("NaMe"))
XCTAssertTrue(row.hasColumn("foo"))
XCTAssertTrue(row.hasColumn("Foo"))
XCTAssertTrue(row.hasColumn("FOO"))
}
XCTAssertTrue(rowFetched)
}
}
}
}
@@ -1,130 +0,0 @@
import XCTest
import GRDB
struct SimpleRowConvertible : RowConvertible {
var firstName: String
var lastName: String
var fetched: Bool = false
init(row: Row) {
firstName = row.value(named: "firstName")
lastName = row.value(named: "lastName")
}
mutating func awakeFromFetch(row: Row) {
fetched = true
}
}
class RowConvertibleTests: GRDBTestCase {
override func setUp() {
super.setUp()
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE structs (firstName TEXT, lastName TEXT)")
}
}
}
func testRowInitializer() {
let row = Row(dictionary: ["firstName": "Arthur", "lastName": "Martin"])
let s = SimpleRowConvertible(row: row)
XCTAssertEqual(s.firstName, "Arthur")
XCTAssertEqual(s.lastName, "Martin")
XCTAssertFalse(s.fetched)
}
func testDictionaryInitializer() {
let s = SimpleRowConvertible(dictionary: ["firstName": "Arthur", "lastName": "Martin"])
XCTAssertEqual(s.firstName, "Arthur")
XCTAssertEqual(s.lastName, "Martin")
XCTAssertFalse(s.fetched)
}
func testFetchFromDatabase() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("INSERT INTO structs (firstName, lastName) VALUES (?, ?)", arguments: ["Arthur", "Martin"])
let ss = SimpleRowConvertible.fetch(db, "SELECT * FROM structs")
let s = Array(ss).first!
XCTAssertEqual(s.firstName, "Arthur")
XCTAssertEqual(s.lastName, "Martin")
XCTAssertTrue(s.fetched)
}
}
}
func testFetchAllFromDatabase() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("INSERT INTO structs (firstName, lastName) VALUES (?, ?)", arguments: ["Arthur", "Martin"])
let ss = SimpleRowConvertible.fetchAll(db, "SELECT * FROM structs")
let s = ss.first!
XCTAssertEqual(s.firstName, "Arthur")
XCTAssertEqual(s.lastName, "Martin")
XCTAssertTrue(s.fetched)
}
}
}
func testFetchOneFromDatabase() {
assertNoError {
try dbQueue.inDatabase { db in
let missingS = SimpleRowConvertible.fetchOne(db, "SELECT * FROM structs")
XCTAssertTrue(missingS == nil)
try db.execute("INSERT INTO structs (firstName, lastName) VALUES (?, ?)", arguments: ["Arthur", "Martin"])
let s = SimpleRowConvertible.fetchOne(db, "SELECT * FROM structs")!
XCTAssertEqual(s.firstName, "Arthur")
XCTAssertEqual(s.lastName, "Martin")
XCTAssertTrue(s.fetched)
}
}
}
func testFetchFromStatement() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("INSERT INTO structs (firstName, lastName) VALUES (?, ?)", arguments: ["Arthur", "Martin"])
let statement = db.selectStatement("SELECT * FROM structs")
let ss = SimpleRowConvertible.fetch(statement)
let s = Array(ss).first!
XCTAssertEqual(s.firstName, "Arthur")
XCTAssertEqual(s.lastName, "Martin")
XCTAssertTrue(s.fetched)
}
}
}
func testFetchAllFromStatement() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("INSERT INTO structs (firstName, lastName) VALUES (?, ?)", arguments: ["Arthur", "Martin"])
let statement = db.selectStatement("SELECT * FROM structs")
let ss = SimpleRowConvertible.fetchAll(statement)
let s = ss.first!
XCTAssertEqual(s.firstName, "Arthur")
XCTAssertEqual(s.lastName, "Martin")
XCTAssertTrue(s.fetched)
}
}
}
func testFetchOneFromStatement() {
assertNoError {
try dbQueue.inDatabase { db in
let statement = db.selectStatement("SELECT * FROM structs")
let missingS = SimpleRowConvertible.fetchOne(statement)
XCTAssertTrue(missingS == nil)
try db.execute("INSERT INTO structs (firstName, lastName) VALUES (?, ?)", arguments: ["Arthur", "Martin"])
let s = SimpleRowConvertible.fetchOne(statement)!
XCTAssertEqual(s.firstName, "Arthur")
XCTAssertEqual(s.lastName, "Martin")
XCTAssertTrue(s.fetched)
}
}
}
}
@@ -1,172 +0,0 @@
import XCTest
import GRDB
class SQLiteStatementConvertibleFetchTests: GRDBTestCase {
func testFetchFromStatement() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (2)")
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
let sequence = Int.fetch(statement)
XCTAssertEqual(Array(sequence), [1,2])
}
}
}
func testFetchAllFromStatement() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (2)")
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
let array = Int.fetchAll(statement)
XCTAssertEqual(array, [1,2])
}
}
}
func testFetchOneFromStatement() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
let nilBecauseMissingRow = Int.fetchOne(statement)
XCTAssertTrue(nilBecauseMissingRow == nil)
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let nilBecauseMissingNULL = Int.fetchOne(statement)
XCTAssertTrue(nilBecauseMissingNULL == nil)
try db.execute("DELETE FROM ints")
try db.execute("INSERT INTO ints (int) VALUES (1)")
let one = Int.fetchOne(statement)!
XCTAssertEqual(one, 1)
}
}
}
func testFetchFromDatabaes() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (2)")
let sequence = Int.fetch(db, "SELECT int FROM ints ORDER BY int")
XCTAssertEqual(Array(sequence), [1,2])
}
}
}
func testFetchAllFromDatabase() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (2)")
let array = Int.fetchAll(db, "SELECT int FROM ints ORDER BY int")
XCTAssertEqual(array, [1,2])
}
}
}
func testFetchOneFromDatabase() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
let nilBecauseMissingRow = Int.fetchOne(db, "SELECT int FROM ints ORDER BY int")
XCTAssertTrue(nilBecauseMissingRow == nil)
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let nilBecauseMissingNULL = Int.fetchOne(db, "SELECT int FROM ints ORDER BY int")
XCTAssertTrue(nilBecauseMissingNULL == nil)
try db.execute("DELETE FROM ints")
try db.execute("INSERT INTO ints (int) VALUES (1)")
let one = Int.fetchOne(db, "SELECT int FROM ints ORDER BY int")!
XCTAssertEqual(one, 1)
}
}
}
func testOptionalFetchFromStatement() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
let sequence = Optional<Int>.fetch(statement)
let ints = Array(sequence)
XCTAssertEqual(ints.count, 2)
XCTAssertTrue(ints[0] == nil)
XCTAssertEqual(ints[1]!, 1)
}
}
}
func testOptionalFetchAllFromStatement() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
let array = Optional<Int>.fetchAll(statement)
XCTAssertEqual(array.count, 2)
XCTAssertTrue(array[0] == nil)
XCTAssertEqual(array[1]!, 1)
}
}
}
func testOptionalFetchFromDatabaes() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let sequence = Optional<Int>.fetch(db, "SELECT int FROM ints ORDER BY int")
let ints = Array(sequence)
XCTAssertEqual(ints.count, 2)
XCTAssertTrue(ints[0] == nil)
XCTAssertEqual(ints[1]!, 1)
}
}
}
func testOptionalFetchAllFromDatabase() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let array = Optional<Int>.fetchAll(db, "SELECT int FROM ints ORDER BY int")
XCTAssertEqual(array.count, 2)
XCTAssertTrue(array[0] == nil)
XCTAssertEqual(array[1]!, 1)
}
}
}
}
@@ -1,151 +0,0 @@
import XCTest
import GRDB
class SelectStatementTests : GRDBTestCase {
override func setUp() {
super.setUp()
var migrator = DatabaseMigrator()
migrator.registerMigration("createPersons") { db in
try db.execute(
"CREATE TABLE persons (" +
"id INTEGER PRIMARY KEY, " +
"creationDate TEXT, " +
"name TEXT NOT NULL, " +
"age INT" +
")")
try db.execute("INSERT INTO persons (name, age) VALUES (?,?)", arguments: ["Arthur", 41])
try db.execute("INSERT INTO persons (name, age) VALUES (?,?)", arguments: ["Barbara", 26])
try db.execute("INSERT INTO persons (name, age) VALUES (?,?)", arguments: ["Craig", 13])
}
assertNoError {
try migrator.migrate(dbQueue)
}
}
func testArrayStatementArguments() {
assertNoError {
dbQueue.inDatabase { db in
let statement = db.selectStatement("SELECT COUNT(*) FROM persons WHERE age < ?")
let ages = [20, 30, 40, 50]
let counts = ages.map { Int.fetchOne(statement, arguments: [$0])! }
XCTAssertEqual(counts, [1,2,2,3])
}
}
}
func testStatementArgumentsSetterWithArray() {
assertNoError {
dbQueue.inDatabase { db in
let statement = db.selectStatement("SELECT COUNT(*) FROM persons WHERE age < ?")
let ages = [20, 30, 40, 50]
let counts = ages.map { (age: Int) -> Int in
statement.arguments = [age]
return Int.fetchOne(statement)!
}
XCTAssertEqual(counts, [1,2,2,3])
}
}
}
func testDictionaryStatementArguments() {
assertNoError {
dbQueue.inDatabase { db in
let statement = db.selectStatement("SELECT COUNT(*) FROM persons WHERE age < :age")
// TODO: Remove this explicit type declaration required by rdar://22357375
let ageDicts: [[String: DatabaseValueConvertible?]] = [["age": 20], ["age": 30], ["age": 40], ["age": 50]]
let counts = ageDicts.map { Int.fetchOne(statement, arguments: StatementArguments($0))! }
XCTAssertEqual(counts, [1,2,2,3])
}
}
}
func testStatementArgumentsSetterWithDictionary() {
assertNoError {
dbQueue.inDatabase { db in
let statement = db.selectStatement("SELECT COUNT(*) FROM persons WHERE age < :age")
// TODO: Remove this explicit type declaration required by rdar://22357375
let ageDicts: [[String: DatabaseValueConvertible?]] = [["age": 20], ["age": 30], ["age": 40], ["age": 50]]
let counts = ageDicts.map { ageDict -> Int in
statement.arguments = StatementArguments(ageDict)
return Int.fetchOne(statement)!
}
XCTAssertEqual(counts, [1,2,2,3])
}
}
}
func testRowSequenceCanBeFetchedTwice() {
assertNoError {
dbQueue.inDatabase { db in
let statement = db.selectStatement("SELECT * FROM persons ORDER BY name")
var names1 = Row.fetch(statement).map { $0.value(named: "name") as String }
var names2 = Row.fetch(statement).map { $0.value(named: "name") as String }
XCTAssertEqual(names1[0], "Arthur")
XCTAssertEqual(names1[1], "Barbara")
XCTAssertEqual(names1[2], "Craig")
XCTAssertEqual(names2[0], "Arthur")
XCTAssertEqual(names2[1], "Barbara")
XCTAssertEqual(names2[2], "Craig")
}
}
}
func testRowSequenceCanBeIteratedTwice() {
assertNoError {
dbQueue.inDatabase { db in
let statement = db.selectStatement("SELECT * FROM persons ORDER BY name")
let rows = Row.fetch(statement)
var names1 = rows.map { $0.value(named: "name") as String }
var names2 = rows.map { $0.value(named: "name") as String }
XCTAssertEqual(names1[0], "Arthur")
XCTAssertEqual(names1[1], "Barbara")
XCTAssertEqual(names1[2], "Craig")
XCTAssertEqual(names2[0], "Arthur")
XCTAssertEqual(names2[1], "Barbara")
XCTAssertEqual(names2[2], "Craig")
}
}
}
func testValueSequenceCanBeFetchedTwice() {
assertNoError {
dbQueue.inDatabase { db in
let statement = db.selectStatement("SELECT name FROM persons ORDER BY name")
var names1 = Array(String.fetch(statement))
var names2 = Array(String.fetch(statement))
XCTAssertEqual(names1[0], "Arthur")
XCTAssertEqual(names1[1], "Barbara")
XCTAssertEqual(names1[2], "Craig")
XCTAssertEqual(names2[0], "Arthur")
XCTAssertEqual(names2[1], "Barbara")
XCTAssertEqual(names2[2], "Craig")
}
}
}
func testValueSequenceCanBeIteratedTwice() {
assertNoError {
dbQueue.inDatabase { db in
let statement = db.selectStatement("SELECT name FROM persons ORDER BY name")
let nameSequence = String.fetch(statement)
var names1 = Array(nameSequence)
var names2 = Array(nameSequence)
XCTAssertEqual(names1[0], "Arthur")
XCTAssertEqual(names1[1], "Barbara")
XCTAssertEqual(names1[2], "Craig")
XCTAssertEqual(names2[0], "Arthur")
XCTAssertEqual(names2[1], "Barbara")
XCTAssertEqual(names2[2], "Craig")
}
}
}
}
@@ -1,160 +0,0 @@
import XCTest
import GRDB
class UpdateStatementTests : GRDBTestCase {
override func setUp() {
super.setUp()
var migrator = DatabaseMigrator()
migrator.registerMigration("createPersons") { db in
try db.execute(
"CREATE TABLE persons (" +
"id INTEGER PRIMARY KEY, " +
"creationDate TEXT, " +
"name TEXT NOT NULL, " +
"age INT" +
")")
}
assertNoError {
try migrator.migrate(dbQueue)
}
}
func testTrailingSemiColonIsAcceptedAndOptional() {
assertNoError {
try dbQueue.inTransaction { db in
try db.updateStatement("INSERT INTO persons (name, age) VALUES ('Arthur', ?)").execute()
try db.updateStatement("INSERT INTO persons (name, age) VALUES ('Barbara', ?)").execute()
try db.updateStatement("INSERT INTO persons (name, age) VALUES ('Arthur', ?);").execute()
try db.updateStatement("INSERT INTO persons (name, age) VALUES ('Barbara', ?);").execute()
return .Commit
}
}
dbQueue.inDatabase { db in
let rows = Row.fetchAll(db, "SELECT * FROM persons ORDER BY name")
XCTAssertEqual(rows.count, 4)
XCTAssertEqual(rows[0].value(named: "name") as String, "Arthur")
XCTAssertEqual(rows[1].value(named: "name") as String, "Arthur")
XCTAssertEqual(rows[2].value(named: "name") as String, "Barbara")
XCTAssertEqual(rows[3].value(named: "name") as String, "Barbara")
}
}
func testArrayStatementArguments() {
assertNoError {
try dbQueue.inTransaction { db in
let statement = db.updateStatement("INSERT INTO persons (name, age) VALUES (?, ?)")
let persons: [[DatabaseValueConvertible?]] = [
["Arthur", 41],
["Barbara", nil],
]
for person in persons {
try statement.execute(arguments: StatementArguments(person))
}
return .Commit
}
dbQueue.inDatabase { db in
let rows = Row.fetchAll(db, "SELECT * FROM persons ORDER BY name")
XCTAssertEqual(rows.count, 2)
XCTAssertEqual(rows[0].value(named: "name") as String, "Arthur")
XCTAssertEqual(rows[0].value(named: "age") as Int, 41)
XCTAssertEqual(rows[1].value(named: "name") as String, "Barbara")
XCTAssertTrue(rows[1].value(named: "age") == nil)
}
}
}
func testStatementArgumentsSetterWithArray() {
assertNoError {
try dbQueue.inTransaction { db in
let statement = db.updateStatement("INSERT INTO persons (name, age) VALUES (?, ?)")
let persons: [[DatabaseValueConvertible?]] = [
["Arthur", 41],
["Barbara", nil],
]
for person in persons {
statement.arguments = StatementArguments(person)
try statement.execute()
}
return .Commit
}
dbQueue.inDatabase { db in
let rows = Row.fetchAll(db, "SELECT * FROM persons ORDER BY name")
XCTAssertEqual(rows.count, 2)
XCTAssertEqual(rows[0].value(named: "name") as String, "Arthur")
XCTAssertEqual(rows[0].value(named: "age") as Int, 41)
XCTAssertEqual(rows[1].value(named: "name") as String, "Barbara")
XCTAssertTrue(rows[1].value(named: "age") == nil)
}
}
}
func testDictionaryStatementArguments() {
assertNoError {
try dbQueue.inTransaction { db in
let statement = db.updateStatement("INSERT INTO persons (name, age) VALUES (:name, :age)")
let persons: [[String: DatabaseValueConvertible?]] = [
["name": "Arthur", "age": 41],
["name": "Barbara", "age": nil],
]
for person in persons {
try statement.execute(arguments: StatementArguments(person))
}
return .Commit
}
dbQueue.inDatabase { db in
let rows = Row.fetchAll(db, "SELECT * FROM persons ORDER BY name")
XCTAssertEqual(rows.count, 2)
XCTAssertEqual(rows[0].value(named: "name") as String, "Arthur")
XCTAssertEqual(rows[0].value(named: "age") as Int, 41)
XCTAssertEqual(rows[1].value(named: "name") as String, "Barbara")
XCTAssertTrue(rows[1].value(named: "age") == nil)
}
}
}
func testStatementArgumentsSetterWithDictionary() {
assertNoError {
try dbQueue.inTransaction { db in
let statement = db.updateStatement("INSERT INTO persons (name, age) VALUES (:name, :age)")
let persons: [[String: DatabaseValueConvertible?]] = [
["name": "Arthur", "age": 41],
["name": "Barbara", "age": nil],
]
for person in persons {
statement.arguments = StatementArguments(person)
try statement.execute()
}
return .Commit
}
dbQueue.inDatabase { db in
let rows = Row.fetchAll(db, "SELECT * FROM persons ORDER BY name")
XCTAssertEqual(rows.count, 2)
XCTAssertEqual(rows[0].value(named: "name") as String, "Arthur")
XCTAssertEqual(rows[0].value(named: "age") as Int, 41)
XCTAssertEqual(rows[1].value(named: "name") as String, "Barbara")
XCTAssertTrue(rows[1].value(named: "age") == nil)
}
}
}
}
@@ -1,611 +0,0 @@
import XCTest
import GRDB
class TransactionObserver : TransactionObserverType {
var lastCommittedEvents: [DatabaseEvent] = []
var events: [DatabaseEvent] = []
var commitError: ErrorType?
var didChangeCount: Int = 0
var willCommitCount: Int = 0
var didCommitCount: Int = 0
var didRollbackCount: Int = 0
func resetCounts() {
didChangeCount = 0
willCommitCount = 0
didCommitCount = 0
didRollbackCount = 0
}
func databaseDidChangeWithEvent(event: DatabaseEvent) {
didChangeCount++
events.append(event)
}
func databaseWillCommit() throws {
willCommitCount++
if let commitError = commitError {
throw commitError
}
}
func databaseDidCommit(db: Database) {
didCommitCount++
lastCommittedEvents = events
events = []
}
func databaseDidRollback(db: Database) {
didRollbackCount++
lastCommittedEvents = []
events = []
}
}
class Artist : Record {
var id: Int64?
var name: String?
init(name: String?) {
self.name = name
super.init()
}
required init(row: Row) {
super.init(row: row)
}
static override func databaseTableName() -> String {
return "artists"
}
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
return ["id": id, "name": name]
}
override func updateFromRow(row: Row) {
if let dbv = row["id"] { id = dbv.value() }
if let dbv = row["name"] { name = dbv.value() }
super.updateFromRow(row)
}
static func setupInDatabase(db: Database) throws {
try db.execute(
"CREATE TABLE artists (" +
"id INTEGER PRIMARY KEY, " +
"name TEXT" +
")")
}
}
class Artwork : Record {
var id: Int64?
var artistId: Int64?
var title: String?
init(title: String?, artistId: Int64? = nil) {
self.title = title
self.artistId = artistId
super.init()
}
required init(row: Row) {
super.init(row: row)
}
static override func databaseTableName() -> String {
return "artworks"
}
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
return ["id": id, "artistId": artistId, "title": title]
}
override func updateFromRow(row: Row) {
if let dbv = row["id"] { id = dbv.value() }
if let dbv = row["artistId"] { artistId = dbv.value() }
if let dbv = row["title"] { title = dbv.value() }
super.updateFromRow(row)
}
static func setupInDatabase(db: Database) throws {
try db.execute(
"CREATE TABLE artworks (" +
"id INTEGER PRIMARY KEY, " +
"artistId INTEGER NOT NULL REFERENCES artists(id) ON DELETE CASCADE ON UPDATE CASCADE, " +
"title TEXT" +
")")
}
}
class TransactionObserverTests: GRDBTestCase {
var observer: TransactionObserver!
override func setUp() {
super.setUp()
assertNoError {
try dbQueue.inDatabase { db in
try Artist.setupInDatabase(db)
try Artwork.setupInDatabase(db)
}
}
self.observer.resetCounts()
}
override var dbConfiguration: Configuration {
observer = TransactionObserver()
var c = super.dbConfiguration
c.transactionObserver = observer
return c
}
func match(event event: DatabaseEvent, kind: DatabaseEvent.Kind, tableName: String, rowId: Int64) -> Bool {
return (event.tableName == tableName) && (event.rowID == rowId) && (event.kind == kind)
}
// MARK: - Events
func testInsertEvent() {
assertNoError {
try dbQueue.inDatabase { db in
let artist = Artist(name: "Gerhard Richter")
//
try artist.save(db)
XCTAssertEqual(self.observer.lastCommittedEvents.count, 1)
let event = self.observer.lastCommittedEvents.filter { event in
self.match(event: event, kind: .Insert, tableName: "artists", rowId: artist.id!)
}.first
XCTAssertTrue(event != nil)
}
}
}
func testUpdateEvent() {
assertNoError {
try dbQueue.inDatabase { db in
let artist = Artist(name: "Gerhard Richter")
try artist.save(db)
artist.name = "Vincent Fournier"
//
try artist.save(db)
XCTAssertEqual(self.observer.lastCommittedEvents.count, 1)
let event = self.observer.lastCommittedEvents.filter {
self.match(event: $0, kind: .Update, tableName: "artists", rowId: artist.id!)
}.first
XCTAssertTrue(event != nil)
}
}
}
func testDeleteEvent() {
assertNoError {
try dbQueue.inDatabase { db in
let artist = Artist(name: "Gerhard Richter")
try artist.save(db)
//
try artist.delete(db)
XCTAssertEqual(self.observer.lastCommittedEvents.count, 1)
let event = self.observer.lastCommittedEvents.filter {
self.match(event: $0, kind: .Delete, tableName: "artists", rowId: artist.id!)
}.first
XCTAssertTrue(event != nil)
}
}
}
func testCascadingDeleteEvents() {
assertNoError {
try dbQueue.inDatabase { db in
let artist = Artist(name: "Gerhard Richter")
try artist.save(db)
let artwork1 = Artwork(title: "Cloud", artistId: artist.id)
try artwork1.save(db)
let artwork2 = Artwork(title: "Ema (Nude on a Staircase)", artistId: artist.id)
try artwork2.save(db)
//
try artist.delete(db)
XCTAssertEqual(self.observer.lastCommittedEvents.count, 3)
let artistEvent = self.observer.lastCommittedEvents.filter {
self.match(event: $0, kind: .Delete, tableName: "artists", rowId: artist.id!)
}.first
XCTAssertTrue(artistEvent != nil)
let artwork1Event = self.observer.lastCommittedEvents.filter {
self.match(event: $0, kind: .Delete, tableName: "artworks", rowId: artwork1.id!)
}.first
XCTAssertTrue(artwork1Event != nil)
let artwork2Event = self.observer.lastCommittedEvents.filter {
self.match(event: $0, kind: .Delete, tableName: "artworks", rowId: artwork2.id!)
}.first
XCTAssertTrue(artwork2Event != nil)
}
}
}
// MARK: - Commits & Rollback
func testImplicitTransactionCommit() {
assertNoError {
let artist = Artist(name: "Gerhard Richter")
try dbQueue.inDatabase { db in
self.observer.resetCounts()
try artist.save(db)
XCTAssertEqual(self.observer.didChangeCount, 1)
XCTAssertEqual(self.observer.willCommitCount, 1)
XCTAssertEqual(self.observer.didCommitCount, 1)
XCTAssertEqual(self.observer.didRollbackCount, 0)
}
}
}
func testCascadeWithImplicitTransactionCommit() {
assertNoError {
let artist = Artist(name: "Gerhard Richter")
let artwork1 = Artwork(title: "Cloud")
let artwork2 = Artwork(title: "Ema (Nude on a Staircase)")
try dbQueue.inDatabase { db in
try artist.save(db)
artwork1.artistId = artist.id
artwork2.artistId = artist.id
try artwork1.save(db)
try artwork2.save(db)
//
self.observer.resetCounts()
try artist.delete(db)
XCTAssertEqual(self.observer.didChangeCount, 3) // 3 deletes
XCTAssertEqual(self.observer.willCommitCount, 1)
XCTAssertEqual(self.observer.didCommitCount, 1)
XCTAssertEqual(self.observer.didRollbackCount, 0)
let artistDeleteEvent = self.observer.lastCommittedEvents.filter {
self.match(event: $0, kind: .Delete, tableName: "artists", rowId: artist.id!)
}.first
XCTAssertTrue(artistDeleteEvent != nil)
let artwork1DeleteEvent = self.observer.lastCommittedEvents.filter {
self.match(event: $0, kind: .Delete, tableName: "artworks", rowId: artwork1.id!)
}.first
XCTAssertTrue(artwork1DeleteEvent != nil)
let artwork2DeleteEvent = self.observer.lastCommittedEvents.filter {
self.match(event: $0, kind: .Delete, tableName: "artworks", rowId: artwork2.id!)
}.first
XCTAssertTrue(artwork2DeleteEvent != nil)
}
}
}
func testExplicitTransactionCommit() {
assertNoError {
let artist = Artist(name: "Gerhard Richter")
let artwork1 = Artwork(title: "Cloud")
let artwork2 = Artwork(title: "Ema (Nude on a Staircase)")
try dbQueue.inTransaction { db in
self.observer.resetCounts()
try artist.save(db)
XCTAssertEqual(self.observer.didChangeCount, 1)
XCTAssertEqual(self.observer.willCommitCount, 0)
XCTAssertEqual(self.observer.didCommitCount, 0)
XCTAssertEqual(self.observer.didRollbackCount, 0)
artwork1.artistId = artist.id
artwork2.artistId = artist.id
self.observer.resetCounts()
try artwork1.save(db)
XCTAssertEqual(self.observer.didChangeCount, 1)
XCTAssertEqual(self.observer.willCommitCount, 0)
XCTAssertEqual(self.observer.didCommitCount, 0)
XCTAssertEqual(self.observer.didRollbackCount, 0)
self.observer.resetCounts()
try artwork2.save(db)
XCTAssertEqual(self.observer.didChangeCount, 1)
XCTAssertEqual(self.observer.willCommitCount, 0)
XCTAssertEqual(self.observer.didCommitCount, 0)
XCTAssertEqual(self.observer.didRollbackCount, 0)
self.observer.resetCounts()
return .Commit
}
XCTAssertEqual(self.observer.didChangeCount, 0)
XCTAssertEqual(self.observer.willCommitCount, 1)
XCTAssertEqual(self.observer.didCommitCount, 1)
XCTAssertEqual(self.observer.didRollbackCount, 0)
XCTAssertEqual(observer.lastCommittedEvents.count, 3)
let artistEvent = observer.lastCommittedEvents.filter {
self.match(event: $0, kind: .Insert, tableName: "artists", rowId: artist.id!)
}.first
XCTAssertTrue(artistEvent != nil)
let artwork1Event = observer.lastCommittedEvents.filter {
self.match(event: $0, kind: .Insert, tableName: "artworks", rowId: artwork1.id!)
}.first
XCTAssertTrue(artwork1Event != nil)
let artwork2Event = observer.lastCommittedEvents.filter {
self.match(event: $0, kind: .Insert, tableName: "artworks", rowId: artwork2.id!)
}.first
XCTAssertTrue(artwork2Event != nil)
}
}
func testCascadeWithExplicitTransactionCommit() {
assertNoError {
let artist = Artist(name: "Gerhard Richter")
let artwork1 = Artwork(title: "Cloud")
let artwork2 = Artwork(title: "Ema (Nude on a Staircase)")
try dbQueue.inTransaction { db in
try artist.save(db)
artwork1.artistId = artist.id
artwork2.artistId = artist.id
try artwork1.save(db)
try artwork2.save(db)
//
self.observer.resetCounts()
try artist.delete(db)
XCTAssertEqual(self.observer.didChangeCount, 3) // 3 deletes
XCTAssertEqual(self.observer.willCommitCount, 0)
XCTAssertEqual(self.observer.didCommitCount, 0)
XCTAssertEqual(self.observer.didRollbackCount, 0)
self.observer.resetCounts()
return .Commit
}
XCTAssertEqual(self.observer.didChangeCount, 0)
XCTAssertEqual(self.observer.willCommitCount, 1)
XCTAssertEqual(self.observer.didCommitCount, 1)
XCTAssertEqual(self.observer.didRollbackCount, 0)
XCTAssertEqual(self.observer.lastCommittedEvents.count, 6) // 3 inserts, and 3 deletes
let artistInsertEvent = self.observer.lastCommittedEvents.filter {
self.match(event: $0, kind: .Insert, tableName: "artists", rowId: artist.id!)
}.first
XCTAssertTrue(artistInsertEvent != nil)
let artwork1InsertEvent = self.observer.lastCommittedEvents.filter {
self.match(event: $0, kind: .Insert, tableName: "artworks", rowId: artwork1.id!)
}.first
XCTAssertTrue(artwork1InsertEvent != nil)
let artwork2InsertEvent = self.observer.lastCommittedEvents.filter {
self.match(event: $0, kind: .Insert, tableName: "artworks", rowId: artwork2.id!)
}.first
XCTAssertTrue(artwork2InsertEvent != nil)
let artistDeleteEvent = self.observer.lastCommittedEvents.filter {
self.match(event: $0, kind: .Delete, tableName: "artists", rowId: artist.id!)
}.first
XCTAssertTrue(artistDeleteEvent != nil)
let artwork1DeleteEvent = self.observer.lastCommittedEvents.filter {
self.match(event: $0, kind: .Delete, tableName: "artworks", rowId: artwork1.id!)
}.first
XCTAssertTrue(artwork1DeleteEvent != nil)
let artwork2DeleteEvent = self.observer.lastCommittedEvents.filter {
self.match(event: $0, kind: .Delete, tableName: "artworks", rowId: artwork2.id!)
}.first
XCTAssertTrue(artwork2DeleteEvent != nil)
}
}
func testExplicitTransactionRollback() {
assertNoError {
let artist = Artist(name: "Gerhard Richter")
let artwork1 = Artwork(title: "Cloud")
let artwork2 = Artwork(title: "Ema (Nude on a Staircase)")
try dbQueue.inTransaction { db in
try artist.save(db)
artwork1.artistId = artist.id
artwork2.artistId = artist.id
try artwork1.save(db)
try artwork2.save(db)
self.observer.resetCounts()
return .Rollback
}
XCTAssertEqual(self.observer.didChangeCount, 0)
XCTAssertEqual(self.observer.willCommitCount, 0)
XCTAssertEqual(self.observer.didCommitCount, 0)
XCTAssertEqual(self.observer.didRollbackCount, 1)
}
}
func testImplicitTransactionRollbackCausedByDatabaseError() {
assertNoError {
do {
try dbQueue.inDatabase { db in
do {
try Artwork(title: "meh").save(db)
XCTFail("Expected Error")
} catch let error as DatabaseError {
XCTAssertEqual(error.code, 19)
XCTAssertEqual(self.observer.didChangeCount, 0)
XCTAssertEqual(self.observer.willCommitCount, 0)
XCTAssertEqual(self.observer.didCommitCount, 0)
XCTAssertEqual(self.observer.didRollbackCount, 0)
throw error
}
}
XCTFail("Expected Error")
} catch let error as DatabaseError {
XCTAssertEqual(error.code, 19)
XCTAssertEqual(self.observer.didChangeCount, 0)
XCTAssertEqual(self.observer.willCommitCount, 0)
XCTAssertEqual(self.observer.didCommitCount, 0)
XCTAssertEqual(self.observer.didRollbackCount, 0)
}
}
}
func testExplicitTransactionRollbackCausedByDatabaseError() {
assertNoError {
do {
try dbQueue.inTransaction { db in
do {
try Artwork(title: "meh").save(db)
XCTFail("Expected Error")
} catch let error as DatabaseError {
// Immediate constraint check has failed.
XCTAssertEqual(error.code, 19)
XCTAssertEqual(self.observer.didChangeCount, 0)
XCTAssertEqual(self.observer.willCommitCount, 0)
XCTAssertEqual(self.observer.didCommitCount, 0)
XCTAssertEqual(self.observer.didRollbackCount, 0)
throw error
}
return .Commit
}
XCTFail("Expected Error")
} catch let error as DatabaseError {
XCTAssertEqual(error.code, 19)
XCTAssertEqual(self.observer.didChangeCount, 0)
XCTAssertEqual(self.observer.willCommitCount, 0)
XCTAssertEqual(self.observer.didCommitCount, 0)
XCTAssertEqual(self.observer.didRollbackCount, 1)
}
}
}
func testImplicitTransactionRollbackCausedByTransactionObserver() {
assertNoError {
self.observer.commitError = NSError(domain: "foo", code: 0, userInfo: nil)
dbQueue.inDatabase { db in
do {
try Artist(name: "Gerhard Richter").save(db)
XCTFail("Expected Error")
} catch let error as NSError {
XCTAssertEqual(error.domain, "foo")
XCTAssertEqual(error.code, 0)
XCTAssertEqual(self.observer.didChangeCount, 1)
XCTAssertEqual(self.observer.willCommitCount, 1)
XCTAssertEqual(self.observer.didCommitCount, 0)
XCTAssertEqual(self.observer.didRollbackCount, 1)
}
}
}
}
func testExplicitTransactionRollbackCausedByTransactionObserver() {
assertNoError {
self.observer.commitError = NSError(domain: "foo", code: 0, userInfo: nil)
do {
try dbQueue.inTransaction { db in
try Artist(name: "Gerhard Richter").save(db)
return .Commit
}
XCTFail("Expected Error")
} catch let error as NSError {
XCTAssertEqual(error.domain, "foo")
XCTAssertEqual(error.code, 0)
XCTAssertEqual(self.observer.didChangeCount, 1)
XCTAssertEqual(self.observer.willCommitCount, 1)
XCTAssertEqual(self.observer.didCommitCount, 0)
XCTAssertEqual(self.observer.didRollbackCount, 1)
}
}
}
func testImplicitTransactionRollbackCausedByDatabaseErrorSuperseedTransactionObserver() {
assertNoError {
self.observer.commitError = NSError(domain: "foo", code: 0, userInfo: nil)
do {
try dbQueue.inDatabase { db in
do {
try Artwork(title: "meh").save(db)
XCTFail("Expected Error")
} catch let error as DatabaseError {
XCTAssertEqual(error.code, 19)
XCTAssertEqual(self.observer.didChangeCount, 0)
XCTAssertEqual(self.observer.willCommitCount, 0)
XCTAssertEqual(self.observer.didCommitCount, 0)
XCTAssertEqual(self.observer.didRollbackCount, 0)
throw error
}
}
XCTFail("Expected Error")
} catch let error as DatabaseError {
XCTAssertEqual(error.code, 19)
XCTAssertEqual(self.observer.didChangeCount, 0)
XCTAssertEqual(self.observer.willCommitCount, 0)
XCTAssertEqual(self.observer.didCommitCount, 0)
XCTAssertEqual(self.observer.didRollbackCount, 0)
}
}
}
func testExplicitTransactionRollbackCausedByDatabaseErrorSuperseedTransactionObserver() {
assertNoError {
self.observer.commitError = NSError(domain: "foo", code: 0, userInfo: nil)
do {
try dbQueue.inTransaction { db in
do {
try Artwork(title: "meh").save(db)
XCTFail("Expected Error")
} catch let error as DatabaseError {
// Immediate constraint check has failed.
XCTAssertEqual(error.code, 19)
XCTAssertEqual(self.observer.didChangeCount, 0)
XCTAssertEqual(self.observer.willCommitCount, 0)
XCTAssertEqual(self.observer.didCommitCount, 0)
XCTAssertEqual(self.observer.didRollbackCount, 0)
throw error
}
return .Commit
}
XCTFail("Expected Error")
} catch let error as DatabaseError {
XCTAssertEqual(error.code, 19)
XCTAssertEqual(self.observer.didChangeCount, 0)
XCTAssertEqual(self.observer.willCommitCount, 0)
XCTAssertEqual(self.observer.didCommitCount, 0)
XCTAssertEqual(self.observer.didRollbackCount, 1)
}
}
}
func testMinimalRowIDUpdateObservation() {
// Here we test that updating a Record made of a single primary key
// column performs an actual UPDATE statement, even though it is
// totally useless (UPDATE id = 1 FROM records WHERE id = 1).
//
// It is important to update something, so that TransactionObserverType
// can observe a change.
//
// The goal is to be able to write tests with minimal tables,
// including tables made of a single primary key column. The less we
// have exceptions, the better it is.
assertNoError {
try dbQueue.inDatabase { db in
try MinimalRowID.setupInDatabase(db)
let record = MinimalRowID()
try record.save(db)
self.observer.resetCounts()
try record.update(db)
XCTAssertEqual(self.observer.didChangeCount, 1)
XCTAssertEqual(self.observer.willCommitCount, 1)
XCTAssertEqual(self.observer.didCommitCount, 1)
XCTAssertEqual(self.observer.didRollbackCount, 0)
}
}
}
}
@@ -1,24 +0,0 @@
import XCTest
import CoreGraphics
import GRDB
class CGFloatTests: GRDBTestCase {
func testCGFLoat() {
assertNoError {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE points (x DOUBLE, y DOUBLE)")
let x: CGFloat = 1
let y: CGFloat? = nil
try db.execute("INSERT INTO points VALUES (?,?)", arguments: [x, y])
let row = Row.fetchOne(db, "SELECT * FROM points")!
let fetchedX: CGFloat = row.value(named: "x")
let fetchedY: CGFloat? = row.value(named: "y")
XCTAssertEqual(x, fetchedX)
XCTAssertTrue(fetchedY == nil)
}
}
}
}
-663
View File
@@ -1,663 +0,0 @@
// All tests in this file must crash.
//
// To run those tests, check the GRDBOSXTests and GRDBiOSTests membership.
import XCTest
import GRDB
// MARK: - Support
class RecordWithoutDatabaseTableName: Record { }
class RecordWithInexistingDatabaseTable: Record {
override static func databaseTableName() -> String? {
return "foo"
}
}
class RecordWithEmptyStoredDatabaseDictionary : Record {
override static func databaseTableName() -> String? {
return "records"
}
}
class RecordWithNilPrimaryKey : Record {
override static func databaseTableName() -> String? {
return "records"
}
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
return ["id": nil]
}
}
class RecordForTableWithoutPrimaryKey : Record {
override static func databaseTableName() -> String? {
return "records"
}
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
return ["name": "foo"]
}
}
class RecordForTableWithMultipleColumnsPrimaryKey : Record {
override static func databaseTableName() -> String? {
return "records"
}
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
return ["name": "foo"]
}
}
class RecordWithRowIDPrimaryKeyNotExposedInStoredDatabaseDictionary : Record {
override static func databaseTableName() -> String? {
return "records"
}
override var storedDatabaseDictionary: [String: DatabaseValueConvertible?] {
return ["name": "foo"]
}
}
// A type that adopts DatabaseValueConvertible but does not adopt SQLiteStatementConvertible
struct IntConvertible: DatabaseValueConvertible {
let int: Int
init(int: Int) {
self.int = int
}
var databaseValue: DatabaseValue {
return DatabaseValue(int64: Int64(int))
}
static func fromDatabaseValue(databaseValue: DatabaseValue) -> IntConvertible? {
guard let int = Int.fromDatabaseValue(databaseValue) else {
return nil
}
return IntConvertible(int: int)
}
}
// MARK: - CrashTests
class CrashTests: GRDBTestCase {
// This method does not actually catch any crash.
// But it expresses an intent :-)
func assertCrash(message: String, @noescape block: () throws -> ()) {
do {
try block()
XCTFail("Crash expected: \(message)")
} catch {
XCTFail("Unexpected error: \(error)")
}
}
// =========================================================================
// MARK: - Migrations
func testMigrationNamesMustBeUnique() {
assertCrash("Already registered migration: \"foo\"") {
var migrator = DatabaseMigrator()
migrator.registerMigration("foo") { db in }
migrator.registerMigration("foo") { db in }
}
}
// =========================================================================
// MARK: - Queue
func testInDatabaseIsNotReentrant() {
assertCrash("DatabaseQueue.inDatabase(_:) or DatabaseQueue.inTransaction(_:) was called reentrantly, which would lead to a deadlock.") {
dbQueue.inDatabase { db in
self.dbQueue.inDatabase { db in
}
}
}
}
func testInTransactionInsideInDatabaseIsNotReentrant() {
assertCrash("DatabaseQueue.inDatabase(_:) or DatabaseQueue.inTransaction(_:) was called reentrantly, which would lead to a deadlock.") {
try dbQueue.inDatabase { db in
try self.dbQueue.inTransaction { db in
return .Commit
}
}
}
}
func testInTransactionIsNotReentrant() {
assertCrash("DatabaseQueue.inDatabase(_:) or DatabaseQueue.inTransaction(_:) was called reentrantly, which would lead to a deadlock.") {
try dbQueue.inTransaction { db in
try self.dbQueue.inTransaction { db in
return .Commit
}
return .Commit
}
}
}
func testRowSequenceCanNotBeGeneratedOutsideOfDatabaseQueue() {
assertCrash("Database was not used on the correct queue.") {
var rows: DatabaseSequence<Row>?
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE persons (name TEXT)")
rows = Row.fetch(db, "SELECT * FROM persons")
}
let _ = rows!.generate()
}
}
func testRowSequenceCanNotBeIteratedOutsideOfDatabaseQueue() {
assertCrash("Database was not used on the correct queue.") {
var generator: DatabaseGenerator<Row>?
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE persons (name TEXT)")
generator = Row.fetch(db, "SELECT * FROM persons").generate()
}
generator!.next()
}
}
// =========================================================================
// MARK: - Statements
func testExecuteDoesNotSupportMultipleStatement() {
assertCrash("Invalid SQL string: multiple statements found.") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE persons (name TEXT, age INT); CREATE TABLE books (name TEXT, age INT)")
}
}
}
func testInvalidNamedBinding() {
assertCrash("Key not found in SQLite statement: `:XXX`") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE persons (name TEXT, age INT)")
try db.execute("INSERT INTO persons (name, age) VALUES (:name, :age)", arguments: ["XXX": "foo", "name": "Arthur", "age": 41])
}
}
}
// =========================================================================
// MARK: - RecordWithoutDatabaseTableName
func testRecordWithoutDatabaseTableNameCanNotBeFetchedByID() {
assertCrash("Nil returned from RecordWithoutDatabaseTableName.databaseTableName()") {
dbQueue.inDatabase { db in
RecordWithoutDatabaseTableName.fetchOne(db, primaryKey: 1)
}
}
}
func testRecordWithoutDatabaseTableNameCanNotBeFetchedByKey() {
assertCrash("Nil returned from RecordWithoutDatabaseTableName.databaseTableName()") {
dbQueue.inDatabase { db in
RecordWithoutDatabaseTableName.fetchOne(db, key: ["foo": "bar"])
}
}
}
func testRecordWithoutDatabaseTableNameCanNotBeInserted() {
assertCrash("Nil returned from RecordWithoutDatabaseTableName.databaseTableName()") {
try dbQueue.inDatabase { db in
try RecordWithoutDatabaseTableName().insert(db)
}
}
}
func testRecordWithoutDatabaseTableNameCanNotBeUpdated() {
assertCrash("Nil returned from RecordWithoutDatabaseTableName.databaseTableName()") {
try dbQueue.inDatabase { db in
try RecordWithoutDatabaseTableName().update(db)
}
}
}
func testRecordWithoutDatabaseTableNameCanNotBeSaved() {
assertCrash("Nil returned from RecordWithoutDatabaseTableName.databaseTableName()") {
try dbQueue.inDatabase { db in
try RecordWithoutDatabaseTableName().save(db)
}
}
}
func testRecordWithoutDatabaseTableNameCanNotBeDeleted() {
assertCrash("Nil returned from RecordWithoutDatabaseTableName.databaseTableName()") {
try dbQueue.inDatabase { db in
try RecordWithoutDatabaseTableName().delete(db)
}
}
}
func testRecordWithoutDatabaseTableNameCanNotBeReloaded() {
assertCrash("Nil returned from RecordWithoutDatabaseTableName.databaseTableName()") {
try dbQueue.inDatabase { db in
try RecordWithoutDatabaseTableName().reload(db)
}
}
}
func testRecordWithoutDatabaseTableNameCanNotBeTestedForExistence() {
assertCrash("Nil returned from RecordWithoutDatabaseTableName.databaseTableName()") {
dbQueue.inDatabase { db in
RecordWithoutDatabaseTableName().exists(db)
}
}
}
// =========================================================================
// MARK: - RecordWithInexistingDatabaseTable
func testRecordWithInexistingDatabaseTableCanNotBeFetchedByID() {
assertCrash("Table \"foo\" does not exist.") {
dbQueue.inDatabase { db in
RecordWithInexistingDatabaseTable.fetchOne(db, primaryKey: 1)
}
}
}
func testRecordWithInexistingDatabaseTableCanNotBeFetchedByKey() {
assertCrash("no such table: foo") {
dbQueue.inDatabase { db in
RecordWithInexistingDatabaseTable.fetchOne(db, key: ["id": 1])
}
}
}
func testRecordWithInexistingDatabaseTableCanNotBeInserted() {
assertCrash("Table \"foo\" does not exist.") {
try dbQueue.inDatabase { db in
try RecordWithInexistingDatabaseTable().insert(db)
}
}
}
func testRecordWithInexistingDatabaseTableCanNotBeUpdated() {
assertCrash("Table \"foo\" does not exist.") {
try dbQueue.inDatabase { db in
try RecordWithInexistingDatabaseTable().update(db)
}
}
}
func testRecordWithInexistingDatabaseTableCanNotBeSaved() {
assertCrash("Table \"foo\" does not exist.") {
try dbQueue.inDatabase { db in
try RecordWithInexistingDatabaseTable().save(db)
}
}
}
func testRecordWithInexistingDatabaseTableCanNotBeDeleted() {
assertCrash("Table \"foo\" does not exist.") {
try dbQueue.inDatabase { db in
try RecordWithInexistingDatabaseTable().delete(db)
}
}
}
func testRecordWithInexistingDatabaseTableCanNotBeReloaded() {
assertCrash("Table \"foo\" does not exist.") {
try dbQueue.inDatabase { db in
try RecordWithInexistingDatabaseTable().reload(db)
}
}
}
func testRecordWithInexistingDatabaseTableCanNotBeTestedForExistence() {
assertCrash("Table \"foo\" does not exist.") {
dbQueue.inDatabase { db in
RecordWithInexistingDatabaseTable().exists(db)
}
}
}
// =========================================================================
// MARK: - RecordWithEmptyStoredDatabaseDictionary
func testRecordWithEmptyStoredDatabaseDictionaryCanNotBeInserted() {
assertCrash("Invalid empty dictionary") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
try RecordWithEmptyStoredDatabaseDictionary().insert(db)
}
}
}
func testRecordWithEmptyStoredDatabaseDictionaryCanNotBeUpdated() {
assertCrash("Invalid empty dictionary") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
try RecordWithEmptyStoredDatabaseDictionary().update(db)
}
}
}
func testRecordWithEmptyStoredDatabaseDictionaryCanNotBeSaved() {
assertCrash("Invalid empty dictionary") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
try RecordWithEmptyStoredDatabaseDictionary().save(db)
}
}
}
func testRecordWithEmptyStoredDatabaseDictionaryCanNotBeDeleted() {
assertCrash("Invalid empty dictionary") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
try RecordWithEmptyStoredDatabaseDictionary().delete(db)
}
}
}
func testRecordWithEmptyStoredDatabaseDictionaryCanNotBeReloaded() {
assertCrash("Invalid empty dictionary") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
try RecordWithEmptyStoredDatabaseDictionary().reload(db)
}
}
}
func testRecordWithEmptyStoredDatabaseDictionaryCanNotBeTestedForExistence() {
assertCrash("Invalid empty dictionary") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
RecordWithEmptyStoredDatabaseDictionary().exists(db)
}
}
}
// =========================================================================
// MARK: - RecordWithNilPrimaryKey
func testRecordWithNilPrimaryKeyCanNotBeUpdated() {
assertCrash("Invalid primary key") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
try RecordWithNilPrimaryKey().update(db)
}
}
}
func testRecordWithNilPrimaryKeyCanNotBeDeleted() {
assertCrash("Invalid primary key") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
try RecordWithNilPrimaryKey().delete(db)
}
}
}
func testRecordWithNilPrimaryKeyCanNotBeReloaded() {
assertCrash("Invalid primary key") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
try RecordWithNilPrimaryKey().reload(db)
}
}
}
func testRecordWithNilPrimaryKeyCanNotBeTestedForExistence() {
assertCrash("Invalid primary key") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY)")
RecordWithNilPrimaryKey().exists(db)
}
}
}
// =========================================================================
// MARK: - RecordForTableWithoutPrimaryKey
func testRecordForTableWithoutPrimaryKeyCanNotBeFetchedByID() {
assertCrash("Primary key of table \"records\" is not made of a single column.") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE records (name TEXT)")
RecordForTableWithoutPrimaryKey.fetchOne(db, primaryKey: 1)
}
}
}
func testRecordForTableWithoutPrimaryKeyCanNotBeUpdated() {
assertCrash("Invalid primary key") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE records (name TEXT)")
try RecordForTableWithoutPrimaryKey().update(db)
}
}
}
func testRecordForTableWithoutPrimaryKeyCanNotBeDeleted() {
assertCrash("Invalid primary key") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE records (name TEXT)")
try RecordForTableWithoutPrimaryKey().delete(db)
}
}
}
func testRecordForTableWithoutPrimaryKeyCanNotBeReloaded() {
assertCrash("Invalid primary key") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE records (name TEXT)")
try RecordForTableWithoutPrimaryKey().reload(db)
}
}
}
func testRecordForTableWithoutPrimaryKeyCanNotBeTestedForExistence() {
assertCrash("Invalid primary key") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE records (name TEXT)")
RecordForTableWithoutPrimaryKey().exists(db)
}
}
}
// =========================================================================
// MARK: - RecordForTableWithMultipleColumnsPrimaryKey
func testRecordForTableWithMultipleColumnsPrimaryKeyCanNotBeFetchedByID() {
assertCrash("Primary key of table \"records\" is not made of a single column.") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE records (a TEXT, b TEXT, PRIMARY KEY(a,b))")
RecordForTableWithMultipleColumnsPrimaryKey.fetchOne(db, primaryKey: 1)
}
}
}
// =========================================================================
// MARK: - RecordWithRowIDPrimaryKeyNotExposedInStoredDatabaseDictionary
func testRecordWithRowIDPrimaryKeyNotExposedInStoredDatabaseDictionaryCanNotBeInserted() {
assertCrash("RecordWithRowIDPrimaryKeyNotExposedInStoredDatabaseDictionary.storedDatabaseDictionary must return the value for the primary key \"id\"") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE records (id INTEGER PRIMARY KEY, name TEXT)")
try RecordWithRowIDPrimaryKeyNotExposedInStoredDatabaseDictionary().insert(db)
}
}
}
// =========================================================================
// MARK: - Concurrency
func testReaderCrashDuringExclusiveTransaction() {
assertCrash("SQLite error 5 with statement `SELECT * FROM stuffs`: database is locked") {
databasePath = "/tmp/GRDBTestReaderDuringExclusiveTransaction.sqlite"
do { try NSFileManager.defaultManager().removeItemAtPath(databasePath) } catch { }
let dbQueue1 = try! DatabaseQueue(path: databasePath)
let dbQueue2 = try! DatabaseQueue(path: databasePath)
try! dbQueue1.inDatabase { db in
try db.execute("CREATE TABLE stuffs (id INTEGER PRIMARY KEY)")
}
let queue = NSOperationQueue()
queue.maxConcurrentOperationCount = 2
queue.addOperation(NSBlockOperation {
do {
try dbQueue1.inTransaction(.Exclusive) { db in
sleep(2) // let other queue try to read.
return .Commit
}
}
catch is DatabaseError {
}
catch {
XCTFail("\(error)")
}
})
queue.addOperation(NSBlockOperation {
dbQueue2.inDatabase { db in
sleep(1) // let other queue open transaction
Row.fetch(db, "SELECT * FROM stuffs") // Crash expected
}
})
queue.waitUntilAllOperationsAreFinished()
}
}
// =========================================================================
// MARK: - DatabaseValueConvertible
func testCrashFetchDatabaseValueConvertibleFromStatement() {
assertCrash("Could not convert NULL to IntConvertible while iterating `SELECT int FROM ints ORDER BY int`.") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
let sequence = IntConvertible.fetch(statement)
for _ in sequence { }
}
}
}
func testCrashFetchAllDatabaseValueConvertibleFromStatement() {
assertCrash("Could not convert NULL to IntConvertible while iterating `SELECT int FROM ints ORDER BY int`.") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
let _ = IntConvertible.fetchAll(statement)
}
}
}
func testCrashFetchDatabaseValueConvertibleFromDatabase() {
assertCrash("Could not convert NULL to IntConvertible while iterating `SELECT int FROM ints ORDER BY int`.") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let sequence = IntConvertible.fetch(db, "SELECT int FROM ints ORDER BY int")
for _ in sequence { }
}
}
}
func testCrashFetchAllDatabaseValueConvertibleFromDatabase() {
assertCrash("Could not convert NULL to IntConvertible while iterating `SELECT int FROM ints ORDER BY int`.") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let _ = IntConvertible.fetchAll(db, "SELECT int FROM ints ORDER BY int")
}
}
}
func testCrashDatabaseValueConvertibleInvalidConversionFromNULL() {
assertCrash("Could not convert NULL to IntConvertible.") {
let row = Row(dictionary: ["int": nil])
let _ = row.value(named: "int") as IntConvertible
}
}
func testCrashDatabaseValueConvertibleInvalidConversionFromInvalidType() {
assertCrash("Could not convert \"foo\" to IntConvertible.") {
let row = Row(dictionary: ["int": "foo"])
let _ = row.value(named: "int") as IntConvertible
}
}
// =========================================================================
// MARK: - SQLiteStatementConvertible
func testCrashFetchSQLiteStatementConvertibleFromStatement() {
assertCrash("Found NULL") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
let sequence = Int.fetch(statement)
for _ in sequence { }
}
}
}
func testCrashFetchAllSQLiteStatementConvertibleFromStatement() {
assertCrash("Found NULL") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let statement = db.selectStatement("SELECT int FROM ints ORDER BY int")
let _ = Int.fetchAll(statement)
}
}
}
func testCrashFetchSQLiteStatementConvertibleFromDatabase() {
assertCrash("Found NULL") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let sequence = Int.fetch(db, "SELECT int FROM ints ORDER BY int")
for _ in sequence { }
}
}
}
func testCrashFetchAllSQLiteStatementConvertibleFromDatabase() {
assertCrash("Found NULL") {
try dbQueue.inDatabase { db in
try db.execute("CREATE TABLE ints (int Int)")
try db.execute("INSERT INTO ints (int) VALUES (1)")
try db.execute("INSERT INTO ints (int) VALUES (NULL)")
let _ = Int.fetchAll(db, "SELECT int FROM ints ORDER BY int")
}
}
}
}
Loaded 100 of 472 files, more files were not shown because too many files have changed in this diff. Show more