SqlTable final class
Minn\Support\SqlTable · public/minn/src/Minn/Support/SqlTable.php · 63 lines
The table a SQL statement is about, as wpdb::get_table_from_query reports it, and a database host string read into its parts (probe wpdb). A name is letters, digits, $ _ . - and backticks (dropped), plus two-byte UTF-8.
Constants and properties
| private | NAME = '((?:[0-9a-zA-Z$_.`-]|[\\xC2-\\xDF][\\x80-\\xBF])+)' | |
| private | LEADS = array ( 0 => 'EXPLAIN(?:\\s+EXTENDED)?\\s+SELECT.*?\\s+FROM', 1 => 'SELECT.*?\\s+FROM', 2 => 'INSERT(?:\\s+(?:LOW_PRIORITY|DELAYED|HIGH_PRIORITY))?(?:\\s+IGNORE)?(?:\\s+INTO)?', 3 => 'REPLACE(?:\\s+(?:LOW_PRIORITY|DELAYED))?(?:\\s+INTO)?', 4 => 'UPDATE(?:\\s+LOW_PRIORITY)?(?:\\s+IGNORE)?', 5 => 'DELETE(?:\\s+(?:LOW_PRIORITY|QUICK|IGNORE))*(?:.+?FROM)?', 6 => '(?:DESCRIBE|DESC|EXPLAIN)', 7 => 'SHOW(?:\\s+FULL)?\\s+(?:COLUMNS|FIELDS|INDEX|INDEXES)\\s+FROM', 8 => 'SHOW\\s+CREATE\\s+TABLE', 9 => 'CREATE(?:\\s+TEMPORARY)?\\s+TABLE(?:\\s+IF\\s+NOT\\s+EXISTS)?', 10 => 'DROP\\s+TABLE(?:\\s+IF\\s+EXISTS)?', 11 => '(?:ALTER|TRUNCATE|OPTIMIZE|REPAIR|CHECK|ANALYZE|RENAME)(?:\\s+TABLE)?', 12 => 'LOCK\\s+TABLES?', 13 => 'LOAD\\s+DATA.*?INTO\\s+TABLE', ) | What leads to the table name in each statement the reference reads, tried in order. |
Public
| static | of(string $query): ?string# | The table a statement names (backticks dropped), or null when it names none the reference recognises. |
| static | host(string $host): ?array# | A DB_HOST read as host, port, socket and whether the host is IPv6: a socket after ":/", an IPv6 address in brackets (more than one colon), a port only when it is digits. Null when nothing parses. @return array{0: string, 1: ?int, 2: ?string, 3: bool}|null |
Nothing matches.