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

The entry rules of the query family: the methods other families and the statement dispatcher call.

Rule: MYSQL-QUERY-ENTRY-001. Scope: SELECT, set operations, VALUES and TABLE statements, WITH, table references, joins, grouping, ordering, limits, locking and INTO, in both grammar generations: the rules of Lowering/Query/Modern (8.0 and later), Lowering/Query/Legacy (5.6 and 5.7) and Lowering/Query/Shared. A query that a subquery, a derived table or a common table expression writes in the parentheses its syntax requires is answered without those parentheses; the construct that holds it writes them. Source: https://dev.mysql.com/doc/refman/8.4/en/select.html. Status: Implemented.

Properties§

public Lowering $lowering

Methods§

public function __construct(public Lowering $lowering)

Parameters

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

Lowers a query statement: a node of select (5.6, 5.7) or select_stmt (8.0 and later).

Parameters

$statementNode

Returns

Throws

ImplementationGap When a production has no rule
Called from 1
Calls 2
public function query(Node $query): Query

Lowers a query used inside another statement: a node of select, select_stmt, subselect, subquery, table_subquery, row_subquery, query_expression, query_expression_parens, query_expression_with_opt_locking_clauses or view_select_aux.

Parameters

$queryNode

Returns

Throws

ImplementationGap When a production has no rule
Called from 1
Calls 14
public function legacyQuery(Node $select, ?Node $union = null): Query

Lowers the query of CREATE TABLE ... SELECT and INSERT ... SELECT of MySQL 5.6 and 5.7: a node of create_select and the node of union_clause, opt_union_clause or union_opt that follows it.

Parameters

$selectNode
$union?Node

Returns

Throws

ImplementationGap When a production has no rule
Test cases 1
Calls 4
public function legacyParenthesizedQuery(Node $select, Node $union): Query

Lowers the parenthesized query of CREATE TABLE ... SELECT and INSERT ... SELECT of MySQL 5.6 and 5.7: the node of create_select written in parentheses (create3, insert_values, insert_query_expression: ( create_select ) union_opt) and the node of union_opt that follows the parentheses. The parentheses are kept as a parenthesized query; the holding statement writes nothing for them.

Parameters

$selectNode
$unionNode

Returns

Throws

ImplementationGap When a production has no rule
Test cases 1
Calls 5
public function where(Node $clause): ?Scalar

Lowers a row predicate: a node of where_clause or opt_where_clause; an absent clause is null.

Parameters

$clauseNode

Returns

Throws

ImplementationGap When a production has no rule
Test cases 1
Calls 2
public function ordering(Node $clause): list<OrderItem>

Lowers ordering or grouping expressions: a node of opt_order_clause, order_clause, order_list or group_list; an absent clause is empty. Integers stay the expressions they are.

Parameters

$clauseNode

Returns

list<OrderItem>

Throws

ImplementationGap When a production has no rule
Test cases 1
Calls 2
public function orderItem(Node $item, ?Node $direction = null): OrderItem

Lowers one ordering expression: a node of order_expr, or a node of order_ident with the node of order_dir that follows it.

Parameters

$itemNode
$direction?Node

Returns

Throws

ImplementationGap When a production has no rule
Calls 2
public function direction(Node $direction): ?Direction

Lowers a sort direction: a node of order_dir, opt_ordering_direction or ordering_direction; no direction is null.

Parameters

$directionNode

Returns

Throws

ImplementationGap When a production has no rule
Test cases 1
Calls 2
public function limit(Node $clause): ?Limit

Lowers a LIMIT clause: a node of opt_limit_clause, limit_clause, opt_simple_limit or opt_limit_clause_init; an absent clause is null.

Parameters

$clauseNode

Returns

Throws

ImplementationGap When a production has no rule
Test cases 1
Calls 2
public function limitValue(Node $option): Scalar

Lowers one LIMIT operand: a node of limit_option.

Parameters

$optionNode

Returns

Throws

ImplementationGap When a production has no rule
Test cases 1
Calls 2
public function tables(Node $list): list<Relation>

Lowers the table references of UPDATE and DELETE: a node of join_table_list or table_reference_list.

Parameters

$listNode

Returns

list<Relation>

Throws

ImplementationGap When a production has no rule
Test cases 1
Calls 2
public function partitions(Node $selection): list<Name>

Lowers an explicit partition selection: a node of opt_use_partition or use_partition; an absent selection is empty.

Parameters

$selectionNode

Returns

list<Name>

Throws

ImplementationGap When a production has no rule
Test cases 1
Calls 2
public function alias(Node $alias): ?Name

Lowers an optional alias: a node of opt_table_alias or select_alias.

Parameters

$aliasNode

Returns

Throws

ImplementationGap When a production has no rule
Calls 4
public function mark(Node $alias): AliasMark

Answers what is written before an optional alias: a node of opt_table_alias or select_alias.

Parameters

$aliasNode

Returns

Throws

ImplementationGap When a production has no rule
Calls 4
public function columnAliases(Node $list): list<Name>

Lowers the column names of a derived table, view or VALUES alias: a node of opt_derived_column_list; an absent list is empty.

Parameters

$listNode

Returns

list<Name>

Throws

ImplementationGap When a production has no rule
Test cases 1
Calls 2
public function with(Node $clause): ?WithClause

Lowers a WITH clause: a node of opt_with_clause or with_clause; an absent clause is null.

Parameters

$clauseNode

Returns

Throws

ImplementationGap When a production has no rule
Test cases 1
Calls 2
public function selectItems(Node $list): list<SelectExpression|Star|TableWildcard>

Lowers a select list: a node of select_item_list.

Parameters

$listNode

Throws

ImplementationGap When a production has no rule
Test cases 1
Calls 2
public function indexNames(Node $list): list<Name>

Lowers the index names of an index hint or of CACHE INDEX: a node of opt_key_usage_list; an absent list is empty. A list that names the primary key with PRIMARY is lowered by indexKeys().

Parameters

$listNode

Returns

list<Name>

Throws

ImplementationGap When the list names PRIMARY or a production has no rule
Test cases 1
Calls 2
public function indexKeys(Node $list): list<Name|PrimaryIndex>

Lowers the indexes of an index hint or of CACHE INDEX, where PRIMARY names the primary key: a node of opt_key_usage_list or key_usage_list; an absent list is empty.

Parameters

$listNode

Returns

Throws

ImplementationGap When a production has no rule
Test cases 1
Called from 1
Calls 2

Test cases 14§

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

Dedicated tests 14

Relations§

Instantiated in 1
Method calls 1
Type declarations 1