classDatabaseOption
final class DatabaseOption
implements Clause
uses Snapshot
Public API: explicitly declared with
@visibility public.One option of CREATE DATABASE or ALTER DATABASE: a name and a value.
Mirrors the DefElem of createdb_opt_item. The name is either one of the keyword spellings or an identifier; the value is a number, a word, a string, TRUE, FALSE, ON or DEFAULT. The optional = between them is not kept. Source: https://www.postgresql.org/docs/17/sql-createdatabase.html.
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('CREATE DATABASE d is_template = true');
$operation->statement->options[0]->option() // => 'is_template'Properties§
public DatabaseOptionKeyword|Name $namepublic OptionArgument $valueMethods§
public function __construct(
public DatabaseOptionKeyword|Name $name,
public OptionArgument $value,
)Parameters
$name | DatabaseOptionKeyword|Name | The keyword spelling or the identifier that names the option |
$value | OptionArgument | The value |
public function option(): stringAnswers the option name the server receives.
Returns
stringpublic function deriveClause(Derivation $derivation, Environment $environment): voidDerives the value.
Parameters
$derivation | Derivation | |
$environment | Environment |
Calls 1
- method-call OptionArgument::deriveClause() line 54
public function render(Output $out): voidWrites the name, an equals sign and the value.
Parameters
$out | Output |
Calls 5
- method-call Output::name() line 63
- class-const NameUse::Identifier() line 63
- method-call Output::keyword() line 65
- function-call
explodeline 65 - method-call Output::symbol() line 67
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
DatabaseOptionTestcalls
Other tests reaching this symbol 1
Relations§
Instantiated in 1
Constant reads 2
- class-const SqlSemantics\Platform\PostgreSql\Statement\Catalog\Database\AlterDatabase::__construct() packages/sql-semantics-postgres/src/Statement/Catalog/Database/AlterDatabase.php:45
- class-const SqlSemantics\Platform\PostgreSql\Statement\Catalog\Database\CreateDatabase::__construct() packages/sql-semantics-postgres/src/Statement/Catalog/Database/CreateDatabase.php:46