classLockTables
final class LockTables
implements Statement
uses Snapshot
Public API: explicitly declared with
@visibility public.LOCK {TABLE | TABLES} t [[AS] alias] lock_type, …: a request to lock tables for the session.
Mirrors SQLCOM_LOCK_TABLES. Rule: MYSQL-LOCK-TABLES-001. Each table name resolves by MYSQL-SERVER-TABLES-001 and its resolution is the relation fact of its TableLock; an alias or name used twice is NonUniqueTable. The statement releases the locks the session held before. TABLE and TABLES are synonyms; TABLES is written. Source: https://dev.mysql.com/doc/refman/8.4/en/lock-tables.html. Status: Implemented.
$lock = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('lock table t read local, u as v write');
[$lock->toString(), $lock->statement->locks[1]->alias?->value] // => ['LOCK TABLES t READ LOCAL, u AS v WRITE', 'v']Properties§
public list<TableLock> $locksMethods§
public function __construct(list<TableLock> $locks)Parameters
$locks | list<TableLock> | The locked tables in written order; at least one |
Throws
InvalidConstruction When the list is emptyCalls 2
- static-call Check::listOf() line 46
- class-const TableLock::class() line 46
public function deriveStatement(Derivation $derivation): voidRecords the resolution of each table and reports a repeated alias.
Parameters
$derivation | Derivation |
Calls 2
- method-call TableNames::record() line 58
- new TableNames line 58
public function render(Output $out): voidTest cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.