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

A JSON array membership test: value MEMBER OF (json_array) (Item_func_member_of, MySQL 8.0.17 and later).

The keyword OF is optional in the grammar and does not change the test; whether it is written is kept, since it is part of the text MySQL names an unaliased select list expression after. The value is a bit_expr and the array a simple_expr (MYSQL-PRECEDENCE-001).

Rule: MYSQL-MEMBER-OF-001. Facts: 1, 0 or NULL, an integer; it can be NULL when an operand can. Terminates: the operands are strict parts. Source: https://dev.mysql.com/doc/refman/8.4/en/json-search-functions.html#operator_member-of. Status: Implemented.

Keeping the optional OF as writtendoctest
(new \SqlSemantics\Platform\MySql\Semantics())->analyze('SELECT a FROM t WHERE 1 MEMBER (a)')->toString() // => 'SELECT a FROM t WHERE 1 MEMBER (a)'

Properties§

public Scalar $operand
public Scalar $array
public OptionalWords $of = OptionalWords::Written

Methods§

public function __construct(
    public Scalar $operand,
    public Scalar $array,
    public OptionalWords $of = OptionalWords::Written,
)

Parameters

$operandScalarThe value searched for
$arrayScalarThe JSON array searched
$ofOptionalWordsWhether the optional OF is written
Calls 8
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives both operands and combines their NULL facts; the test needs MySQL 8.0 or later.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the value, MEMBER, OF when it is written, and the array in parentheses.

Parameters

$outOutput
Test cases 1
Calls 4

Test cases 4§

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

Dedicated tests 4

Relations§

Instantiated in 1
Type checks 1
Type declarations 1