classExplainFacts
final class ExplainFacts
Derives the rows EXPLAIN returns, from its format and options.
Rule: MYSQL-EXPLAIN-ROWS-001. Format names are compared without regard to case. TRADITIONAL returns one row per table of the plan with the columns of the layout of MYSQL-SHOW-ROWS-001 (in MySQL 5.6 EXTENDED adds filtered and PARTITIONS adds partitions); JSON, and TREE from MySQL 8.0 on, return one column EXPLAIN. Without FORMAT, MySQL 5.x uses TRADITIONAL and MySQL 8.0 and later the format of the explain_format system variable, so the shape depends on the session. EXPLAIN ANALYZE returns one EXPLAIN column in every format it accepts and refuses TRADITIONAL. EXPLAIN INTO (8.1 and later) stores the JSON plan in a user variable, returns no rows and requires FORMAT=JSON. Another format name is refused (ER_UNKNOWN_EXPLAIN_FORMAT). A refused statement returns no rows. Terminates: a fixed table. Source: https://dev.mysql.com/doc/refman/8.4/en/explain.html, https://dev.mysql.com/doc/refman/8.4/en/explain-output.html, https://dev.mysql.com/doc/refman/5.6/en/explain-extended.html. Status: Implemented.
Methods§
public function derive(
Derivation $derivation,
?Name $format,
bool $analyze,
?ExplainModifier $modifier,
?UserVariable $into,
): voidRecords the rows of an EXPLAIN, or reports why the server refuses it.
Parameters
$derivation | Derivation | |
$format | ?Name | |
$analyze | bool | |
$modifier | ?ExplainModifier | |
$into | ?UserVariable |
Called from 2
- method-call SqlSemantics\Platform\MySql\Statement\Utility\Explain\Explain::deriveStatement() packages/sql-semantics-mysql/src/Statement/Utility/Explain/Explain.php:68
- method-call SqlSemantics\Platform\MySql\Statement\Utility\Explain\ExplainConnection::deriveStatement() packages/sql-semantics-mysql/src/Statement/Utility/Explain/ExplainConnection.php:59
Calls 7
- function-call
strtoupperline 45 - method-call Derivation::scalar() line 47
- method-call Derivation::environment() line 47
- method-call ExplainFacts::refusal() line 49
- method-call Derivation::report() line 51
- new UtilityMisuse line 51
- method-call ExplainFacts::rows() line 56
public function refusal(
GrammarRelease $release,
?string $format,
bool $analyze,
bool $into,
): ?UtilityRuleAnswers the rule a format and the options break, or null when the server accepts them.
Parameters
$release | GrammarRelease | |
$format | ?string | |
$analyze | bool | |
$into | bool |
Returns
Test cases 1
Called from 1
Calls 5
- method-call ExplainFacts::legacy() line 65
- function-call
in_arrayline 68 - class-const UtilityRule::UnknownExplainFormat() line 68
- class-const UtilityRule::AnalyzeFormat() line 69
- class-const UtilityRule::ExplainIntoFormat() line 70
public function rows(
Derivation $derivation,
?string $format,
bool $analyze,
?ExplainModifier $modifier,
): voidRecords the rows of an accepted EXPLAIN that returns rows.
Parameters
$derivation | Derivation | |
$format | ?string | |
$analyze | bool | |
$modifier | ?ExplainModifier |
Called from 1
Calls 13
- new ShowFacts line 80
- method-call ShowFacts::rows() line 82
- class-const Report::ExplainDocument() line 82
- method-call ExplainFacts::legacy() line 86
- method-call Derivation::output() line 87
- method-call ShowFacts::query() line 87
- method-call ShowFacts::open() line 87
- new SessionState line 87
- class-const Report::Explain() line 92
- class-const ExplainModifier::Extended() line 93
- class-const Report::ExplainExtended() line 93
- class-const ExplainModifier::Partitions() line 94
- class-const Report::ExplainPartitions() line 94
public function legacy(GrammarRelease $release): boolTells whether a release is MySQL 5.6 or 5.7, which have no TREE format and no explain_format variable.
Parameters
$release | GrammarRelease |
Returns
boolTest cases 1
Called from 2
Calls 2
- class-const GrammarRelease::MySql5651() line 103
- class-const GrammarRelease::MySql5744() line 103
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Relations§
Instantiated in 2
- new SqlSemantics\Platform\MySql\Statement\Utility\Explain\Explain::deriveStatement() packages/sql-semantics-mysql/src/Statement/Utility/Explain/Explain.php:68
- new SqlSemantics\Platform\MySql\Statement\Utility\Explain\ExplainConnection::deriveStatement() packages/sql-semantics-mysql/src/Statement/Utility/Explain/ExplainConnection.php:59
Method calls 2
- method-call SqlSemantics\Platform\MySql\Statement\Utility\Explain\Explain::deriveStatement() packages/sql-semantics-mysql/src/Statement/Utility/Explain/Explain.php:68
- method-call SqlSemantics\Platform\MySql\Statement\Utility\Explain\ExplainConnection::deriveStatement() packages/sql-semantics-mysql/src/Statement/Utility/Explain/ExplainConnection.php:59