classClauseRule
final class ClauseRule
Lowers the account clauses shared by CREATE USER, ALTER USER and GRANT.
Rule: MYSQL-ACCOUNT-CLAUSE-001. Scope: require_clause, require_list, require_list_element, opt_and, connect_options, connect_option_list, connect_option, grant_options, grant_option_list, grant_option, opt_grant_option, opt_account_lock_password_expire_options, opt_account_lock_password_expire_option_list, opt_account_lock_password_expire_option, password_expire, opt_user_attribute. Every clause keeps its options in source order and every number and string its exact value; AND between REQUIRE conditions is an optional word. Constructs: TlsRequirement, TlsCondition, ResourceLimit, GrantOptionRight, AccountOption, UserComment. Terminates: the lists are flattened iteratively; every other child is a strict subtree. Source: https://dev.mysql.com/doc/refman/8.4/en/create-user.html, https://dev.mysql.com/doc/refman/5.7/en/grant.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
public function tls(Node $clause): ?TlsRequirementLowers a require_clause; an absent clause is null.
Parameters
$clause | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 5
- method-call SqlSemantics\Platform\MySql\Lowering\Account\LegacyGrantRule::grant() packages/sql-semantics-mysql/src/Lowering/Account/LegacyGrantRule.php:86
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:81
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:89
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:98
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::alter() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:136
Calls 8
- method-call Lowering::form() line 122
- new TlsRequirement line 126
- class-const TlsKind::None() line 126
- class-const TlsKind::Ssl() line 127
- class-const TlsKind::X509() line 128
- class-const TlsKind::Specified() line 129
- method-call ClauseRule::conditions() line 129
- static-call ImplementationGap::production() line 130
public function conditions(Node $list): list<TlsCondition>Lowers the conditions of a require_list, confirming the optional AND between them.
Parameters
$list | Node |
Returns
list<TlsCondition>Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 6
- method-call ClauseRule::spine() line 143
- method-call Lowering::form() line 144
- class-const ClauseRule::CONDITIONS() line 148
- static-call ImplementationGap::production() line 148
- new TlsCondition line 149
- method-call ClauseRule::string() line 149
public function limits(Node $clause): list<ResourceLimit>Lowers a connect_options clause of CREATE USER or ALTER USER; an absent clause is empty.
Parameters
$clause | Node |
Returns
list<ResourceLimit>Throws
ImplementationGap When a production has no ruleCalled from 4
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:82
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:90
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:99
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::alter() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:137
Calls 4
- method-call Lowering::form() line 163
- static-call ImplementationGap::production() line 168
- method-call ClauseRule::spine() line 171
- method-call ClauseRule::limit() line 172
public function limit(Form $form): ResourceLimitLowers one resource limit.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 2
Calls 4
- class-const ClauseRule::LIMITS() line 185
- static-call ImplementationGap::production() line 185
- new ResourceLimit line 187
- method-call Form::node() line 187
public function grantOptions(Node $clause): list<WithOption>Lowers the grant_options of GRANT: WITH GRANT OPTION (8.0+) or a WITH list of GRANT OPTION and limits (5.x).
Parameters
$clause | Node |
Returns
list<WithOption>Throws
ImplementationGap When a production has no ruleCalled from 3
- method-call SqlSemantics\Platform\MySql\Lowering\Account\GrantRule::grant() packages/sql-semantics-mysql/src/Lowering/Account/GrantRule.php:73
- method-call SqlSemantics\Platform\MySql\Lowering\Account\GrantRule::all() packages/sql-semantics-mysql/src/Lowering/Account/GrantRule.php:100
- method-call SqlSemantics\Platform\MySql\Lowering\Account\LegacyGrantRule::grant() packages/sql-semantics-mysql/src/Lowering/Account/LegacyGrantRule.php:87
Calls 5
- method-call Lowering::form() line 198
- new GrantOptionRight line 203
- static-call ImplementationGap::production() line 206
- method-call ClauseRule::spine() line 209
- method-call ClauseRule::limit() line 211
public function grantOption(Node $clause): boolLowers an opt_grant_option: whether WITH GRANT OPTION is written.
Parameters
$clause | Node |
Returns
boolThrows
ImplementationGap When the production has no ruleCalled from 2
Calls 2
- method-call Lowering::form() line 224
- static-call ImplementationGap::production() line 229
public function options(Node $clause): list<AccountOption>Lowers the password and locking options; absent options are empty.
Parameters
$clause | Node |
Returns
list<AccountOption>Throws
ImplementationGap When a production has no ruleCalled from 4
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:83
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:91
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:100
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::alter() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:138
Calls 4
- method-call Lowering::form() line 241
- static-call ImplementationGap::production() line 246
- method-call ClauseRule::spine() line 249
- method-call ClauseRule::option() line 250
public function option(Node $option): AccountOptionLowers one password or locking option.
Parameters
$option | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 7
- method-call Lowering::form() line 263
- function-call
str_starts_withline 264 - method-call ClauseRule::expire() line 265
- class-const ClauseRule::OPTIONS() line 267
- new AccountOption line 269
- class-const ClauseRule::NUMBERED() line 271
- static-call ImplementationGap::production() line 271
public function expire(Node $expire): voidConfirms the MySQL 5.7 password_expire production, whose marker holds no operand.
Parameters
$expire | Node |
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 2
- method-call Lowering::form() line 283
- static-call ImplementationGap::production() line 285
public function comment(Node $clause): ?UserCommentLowers an opt_user_attribute; an absent clause is null.
Parameters
$clause | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:92
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::alter() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:139
Calls 5
- method-call Lowering::form() line 297
- new UserComment line 301
- class-const CommentKind::Attribute() line 301
- class-const CommentKind::Comment() line 302
- static-call ImplementationGap::production() line 303
Lowers a quoted string token at a position that is not an expression.
Parameters
$form | Form | |
$position | int |
Returns
Called from 7
- method-call SqlSemantics\Platform\MySql\Lowering\Account\ClauseRule::conditions() packages/sql-semantics-mysql/src/Lowering/Account/ClauseRule.php:149
- method-call SqlSemantics\Platform\MySql\Lowering\Account\PasswordRule::password() packages/sql-semantics-mysql/src/Lowering/Account/PasswordRule.php:91
- method-call SqlSemantics\Platform\MySql\Lowering\Account\PasswordRule::password() packages/sql-semantics-mysql/src/Lowering/Account/PasswordRule.php:92
- method-call SqlSemantics\Platform\MySql\Lowering\Account\PasswordRule::password() packages/sql-semantics-mysql/src/Lowering/Account/PasswordRule.php:93
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserListRule::grant() packages/sql-semantics-mysql/src/Lowering/Account/UserListRule.php:205
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserListRule::grant() packages/sql-semantics-mysql/src/Lowering/Account/UserListRule.php:206
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:103
Calls 2
- new Text line 314
- method-call Form::token() line 314
Answers the items of a list production of this rule, in source order.
Parameters
$list | Node |
Returns
list<Node>Throws
ImplementationGap When the production has no ruleCalled from 4
- method-call SqlSemantics\Platform\MySql\Lowering\Account\ClauseRule::conditions() packages/sql-semantics-mysql/src/Lowering/Account/ClauseRule.php:143
- method-call SqlSemantics\Platform\MySql\Lowering\Account\ClauseRule::limits() packages/sql-semantics-mysql/src/Lowering/Account/ClauseRule.php:171
- method-call SqlSemantics\Platform\MySql\Lowering\Account\ClauseRule::grantOptions() packages/sql-semantics-mysql/src/Lowering/Account/ClauseRule.php:209
- method-call SqlSemantics\Platform\MySql\Lowering\Account\ClauseRule::options() packages/sql-semantics-mysql/src/Lowering/Account/ClauseRule.php:249
Calls 5
- method-call Lowering::form() line 325
- class-const ClauseRule::LISTS() line 326
- static-call ImplementationGap::production() line 327
- method-call Lists::items() line 330
- new Lists line 330
Private surface 6§
Implementation details, listed for orientation only.
private const OPTIONS = ['opt_account_lock_password_expire_option: ACCOUNT_SYM UNLOCK_SYM' => \SqlSeman…private const NUMBERED = ['opt_account_lock_password_expire_option: PASSWORD EXPIRE_SYM INTERVAL_SYM rea…private const LIMITS = ['connect_option: MAX_QUERIES_PER_HOUR ulong_num' => \SqlSemantics\Platform\MyS…private const CONDITIONS = ['require_list_element: SUBJECT_SYM TEXT_STRING' => \SqlSemantics\Platform\MySq…private const LISTS = ['connect_option_list: connect_option_list connect_option' => true, 'connect_op…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
ClauseRuleTestcalls
Relations§
Instantiated in 6
- new SqlSemantics\Platform\MySql\Lowering\Account\GrantRule::grant() packages/sql-semantics-mysql/src/Lowering/Account/GrantRule.php:59
- new SqlSemantics\Platform\MySql\Lowering\Account\GrantRule::all() packages/sql-semantics-mysql/src/Lowering/Account/GrantRule.php:92
- new SqlSemantics\Platform\MySql\Lowering\Account\LegacyGrantRule::grant() packages/sql-semantics-mysql/src/Lowering/Account/LegacyGrantRule.php:73
- new SqlSemantics\Platform\MySql\Lowering\Account\PasswordRule::password() packages/sql-semantics-mysql/src/Lowering/Account/PasswordRule.php:87
- new SqlSemantics\Platform\MySql\Lowering\Account\UserListRule::grant() packages/sql-semantics-mysql/src/Lowering/Account/UserListRule.php:201
- new SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::__construct() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:60
Method calls 26
- method-call SqlSemantics\Platform\MySql\Lowering\Account\GrantRule::grant() packages/sql-semantics-mysql/src/Lowering/Account/GrantRule.php:73
- method-call SqlSemantics\Platform\MySql\Lowering\Account\GrantRule::grant() packages/sql-semantics-mysql/src/Lowering/Account/GrantRule.php:80
- method-call SqlSemantics\Platform\MySql\Lowering\Account\GrantRule::all() packages/sql-semantics-mysql/src/Lowering/Account/GrantRule.php:100
- method-call SqlSemantics\Platform\MySql\Lowering\Account\LegacyGrantRule::grant() packages/sql-semantics-mysql/src/Lowering/Account/LegacyGrantRule.php:75
- method-call SqlSemantics\Platform\MySql\Lowering\Account\LegacyGrantRule::grant() packages/sql-semantics-mysql/src/Lowering/Account/LegacyGrantRule.php:86
- method-call SqlSemantics\Platform\MySql\Lowering\Account\LegacyGrantRule::grant() packages/sql-semantics-mysql/src/Lowering/Account/LegacyGrantRule.php:87
- method-call SqlSemantics\Platform\MySql\Lowering\Account\PasswordRule::password() packages/sql-semantics-mysql/src/Lowering/Account/PasswordRule.php:91
- method-call SqlSemantics\Platform\MySql\Lowering\Account\PasswordRule::password() packages/sql-semantics-mysql/src/Lowering/Account/PasswordRule.php:92
- method-call SqlSemantics\Platform\MySql\Lowering\Account\PasswordRule::password() packages/sql-semantics-mysql/src/Lowering/Account/PasswordRule.php:93
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserListRule::grant() packages/sql-semantics-mysql/src/Lowering/Account/UserListRule.php:205
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserListRule::grant() packages/sql-semantics-mysql/src/Lowering/Account/UserListRule.php:206
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:81
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:82
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:83
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:89
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:90
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:91
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:92
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:98
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:99
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:100
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::definition() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:103
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::alter() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:136
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::alter() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:137
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::alter() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:138
- method-call SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::alter() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:139