classDatabaseRule
final class DatabaseRule
Lowers CREATE, ALTER and DROP DATABASE.
Rule: MYSQL-DATABASE-001. Scope: the DATABASE alternatives of create, alter and drop (alter and drop in 5.6 and 5.7), alter_database_stmt, drop_database_stmt, opt_create_database_options, create_database_options, create_database_option, alter_database_options, alter_database_option, default_encryption. The character set and collation go through the leaf character set rules; DEFAULT before an option and its equals sign are optional (LeafNoise). Constructs: CreateDatabase, AlterDatabase, UpgradeDatabaseName, DropDatabase and the DatabaseOption classes. Terminates: the option lists are flattened iteratively. Source: https://dev.mysql.com/doc/refman/8.4/en/create-database.html, https://dev.mysql.com/doc/refman/8.4/en/alter-database.html, https://dev.mysql.com/doc/refman/8.4/en/drop-database.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
Lowers a database statement.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 7
- new CreateDatabase line 71
- method-call Form::node() line 72
- method-call DatabaseRule::options() line 74
- new AlterDatabase line 76
- new UpgradeDatabaseName line 80
- new DropDatabase line 81
- static-call ImplementationGap::production() line 82
public function options(Node $list): list<DatabaseOption>Lowers an option list: a node of opt_create_database_options, create_database_options or alter_database_options.
Parameters
$list | Node |
Returns
list<DatabaseOption>Throws
ImplementationGap When a production has no ruleCalled from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Instance\DatabaseRule::statement() packages/sql-semantics-mysql/src/Lowering/Server/Instance/DatabaseRule.php:74
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Instance\DatabaseRule::statement() packages/sql-semantics-mysql/src/Lowering/Server/Instance/DatabaseRule.php:78
Calls 5
- method-call Lowering::form() line 94
- class-const DatabaseRule::LISTS() line 99
- method-call Lists::items() line 101
- new Lists line 101
- method-call DatabaseRule::option() line 102
public function option(Node $option): DatabaseOptionLowers one option: a node of create_database_option or alter_database_option.
Parameters
$option | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Instance\DatabaseRule::options() packages/sql-semantics-mysql/src/Lowering/Server/Instance/DatabaseRule.php:102
- method-call SqlSemantics\Platform\MySql\Lowering\Server\Instance\DatabaseRule::option() packages/sql-semantics-mysql/src/Lowering/Server/Instance/DatabaseRule.php:119
Calls 8
- method-call Lowering::form() line 115
- method-call DatabaseRule::option() line 119
- method-call DatabaseRule::readOnly() line 120
- new DatabaseCharset line 121
- new DatabaseCollation line 122
- new CollationName line 122
- method-call DatabaseRule::encryption() line 123
- static-call ImplementationGap::production() line 124
public function readOnly(Form $form): DatabaseReadOnlyLowers READ ONLY.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 2
- method-call Form::node() line 135
- new DatabaseReadOnly line 137
public function encryption(Node $encryption): DatabaseEncryptionLowers ENCRYPTION: a node of default_encryption.
Parameters
$encryption | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 3
- method-call Lowering::form() line 147
- static-call ImplementationGap::production() line 149
- new DatabaseEncryption line 154
Private surface 2§
Implementation details, listed for orientation only.
private const LISTS = ['opt_create_database_options:', 'create_database_options: create_database_opti…private Lowering $loweringTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
DatabaseRuleTestcalls