classFunctionCall
final class FunctionCall
implements Scalar
uses Snapshot
@visibility public.A call written as name(...) or db.name(...): a native function reached by name, a loadable function or a stored function.
The server mirrors this as PTI_function_call_generic_ident_sys and PTI_function_call_generic_2d. Only the unqualified form takes argument aliases. The facts follow MYSQL-ROUTINE-CALL-001. The name is written against its parenthesis, because a name followed by a space is a column unless IGNORE_SPACE is set. Source: https://dev.mysql.com/doc/refman/8.4/en/function-resolution.html. Status: Implemented.
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("SELECT concat('a', 'b')");
$query->field(0)->type->descriptor->name() // => 'VARCHAR'$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('SELECT db.score(1)');
$query->field(0)->type->missing[0]->describe() // => 'the signature of routine score'new \SqlSemantics\Platform\MySql\Statement\Call\FunctionCall(new \SqlSemantics\Platform\MySql\Model\Statement\Identifier\Name('f'), [new \SqlSemantics\Platform\MySql\Statement\Call\CallArgument(new \SqlSemantics\Platform\MySql\Statement\Literal\NullLiteral(), new \SqlSemantics\Platform\MySql\Model\Statement\Identifier\Name('x'))], new \SqlSemantics\Platform\MySql\Model\Statement\Identifier\Name('db')) // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\InvalidConstructionProperties§
public list<CallArgument> $argumentspublic Name $namepublic Name|null $schema = nullMethods§
public function __construct(
public Name $name,
list<CallArgument> $arguments = [],
public Name|null $schema = null,
)Parameters
$name | Name | The function name |
$arguments | list<CallArgument> | The arguments in order |
$schema | Name|null | The database of a qualified call |
Calls 4
- static-call Check::listOf() line 56
- class-const CallArgument::class() line 56
- static-call Check::input() line 57
- method-call FunctionCall::named() line 57
public function named(): boolTells whether an argument has an alias.
Returns
boolTest cases 1
Called from 3
- method-call SqlSemantics\Platform\MySql\Rules\Call\RoutineCalls::result() packages/sql-semantics-mysql/src/Rules/Call/RoutineCalls.php:52
- method-call SqlSemantics\Platform\MySql\Rules\Call\RoutineCalls::result() packages/sql-semantics-mysql/src/Rules/Call/RoutineCalls.php:54
- method-call SqlSemantics\Platform\MySql\Statement\Call\FunctionCall::__construct() packages/sql-semantics-mysql/src/Statement/Call/FunctionCall.php:57
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the arguments and the result of the called function.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 4
- method-call Arguments::one() line 81
- new Arguments line 81
- method-call RoutineCalls::result() line 84
- new RoutineCalls line 84
public function render(Output $out): voidWrites the call with the name against its parenthesis.
Parameters
$out | Output |
Test cases 2
Calls 3
- method-call Output::name() line 93
- class-const NameUse::Qualifier() line 93
- class-const NameUse::Routine() line 95
Test cases 11§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
FunctionCallTest::testDeriveScalarDependsOnAStoredFunctioncallsFunctionCallTest::testDeriveScalarTypesANativeFunctioncallsFunctionCallTest::testNamedTellsWhetherAnArgumentHasAnAliascallsFunctionCallTest::testRenderGluesTheNameToItsParenthesiscallsFunctionCallTest::testRenderQuotesAKeywordNamecalls
Other tests reaching this symbol 6
FunctionRuleTest::testCallLowersKeywordAndGenericCallscallsRoutineCallsTest::testResultDependsOnAStoredOrLoadableFunctioncallsRoutineCallsTest::testResultReportsWhatTheServerRejectscallsRoutineCallsTest::testResultTypesANativeFunctioncallsItemNamingTest::testCanonicalAnswersTheRenderedTextcallsItemNamingTest::testConstantSpellsTheNameArgumentOfNameConstcalls