classShowColumns
final class ShowColumns
implements Statement, Relation
uses Snapshot
Public API: explicitly declared with
@visibility public.SHOW COLUMNS (SHOW FIELDS): the columns of a table or view.
Rule: MYSQL-SHOW-COLUMNS-001. The table resolves by MYSQL-SHOW-TARGET-001; a database written after it replaces the one written with the table name. FULL adds Collation, Privileges and Comment; EXTENDED, from MySQL 8.0 on, also lists hidden columns. 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-columns.html. Status: Implemented.
$show = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("SHOW FULL FIELDS IN t FROM shop LIKE 'a%'");
[count($show->fields()), $show->toString()] // => [9, "SHOW FULL COLUMNS FROM t FROM shop LIKE 'a%'"]Properties§
public InspectedTable $tablepublic ?ShowListing $listing = nullpublic ?Name $database = nullMethods§
public function __construct(
public InspectedTable $table,
public ?ShowListing $listing = null,
public ?Name $database = null,
public ShowLike|ShowWhere|null $filter = null,
)Parameters
$table | InspectedTable | The table |
$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 4
- method-call ShowTargets::derive() line 60
- new ShowTargets line 60
- method-call ShowFacts::derive() line 61
- new ShowFacts line 61
public function deriveRelation(Derivation $derivation, Environment $environment): RelationFactDerives the result columns.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 4
- method-call ShowFacts::fact() line 69
- new ShowFacts line 69
- class-const Report::FullColumns() line 69
- class-const Report::Columns() line 69
public function render(Output $out): voidWrites the statement.
Parameters
$out | Output |
Calls 4
- method-call Output::keyword() line 77
- function-call
explodeline 79 - class-const NameUse::Qualifier() line 83
- method-call Output::node() line 85
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Other tests reaching this symbol 1
Relations§
Instantiated in 2
- new SqlSemantics\Platform\MySql\Lowering\Utility\Show\LegacyObjectRule::columns() packages/sql-semantics-mysql/src/Lowering/Utility/Show/LegacyObjectRule.php:155
- new SqlSemantics\Platform\MySql\Lowering\Utility\Show\ObjectRule::statement() packages/sql-semantics-mysql/src/Lowering/Utility/Show/ObjectRule.php:79