final class JsonResponse
    implements Node
    uses Snapshot
Public API: explicitly declared with @visibility public.

The response of an ON EMPTY or ON ERROR clause: raise an error, return NULL, or return a default literal.

The holder of the clause derives the default and writes ON EMPTY or ON ERROR. Source: https://dev.mysql.com/doc/refman/8.4/en/json-search-functions.html#function_json-value, https://dev.mysql.com/doc/refman/8.4/en/json-table-functions.html.

Holding a default responsedoctest
$response = new \SqlSemantics\Platform\MySql\Statement\Call\Json\JsonResponse(\SqlSemantics\Platform\MySql\Statement\Call\Json\JsonResponseKind::Default, new \SqlSemantics\Platform\MySql\Statement\Literal\NumberLiteral('0'));
    $response->default?->text // => '0'
Refusing a default without DEFAULTdoctest
new \SqlSemantics\Platform\MySql\Statement\Call\Json\JsonResponse(\SqlSemantics\Platform\MySql\Statement\Call\Json\JsonResponseKind::Null, new \SqlSemantics\Platform\MySql\Statement\Literal\NumberLiteral('0')) // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\InvalidConstruction

Properties§

public Scalar|null $default = null

Methods§

public function __construct(public JsonResponseKind $kind, public Scalar|null $default = null)

Parameters

$kindJsonResponseKindThe response
$defaultScalar|nullThe literal of DEFAULT; present exactly for DEFAULT
Calls 2
public function render(Output $out): void

Writes the response.

Parameters

$outOutput
Test cases 1
Calls 1

Test cases 5§

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

Dedicated tests 1
Other tests reaching this symbol 4

Relations§

Instantiated in 3
Type declarations 5