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

An ORDER BY or LIMIT that a 5.6 subquery writes after the locking clauses of its query block, or a LIMIT it writes after the block's own LIMIT.

The 5.6 grammar lets a query specification of a subquery or a derived table be followed by opt_union_order_or_limit. Unless the block already orders or limits its rows, the server attaches that ORDER BY and LIMIT to the block itself (the order_clause action adds no query level, and limit_options sets the limit of the current block), so they are the block's own clauses written at a later position; a LIMIT written after a LIMIT of the block replaces it. The block that holds the clauses derives them like its own ORDER BY and LIMIT. Source: https://dev.mysql.com/doc/refman/5.6/en/select.html, https://github.com/mysql/mysql-server/blob/mysql-5.6.51/sql/sql_yacc.yy (order_clause, limit_options).

Reading an ORDER BY written after FOR UPDATE in a 5.6 subquerydoctest
$query = (new \SqlSemantics\Platform\MySql\Semantics('mysql-5.6.51'))->analyze('SELECT (SELECT a FROM t FOR UPDATE ORDER BY a)');
    count($query->statement->items[0]->expression->query->late->orderBy) // => 1
Refusing a late ordering without clausesdoctest
new \SqlSemantics\Platform\MySql\Statement\Query\Clause\LateOrdering([]) // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\InvalidConstruction

Properties§

public list<OrderItem> $orderBy
public Limit|null $limit = null

Methods§

public function __construct(list<OrderItem> $orderBy, public Limit|null $limit = null)

Parameters

$orderBylist<OrderItem>The ORDER BY items
$limitLimit|nullThe LIMIT clause
Calls 5
public function render(Output $out): void

Writes ORDER BY and LIMIT.

Parameters

$outOutput
Calls 2

Test cases 6§

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

Dedicated tests 2
Other tests reaching this symbol 4

Relations§

Instantiated in 1
Type declarations 2