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

Lowers the optional keywords, synonym keywords and empty marker rules that several statement families share.

Rule: MYSQL-OPTION-001. Scope: opt_as, opt_if_not_exists, if_exists, opt_temporary, opt_ignore, opt_all, opt_default, opt_equal, equal, opt_wild, opt_storage, opt_table, opt_comma, optional_braces, opt_no_write_to_binlog, opt_key_or_index, key_or_index, keys_or_index, table_or_tables, not, charset, character_set, opt_restrict, and the empty marker rules remember_name, remember_end, init_lex_create_info, clear_privileges, clear_password_expire_options, get_select_lex, subselect_start, subselect_end, have_partitioning, init_key_options, sp_init_param, no_definer and empty_select_options. An optional keyword lowers to whether it is written; RESTRICT and CASCADE to the keyword written. A synonym or marker rule holds no operand: skip() confirms the production is one of them. Which of the keywords are noise or synonyms for the token correspondence is stated in LeafNoise. Terminates: constant work. Source: the statement pages cited in LeafNoise. Status: Implemented.

Methods§

public function __construct(private Lowering $lowering)

Parameters

$loweringLoweringThe lowering this rule belongs to
public function present(Node $option): bool

Tells whether an optional keyword is written.

Parameters

$optionNode

Returns

bool

Throws

ImplementationGap When the production has no rule
Test cases 2
Calls 2
public function skip(Node $inert): void

Confirms that a node is a synonym keyword or an empty marker and holds no operand.

Parameters

$inertNode

Throws

ImplementationGap When the production has no rule
Test cases 1
Calls 2
public function dropBehavior(Node $behavior): ?DropBehavior

Lowers the optional RESTRICT or CASCADE keyword of a DROP.

Parameters

$behaviorNode

Returns

Throws

ImplementationGap When the production has no rule
Test cases 1
Calls 3

Private surface 3§

Implementation details, listed for orientation only.

private const PRESENT = ['opt_as:' => false, 'opt_as: AS' => true, 'opt_if_not_exists:' => false, 'opt_…
private const INERT = ['key_or_index: KEY_SYM' => true, 'key_or_index: INDEX_SYM' => true, 'keys_or_i…
private Lowering $lowering

Test cases 4§

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

Dedicated tests 4

Relations§

Instantiated in 1
Type declarations 1