classExplainConnection
final class ExplainConnection
implements Statement
uses Snapshot
Public API: explicitly declared with
@visibility public.EXPLAIN FOR CONNECTION: the plan of the statement another connection is running (MySQL 5.7 and later).
Rule: MYSQL-EXPLAIN-CONNECTION-001. The connection is a thread number as SHOW PROCESSLIST reports it; the statement it runs is not part of the request. The options and the rows of the report follow MYSQL-EXPLAIN-ROWS-001. Terminates: no nested statement. Source: https://dev.mysql.com/doc/refman/8.4/en/explain-for-connection.html. Status: Implemented.
$explain = (new \SqlSemantics\Platform\MySql\Semantics('mysql-5.7.44'))->analyze('EXPLAIN FORMAT = JSON FOR CONNECTION 42');
[$explain->statement->connection->text, $explain->field(0)->name?->value, $explain->toString()] // => ['42', 'EXPLAIN', 'EXPLAIN FORMAT = `JSON` FOR CONNECTION 42']Properties§
public Numeral $connectionpublic Name|null $format = nullpublic bool $analyze = falsepublic ExplainModifier|null $modifier = nullpublic UserVariable|null $into = nullMethods§
public function __construct(
public Numeral $connection,
public Name|null $format = null,
public bool $analyze = false,
public ExplainModifier|null $modifier = null,
public UserVariable|null $into = null,
)Parameters
$connection | Numeral | The connection identifier |
$format | Name|null | The format name after FORMAT = |
$analyze | bool | Whether ANALYZE is written |
$modifier | ExplainModifier|null | The EXTENDED or PARTITIONS keyword of MySQL 5.7 |
$into | UserVariable|null | The variable after INTO |
Calls 1
- static-call Check::input() line 51
public function deriveStatement(Derivation $derivation): voidRecords the rows of the report.
Parameters
$derivation | Derivation |
Calls 2
- method-call ExplainFacts::derive() line 59
- new ExplainFacts line 59
public function render(Output $out): voidWrites EXPLAIN, the options and the connection.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 67
- class-const NameUse::Label() line 75
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\Lowering\Utility\Explain\ExplainRule::legacy() packages/sql-semantics-mysql/src/Lowering/Utility/Explain/ExplainRule.php:152
- new SqlSemantics\Platform\MySql\Lowering\Utility\Explain\ExplainRule::modern() packages/sql-semantics-mysql/src/Lowering/Utility/Explain/ExplainRule.php:167