classCreateDatabase
final class CreateDatabase
implements Statement
uses Snapshot
Public API: explicitly declared with
@visibility public.A request to create a database.
Rule: PG-CREATEDB-001. Mirrors CreatedbStmt. The options are kept in the order written; the optional WITH before them is not kept. An option given twice or not recognized by the release is a diagnostic (PG-CATALOG-OPTION-001). A database is not a relation declaration: the statement provides none. Source: https://www.postgresql.org/docs/17/sql-createdatabase.html. Status: Implemented.
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze("CREATE DATABASE d WITH OWNER = app ENCODING 'UTF8'");
[$operation->statement->name->value, $operation->statement->options[1]->option(), $operation->toString()] // => ['d', 'encoding', "CREATE DATABASE d WITH OWNER = app ENCODING = 'UTF8'"]Properties§
public list<DatabaseOption> $optionspublic Name $nameMethods§
public function __construct(public Name $name, list<DatabaseOption> $options = [])Parameters
$name | Name | The database name |
$options | list<DatabaseOption> | The options in the order written |
Calls 2
- static-call Check::listOf() line 46
- class-const DatabaseOption::class() line 46
public function deriveStatement(Derivation $derivation): voidDerives the option values and checks the option names.
Parameters
$derivation | Derivation |
Calls 4
- method-call ClauseFacts::derive() line 54
- new ClauseFacts line 54
- method-call OptionChecks::database() line 55
- new OptionChecks line 55
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 3
- method-call Output::keyword() line 63
- class-const NameUse::Column() line 63
- method-call Output::node() line 67
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
CreateDatabaseTestcalls