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

Lowers the select options, the select list and select list aliases of every grammar generation.

Rule: MYSQL-SELECT-ITEMS-001. Scope: select_options, select_option_list, select_option, query_spec_option, opt_query_spec_options, query_spec_option_list, query_expression_option, opt_query_expression_options, query_expression_option_list, select_item_list, select_item, select_alias. Options and items keep their written order; a select alias written as a string names the item like an identifier. An item without alias that the server names after its text keeps the layout of its expression (MYSQL-ITEM-LAYOUT-001) unless the expression is written exactly as its canonical rendering, which an item without layout stands for; an item that names itself, such as a column reference or a string (MYSQL-SELECT-ITEM-NAME-001), keeps none. Constructs: SelectOption, SelectExpression, Star, and the TableWildcard of the leaf rules. Terminates: lists are flattened iteratively. Source: https://dev.mysql.com/doc/refman/8.4/en/select.html. Status: Implemented.

Methods§

public function __construct(private Lowering $lowering)

Parameters

$loweringLoweringThe lowering this rule belongs to
public function options(Node $options): list<SelectOption>

Lowers the select options in written order.

Parameters

$optionsNode

Returns

Throws

ImplementationGap When a production has no rule
Called from 9
Calls 7
public function items(Node $list): list<SelectExpression|Star|TableWildcard>

Lowers the select list in written order.

Parameters

$listNode

Throws

ImplementationGap When a production has no rule
Called from 10
Calls 7
public function expression(Node $expression, Node $alias): SelectExpression

Lowers a projected expression with its alias, keeping the layout of an expression without alias that the server names after its text and that is not written as the canonical rendering (MYSQL-ITEM-LAYOUT-001).

Parameters

$expressionNode
$aliasNode

Throws

ImplementationGap When a production has no rule
Called from 2
Calls 8
public function mark(Node $alias): AliasMark

Answers whether a select alias is written after AS; no alias answers AS, the mark of an item without alias.

Parameters

$aliasNode

Returns

Throws

ImplementationGap When the production has no rule
Called from 2
Calls 6

Private surface 5§

Implementation details, listed for orientation only.

private const OPTIONS = ['select_option: SQL_NO_CACHE_SYM' => \SqlSemantics\Platform\MySql\Statement\Qu…
private const LISTS = ['select_options:' => false, 'opt_query_spec_options:' => false, 'opt_query_exp…
private const SPINES = ['select_option_list: select_option_list select_option' => true, 'select_option…
private const ALIASES = ['select_alias:' => null, 'select_alias: AS ident' => 1, 'select_alias: AS TEXT…
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 9
Method calls 21