classKeywordCall
final class KeywordCall
implements Scalar, OutputNaming
uses Snapshot
@visibility public.A call of substring, overlay or json_object spelled with the keyword and plain arguments.
The server builds a plain FuncCall. Rule: PG-KEYWORD-CALL-001. Facts: those of the call (PG-CALL-RESULT-001): substring and overlay are searched along the path, json_object in pg_catalog alone; named arguments are left to the routine. JSON_OBJECT takes at least one argument. Source: https://www.postgresql.org/docs/17/functions-string.html, https://www.postgresql.org/docs/17/functions-json.html. Status: Implemented.
$call = new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Syntax\KeywordCall(\SqlSemantics\Platform\PostgreSql\Statement\Invocation\Syntax\KeywordFunction::Substring, []);
[$call->function->value, $call->outputName()->value] // => ['SUBSTRING', 'substring']new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Syntax\KeywordCall(\SqlSemantics\Platform\PostgreSql\Statement\Invocation\Syntax\KeywordFunction::JsonObject, []) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstructionProperties§
public list<Argument> $argumentspublic KeywordFunction $functionMethods§
public function __construct(public KeywordFunction $function, list<Argument> $arguments)Parameters
$function | KeywordFunction | The function |
$arguments | list<Argument> | The arguments in order |
Calls 3
- static-call Check::listOf() line 56
- class-const Argument::class() line 56
- class-const KeywordFunction::JsonObject() line 56
public function outputName(): NameNames an unaliased result column after the function.
Returns
Test cases 1
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the arguments and the result of the call.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 13
- method-call Derivation::scalar() line 75
- method-call CallChecks::arguments() line 78
- new CallChecks line 78
- function-call
strtolowerline 79 - method-call KeywordFunction::catalogOnly() line 81
- new Name line 81
- new ScalarFact line 83
- new Dependent line 83
- new UndeclaredRoutine line 83
- new QualifiedName line 83
- class-const Nullability::Dependent() line 83
- method-call CallTyping::catalog() line 86
- new CallTyping line 86
public function render(Output $out): voidWrites the keyword and the arguments in parentheses.
Parameters
$out | Output |
Test cases 1
Calls 1
- method-call Output::keyword() line 94
Test cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
KeywordCallTest::testDeriveScalarLeavesNamedArgumentsToTheRoutinecallsKeywordCallTest::testDeriveScalarSearchesThePathForSubstringcallsKeywordCallTest::testOutputNameIsTheFunctionNamecallsKeywordCallTest::testRejectsJsonObjectWithoutArgumentscallsKeywordCallTest::testRenderWritesTheKeywordAndTheArgumentscalls
Relations§
Instantiated in 3
- new SqlSemantics\Platform\PostgreSql\Lowering\Invocation\JsonRule::creation() packages/sql-semantics-postgres/src/Lowering/Invocation/JsonRule.php:99
- new SqlSemantics\Platform\PostgreSql\Lowering\Invocation\TextRule::expression() packages/sql-semantics-postgres/src/Lowering/Invocation/TextRule.php:84
- new SqlSemantics\Platform\PostgreSql\Lowering\Invocation\TextRule::expression() packages/sql-semantics-postgres/src/Lowering/Invocation/TextRule.php:87