final class CreateRole
    implements Statement
    uses Snapshot
Public API: explicitly declared with @visibility public.

CREATE ROLE [IF NOT EXISTS] role, … (8.0+): a request to create roles, which are locked accounts.

Mirrors PT_create_role. Rule: MYSQL-CREATE-ROLE-001. Source: https://dev.mysql.com/doc/refman/8.4/en/create-role.html. Status: Implemented.

Creating rolesdoctest
(new \SqlSemantics\Platform\MySql\Semantics())->analyze("create role if not exists reader, 'writer'@'%'")->toString() // => 'CREATE ROLE IF NOT EXISTS reader, writer@`%`'

Properties§

public list<AccountName> $roles
public bool $ifNotExists

Methods§

public function __construct(public bool $ifNotExists, list<AccountName> $roles)

Parameters

$ifNotExistsboolWhether IF NOT EXISTS is written
$roleslist<AccountName>The roles in order; at least one
Calls 2
public function deriveStatement(Derivation $derivation): void

Derives nothing: the statement names no relation and no expression.

Parameters

$derivationDerivation
public function render(Output $out): void

Writes the request.

Parameters

$outOutput
Calls 2

Test cases 1§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1

Relations§

Instantiated in 1