Commit Graph
127 Commits
Author SHA1 Message Date
Gwendal Roué 909f7455e6 Fix more typos in public documentation 2026-11-01 21:01:03 +01:00
Gwendal Roué 5d9e853f24 Fix typos in code samples 2026-11-01 20:45:05 +01:00
Gwendal Roué 7a216d7d34 Fix typos in public documentation 2026-11-01 20:45:05 +01:00
Gwendal Roué 6cc3116ff4 TableAlias is generic 2025-05-10 14:52:48 +02:00
Gwendal Roué a642ac51aa AllColumnsExcluding 2025-01-19 16:26:59 +01:00
Gwendal Roué 473b06eac5 Fix compiler warnings about SQLQualifiedRelation 2024-09-15 11:32:06 +02:00
Gwendal Roué 28c6ea96b4 Fix redundant_self_in_closure Swiftlint warning 2023-07-29 10:06:33 +02:00
Gwendal Roué ac214e6760 SE-0345: if let shorthand for shadowing an existing optional variable 2023-01-30 08:00:47 +01:00
Gwendal Roué c6657b7063 ColumnAssignment that does nothing
A cool upsert feature is to overwrite an existing value in case of conflict, but another cool upsert feature is to NOT overwrite an existing value. This commit makes it possible to create a ColumnAssignement that does nothing.
2022-08-23 20:02:17 +02:00
Gwendal Roué 2789444acd Enable UPSERT and RETURNING with SQLCipher 2022-08-21 21:22:34 +02:00
Gwendal Roué a702fe6bc9 BREAKING: persistence callbacks, and support for RETURNING
- Replace performInsert, performUpdate, etc with callbacks: willInsert, aroundInsert, didInsert, etc.
- Always call didInsert, even with INSERT OR IGNORE
- Explicit conflict resolution in persistence methods
- Add ...AndFetch... methods
2022-08-21 21:22:34 +02:00
Gwendal Roué c86581dedc Make SQLQueryGenerator.swift easier to read 2022-08-21 21:22:34 +02:00
Gwendal Roué 895964de16 BREAKING: Throwing FetchableRecord.init(row:) 2022-08-21 21:22:34 +02:00
Gwendal Roué a9fcf1b9c1 SE-0335, SE-0341, SE-0346, SE-0352, SE-0358: some, any, primary associated types 2022-08-21 21:22:34 +02:00
Gwendal Roué bf601e6810 Merge SelectStatement and UpdateStatement
Addresses #1015
2021-07-29 20:20:15 +02:00
Gwendal Roué 0098369e29 Simplify Refinable 2021-06-27 13:11:26 +02:00
Gwendal Roué ed3397176a Documentation 2021-05-01 17:28:49 +02:00
Gwendal Roué 5f4c64ceda Fix failing tests for #965 2021-05-01 17:00:12 +02:00
Gwendal Roué c0a3e61253 DatabaseRegion is now case-preserving and case-insensitive 2021-04-10 16:27:45 +02: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é 8ad096ae35 Refactor column counting for improved testability 2021-03-14 11:49:35 +01:00
Gwendal Roué ed3d1e1ac4 selectOnly() clears the isDistinct flag 2021-03-08 21:36:09 +01:00
Gwendal Roué 4521e6b37d Make filterPromise an optional promise instead of a promise of optional
This way, filterPromise and havingExpressionPromise have the same type
2021-03-08 21:25:27 +01:00
Gwendal Roué a655974eb0 Let joined associations use CTEs 2021-03-08 14:10:38 +01:00
Gwendal Roué f49fab0cff Merge SQLQuery into SQLRelation 2021-03-07 14:37:53 +01:00
Gwendal Roué 10a16ac6f0 Rename .allNotPrefetched to .bridge 2021-02-18 08:42:01 +01:00
Gwendal Roué 15b892af6e Implement filters with SQLExpression? instead of [SQLExpression]
Those arrays were introduced so that we can generate nicer sql: `a AND b AND c`, instead of `(a AND b) AND c`.

This flattening is provided by the && operator and `SQLExpression.associativeBinary`, so those arrays are no longer needed.
2021-02-17 08:45:57 +01:00
Gwendal Roué 920417beb3 Replace protocols with enums 2021-02-14 18:28:15 +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é 836efb120f Xcode 12.3 formatting 2020-12-23 12:13:05 +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é 85af2deced Document TODOs with row values 2020-12-12 12:40:49 +01:00
Gwendal Roué b715206502 Row values 2020-12-12 12:40:49 +01:00
Gwendal Roué c36539adb3 CTEs can enter UPDATE and DELETE queries 2020-12-12 11:06:51 +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é 63255cabf8 SQL interpolation of CTEs 2020-12-05 13:40:56 +01:00
Gwendal Roué 9d1bcec132 Cleanup filtering of trivially true joining conditions 2020-12-05 12:49:31 +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é 378279ee1a Move the isRecursive flag where it belongs 2020-12-05 10:32:46 +01:00
Gwendal Roué 91dd13e2be Merge cte support into AllColumns 2020-12-03 18:51:26 +01:00
Gwendal Roué 64776682fe Drop USING clause until actually needed 2020-12-03 09:21:19 +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
Gwendal Roué 2c42d0129c CTE columns: WITH cte(a, b) AS ... 2020-12-02 05:36:56 +01:00
Gwendal Roué a70b42cbf5 Extract SQLAssociationCondition.using 2020-12-01 20:30:36 +01:00
Gwendal Roué 6d14f792e6 Remove dead code 2020-12-01 19:36:50 +01:00
Gwendal Roué 1238843a44 Cleanup 2020-12-01 19:33:43 +01:00
Gwendal Roué 0191676063 Using clause for CTE associations 2020-12-01 09:17:05 +01:00