final class PasswordAssignment
    implements SetItem
    uses Snapshot
Public API: explicitly declared with @visibility public.

A password assignment among other assignments of a MySQL 5.6 SET: SET @a = 1, PASSWORD FOR u = PASSWORD('x').

Rule: MYSQL-SET-PASSWORD-001. MySQL 5.6 reads PASSWORD [FOR user] = … as one item of the SET list; it assigns the password of the account, or of the current user without FOR, in order with the other items. A SET whose only item is a password is the account statement SET PASSWORD of the account family. Facts: none; the password is a literal or a hashing call the account family models. Terminates: the parts are leaves. Source: https://dev.mysql.com/doc/refman/5.6/en/set-password.html, https://dev.mysql.com/doc/refman/5.6/en/set-variable.html. Status: Implemented.

Reading a password item of a listdoctest
$set = (new \SqlSemantics\Platform\MySql\Semantics('mysql-5.6.51'))->analyze("SET @a = 1, PASSWORD FOR u = 'x'");
    [$set->statement->items[1]->user?->user->value, $set->toString()] // => ['u', "SET @a = 1, PASSWORD FOR u = 'x'"]

Properties§

public Password $password
public Account|null $user = null

Methods§

public function __construct(public Password $password, public Account|null $user = null)

Parameters

$passwordPasswordThe new password
$userAccount|nullThe account, or null for the current user
public function deriveItem(Derivation $derivation): void

Derives nothing: the parts are literals and account names.

Parameters

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

Writes PASSWORD, the account, an equals sign and the password.

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