classShowCreateTable
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.
$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']$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§
public InspectedTable $tableMethods§
public function __construct(public InspectedTable $table)Parameters
$table | InspectedTable | The table or view |
public function deriveStatement(Derivation $derivation): voidDerives the rows.
Parameters
$derivation | Derivation |
Calls 13
- new ShowFacts line 57
- method-call RelationKinds::kind() line 58
- new RelationKinds line 58
- method-call ShowTargets::derive() line 58
- new ShowTargets line 58
- method-call Derivation::output() line 60
- method-call ShowFacts::query() line 60
- method-call ShowFacts::open() line 60
- new TableOrView line 60
- method-call ShowFacts::rows() line 64
- class-const RelationKind::View() line 64
- class-const Report::CreateView() line 64
- class-const Report::CreateTable() line 64
public function render(Output $out): voidTest 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
- new SqlSemantics\Platform\MySql\Lowering\Utility\Show\LegacyObjectRule::schema() packages/sql-semantics-mysql/src/Lowering/Utility/Show/LegacyObjectRule.php:133
- new SqlSemantics\Platform\MySql\Lowering\Utility\Show\ObjectRule::definition() packages/sql-semantics-mysql/src/Lowering/Utility/Show/ObjectRule.php:103