final class CommonTableExpression
    implements Node
    uses Snapshot
Public API: explicitly declared with @visibility public.

One common table expression: name [(columns)] AS (query).

The query is the one inside the parentheses the syntax requires. The WITH clause that holds the expression derives it (MYSQL-WITH-001). Source: https://dev.mysql.com/doc/refman/8.4/en/with.html.

Reading a common table expressiondoctest
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('WITH c (x) AS (SELECT 1) SELECT x FROM c');
    [$query->statement->with->tables[0]->name->value, $query->statement->with->tables[0]->columns[0]->value] // => ['c', 'x']

Properties§

public list<Name> $columns
public Name $name
public Query $query

Methods§

public function __construct(public Name $name, list<Name> $columns, public Query $query)

Parameters

$nameNameThe table name
$columnslist<Name>The column names in written order
$queryQueryThe query that produces the rows
Calls 2
public function render(Output $out): void

Writes the expression.

Parameters

$outOutput
Calls 5

Test cases 2§

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

Dedicated tests 1
Other tests reaching this symbol 1

Relations§

Instantiated in 1
Constant reads 1
Type checks 1