classSystemAssignment
final class SystemAssignment
implements SetItem
uses Snapshot
@visibility public.An assignment to a system variable named with @@: SET @@GLOBAL.x = v, SET @@x = DEFAULT.
Rule: MYSQL-SET-ITEM-001 (system variables). The scope written inside @@ applies to this variable only; without one the session value is assigned. The variable is derived as a system variable reference, the value as an expression at a position that sees no relation; a keyword value (SetWord) has no facts, and a bare name value is its text (MYSQL-SET-WORD-001). Diagnostics: none, as the variables of the running server are not part of the context. Terminates: the parts are leaves. Source: https://dev.mysql.com/doc/refman/8.4/en/set-variable.html. Status: Implemented.
$set = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('SET @@PERSIST.max_connections = 10');
[$set->statement->items[0]->variable->scope, $set->toString()] // => [\SqlSemantics\Platform\MySql\Statement\Variable\VariableScope::Persist, 'SET @@PERSIST.max_connections = 10']Properties§
public SystemVariable $variablepublic Scalar|SetWord $valueMethods§
public function __construct(public SystemVariable $variable, public Scalar|SetWord $value)Parameters
$variable | SystemVariable | The assigned variable with the scope written inside `@@` |
$value | Scalar|SetWord | The value: an expression, or a keyword the grammar accepts there |
Calls 1
- static-call Check::input() line 43
public function deriveItem(Derivation $derivation): voidDerives the variable and the value.
Parameters
$derivation | Derivation |
Calls 4
- method-call Derivation::scalar() line 51
- method-call Derivation::environment() line 51
- method-call Operands::single() line 53
- new Operands line 53
public function render(Output $out): voidWrites the variable, an equals sign and the value.
Parameters
$out | Output |
Calls 2
- method-call Output::node() line 62
- method-call Output::keyword() line 64
Test cases 4§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.