final class Block
Restricted visibility: declared "@visibility SqlSemantics\Platform\MySql\Lowering\Query". Code outside that scope must not name this declaration.

The parts of one query block during lowering, before the clauses written after it are known.

A lowering-time value: the trailing clauses of the block are collected in a trailer until the block is finished into a selection. An INTO written after the clauses of a block that writes none of them is the INTO after the select list, which is how the parser reads its text. The ORDER BY and LIMIT a 5.6 subquery writes after a block are added by finish().

Properties§

public list<SelectOption> $options
public IntoDestination|null $into = null
public Relation|null $from = null
public Scalar|null $where = null
public Grouping|null $groupBy = null
public Scalar|null $having = null
public list<WindowDefinition> $windows = []
public Scalar|null $qualify = null
public Trailer $trailer = new \SqlSemantics\Platform\MySql\Lowering\Query\Shared\Trailer()

Methods§

public function __construct(
    public list<SelectOption> $options,
    public list<SelectExpression|Star|TableWildcard> $items,
    public IntoDestination|null $into = null,
    public Relation|null $from = null,
    public Scalar|null $where = null,
    public Grouping|null $groupBy = null,
    public Scalar|null $having = null,
    public list<WindowDefinition> $windows = [],
    public Scalar|null $qualify = null,
    public Trailer $trailer = new \SqlSemantics\Platform\MySql\Lowering\Query\Shared\Trailer(),
)

Parameters

$optionslist<SelectOption>The modifiers
$itemslist<SelectExpression|Star|TableWildcard>The select list
$intoIntoDestination|nullThe INTO destination after the select list
$fromRelation|nullThe FROM clause
$whereScalar|nullThe row predicate
$groupByGrouping|nullThe GROUP BY clause
$havingScalar|nullThe group predicate
$windowslist<WindowDefinition>The named windows
$qualifyScalar|nullThe QUALIFY predicate
$trailerTrailerThe clauses written after the block
Calls 1
public function finish(Trailer $later): Query

Finishes the block with the ORDER BY and LIMIT a 5.6 subquery writes after it (opt_union_order_or_limit).

An ORDER BY after a block that already orders or limits its rows orders the rows of the block in a query level of its own (the 5.6 order_clause action adds a fake query block). Otherwise the clauses are the block's own: written in place when nothing of the block stands between, and kept as a late ordering after the block's locking clauses or after its own LIMIT, which a later LIMIT replaces.

Parameters

$laterTrailer

Returns

Throws

AnalysisException When INTO is written twice (see `select()`)
Test cases 1
Called from 1
Calls 5
public function bare(): self

Answers the block without the clauses written after it.

Returns

self
Calls 1
public function select(LateOrdering|null $late = null): Select

Finishes the block into a selection.

Parameters

$lateLateOrdering|nullThe ORDER BY and LIMIT a 5.6 subquery writes after the locking clauses or the LIMIT of the block

Returns

Throws

AnalysisException When INTO is written twice, which the server rejects while parsing (ER_SYNTAX_ERROR of the 5.7 `select_part2` action, ER_MULTIPLE_INTO_CLAUSES of 8.0 `PT_select_stmt::make_cmd`, right after contextualizing; the 5.6 grammar has no such form)
Test cases 1
Called from 3
Calls 4

Test cases 17§

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

Dedicated tests 8
Other tests reaching this symbol 9

Relations§

Instantiated in 10
Method calls 1
Type checks 6
Type declarations 15