classShowTables
final class ShowTables
implements Statement, Relation
uses Snapshot
@visibility public.SHOW TABLES: the tables and views of a database.
Rule: MYSQL-SHOW-TABLES-001. One column named Tables_in_db after the database written or the current one, Tables_in_db (pattern) with LIKE; FULL adds Table_type. EXTENDED, from MySQL 8.0 on, also lists hidden tables and adds no column. When neither the statement nor the context names the database, the column name depends on the current database of the session and the shape is open. The rows and the WHERE condition are derived by MYSQL-SHOW-FACTS-001. Terminates: a fixed layout. Source: https://dev.mysql.com/doc/refman/8.4/en/show-tables.html. Status: Implemented.
$show = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("SHOW FULL TABLES FROM shop LIKE 'o%'");
[$show->field(0)->name?->value, $show->field(1)->name?->value, $show->toString()] // => ['Tables_in_shop (o%)', 'Table_type', "SHOW FULL TABLES FROM shop LIKE 'o%'"]Properties§
public ?ShowListing $listing = nullpublic ?Name $database = nullMethods§
public function __construct(
public ?ShowListing $listing = null,
public ?Name $database = null,
public ShowLike|ShowWhere|null $filter = null,
)Parameters
$listing | ?ShowListing | The FULL and EXTENDED keywords |
$database | ?Name | The database written after FROM or IN; null for the current database |
$filter | ShowLike|ShowWhere|null | The LIKE or WHERE clause |
public function deriveStatement(Derivation $derivation): voidDerives the rows and the filter.
Parameters
$derivation | Derivation |
Calls 2
- method-call ShowFacts::derive() line 58
- new ShowFacts line 58
public function deriveRelation(Derivation $derivation, Environment $environment): RelationFactDerives the result columns.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 7
- new ShowFacts line 66
- method-call ShowFacts::database() line 67
- method-call ShowFacts::open() line 69
- method-call ShowFacts::currentDatabase() line 69
- method-call ShowFacts::fact() line 73
- class-const Report::FullTables() line 73
- class-const Report::Tables() line 73
public function render(Output $out): voidWrites the statement.
Parameters
$out | Output |
Calls 4
- method-call Output::keyword() line 81
- function-call
explodeline 83 - class-const NameUse::Qualifier() line 87
- method-call Output::node() line 89
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Relations§
Instantiated in 2
- new SqlSemantics\Platform\MySql\Lowering\Utility\Show\LegacyObjectRule::schema() packages/sql-semantics-mysql/src/Lowering/Utility/Show/LegacyObjectRule.php:125
- new SqlSemantics\Platform\MySql\Lowering\Utility\Show\ObjectRule::statement() packages/sql-semantics-mysql/src/Lowering/Utility/Show/ObjectRule.php:67