final class ParenthesizedQuery
    implements Statement, Query
    uses Snapshot
Public API: explicitly declared with @visibility public.

A query written in parentheses where the parentheses group it.

The parentheses keep a query in its place: an operand of a set operation with its own ordering, a query with a WITH clause, or a parenthesized statement. The parentheses that a subquery, a derived table or a common table expression requires belong to that construct and are not a parenthesized query; only further parentheses are.

Rule: MYSQL-PARENTHESIZED-QUERY-001. The rows are those of the inner query. Source: https://dev.mysql.com/doc/refman/8.4/en/union.html. Status: Implemented.

Reading a parenthesized operanddoctest
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('(SELECT a FROM t ORDER BY a LIMIT 1) UNION SELECT b FROM u');
    $query->statement->left->query->limit !== null // => true

Properties§

public Query $query

Methods§

public function __construct(public Query $query)

Parameters

$queryQueryThe query inside the parentheses
public function deriveStatement(Derivation $derivation): void

Derives the query as a statement root and records its rows as the output.

Parameters

$derivationDerivation
Calls 3
public function deriveQuery(Derivation $derivation, Environment $outer): QueryFact

Answers the rows of the inner query.

Parameters

$derivationDerivation
$outerEnvironment

Returns

Calls 1
public function render(Output $out): void

Writes the query in parentheses.

Parameters

$outOutput
Calls 1

Test cases 18§

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

Dedicated tests 2
Other tests reaching this symbol 16

Relations§

Instantiated in 8
Type checks 8
Type declarations 2