classTableCall
final class TableCall
implements Relation
uses Snapshot
Public API: explicitly declared with
@visibility public.One occurrence of a table-valued function as query input: a name with arguments.
Rule: SQLITE-TABLE-CALL-001. The arguments are derived where the relations to the left of the call are visible. A name that is a declared relation or a common table has the shape of that relation; any other name is a table-valued function, whose columns come from a virtual table module the context does not declare, so the shape is open and names the undeclared routine. Source: https://sqlite.org/vtab.html#table_valued_functions. Status: Implemented.
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze("SELECT * FROM json_each('[1]') AS j", []);
[$query->statement->from->name->name->value, count($query->statement->from->arguments), $query->shape()->missing[0]->describe()] // => ['json_each', 1, 'the signature of routine json_each']Properties§
public list<Scalar> $argumentspublic QualifiedName $namepublic Name|null $alias = nullpublic bool $as = trueMethods§
public function __construct(
public QualifiedName $name,
list<Scalar> $arguments,
public Name|null $alias = null,
public bool $as = true,
)Parameters
$name | QualifiedName | The function name with its optional schema |
$arguments | list<Scalar> | The arguments in order |
$alias | Name|null | The correlation name |
$as | bool | Whether the keyword AS introduces the alias; SQLite names a column after the text of an expression, which includes it |
Throws
InvalidConstruction When AS is left out without an aliasCalls 3
- static-call Check::input() line 58
- static-call Check::listOf() line 59
- class-const Scalar::class() line 59
public function deriveRelation(Derivation $derivation, Environment $environment): RelationFactDerives the arguments and the shape of the occurrence.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 7
- method-call Derivation::scalar() line 68
- method-call Derivation::table() line 70
- method-call TableShapes::fact() line 72
- new TableShapes line 72
- new RelationFact line 75
- new RowShape line 75
- new UndeclaredRoutine line 75
public function render(Output $out): voidWrites the call and the correlation name.
Parameters
$out | Output |
Calls 5
- method-call Output::name() line 84
- class-const NameUse::Qualifier() line 84
- class-const NameUse::Routine() line 86
- method-call Output::keyword() line 89
- class-const NameUse::Alias() line 91
Test cases 6§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
Other tests reaching this symbol 2
Relations§
Instantiated in 1
Type checks 3
- instanceof SqlSemantics\Platform\Sqlite\Rules\Resolution\FromScope::open() packages/sql-semantics-sqlite/src/Rules/Resolution/FromScope.php:59
- instanceof SqlSemantics\Platform\Sqlite\Rules\Resolution\FromScope::open() packages/sql-semantics-sqlite/src/Rules/Resolution/FromScope.php:60
- instanceof SqlSemantics\Platform\Sqlite\Rules\Resolution\FromScope::open() packages/sql-semantics-sqlite/src/Rules/Resolution/FromScope.php:61