final class DropDatabase
    implements Statement
    uses Snapshot
Public API: explicitly declared with @visibility public.

A request to remove a database.

Rule: PG-DROPDB-001. Mirrors DropdbStmt. The options are kept in the order written, repetitions included; the optional WITH before them is not kept. Source: https://www.postgresql.org/docs/17/sql-dropdatabase.html. Status: Implemented.

Dropping a database while it is in usedoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('DROP DATABASE IF EXISTS d (FORCE)');
    [$operation->statement->ifExists, $operation->toString()] // => [true, 'DROP DATABASE IF EXISTS d WITH (FORCE)']

Properties§

public list<DropDatabaseOption> $options
public Name $name
public bool $ifExists = false

Methods§

public function __construct(
    public Name $name,
    public bool $ifExists = false,
    list<DropDatabaseOption> $options = [],
)

Parameters

$nameNameThe database name
$ifExistsboolWhether IF EXISTS is written
$optionslist<DropDatabaseOption>The options in the order written
Calls 2
public function deriveStatement(Derivation $derivation): void

Derives nothing: a database is not part of a declaration context.

Parameters

$derivationDerivation
public function render(Output $out): void

Writes the request.

Parameters

$outOutput
Calls 4

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 4