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

A pattern match: x [NOT] LIKE pattern [ESCAPE c] (Item_func_like).

The operand is a bit_expr; the pattern and the escape character are simple_expr (MYSQL-PRECEDENCE-001). Without ESCAPE the escape character is the backslash, or none under NO_BACKSLASH_ESCAPES; that default is not written.

Rule: MYSQL-LIKE-001. Facts: 1, 0 or NULL, an integer; it can be NULL when an operand can. Every operand takes a single value. Terminates: the operands are strict parts. Source: https://dev.mysql.com/doc/refman/8.4/en/string-comparison-functions.html#operator_like. Status: Implemented.

Reading the escape characterdoctest
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("SELECT a FROM t WHERE a LIKE 'x!%' ESCAPE '!'");
    $query->statement->where->escape->value() // => '!'

Properties§

public Scalar $operand
public Scalar $pattern
public Scalar|null $escape = null
public bool $negated = false

Methods§

public function __construct(
    public Scalar $operand,
    public Scalar $pattern,
    public Scalar|null $escape = null,
    public bool $negated = false,
)

Parameters

$operandScalarThe matched expression
$patternScalarThe pattern
$escapeScalar|nullThe escape character, when ESCAPE is written
$negatedboolWhether NOT is written before LIKE
Calls 7
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the operands and combines their NULL facts.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the operand, the optional NOT, LIKE, the pattern and the escape clause.

Parameters

$outOutput
Test cases 1
Calls 2

Test cases 5§

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

Dedicated tests 3
Other tests reaching this symbol 2

Relations§

Instantiated in 3
Type checks 1