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

SHOW GRANTS: the GRANT statements that reproduce the privileges of an account or role.

Rule: MYSQL-SHOW-GRANTS-001. One column, named Grants for user@host after the account written (host % when none is written). Without FOR, or with FOR CURRENT_USER, the account is the current user of the session, so the column name depends on it and the shape is open. USING (8.0 and later) names roles whose privileges are shown as granted to the account. Terminates: a fixed layout. Source: https://dev.mysql.com/doc/refman/8.4/en/show-grants.html. Status: Implemented.

Reading the column named after the accountdoctest
$show = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("SHOW GRANTS FOR 'u'@'localhost' USING r");
    [$show->field(0)->name?->value, $show->toString()] // => ['Grants for u@localhost', 'SHOW GRANTS FOR u@localhost USING r']

Properties§

public list<Account> $using
public Account|null $user = null

Methods§

public function __construct(public Account|null $user = null, list<Account> $using = [])

Parameters

$userAccount|nullThe account or role after FOR; null when FOR is not written
$usinglist<Account>The roles of USING in order; only with an account
Calls 3
public function deriveStatement(Derivation $derivation): void

Derives the rows.

Parameters

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

Writes the statement.

Parameters

$outOutput
Calls 1

Test cases 2§

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

Dedicated tests 2

Relations§

Instantiated in 5