classWith
final class With
implements WithClause
uses Snapshot
Public API: explicitly declared with
@visibility public.A WITH clause: common table expressions and the RECURSIVE marker.
The query, UPDATE or DELETE that holds the clause binds its expressions (MYSQL-WITH-001). Source: https://dev.mysql.com/doc/refman/8.4/en/with.html.
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('WITH RECURSIVE c AS (SELECT 1 AS n UNION ALL SELECT n + 1 FROM c WHERE n < 3) SELECT n FROM c');
[$query->statement->with->recursive, count($query->statement->with->tables)] // => [true, 1]new \SqlSemantics\Platform\MySql\Statement\Query\With\With(false, []) // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\InvalidConstructionProperties§
public non-empty-list<CommonTableExpression> $tablespublic bool $recursiveMethods§
public function __construct(public bool $recursive, list<CommonTableExpression> $tables)Parameters
$recursive | bool | Whether RECURSIVE is written |
$tables | list<CommonTableExpression> | The common table expressions in written order; at least one |
Calls 2
- static-call Check::listOf() line 43
- class-const CommonTableExpression::class() line 43
public function bind(Derivation $derivation, Environment $outer): EnvironmentDerives the common table expressions and answers the scope that sees them (MYSQL-WITH-001).
Parameters
$derivation | Derivation | |
$outer | Environment |
Returns
Calls 2
- method-call CommonTables::bind() line 51
- new CommonTables line 51
public function render(Output $out): voidWrites the clause.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 59
- method-call Output::list() line 63
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.