final class Frame
    implements Node
    uses Snapshot
Public API: explicitly declared with @visibility public.

The frame of a window: its unit, its boundaries and its exclusion.

The short form names the start only and ends at the current row; the BETWEEN form names both ends. The grammar admits UNBOUNDED PRECEDING only as a start and UNBOUNDED FOLLOWING only as an end. Source: https://sqlite.org/windowfunctions.html#frame_specifications.

Reading both ends of a framedoctest
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT sum(a) OVER (ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) FROM t');
    $query->statement->columns[0]->expression->over->frame->end->kind // => \SqlSemantics\Platform\Sqlite\Statement\Expression\Window\FrameBoundKind::CurrentRow
Refusing a start the grammar does not admitdoctest
new \SqlSemantics\Platform\Sqlite\Statement\Expression\Window\Frame(\SqlSemantics\Platform\Sqlite\Statement\Expression\Window\FrameUnit::Rows, new \SqlSemantics\Platform\Sqlite\Statement\Expression\Window\FrameBound(\SqlSemantics\Platform\Sqlite\Statement\Expression\Window\FrameBoundKind::UnboundedFollowing)) // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstruction
Refusing an end at unbounded precedingdoctest
new \SqlSemantics\Platform\Sqlite\Statement\Expression\Window\Frame(\SqlSemantics\Platform\Sqlite\Statement\Expression\Window\FrameUnit::Rows, new \SqlSemantics\Platform\Sqlite\Statement\Expression\Window\FrameBound(\SqlSemantics\Platform\Sqlite\Statement\Expression\Window\FrameBoundKind::CurrentRow), new \SqlSemantics\Platform\Sqlite\Statement\Expression\Window\FrameBound(\SqlSemantics\Platform\Sqlite\Statement\Expression\Window\FrameBoundKind::UnboundedPreceding)) // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstruction

Properties§

public FrameUnit $unit
public FrameBound $start
public FrameBound|null $end = null
public FrameExclusion|null $exclusion = null

Methods§

public function __construct(
    public FrameUnit $unit,
    public FrameBound $start,
    public FrameBound|null $end = null,
    public FrameExclusion|null $exclusion = null,
)

Parameters

$unitFrameUnitThe unit
$startFrameBoundThe start boundary
$endFrameBound|nullThe end boundary of the BETWEEN form
$exclusionFrameExclusion|nullThe written exclusion
Calls 3
public function render(Output $out): void

Writes the frame.

Parameters

$outOutput
Calls 3

Test cases 8§

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 7

Relations§

Instantiated in 2
Type declarations 2