final class Field
    uses Snapshot
Public API: explicitly declared with @visibility public.

One output field of a query, with the facts the operation derived for it.

A field belongs to the operation that derived it. It is a reading result, not an input for building another query.

Reading a fielddoctest
$semantics = new \SqlSemantics\Platform\Sqlite\Semantics();
    $table = $semantics->analyze('CREATE TABLE t (a INTEGER)');
    $field = $semantics->analyze('SELECT a AS x FROM t', [$table])->field('x');
    [$field->position, $field->name?->value, $field->column()?->name->value] // => [0, 'x', 'a']

Properties§

public Name|null $name
public TypeFact $type
public Nullability $nullability
public int $position
public OutputSlot $slot
public Scalar|null $expression = null
public Resolution|null $resolution = null

Methods§

public function __construct(
    public int $position,
    public OutputSlot $slot,
    public Scalar|null $expression = null,
    public Resolution|null $resolution = null,
)

Parameters

$positionintThe zero-based output position
$slotOutputSlotThe output position with its name and facts
$expressionScalar|nullThe expression that computes the field; null when no single expression does, as for a set operation
$resolutionResolution|nullThe name resolution when the expression is a direct name use
public function column(): ?Column

Answers the declared column the field directly returns, when it is one.

Returns

Calls 1

Test cases 61§

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

Dedicated tests 1
Other tests reaching this symbol 60

Relations§

Instantiated in 6
Constant reads 3
Type checks 12
Type declarations 9