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

A temporal interval: INTERVAL quantity unit, the operand of interval arithmetic and of DATE_ADD and DATE_SUB.

An interval is not a value of its own; the expression that holds it derives the quantity. The quantity is enclosed between INTERVAL and the unit, so it may be any expression. Source: https://dev.mysql.com/doc/refman/8.4/en/expressions.html#temporal-intervals.

Reading the quantity and the unitdoctest
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('SELECT a FROM t WHERE a + INTERVAL 2 DAY_HOUR');
    [$query->statement->where->interval->quantity->text, $query->statement->where->interval->unit->value] // => ['2', 'DAY_HOUR']

Properties§

public Scalar $quantity

Methods§

public function __construct(public Scalar $quantity, public IntervalUnit $unit)

Parameters

$quantityScalarThe number of units, or the formatted string of a compound unit
$unitIntervalUnitThe unit
public function render(Output $out): void

Writes INTERVAL, the quantity and the unit keyword.

Parameters

$outOutput
Test cases 1
Calls 1

Test cases 10§

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 9

Relations§

Instantiated in 1
Type declarations 3