final class ColumnResolver
Restricted visibility: declared "@visibility SqlSemantics\Platform\Sqlite". Code outside that scope must not name this declaration.

Resolves a column name the way SQLite does.

Rule: SQLITE-COLUMN-LOOKUP-001. The lookup starts at the innermost query and moves outwards one query at a time. In a query, every input relation the qualifier admits is asked for the name; a relation answers with its first column of that name, an unqualified name skips the columns a USING or NATURAL join merged away, and a relation without such a column answers with its implicit column of that name. One answer resolves the name, more than one makes it ambiguous. With no answer, an unqualified name that is a result column alias of the query denotes that result column. A relation whose columns are not all known (an undeclared table, or a column of a subquery whose name follows an unexpanded star or is picked at random) that does not answer makes the outcome conditional on what is missing: the inputs of its open shape and those its unnamed columns depend on (LookupLevel::undecided()), or else the random name. A relation whose hidden list holds QUALIFIED_ONLY is reachable with a qualifier only (NEW, OLD, excluded). An environment that holds nothing but common tables is no query level. Terminates: the scopes form a finite chain. Source: https://sqlite.org/lang_expr.html#column_names, https://sqlite.org/lang_select.html. Status: Implemented.

Constants§

public const QUALIFIED_ONLY = -1

The hidden-list entry that marks a relation as reachable with a qualifier only.

Methods§

public function find(
    Environment $environment,
    Name $column,
    ?QualifiedName $qualifier = null,
): Resolution

Resolves a column name at a position.

Parameters

$environmentEnvironment
$columnName
$qualifier?QualifiedName

Returns

Test cases 5
Called from 7
Calls 8
public function admits(
    Environment $scope,
    VisibleRelation $relation,
    ?QualifiedName $qualifier,
): bool
public function match(
    Environment $scope,
    VisibleRelation $relation,
    Name $column,
    bool $merged,
    int $depth,
): ResolvedColumn|list<MissingInput>

Asks one relation for a column: the column found, or the inputs whose absence leaves the answer open (none when the relation certainly has no such column).

Parameters

$scopeEnvironment
$relationVisibleRelation
$columnName
$mergedbool
$depthint
Test cases 2
Called from 1
Calls 4

Test cases 11§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 8
Other tests reaching this symbol 3

Relations§

Instantiated in 8
Method calls 8
Constant reads 6