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

One locking clause of a query: FOR UPDATE|SHARE [OF tables] [NOWAIT|SKIP LOCKED] or LOCK IN SHARE MODE.

The tables are names of tables of the query, by correlation name when they have one; the query that holds the clause reports a name that names none. A table may be written t.*, which names the same table; the form is kept, since a locking clause of a subquery is part of the text MySQL names an unaliased select list expression after. Source: https://dev.mysql.com/doc/refman/8.4/en/innodb-locking-reads.html, https://dev.mysql.com/doc/refman/8.4/en/select.html.

Reading the tables of a locking clausedoctest
$clause = new \SqlSemantics\Platform\MySql\Statement\Query\Locking\LockingClause(\SqlSemantics\Platform\MySql\Statement\Query\Locking\LockStrength::Update, [new \SqlSemantics\Platform\MySql\Model\Statement\Identifier\QualifiedName(new \SqlSemantics\Platform\MySql\Model\Statement\Identifier\Name('t'))], \SqlSemantics\Platform\MySql\Statement\Query\Locking\LockedRowAction::Nowait);
    [$clause->tables[0]->name->value, $clause->action] // => ['t', \SqlSemantics\Platform\MySql\Statement\Query\Locking\LockedRowAction::Nowait]
Refusing a table list on LOCK IN SHARE MODEdoctest
new \SqlSemantics\Platform\MySql\Statement\Query\Locking\LockingClause(\SqlSemantics\Platform\MySql\Statement\Query\Locking\LockStrength::ShareMode, [new \SqlSemantics\Platform\MySql\Model\Statement\Identifier\QualifiedName(new \SqlSemantics\Platform\MySql\Model\Statement\Identifier\Name('t'))]) // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\InvalidConstruction

Properties§

public list<QualifiedName> $tables
public list<OptionalWords> $wildcards
public LockStrength $strength
public LockedRowAction|null $action = null

Methods§

public function __construct(
    public LockStrength $strength,
    list<QualifiedName> $tables = [],
    public LockedRowAction|null $action = null,
    list<OptionalWords> $wildcards = [],
)

Parameters

$strengthLockStrengthThe lock taken
$tableslist<QualifiedName>The locked tables; empty for every table of the query
$actionLockedRowAction|nullWhat to do with a row locked elsewhere
$wildcardslist<OptionalWords>For each locked table, whether it is written with `.*`; empty when none is
Calls 8

Test cases 17§

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

Dedicated tests 5
Other tests reaching this symbol 12

Relations§

Instantiated in 3
Constant reads 2
Type declarations 1