final class FunctionCall
    implements Scalar
    uses Snapshot
Public API: explicitly declared with @visibility public.

A call of a scalar, aggregate or window function.

Rule: SQLITE-FUNCTION-CALL-001. The arguments, the ordering of aggregate arguments, the filter and the window are derived at the position of the call. The result facts are those of SQLITE-FUNCTION-RESULT-001: a built-in function has its documented result; a wrong number of arguments is reported; any other name depends on the undeclared routine. The star form passes no argument. A clause the kind of function does not take is reported by SQLITE-CALL-CLAUSE-001. Source: https://sqlite.org/lang_expr.html#functions, https://sqlite.org/lang_aggfunc.html, https://sqlite.org/windowfunctions.html. Status: Implemented.

Reading the parts of an aggregate calldoctest
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT count(DISTINCT a) FILTER (WHERE b > 0) FROM t');
    $call = $query->statement->columns[0]->expression;
    [$call->name->value, $call->quantifier, count($call->arguments), $call->filter !== null, $query->field(0)->nullability] // => ['count', \SqlSemantics\Platform\Sqlite\Statement\Query\SetQuantifier::Distinct, 1, true, \SqlSemantics\Platform\Sqlite\Model\Statement\Type\Nullability::NotNull]
Refusing arguments next to the stardoctest
new \SqlSemantics\Platform\Sqlite\Statement\Expression\FunctionCall(new \SqlSemantics\Platform\Sqlite\Model\Statement\Identifier\Name('count'), [new \SqlSemantics\Platform\Sqlite\Statement\Expression\Literal\NullLiteral()], true) // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstruction
Refusing a quantifier next to the stardoctest
new \SqlSemantics\Platform\Sqlite\Statement\Expression\FunctionCall(new \SqlSemantics\Platform\Sqlite\Model\Statement\Identifier\Name('count'), [], true, \SqlSemantics\Platform\Sqlite\Statement\Query\SetQuantifier::Distinct) // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstruction

Properties§

public list<Scalar> $arguments
public list<SortTerm> $order
public Name $name
public bool $star = false
public SetQuantifier|null $quantifier = null
public Scalar|null $filter = null
public WindowSpec|Name|null $over = null

Methods§

public function __construct(
    public Name $name,
    list<Scalar> $arguments = [],
    public bool $star = false,
    public SetQuantifier|null $quantifier = null,
    list<SortTerm> $order = [],
    public Scalar|null $filter = null,
    public WindowSpec|Name|null $over = null,
)

Parameters

$nameNameThe function name
$argumentslist<Scalar>The arguments in order
$starboolWhether the argument list is the star
$quantifierSetQuantifier|nullThe written DISTINCT or ALL
$orderlist<SortTerm>The ordering written inside the argument list
$filterScalar|nullThe FILTER predicate
$overWindowSpec|Name|nullThe window written after OVER: a specification or a window name
Calls 4
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives every part of the call and the result of the function.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

Calls 6
public function render(Output $out): void

Writes the call.

Parameters

$outOutput
Calls 6

Test cases 32§

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 29

Relations§

Instantiated in 6
Constant reads 1
Type checks 3
Type declarations 2