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.

Reading a recursive WITH clausedoctest
$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]
Refusing a WITH clause without tablesdoctest
new \SqlSemantics\Platform\MySql\Statement\Query\With\With(false, []) // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\InvalidConstruction

Properties§

public non-empty-list<CommonTableExpression> $tables
public bool $recursive

Methods§

public function __construct(public bool $recursive, list<CommonTableExpression> $tables)

Parameters

$recursiveboolWhether RECURSIVE is written
$tableslist<CommonTableExpression>The common table expressions in written order; at least one
Calls 2
public function bind(Derivation $derivation, Environment $outer): Environment

Derives the common table expressions and answers the scope that sees them (MYSQL-WITH-001).

Parameters

$derivationDerivation
$outerEnvironment
Calls 2
public function render(Output $out): void

Writes the clause.

Parameters

$outOutput
Calls 2

Test cases 1§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1

Relations§

Instantiated in 1
Type declarations 2