final class Strings
Restricted visibility: declared "@visibility SqlSemantics\Platform\MySql". Code outside that scope must not name this declaration.

Decodes and spells the quoted string tokens of MySQL under a fixed escape setting.

Rule: MYSQL-STRING-DECODE-001. Scope: the terminals TEXT_STRING and NCHAR_STRING. The text between the quotes is read byte by byte. A doubled quote character is one quote. Unless NO_BACKSLASH_ESCAPES is set, a backslash and the byte after it are one escape: \0 is NUL, \b backspace, \n newline, \r carriage return, \t tab, \Z byte 0x1A, \% and \_ keep the backslash, and before any other byte the backslash is dropped. Under NO_BACKSLASH_ESCAPES a backslash is an ordinary byte. The spelling writes single quotes, doubles each single quote and, when backslash is an escape, doubles each backslash; that spelling decodes to the same bytes. Assumption: the client character set does not use the bytes of a backslash or a quote inside a multi-byte character (true for utf8mb4, utf8mb3, latin1 and ASCII; not for sjis, big5, gbk, gb18030, cp932). Terminates: one pass over the text. Source: https://dev.mysql.com/doc/refman/8.4/en/string-literals.html. Status: Implemented.

Methods§

Private surface 2§

Implementation details, listed for orientation only.

private const ESCAPES = ['0' => "\x00", 'b' => "\x08", 'n' => "\n", 'r' => "\r", 't' => "\t", 'Z' => "\…
private const SPELLINGS = ['\\' => '\\\\', "\x00" => '\0', "\n" => '\n', "\r" => '\r', "\x1a" => '\Z']

Test cases 8§

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

Dedicated tests 8

Relations§

Instantiated in 7
Method calls 7