final class NamesExpression
    implements SetItem
    uses Snapshot
Public API: explicitly declared with @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.

Reading the refusaldoctest
(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 expression

Properties§

public Scalar $value

Methods§

public function __construct(public Scalar $value)

Parameters

$valueScalarThe expression written after the equals sign
public function deriveItem(Derivation $derivation): void

Derives the expression and reports the refusal.

Parameters

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

Writes NAMES, an equals sign and the expression.

Parameters

$outOutput
Calls 1

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