final class ExpressionRule
Restricted visibility: declared "@visibility SqlSemantics\Platform\MySql\Lowering\Query". Code outside that scope must not name this declaration.

Lowers the query statements and query expressions of the 8.0 and later grammars.

Rule: MYSQL-QUERY-MODERN-001. Scope: select_stmt, select_stmt_with_into, query_expression, query_expression_body, query_expression_parens, query_expression_with_opt_locking_clauses, subquery, row_subquery, table_subquery, union_option. The ORDER BY and LIMIT of a query expression and the INTO and locking clauses of the statement belong to the query block when the body is a single one (MYSQL-SELECT-001); else they make a query expression and a query statement. Set operations are left-deep in written order. The parentheses a subquery requires are removed; further parentheses are parenthesized queries. Constructs: Select (through the query block), SetOperation, ParenthesizedQuery, QueryExpression, QueryStatement. Terminates: the left spine of a set operation is walked in a loop; recursion follows strictly smaller operands. Source: https://dev.mysql.com/doc/refman/8.4/en/select.html, https://dev.mysql.com/doc/refman/8.4/en/set-operations.html. Status: Implemented.

Methods§

public function __construct(private Lowering $lowering)

Parameters

$loweringLoweringThe lowering this rule belongs to
public function statement(Node $statement): Query

Lowers a query statement: a node of select_stmt.

Parameters

$statementNode

Returns

Throws

ImplementationGap When a production has no rule
Called from 1
Calls 7
public function expression(Node $expression, Trailer $later): Query

Lowers a query expression with the clauses the statement writes after it.

Parameters

$expressionNode
$laterTrailer

Returns

Throws

ImplementationGap When a production has no rule
Called from 8
Calls 13

Private surface 3§

Implementation details, listed for orientation only.

private const OPERATIONS = ['query_expression_body: query_expression_body UNION_SYM union_option query_exp…
private const QUANTIFIERS = ['union_option:' => null, 'union_option: DISTINCT' => \SqlSemantics\Platform\My…
private Lowering $lowering

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 6
Method calls 10