classDropDatabase
final class DropDatabase
implements Statement
uses Snapshot
Public API: explicitly declared with
@visibility public.DROP {DATABASE | SCHEMA} [IF EXISTS] name: a request to remove a database and every table in it.
Mirrors SQLCOM_DROP_DB. Rule: MYSQL-DROP-DATABASE-001. The statement removes no declaration from the context it is analyzed against. Source: https://dev.mysql.com/doc/refman/8.4/en/drop-database.html. Status: Implemented.
$drop = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('drop schema if exists shop');
[$drop->toString(), $drop->statement->ifExists] // => ['DROP DATABASE IF EXISTS shop', true]Properties§
public bool $ifExistspublic Name $nameMethods§
public function __construct(public bool $ifExists, public Name $name)Parameters
$ifExists | bool | Whether IF EXISTS is written |
$name | Name | The database name |
public function deriveStatement(Derivation $derivation): voidHas nothing to derive: a database is no relation.
Parameters
$derivation | Derivation |
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 3
- method-call Output::keyword() line 51
- method-call Output::name() line 55
- class-const NameUse::Qualifier() line 55
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
DropDatabaseTestcalls