classTrim
final class Trim
implements Scalar
uses Snapshot
Public API: explicitly declared with
@visibility public.A call of TRIM(): a string without the leading, trailing or both occurrences of a removed string, by default spaces.
Rule: MYSQL-TRIM-CALL-001. The result is a string in the character set of the arguments and is NULL when an argument is. The eight written forms are kept: with or without a side, with or without the removed string. Without a side and a removed string there is no FROM. Terminates: the operands are strict parts. Source: https://dev.mysql.com/doc/refman/8.4/en/string-functions.html#function_trim. Status: Implemented.
$trim = new \SqlSemantics\Platform\MySql\Statement\Call\Trim(new \SqlSemantics\Platform\MySql\Statement\Name\ColumnUse(new \SqlSemantics\Platform\MySql\Model\Statement\Identifier\Name('a')), \SqlSemantics\Platform\MySql\Statement\Call\TrimSide::Leading, new \SqlSemantics\Platform\MySql\Statement\Literal\StringLiteral(['x']));
[$trim->side, $trim->removed !== null] // => [\SqlSemantics\Platform\MySql\Statement\Call\TrimSide::Leading, true]Properties§
public Scalar $subjectpublic TrimSide|null $side = nullpublic Scalar|null $removed = nullMethods§
public function __construct(
public Scalar $subject,
public TrimSide|null $side = null,
public Scalar|null $removed = null,
)Parameters
$subject | Scalar | The string to trim |
$side | TrimSide|null | The side, when written |
$removed | Scalar|null | The string to remove, when written |
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operands; the result is a string.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 4
- method-call Arguments::one() line 52
- new Arguments line 52
- method-call ResultTyping::fact() line 56
- new ResultTyping line 56
public function render(Output $out): voidWrites the call in the form it was written.
Parameters
$out | Output |
Test cases 1
Calls 2
- method-call Output::keyword() line 64
- method-call Output::node() line 68
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.