classRoleSelection
final class RoleSelection
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.The roles SET ROLE, a DEFAULT ROLE clause or GRANT … AS … WITH ROLE select: role, …, NONE, DEFAULT or ALL [EXCEPT role, …].
The roles are the named ones for Named and the excepted ones for All. Source: https://dev.mysql.com/doc/refman/8.4/en/set-role.html, https://dev.mysql.com/doc/refman/8.4/en/set-default-role.html.
$selection = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('SET ROLE ALL EXCEPT r')->statement->roles;
[$selection->set, $selection->roles[0]->user->value] // => [\SqlSemantics\Platform\MySql\Statement\Account\User\RoleSet::All, 'r']Properties§
public list<AccountName> $rolespublic RoleSet $setMethods§
public function __construct(public RoleSet $set, list<AccountName> $roles = [])Parameters
$set | RoleSet | Which roles are selected |
$roles | list<AccountName> | The named roles (at least one), or the roles EXCEPT names; none otherwise |
Calls 7
- static-call Check::listOf() line 40
- class-const AccountName::class() line 40
- static-call Check::input() line 41
- class-const RoleSet::Named() line 42
- class-const RoleSet::All() line 43
- class-const RoleSet::None() line 44
- class-const RoleSet::Default() line 44
public function render(Output $out): voidWrites the selection.
Parameters
$out | Output |
Calls 6
- class-const RoleSet::Named() line 54
- method-call Output::list() line 54
- class-const RoleSet::None() line 55
- method-call Output::keyword() line 55
- class-const RoleSet::Default() line 56
- class-const RoleSet::All() line 57
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
RoleSelectionTestcalls
Relations§
Instantiated in 14
- new SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::statement() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:53
- new SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::statement() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:54
- new SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::statement() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:55
- new SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::statement() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:56
- new SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::statement() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:57
- new SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::statement() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:58
- new SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::statement() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:59
- new SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::withRoles() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:115
- new SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::withRoles() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:116
- new SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::withRoles() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:117
- new SqlSemantics\Platform\MySql\Lowering\Account\RoleRule::withRoles() packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:118
- new SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::alter() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:151
- new SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::alter() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:152
- new SqlSemantics\Platform\MySql\Lowering\Account\UserStatementRule::alter() packages/sql-semantics-mysql/src/Lowering/Account/UserStatementRule.php:156
Type declarations 5
- type SqlSemantics\Platform\MySql\Lowering\Account\RoleRule packages/sql-semantics-mysql/src/Lowering/Account/RoleRule.php:109
- type SqlSemantics\Platform\MySql\Statement\Account\AlterDefaultRole packages/sql-semantics-mysql/src/Statement/Account/AlterDefaultRole.php:35
- type SqlSemantics\Platform\MySql\Statement\Account\Privilege\GrantAs packages/sql-semantics-mysql/src/Statement/Account/Privilege/GrantAs.php:32
- type SqlSemantics\Platform\MySql\Statement\Account\SetDefaultRole packages/sql-semantics-mysql/src/Statement/Account/SetDefaultRole.php:41
- type SqlSemantics\Platform\MySql\Statement\Account\SetRole packages/sql-semantics-mysql/src/Statement/Account/SetRole.php:30