final class ShowKeys
    implements Statement, Relation
    uses Snapshot
Public API: explicitly declared with @visibility public.

SHOW INDEX (SHOW INDEXES, SHOW KEYS): the index parts of a table.

Rule: MYSQL-SHOW-KEYS-001. The table resolves by MYSQL-SHOW-TARGET-001; a database written after it replaces the one written with the table name. EXTENDED, from MySQL 8.0 on, also lists hidden index parts. INDEX, INDEXES and KEYS are the same keyword (LeafNoise); the writer emits INDEXES. Only WHERE filters the rows. The rows and the WHERE condition are derived by MYSQL-SHOW-FACTS-001 from the layout of MYSQL-SHOW-ROWS-001. Terminates: a fixed layout. Source: https://dev.mysql.com/doc/refman/8.4/en/show-index.html. Status: Implemented.

Reading the statementdoctest
$show = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("SHOW KEYS FROM t WHERE Key_name = 'PRIMARY'");
    [$show->facts->scalar($show->statement->filter->condition->left)->resolution->slot->name?->value, $show->toString()] // => ['Key_name', "SHOW INDEXES FROM t WHERE Key_name = 'PRIMARY'"]

Properties§

public bool $extended = false
public ?Name $database = null
public ?ShowWhere $filter = null

Methods§

public function __construct(
    public InspectedTable $table,
    public bool $extended = false,
    public ?Name $database = null,
    public ?ShowWhere $filter = null,
)

Parameters

$tableInspectedTableThe table
$extendedboolWhether EXTENDED is written
$database?NameThe database written after FROM or IN; null for the current database
$filter?ShowWhereThe WHERE clause
public function deriveStatement(Derivation $derivation): void

Derives the rows and the filter.

Parameters

$derivationDerivation
Calls 4
public function deriveRelation(Derivation $derivation, Environment $environment): RelationFact

Derives the result columns.

Parameters

$derivationDerivation
$environmentEnvironment
Calls 3
public function render(Output $out): void

Writes the statement.

Parameters

$outOutput
Calls 3

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
Type declarations 1