packages/sql-semantics-mysql/src/Statement/Server/Lock/LockMode.php

1<?php
2
3declare(strict_types=1);
4
5namespace SqlSemantics\Platform\MySql\Statement\Server\Lock;
6
7/**
8 * The lock LOCK TABLES takes on one table.
9 *
10 * Mirrors the thr_lock_type of table_lock: READ (TL_READ_NO_INSERT), READ
11 * LOCAL (TL_READ), WRITE (TL_WRITE_DEFAULT) and, before MySQL 8.0,
12 * LOW_PRIORITY WRITE (TL_WRITE_LOW_PRIORITY; deprecated in 5.6 and without
13 * effect from 5.6.5). Each case holds the keywords it is written with.
14 * Source: https://dev.mysql.com/doc/refman/8.4/en/lock-tables.html,
15 * https://dev.mysql.com/doc/refman/5.7/en/lock-tables.html.
16 *
17 * @visibility public
18 * @example Reading the keywords of a case
19 *     \SqlSemantics\Platform\MySql\Statement\Server\Lock\LockMode::ReadLocal->value // => 'READ LOCAL'
20 */
21enum LockMode: string
22{
23    case Read = 'READ';
24    case ReadLocal = 'READ LOCAL';
25    case Write = 'WRITE';
26    case LowPriorityWrite = 'LOW_PRIORITY WRITE';
27}
28