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

Lowers EXPLAIN, DESCRIBE, HELP and USE.

Rule: MYSQL-EXPLAIN-LOWERING-001. Scope: describe, explanable_command (5.6), explainable_command (5.7), opt_extended_describe (5.x), describe_command, opt_describe_column, describe_stmt, explain_stmt, explainable_stmt, opt_explain_options, opt_explain_format, opt_explain_into, opt_explain_for_schema (8.0 and later), help, use. Constructs: DescribeTable, Explain, ExplainConnection, Help, UseDatabase. The explained statement is lowered by the query and data manipulation families. DESC, DESCRIBE and EXPLAIN are the same keyword (UtilityNoise). Terminates: every part is a strict subtree. Source: https://dev.mysql.com/doc/refman/8.4/en/explain.html, https://dev.mysql.com/doc/refman/8.4/en/help.html, https://dev.mysql.com/doc/refman/8.4/en/use.html. Status: Implemented.

Methods§

public function __construct(private Lowering $lowering)

Parameters

$loweringLoweringThe lowering this rule belongs to
public function statement(Form $form): Statement
public function column(Node $column): Name|Text|null

Lowers the column pattern of DESCRIBE: a node of opt_describe_column.

Parameters

$columnNode

Returns

Name|Text|null

Throws

ImplementationGap When a production has no rule
Called from 1
Calls 2
public function legacy(Form $options, Form $command): Statement

Lowers EXPLAIN of MySQL 5.x from its opt_extended_describe and its explained command.

Parameters

$optionsForm
$commandForm

Returns

Throws

ImplementationGap When a production has no rule
Called from 1
Calls 6
public function modern(Node $options, ?Node $into, Form $explainable): Statement

Private surface 4§

Implementation details, listed for orientation only.

private const MODIFIERS = ['opt_extended_describe: EXTENDED_SYM' => \SqlSemantics\Platform\MySql\Statemen…
private const EXPLAINED = ['explanable_command: select' => 0, 'explanable_command: insert' => 0, 'explana…
private const QUERIES = ['select' => true, 'select_stmt' => true]
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 1
Method calls 1