classShowCreateDatabase
final class ShowCreateDatabase
implements Statement
uses Snapshot
Public API: explicitly declared with
@visibility public.SHOW CREATE DATABASE (SHOW CREATE SCHEMA): the statement that creates a database.
Rule: MYSQL-SHOW-CREATE-DATABASE-001. IF NOT EXISTS makes the returned statement carry the same clause. The columns are those of the layout of MYSQL-SHOW-ROWS-001. Terminates: a fixed layout. Source: https://dev.mysql.com/doc/refman/8.4/en/show-create-database.html. Status: Implemented.
$show = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('SHOW CREATE SCHEMA IF NOT EXISTS shop');
[$show->field(1)->name?->value, $show->toString()] // => ['Create Database', 'SHOW CREATE DATABASE IF NOT EXISTS shop']Properties§
public Name $namepublic bool $ifNotExists = falseMethods§
public function __construct(public Name $name, public bool $ifNotExists = false)Parameters
$name | Name | The database |
$ifNotExists | bool | Whether IF NOT EXISTS is written |
public function deriveStatement(Derivation $derivation): voidDerives the rows.
Parameters
$derivation | Derivation |
Calls 3
- method-call ShowFacts::rows() line 47
- new ShowFacts line 47
- class-const Report::CreateDatabase() line 47
public function render(Output $out): voidWrites the statement.
Parameters
$out | Output |
Calls 3
- method-call Output::keyword() line 55
- method-call Output::name() line 59
- class-const NameUse::Qualifier() line 59
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
- new SqlSemantics\Platform\MySql\Lowering\Utility\Show\LegacyObjectRule::schema() packages/sql-semantics-mysql/src/Lowering/Utility/Show/LegacyObjectRule.php:132
- new SqlSemantics\Platform\MySql\Lowering\Utility\Show\ObjectRule::definition() packages/sql-semantics-mysql/src/Lowering/Utility/Show/ObjectRule.php:101