final class Concatenation
    implements Scalar
    uses Snapshot
Public API: explicitly declared with @visibility public.

The string concatenation a || b of the PIPES_AS_CONCAT mode (Item_func_concat).

Without PIPES_AS_CONCAT || is a synonym of OR, so this form exists only under that mode and is rejected by the derivation otherwise. It is the weakest operator of the simple_expr level and associates to the left.

Rule: MYSQL-CONCATENATION-001. Facts: a VARCHAR, or a VARBINARY when an operand is a binary string (MYSQL-STRING-RESULT-001); NULL when an operand is. Terminates: the operands are strict parts. Source: https://dev.mysql.com/doc/refman/8.4/en/sql-mode.html#sqlmode_pipes_as_concat, https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_concat. Status: Implemented.

Concatenating under PIPES_AS_CONCATdoctest
$semantics = new \SqlSemantics\Platform\MySql\Semantics(null, \SqlSemantics\Platform\MySql\Mode::fromString('PIPES_AS_CONCAT'));
    $semantics->analyze("SELECT a FROM t WHERE a || 'x'")->statement->where instanceof \SqlSemantics\Platform\MySql\Statement\Expression\Operator\Concatenation // => true

Properties§

public Scalar $left
public Scalar $right

Methods§

public function __construct(public Scalar $left, public Scalar $right)

Parameters

$leftScalarThe left operand
$rightScalarThe right operand
Calls 5
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives both operands and the string type of the result.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the operands around ||.

Parameters

$outOutput
Test cases 2
Calls 1

Test cases 8§

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

Dedicated tests 4
Other tests reaching this symbol 4

Relations§

Instantiated in 1
Type checks 1