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.

Holding the parts of TRIM(LEADING 'x' FROM a)doctest
$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 $subject
public TrimSide|null $side = null
public Scalar|null $removed = null

Methods§

public function __construct(
    public Scalar $subject,
    public TrimSide|null $side = null,
    public Scalar|null $removed = null,
)

Parameters

$subjectScalarThe string to trim
$sideTrimSide|nullThe side, when written
$removedScalar|nullThe string to remove, when written
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the operands; the result is a string.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the call in the form it was written.

Parameters

$outOutput
Test cases 1
Calls 2

Test cases 3§

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

Dedicated tests 2
Other tests reaching this symbol 1

Relations§

Instantiated in 1