final class JsonBehaviorClause
    implements Clause
    uses Snapshot
Public API: explicitly declared with @visibility public.

behavior ON EMPTY and behavior ON ERROR of an SQL/JSON function or JSON_TABLE column.

Source: https://www.postgresql.org/docs/17/functions-json.html#FUNCTIONS-SQLJSON-QUERYING.

Reading an ON ERROR behaviordoctest
$clause = new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\Query\JsonBehaviorClause(null, new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\Query\JsonBehavior(\SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\Query\JsonBehaviorKind::Error));
    [$clause->onEmpty, $clause->onError->kind->value] // => [null, 'ERROR']
Rejecting a clause without a behaviordoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Json\Query\JsonBehaviorClause(null, null) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public JsonBehavior|null $onEmpty
public JsonBehavior|null $onError

Methods§

public function __construct(
    public JsonBehavior|null $onEmpty,
    public JsonBehavior|null $onError,
)

Parameters

$onEmptyJsonBehavior|nullThe behavior when the path finds nothing
$onErrorJsonBehavior|nullThe behavior when an error occurs
Calls 1
public function deriveClause(Derivation $derivation, Environment $environment): void

Derives the default expressions.

Parameters

$derivationDerivation
$environmentEnvironment
Test cases 1
public function render(Output $out): void

Writes the behaviors with ON EMPTY and ON ERROR.

Parameters

$outOutput
Test cases 1
Calls 1

Test cases 6§

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 3

Relations§

Instantiated in 3
Type checks 1
Type declarations 4