You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor!: unify SqlBuilder concept and type-safe DDL builder chaining
Replace three identical concepts (BuildsSql, AnySelectQuery, SqlStatement)
with a single SqlBuilder concept in sql_core.hpp. DDL builders now use a
typed Prior template parameter instead of std::string prior_sql_, making
raw-string construction impossible at the type level.
- Add no_prior sentinel and sql_string_builder bridge types for DDL chains
- Template ddl_continuation<Prior> and all DDL builders on SqlBuilder Prior
- Template union_query on Left/Right builders instead of storing pre-built SQL
- Template case_when_expr on Builder instead of storing pre-built SQL
- lateral_join methods now take SqlBuilder subquery + sql_alias (was string)
- Rename column_alias to sql_alias (it's used for table aliases too)
- TypedSelectQuery now refines SqlBuilder
- explain/explain_analyze use SqlBuilder constraint
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
-`grant<privilege::select, ...>(grant_target, grant_user)` — compile-time privilege set overload of `grant`
52
52
-`revoke(privilege_list, grant_target, grant_user)` — `REVOKE ... ON ... FROM ...`
53
53
-`revoke<privilege::select, ...>(grant_target, grant_user)` — compile-time privilege set overload of `revoke`
54
-
-`column_alias` — strongly-typed SQL alias identifier (wraps `std::string_view`); required as the second argument to `.with_alias()` in place of a plain `std::string`
54
+
-`SqlBuilder` concept — unified concept for any type that can produce SQL via `build_sql() const → std::string`; replaces the previous `BuildsSql`, `AnySelectQuery`, and `SqlStatement` concepts which were structurally identical
55
+
-`sql_alias` — strongly-typed SQL alias identifier (wraps `std::string_view`); used as the alias argument to `.with_alias()`, `.lateral_join()`, etc.
56
+
-`no_prior` / `sql_string_builder` — DDL-internal sentinel and bridge types for the typed prior chain
- Simple column-ref predicate factories (`equal`, `greater_than`, `like`, `between`, `in`, etc.) now return `check_expr` instead of `sql_predicate`; `check_expr` implicitly converts to `sql_predicate` so existing WHERE/HAVING/JOIN ON usage is unaffected
-**Breaking:**`.with_alias()` now requires a `column_alias` value as its second argument instead of a plain `std::string`; replace `.with_alias(Proj{}, "name")` with `.with_alias(Proj{}, column_alias{"name"})`
111
+
-**Breaking:**`column_alias` renamed to `sql_alias`; replace `sql_alias{"name"}` with `sql_alias{"name"}`
112
+
-**Breaking:**`.with_alias()` now requires a `sql_alias` value as its second argument instead of a plain `std::string`; replace `.with_alias(Proj{}, "name")` with `.with_alias(Proj{}, sql_alias{"name"})`
113
+
-**Breaking:** DDL builders now use a typed `Prior` template parameter instead of `std::string prior_sql_`; builder constructors no longer accept raw strings — chaining is enforced at the type level via `ddl_continuation<Prior>`
114
+
-**Breaking:**`lateral_join` / `left_lateral_join` / `lateral_join_on` / `left_lateral_join_on` now take a `SqlBuilder`-constrained subquery and `sql_alias` instead of `std::string` and `std::string_view`; replace `.lateral_join(q.build_sql(), "alias")` with `.lateral_join(q, sql_alias{"alias"})`
115
+
-**Breaking:**`union_query` now stores the two query builders instead of a pre-built SQL string; `union_()`, `union_all()`, `intersect_()`, `except_()` return deduced types
116
+
-**Breaking:**`case_when_expr` now stores the builder instead of a pre-built SQL string
117
+
-**Breaking:**`AnySelectQuery` and `SqlStatement` concepts removed; use `SqlBuilder` instead
-`explain()` and `explain_analyze()` now use `SqlBuilder` concept constraint instead of inline requires clause
110
120
-**Breaking:**`grant` and `revoke` now require strongly-typed `privilege_list`, `grant_target`, and `grant_user` arguments instead of plain strings; the old string-based overloads have been removed
111
121
112
122
-`natural_join<T>()`, `natural_left_join<T>()`, `natural_right_join<T>()` — `NATURAL [LEFT|RIGHT] JOIN` with no ON/USING clause
0 commit comments