classFunctions
final class Functions
The result facts of the built-in SQL functions of SQLite.
Rule: SQLITE-FUNCTION-RESULT-001. The table lists the core, aggregate, window, date and time, and JSON functions of the manual with the number of arguments each accepts, the storage classes of its result and its NULL rule. Result codes: I, R, T, B name storage classes and combine (IR is INTEGER or REAL); * is any class; 1 is the class of the first argument; + is the class of any argument; 2 is the class of any argument after the first; L is the class of the first or third argument. NULL codes: N never NULL; P NULL exactly when an argument can be NULL; C NULL only when every argument can be; F NULL when the first argument can be; Y possibly NULL. Kind codes: s scalar, a aggregate (also usable as a window function), w window only. A function that takes one argument as an aggregate and more as a scalar has both rows. A name outside the table is an application-defined or extension routine: its result depends on the undeclared routine. Source: https://sqlite.org/lang_corefunc.html, https://sqlite.org/lang_aggfunc.html, https://sqlite.org/windowfunctions.html#biwinfunc, https://sqlite.org/lang_datefunc.html, https://sqlite.org/json1.html. Status: Implemented.
Methods§
public function row(string $name, int $arguments): array{int, int, string, string, string}|nullAnswers the table row of a call, or null when the name is no built-in function or accepts no such argument count.
Parameters
$name | string | |
$arguments | int |
Returns
array{int, int, string, string, string}|nullTest cases 2
Called from 3
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\CallChecks::report() packages/sql-semantics-sqlite/src/Rules/Typing/CallChecks.php:36
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Functions::aggregates() packages/sql-semantics-sqlite/src/Rules/Typing/Functions.php:174
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\Functions::result() packages/sql-semantics-sqlite/src/Rules/Typing/Functions.php:184
Calls 2
- class-const Functions::TABLE() line 160
- class-const Comparison::AsciiInsensitive() line 160
public function aggregates(string $name, int $arguments): boolTells whether a call computes one value from many rows: a built-in aggregate called without a window.
Parameters
$name | string | |
$arguments | int |
Returns
boolCalled from 1
Calls 1
- method-call Functions::row() line 174
public function result(Name $name, list<ScalarFact> $arguments): ScalarFactAnswers the facts of the result of a call from the facts of its arguments.
Parameters
$name | Name | |
$arguments | list<ScalarFact> |
Returns
Test cases 4
Called from 1
Calls 17
- method-call Functions::row() line 184
- function-call
countline 184 - class-const Functions::TABLE() line 186
- class-const Comparison::AsciiInsensitive() line 186
- new ScalarFact line 187
- new Invalid line 187
- new WrongArgumentCount line 187
- class-const Nullability::Dependent() line 187
- new Dependent line 190
- new UndeclaredRoutine line 190
- new QualifiedName line 190
- function-call
str_splitline 203 - class-const Functions::CLASSES() line 204
- method-call Storages::either() line 209
- new Storages line 209
- method-call Storages::fact() line 209
- method-call Functions::nullability() line 209
public function nullability(string $code, list<Nullability> $arguments): NullabilityAnswers the NULL fact a NULL code gives for the NULL facts of the arguments.
Parameters
$code | string | |
$arguments | list<Nullability> |
Returns
Test cases 4
Called from 1
Calls 2
- class-const Nullability::NotNull() line 220
- class-const Nullability::Nullable() line 220
Private surface 2§
Implementation details, listed for orientation only.
private const TABLE = ['abs' => [[1, 1, 'IR', 'P', 's']], 'changes' => [[0, 0, 'I', 'N', 's']], 'char…private const CLASSES = ['I' => \SqlSemantics\Platform\Sqlite\Statement\Type\Storage::Integer, 'R' => \…Test cases 11§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 11
FunctionsTest::testAggregatesHoldsForABuiltInAggregateCalledWithItsArgumentscallsFunctionsTest::testNullabilityFollowsTheFirstArgumentForTheCodeFcallsFunctionsTest::testNullabilityIsNotNullWhenAnyArgumentIsForTheCodeCcallsFunctionsTest::testNullabilityOfTheFixedCodesIgnoresTheArgumentscallsFunctionsTest::testNullabilityPropagatesEveryArgumentForTheCodePcallsFunctionsTest::testResultDependsOnAnUndeclaredRoutinecallsFunctionsTest::testResultFollowsTheResultCodeOfTheRowcallsFunctionsTest::testResultIsInvalidForAWrongArgumentCountcallsFunctionsTest::testResultUnitesTheClassesOfTheArgumentsTheCodeSelectscallsFunctionsTest::testRowFindsTheRowForTheArgumentCountCaseInsensitivelycallsFunctionsTest::testRowIsNullForAnUnknownNameOrArgumentCountcalls
Relations§
Instantiated in 3
- new SqlSemantics\Platform\Sqlite\Rules\Query\Aggregation::aggregates() packages/sql-semantics-sqlite/src/Rules/Query/Aggregation.php:37
- new SqlSemantics\Platform\Sqlite\Rules\Typing\CallChecks::report() packages/sql-semantics-sqlite/src/Rules/Typing/CallChecks.php:36
- new SqlSemantics\Platform\Sqlite\Statement\Expression\FunctionCall::deriveScalar() packages/sql-semantics-sqlite/src/Statement/Expression/FunctionCall.php:103
Method calls 3
- method-call SqlSemantics\Platform\Sqlite\Rules\Query\Aggregation::aggregates() packages/sql-semantics-sqlite/src/Rules/Query/Aggregation.php:40
- method-call SqlSemantics\Platform\Sqlite\Rules\Typing\CallChecks::report() packages/sql-semantics-sqlite/src/Rules/Typing/CallChecks.php:36
- method-call SqlSemantics\Platform\Sqlite\Statement\Expression\FunctionCall::deriveScalar() packages/sql-semantics-sqlite/src/Statement/Expression/FunctionCall.php:103