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

SHOW CREATE TABLE: the statement that creates a table, or a view.

Rule: MYSQL-SHOW-CREATE-TABLE-001. The table resolves by MYSQL-SHOW-TARGET-001. For a base table the server returns Table and Create Table; the statement also accepts a view and then returns the four columns of SHOW CREATE VIEW (MYSQL-SHOW-ROWS-001). A declared table answers the columns of its kind (MYSQL-RELATION-KIND-001); for any other name the shape is open and depends on whether the name is a table or a view (TableOrView). Terminates: no nested part. Source: https://dev.mysql.com/doc/refman/8.4/en/show-create-table.html. Status: Implemented.

Reading the statementdoctest
$show = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('SHOW CREATE TABLE shop.t');
    [$show->shape()?->missing[0]->describe(), $show->toString()] // => ['whether shop.t is a base table or a view', 'SHOW CREATE TABLE shop.t']
Reading the columns for a declared viewdoctest
$semantics = new \SqlSemantics\Platform\MySql\Semantics();
    $view = $semantics->analyze('CREATE VIEW v AS SELECT 1 AS a');
    $semantics->analyze('SHOW CREATE TABLE v', [$view])->field(1)->name?->value // => 'Create View'

Properties§

Methods§

public function __construct(public InspectedTable $table)

Parameters

$tableInspectedTableThe table or view
public function deriveStatement(Derivation $derivation): void
public function render(Output $out): void

Writes the statement.

Parameters

$outOutput
Calls 1

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 2