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\MySql\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

Called from 1
Calls 1

Test cases 27§

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

Other tests reaching this symbol 27

Relations§

Instantiated in 14
Method calls 1
Constant reads 4
Type checks 10
Type declarations 10