classConcatenation
final class Concatenation
implements Scalar
uses Snapshot
@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.
$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 // => trueProperties§
public Scalar $leftpublic Scalar $rightMethods§
public function __construct(public Scalar $left, public Scalar $right)Parameters
$left | Scalar | The left operand |
$right | Scalar | The right operand |
Calls 5
- new Precedence line 47
- static-call Check::input() line 48
- method-call Precedence::fits() line 48
- class-const Precedence::SIMPLE_EXPR() line 48
- method-call Precedence::opening() line 49
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives both operands and the string type of the result.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 7
- static-call Check::input() line 57
- new Operands line 58
- method-call Operands::single() line 59
- method-call Derivation::scalar() line 59
- new ScalarFact line 62
- method-call StringResult::concatenation() line 62
- new StringResult line 62
public function render(Output $out): voidWrites the operands around ||.
Parameters
$out | Output |
Test cases 2
Calls 1
- method-call Output::node() line 70
Test cases 8§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.