classPathColumn
final class PathColumn
implements JsonTableColumn
uses Snapshot
Public API: explicitly declared with
@visibility public.A name type PATH path or name type EXISTS PATH path column of JSON_TABLE, with its ON EMPTY and ON ERROR responses.
Rule: MYSQL-JSON-TABLE-COLUMN-001 (path). The column has the declared type and is NULL when the path finds nothing and by default on an error; an EXISTS column is 1 or 0. The server accepts ON ERROR before ON EMPTY and warns that the order is deprecated, so the written order is kept. Terminates: the parts are strict parts. Source: https://dev.mysql.com/doc/refman/8.4/en/json-table-functions.html. Status: Implemented.
$column = new \SqlSemantics\Platform\MySql\Statement\Call\Json\PathColumn(new \SqlSemantics\Platform\MySql\Model\Statement\Identifier\Name('a'), new \SqlSemantics\Platform\MySql\Statement\Type\Integral(\SqlSemantics\Platform\MySql\Statement\Type\Kind\IntegralKind::Int), new \SqlSemantics\Platform\MySql\Statement\Literal\StringLiteral(['$.a']));
[$column->name->value, $column->type->name(), $column->exists] // => ['a', 'INT', false]new \SqlSemantics\Platform\MySql\Statement\Call\Json\PathColumn(new \SqlSemantics\Platform\MySql\Model\Statement\Identifier\Name('a'), new \SqlSemantics\Platform\MySql\Statement\Type\Integral(\SqlSemantics\Platform\MySql\Statement\Type\Kind\IntegralKind::Int), new \SqlSemantics\Platform\MySql\Statement\Literal\StringLiteral(['$.a']), errorFirst: true) // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\InvalidConstructionProperties§
public Name $namepublic TypeName $typepublic StringLiteral $pathpublic bool $exists = falsepublic CollationName|null $collation = nullpublic JsonResponse|null $onEmpty = nullpublic JsonResponse|null $onError = nullpublic bool $errorFirst = falseMethods§
public function __construct(
public Name $name,
public TypeName $type,
public StringLiteral $path,
public bool $exists = false,
public CollationName|null $collation = null,
public JsonResponse|null $onEmpty = null,
public JsonResponse|null $onError = null,
public bool $errorFirst = false,
)Parameters
$name | Name | The column name |
$type | TypeName | The declared type |
$path | StringLiteral | The path |
$exists | bool | Whether the column is an EXISTS column |
$collation | CollationName|null | The written collation |
$onEmpty | JsonResponse|null | The ON EMPTY response |
$onError | JsonResponse|null | The ON ERROR response |
$errorFirst | bool | Whether ON ERROR is written before ON EMPTY |
Calls 1
- static-call Check::input() line 65
public function deriveColumns(
Derivation $derivation,
Environment $environment,
): list<OutputSlot>Derives the path and the defaults and answers the column.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
list<OutputSlot>Test cases 1
Calls 5
- method-call Arguments::one() line 75
- new Arguments line 75
- new OutputSlot line 82
- new Known line 82
- class-const Nullability::Nullable() line 82
public function render(Output $out): voidWrites the column.
Parameters
$out | Output |
Test cases 1
Calls 5
- method-call Output::name() line 90
- class-const NameUse::Column() line 90
- method-call Output::keyword() line 92
- function-call
array_reverseline 99 - method-call Output::node() line 101
Test cases 4§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.