Commit Graph
165 Commits
Author SHA1 Message Date
Gwendal Roué 09899e9bcf filter(id:) does not accept optionals 2021-03-28 06:48:22 +02:00
Gwendal Roué 9489174b98 Filter by id for Identifiable types with optional ID type 2021-03-27 18:47:16 +01:00
Gwendal Roué b086b99821 Filter by id for Identifiable types 2021-03-27 17:43:01 +01:00
Gwendal Roué 051fdb37b6 Rename SQLLiteral to SQL 2021-03-21 13:33:49 +01:00
Gwendal Roué c4443eead8 SELECT * FROM cte is no longer a special case, because SQLGenerationContext knows about the available CTEs 2021-03-19 19:06:47 +01:00
Gwendal Roué 1f4db99a37 Documentation fix 2021-03-17 20:26:10 +01:00
Gwendal Roué ac436a2770 Make SQLLiteral less painful to use 2021-03-14 11:09:29 +01:00
Gwendal Roué cb8611587c Fix Swiftlint warning 2021-03-12 13:48:41 +01:00
Gwendal Roué 42718db49d Documentation 2021-03-08 21:11:36 +01:00
Gwendal Roué f9b554d00a Merge AggregateJoinableRequest into DerivableRequest
Also put distinct(), limit(_:offset:) and with(_:) into DerivableRequest
2021-03-08 07:55:20 +01:00
Gwendal Roué f0aec27095 AssociationToMany: distinct(), limit(_:offset:), with(_:) 2021-03-07 20:25:30 +01:00
Gwendal Roué 092b0d0e44 Move with(cte) methods to the file it belongs to 2021-03-07 19:58:15 +01:00
Gwendal Roué 9c6ff6a1c0 Simplifly association aggregates
We don't need any promise. We used to, but SQLExpression.fastPrimaryKey has been introduced since then.
2021-03-07 19:36:08 +01:00
Gwendal Roué a4dca3390a AggregateJoinableRequest is the new protocol that supports aggregate annotations
AssociationToMany is a subprotocol of AggregateJoinableRequest :-)
2021-03-07 19:15:09 +01:00
Gwendal Roué f49fab0cff Merge SQLQuery into SQLRelation 2021-03-07 14:37:53 +01:00
Gwendal Roué bac7b6b0e5 Refactor function calls
and make it possible to express other DISTINCT aggregates than COUNT: SUM(DISTINCT ...), etc.
2021-03-06 13:25:25 +01:00
Gwendal Roué 64bb63e304 CommonTableExpression has an implicit Row RowDecoder 2021-02-20 12:47:13 +01:00
Gwendal Roué de52856cf3 Aliasing is not qualifying 2021-02-17 18:11:00 +01:00
Gwendal Roué 0dd345eb91 SQLQuery no longer depends on SQLExpressible and other high-level protocols 2021-02-17 18:00:53 +01:00
Gwendal Roué c4620aa587 SQLRelation no longer depends on SQLExpressible and _JoinableRequest
Those are one level up
2021-02-17 17:43:57 +01:00
Gwendal Roué 488849535e CommonTableExpression has an implicit Void RowDecoder 2021-02-17 13:22:28 +01:00
Gwendal Roué 920417beb3 Replace protocols with enums 2021-02-14 18:28:15 +01:00
Gwendal Roué ba3a3f7c38 Move definition of TableRecord to CTE associations 2021-02-09 18:14:35 +01:00
Gwendal Roué 7914805524 Remove TableRecord requirements for QueryInterfaceRequest aggregates 2021-02-09 18:14:35 +01:00
Gwendal Roué 40389ee102 Decouple associations from their origin database table
This allows us to create an association without providing the origin table name, and thus to build association without TableRecord.
2021-02-07 16:01:34 +01:00
Gwendal Roué 8bf9e5e30f Decouple associations from TableRecord
Associations is generic for type safety, not for defining the association (just as QueryInterfaceRequest)
2021-01-23 09:48:18 +01:00
Gwendal Roué 836efb120f Xcode 12.3 formatting 2020-12-23 12:13:05 +01:00
Gwendal Roué 60a9494434 Fix Swiftlint warnings 2020-12-23 10:10:10 +01:00
Gwendal Roué b485d4d3dc forSingleResult is no longer mandatory 2020-12-23 10:08:16 +01:00
Gwendal Roué 6abbf82a89 So long, visitor pattern! 2020-12-23 09:02:17 +01:00
Gwendal Roué e72007c1dd Make SQLiteral.subquery a promise
This allows us to postpone CTEs definition until a db connection is available
2020-12-13 18:29:43 +01:00
Gwendal Roué ab502baa20 CommonTableExpression.contains(_:) 2020-12-13 18:29:28 +01:00
Gwendal Roué 992f2a2d83 Revert "CommonTableExpression.contains(_:)"
This reverts commit f94cecb329.

