Add MySQL and MariaDB dialect query builders#1
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… set ops, CTE, lateral) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ative comments Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ing comments) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ions, no cross-dialect comment framing) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…); DML coverage ledger
…TRIM, CONVERT, conditionals)
…chema+storage/pretty/randomBytes); functions ledger
…ers); MySQL forShare via full lock string
…er/combination/lock); widen cross-dialect select type hints
…aDB\Q facade; shared BuildsExpressions facade trait
…TURNING (VALUES upsert, no AS new); UPDATE shared
…funcs); ledger updates
…ing in per-dialect files)
…eDialect, QueryBuilder::withValidateTarget) — validation-only, rendering unchanged
…riadb-differences.md)
…e MariaDB\, version-aware requireDialect gates, InsertValuesBuilder as()/Q::values, differences test corpus) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ers and BuildsExpressions/SharedFunctions into Q/Q\Func Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ysql-mariadb.md rewrite, README/AGENTS, design-doc status header) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… (both engines, render + validation); drop pre-collapse FunctionsMysqlOnlyTest Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…at literal call sites Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… precedence rescale; AGENTS note — Q\Func returns Exp, FROM-only constructs live on Q Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ray), parenthesized RHS) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…deredSetAggBuilder->withinGroup()->orderBy()->desc()->over(), mirroring the PG canonical shape Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…Builder implements FromExp, column()/columnForOrdinality()) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…Supported in §12 ledger; update usage-doc operators/functions + Limitations Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…->columns(closure); path()/existsPath()/forOrdinality()/on-empty+on-error/nested()->path()->columns(); docs updated (ledger, usage example, limitations) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ocument validation-error categories in AGENTS.md - tests/MySQL SelectJsonShapeTest: JSON_OBJECT / JSON_ARRAYAGG / JSON_OBJECTAGG selection shapes (nested objects, roll-ups via join+GROUP BY, correlated subselects, COALESCE(...,JSON_ARRAY()) empty-array idiom), grounded in the MySQL 8.4 reference - AggBuilder: gate DISTINCT to the aggregates whose grammar accepts it (AVG/COUNT/MAX/MIN/SUM) via $sb->addError when validating; doc-cited allow-list - FunctionsTest: accepted/rejected DISTINCT + withoutValidation() bypass; ExpressionsTest: comparison/arithmetic/unary/REGEXP/junction/ANY-ALL coverage - AGENTS.md: new "Validation errors" section — advisory value checks gate on isValidating() and keep rendering; mutually-exclusive builder state always throws Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add tests for previously-uncovered API surface: expression operators, function facades, join/lateral/set-op/CTE/window builder methods, DML alias & RETURNING paths, MySQL named-arg binding (new ArgsTest), and validation branches (empty CASE, invalid identifier/type, values+query / ON CONFLICT constraint+targets). Regroup the MySQL SELECT test nest-by-clause to match PostgreSQL. Document the coverage tooling and intentionally-uncovered set in AGENTS.md, and add the xdebug extension to devbox so coverage runs out of the box. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…on/GroupConcat) (→ 99%) - MySQL Keywords: backtick-quoted part in a dotted identifier - MySQL Requirement: version-window satisfiedBy upper bound + describe() variants (new RequirementTest) - PostgreSQL WindowDefinition: named window refining another, multi-key PARTITION BY - MySQL GroupConcatBuilder: multiple expressions and multiple ORDER BY keys Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bring the MySQL family to parity with the PostgreSQL builder for JSON
construction, and restructure the README around both dialect families.
JSON object builder:
- Q\Func::jsonObject() now returns an immutable JsonObjectBuilder
(prop/propIf/applyIf/unset) rendering JSON_OBJECT(...), replacing the
varargs passthrough. Computed keys stay on the Q::func('JSON_OBJECT', ...)
escape hatch.
JSON-first entry point:
- Q::selectJson()/applySelectJson()/as() make a JSON object the query's
first select element, via a new SelectJsonSelectBuilder and selectJson /
selectJsonAlias threaded through SelectQueryParts, derive() and
writeSelectParts().
The prop-builder pattern is shared architecture, not a PG SQL feature, so
the name and SQL stay dialect-native (jsonObject / JSON_OBJECT).
README: rewritten as a balanced two-dialect hub — shared philosophy,
dialect overview, intermixed per-engine examples with an index, and a
prominent "MySQL & MariaDB: one builder, two engines" section covering
construction-determined rendering and opt-in target validation. composer.json
now advertises MySQL/MariaDB.
Tests: ported the PostgreSQL JsonBuildObject/JsonQuery suites to the MySQL
family. 664 pass, PHPStan level max clean, new builders 100% covered.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.