Commit Graph
6861 Commits
Author SHA1 Message Date
Gwendal Roué bdf8d0bcd5 Merge pull request #515 from alextrob/feature/fetchOne-limit-1
Add "LIMIT 1" to `fetchOne` requests
2019-04-18 07:04:56 +02:00
Gwendal Roué 5af1686677 Thank you notice 2019-04-18 07:02:42 +02:00
Gwendal Roué 2711b9bb04 Merge branch 'GRDB-4.0' into feature/fetchOne-limit-1 2019-04-18 07:01:03 +02:00
Gwendal Roué a172473e37 CHANGELOG 2019-04-17 21:35:23 +02:00
Gwendal Roué 3f8047fc0e Tests for the singleResult hint and SQLRequest.init(_:request:) 2019-04-17 21:32:47 +02:00
Gwendal Roué a12830050b Tests for the singleResult hint and databaseRegion 2019-04-17 21:32:13 +02:00
Gwendal Roué 21c0175a71 Tests for the singleResult hint and fetchCount 2019-04-17 21:31:53 +02:00
Gwendal Roué 65fe2bb50c Tests for the singleResult hint and fetching methods 2019-04-17 21:31:30 +02:00
Gwendal Roué e3a0935914 Add SQL tests for all record testFetchOne…() methods
We usually update all those tests together
2019-04-17 14:01:16 +02:00
Gwendal Roué 693e6da773 Do not test that fetchOne does not add LIMIT 1 to raw SQL requests
We do not add LIMIT 1 to raw SQL requests because it is difficult. But it would not be wrong to do so.
2019-04-17 13:08:51 +02:00
Gwendal Roué 4716f91d8b Bake the single result expectation right into filter(key:) methods
This better hides this flag inside SQLSelectQuery, and avoids explicit support from FetchableRecord and TableRecord
2019-04-16 08:47:50 +02:00
Gwendal Roué 46791c8f74 Remove QueryInterfaceRequest.init(query:) 2019-04-16 07:56:44 +02:00
Alex Robinson 1b3f0e8ece Update FetchRequest protocol in README 2019-04-16 11:11:37 +10:00
Alex Robinson e2211aca21 Exclude LIMIT 1 in more cases
Adds a flag to SQLSelectQuery indicating that it expects a single record (for example when querying by primary or unique key).

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

    let request = Player.filter(key: 123) // or Player.filter(key: ["email": "me@example.com"])
    let player = try dbQueue.read { db in try request.fetchOne(db) }
2019-04-16 11:10:43 +10:00
Alex Robinson 235a612ce0 Remove LIMIT 1 from expected SQL when filtering by key
Tests now fail
2019-04-16 10:29:40 +10:00
Alex Robinson 7070dedf1a Replace FetchRequestHint with a boolean for single results
Fixes previous test failure
2019-04-16 10:20:36 +10:00
Alex Robinson 20aecd5328 Add failing test for fetchOne with a non-zero offset 2019-04-16 10:20:36 +10:00
Gwendal Roué 1af55653d3 Fix typo 2019-04-13 17:06:41 +02:00
Gwendal Roué 9efc20fa51 Association: introduce request(for:) before using it 2019-04-13 13:55:15 +02:00
Gwendal Roué f847be98f5 Associations: aggregates are available on HasManyThrough, too 2019-04-13 13:48:12 +02:00
Gwendal Roué ff00dabcd1 Associations documentation 2019-04-13 13:46:28 +02:00
Gwendal Roué 72f00ccd9a Associations: delay introduction of request(for:) 2019-04-13 13:34:34 +02:00
Gwendal Roué 5995f468e3 Associations: improve "Required Protocols" chapter 2019-04-13 06:55:28 +02:00
Gwendal Roué 023afce21b Put #514 in TODO 2019-04-11 08:31:16 +02:00
Gwendal Roué 9b24671043 Disable #514 failing tests 2019-04-11 08:14:04 +02:00
Alex Robinson 088f6c92c7 Update inline docs 2019-04-11 13:50:57 +10:00
Alex Robinson 207b90f1b5 Update FetchRequest protocol in README 2019-04-11 13:27:32 +10:00
Alex Robinson dd139b6268 Fix testing lastSQLQuery when a cursor hasn't retrieved a record
This problem was masked by the fact all queries in the test expected the same SQL query.
2019-04-11 13:19:04 +10:00
Alex Robinson 072fa2583a Add hints for use in request preparation
Hints are ignored by SQLRequest. When you write raw SQL you probably don't want GRDB to modify your query.
2019-04-11 13:14:41 +10:00
Alex Robinson af1fd6b90c More tests for presence of LIMIT 1 2019-04-11 13:08:29 +10:00
Alex Robinson f9868bd8b5 Update tests to expect "LIMIT 1" where appropriate
Tests currently fail
2019-04-11 11:51:16 +10:00
Gwendal Roué 00ae2de14e Another failing test for #514 2019-04-10 19:54:44 +02:00
Gwendal Roué a6cbd242e6 Add a failing test forr #514 2019-04-10 19:29:50 +02:00
Gwendal Roué be950162d0 Merge pull request #508 from michaelkirk-signal/mkirk/GRDB-4.0-sqlcipher-cipher_compatibility
Allow Database Connection Configuration
2019-04-10 13:47:03 +02:00
Gwendal Roué db34d9537b Remove more useless failing tests 2019-04-10 07:49:06 +02:00
Gwendal Roué 1682df5c4e Thank you notice 2019-04-09 20:26:28 +02:00
Gwendal Roué 3ca7647110 Merge branch 'GRDB-4.0' into mkirk/GRDB-4.0-sqlcipher-cipher_compatibility
# Conflicts:
#	CHANGELOG.md
2019-04-09 20:25:22 +02:00
Gwendal Roué 2c4a449c5b Fix prepareDatabase sample code and markdown layout 2019-04-09 20:23:08 +02:00
Gwendal Roué 49d92dc6ce Three slashes for documentation comment 2019-04-09 20:21:34 +02:00
Gwendal Roué d52fcbe0c9 Fixits for Configuration.cipherPageSize and kdfIterations 2019-04-09 20:21:17 +02:00
Gwendal Roué 5bf54dc5c9 Update README for cipher_page_size and kdf_iter SQLCipher pragmas 2019-04-09 20:15:46 +02:00
Gwendal Roué 0a814ee1e7 CHANGELOG 2019-04-09 20:04:20 +02:00
Gwendal Roué 94316540de Remove useless failing tests
They were failing because database initialization now uses high level methods which throw detailed errors.
2019-04-09 20:01:22 +02:00
Gwendal Roué b67a53e645 whitespace 2019-04-09 19:57:22 +02:00
Gwendal Roué a0f37c6e85 Simplify Database.validateFormat() 2019-04-09 19:56:01 +02:00
Gwendal Roué 82dc51c554 Document prepareDatabase call site
Because it willl be easy to forget the context of #508 when we read this code in the future
2019-04-09 19:55:45 +02:00
Gwendal Roué 6115078e95 Simplify Database.validateSQLCipher() 2019-04-09 19:46:58 +02:00
Gwendal Roué 8d35330e12 whitespace 2019-04-09 19:40:27 +02:00
Gwendal Roué e0e07a7454 Merge pull request #510 from signalapp/charlesmchen/tableRegionVisibility
Expose DatabaseRegion(table:) initializer
2019-04-09 19:31:57 +02:00
Gwendal Roué 7a42bb42f5 README: make DatabaseRegion documentation less detailed 2019-04-09 19:29:38 +02:00