classNamesExpression
final class NamesExpression
implements SetItem
uses Snapshot
@visibility public.NAMES = expr in a SET of MySQL 5.6 and 5.7, which the grammar reads and the server refuses.
Rule: MYSQL-SET-NAMES-002. The grammar of MySQL 5.x has the production so that a stored program variable named names can be reported: the server raises ER_SP_BAD_VAR_SHADOW when the enclosing program declares a variable names and a syntax error otherwise; SET NAMES takes a character set name (SetNames). The expression is derived at a position that sees no relation. Diagnostics: UtilityRule::NamesExpression. Terminates: the value is a strict subtree. Source: https://dev.mysql.com/doc/refman/5.7/en/set-names.html, the NAMES_SYM equal expr action of sql/sql_yacc.yy (5.7). Status: Implemented.
(new \SqlSemantics\Platform\MySql\Semantics('mysql-5.7.44'))->analyze("SET NAMES = 'utf8'") // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\SemanticException: SET NAMES takes a character set name, not an expressionProperties§
public Scalar $valueMethods§
public function __construct(public Scalar $value)Parameters
$value | Scalar | The expression written after the equals sign |
public function deriveItem(Derivation $derivation): voidDerives the expression and reports the refusal.
Parameters
$derivation | Derivation |
Calls 5
- method-call Derivation::scalar() line 48
- method-call Derivation::environment() line 48
- method-call Derivation::report() line 49
- new UtilityMisuse line 49
- class-const UtilityRule::NamesExpression() line 49
public function render(Output $out): voidWrites NAMES, an equals sign and the expression.
Parameters
$out | Output |
Calls 1
- method-call Output::keyword() line 57
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.