We can't expose a raw table name like that, because it may be used several times, and need an alias.
2020-12-08 18:36:51 +01:00
Gwendal Roué f94cecb329 CommonTableExpression.contains(_:) 2020-12-06 19:22:30 +01:00
Gwendal Roué 86cfee4e23 Fix typo 2020-12-05 19:57:54 +01:00
Gwendal Roué a3351513ce Optimize inclusion of CTE association
In order to count the selected columns of a CTE, we do not need to have SQLite compile the whole CTE request when we have information about the selected columns.
2020-12-05 19:50:47 +01:00
Gwendal Roué f18bcb67e4 Documentation 2020-12-05 17:56:39 +01:00
Gwendal Roué b60f39e7cc Merge branch 'development' into dev/cte
# Conflicts:
#	GRDB/QueryInterface/Request/Association/Association.swift
#	GRDB/QueryInterface/Request/QueryInterfaceRequest.swift
#	GRDB/QueryInterface/SQL/SQLQuery.swift
#	GRDB/QueryInterface/SQLGeneration/SQLGenerationContext.swift
#	GRDB/QueryInterface/SQLGeneration/SQLQueryGenerator.swift
2020-12-05 12:31:52 +01:00
Gwendal Roué 1e2d07a16f Simplify SQLSource
SQLSource used to be more or less able to deal with subqueries, as in SELECT ... FROM (SELECT ...).

But we had only one use case for it, the "trivial count query": SELECT COUNT(*) FROM (SELECT ...). And many opportunities for fatal errors, because such subqueries were not generally supported.

So we simplify SQLSource, and implement the trivial count query in another way.
2020-12-05 12:21:14 +01:00
Gwendal Roué 66b23d423f Cleanup JoinAssociation 2020-12-05 10:54:31 +01:00
Gwendal Roué 3094c274df Enhance error message 2020-12-05 10:34:32 +01:00
Gwendal Roué 378279ee1a Move the isRecursive flag where it belongs 2020-12-05 10:32:46 +01:00
Gwendal Roué 836a0a5e37 Documentation 2020-12-03 19:15:57 +01:00
Gwendal Roué 91dd13e2be Merge cte support into AllColumns 2020-12-03 18:51:26 +01:00
Gwendal Roué a1f0f2c9b7 TODO 2020-12-03 09:24:56 +01:00
Gwendal Roué 6f409f2140 Fix typo 2020-12-03 09:22:15 +01:00
Gwendal Roué 64776682fe Drop USING clause until actually needed 2020-12-03 09:21:19 +01:00
Gwendal Roué a21e6575d8 _AllCTEColumns delegates to AllColumns and _SQLQualifiedAllColumns 2020-12-03 08:37:55 +01:00
Gwendal Roué 4ee6f3293a CTE columns are provided as strings 2020-12-03 08:34:43 +01:00
Gwendal Roué 17b884b3dc Recursive CTEs 2020-12-03 08:28:14 +01:00