classFrame
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.
$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::CurrentRownew \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\InvalidConstructionnew \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\InvalidConstructionProperties§
public FrameUnit $unitpublic FrameBound $startpublic FrameBound|null $end = nullpublic FrameExclusion|null $exclusion = nullMethods§
public function __construct(
public FrameUnit $unit,
public FrameBound $start,
public FrameBound|null $end = null,
public FrameExclusion|null $exclusion = null,
)Parameters
$unit | FrameUnit | The unit |
$start | FrameBound | The start boundary |
$end | FrameBound|null | The end boundary of the BETWEEN form |
$exclusion | FrameExclusion|null | The written exclusion |
Calls 3
- static-call Check::input() line 41
- class-const FrameBoundKind::UnboundedFollowing() line 41
- class-const FrameBoundKind::UnboundedPreceding() line 42
public function render(Output $out): voidWrites the frame.
Parameters
$out | Output |
Calls 3
- method-call Output::keyword() line 50
- method-call Output::node() line 52
- function-call
explodeline 57
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
WindowRuleTest::testBoundLowersEveryBoundaryKindWithItsOffsetcallsWindowRuleTest::testExclusionLowersEachExclusionAndNullWithoutItcallsWindowRuleTest::testFrameLowersAStartOnlyFrameAndABetweenFrameOfEveryUnitcallsFunctionCallTest::testRenderWritesANewlyBuiltCallcallsFrameBoundTest::testRenderWritesANewlyBuiltBoundarycallsWindowSpecTest::testExpressionsIsEmptyForAnEmptyWindowcallsWindowSpecTest::testRenderWritesANewlyBuiltSpecificationcalls