Remove QueryInterfaceRequest.contains(_:)

This commit is contained in:
Gwendal Roué authored and Gwendal Roué committed 2017-06-20 07:54:19 +02:00
1 parent e987695732
commit 604cf6b522
5 files changed
+2 -47

No files matched your search

+1
View File
@@ -7,6 +7,7 @@ Release Notes
- `DatabaseCoder` has been removed.
- `QueryInterfaceRequest.exists` has been removed.
- `QueryInterfaceRequest.contains` has been removed.
## 0.110.0
-9
View File
@@ -483,15 +483,6 @@ Build a `value IN (...)` expression from any sequence of [values](../../../#valu
![1,2,3].contains(Column("id"))
```
The most general way to generate an `IN` operator is from any value that adopts the [SQLCollection](http://groue.github.io/GRDB.swift/docs/0.110.0/Protocols/SQLCollection.html) protocol, like the [query interface requests](../../../#requests):
```swift
let request = Person.select(Column("id"))
// SQLExpression: in IN (SELECT id FROM persons)
request.contains(Column("id"))
```
#### The BETWEEN Operator
+1 -19
View File
@@ -8,7 +8,7 @@
/// # Low Level Query Interface
///
/// SQLSelectQuery is the protocol for types that represent a full select query.
public protocol SQLSelectQuery : Request, SQLCollection {
public protocol SQLSelectQuery : Request {
/// This function is an implementation detail of the query interface.
/// Do not use it directly.
@@ -28,24 +28,6 @@ public protocol SQLSelectQuery : Request, SQLCollection {
}
// MARK: - SQLCollection adoption
extension SQLSelectQuery {
/// This function is an implementation detail of the query interface.
/// Do not use it directly.
///
/// See https://github.com/groue/GRDB.swift/#the-query-interface
///
/// # Low Level Query Interface
///
/// See SQLCollection.collectionSQL(_)
public func collectionSQL(_ arguments: inout StatementArguments?) -> String {
return selectQuerySQL(&arguments)
}
}
// MARK: - Request adoption
extension SQLSelectQuery {
-9
View File
@@ -2927,15 +2927,6 @@ Feed [requests](#requests) with SQL expressions built from your Swift code:
```
> :point_up: **Note**: SQLite string comparison, by default, is case-sensitive and not Unicode-aware. See [string comparison](#string-comparison) if you need more control.
To check inclusion in a subquery, call the `contains` method on another request:
```swift
// SELECT * FROM events
// WHERE userId IN (SELECT id FROM persons WHERE verified)
let verifiedUserIds = User.select(idColumn).filter(verifiedColumn)
Event.filter(verifiedUserIds.contains(userIdColumn))
```
- `LIKE`
@@ -143,16 +143,6 @@ class QueryInterfaceExpressionsTests: GRDBTestCase {
XCTAssertEqual(
sql(dbQueue, tableRequest.filter(!("A"..."z").contains(Col.name))),
"SELECT * FROM \"readers\" WHERE (\"name\" NOT BETWEEN 'A' AND 'z')")
// Subquery
XCTAssertEqual(
sql(dbQueue, tableRequest.filter(tableRequest.select(Col.id).contains(Col.id))),
"SELECT * FROM \"readers\" WHERE (\"id\" IN (SELECT \"id\" FROM \"readers\"))")
// Subquery
XCTAssertEqual(
sql(dbQueue, tableRequest.filter(!tableRequest.select(Col.id).contains(Col.id))),
"SELECT * FROM \"readers\" WHERE (\"id\" NOT IN (SELECT \"id\" FROM \"readers\"))")
}
func testContainsWithCollation() throws {