final class Mode
    implements Mode
Public API: explicitly declared with @visibility public.

The parts of a MySQL session's sql_mode that change how SQL text is read.

Five modes change tokenization: ANSI_QUOTES, PIPES_AS_CONCAT, HIGH_NOT_PRECEDENCE, NO_BACKSLASH_ESCAPES and IGNORE_SPACE. A combination mode such as ANSI turns on the ones it includes. Every other mode name, such as STRICT_TRANS_TABLES or REAL_AS_FLOAT, is read and not recorded: it changes no token, and a fact that depends on it names the session state it is missing. Source: https://dev.mysql.com/doc/refman/8.4/en/sql-mode.html.

Reading the mode a session reportsdoctest
\SqlSemantics\Platform\MySql\Mode::fromString('STRICT_TRANS_TABLES,ansi_quotes,NO_BACKSLASH_ESCAPES')->toString() // => 'ANSI_QUOTES,NO_BACKSLASH_ESCAPES'
Reading double quotes as identifiersdoctest
$semantics = new \SqlSemantics\Platform\MySql\Semantics(null, \SqlSemantics\Platform\MySql\Mode::fromString('ANSI_QUOTES'));
    $semantics->analyze('SELECT "order" FROM t')->toString() // => 'SELECT `order` FROM t'

Properties§

public bool $ansiQuotes = false
public bool $pipesAsConcat = false
public bool $highNotPrecedence = false
public bool $noBackslashEscapes = false
public bool $ignoreSpace = false

Methods§

public function __construct(
    public bool $ansiQuotes = false,
    public bool $pipesAsConcat = false,
    public bool $highNotPrecedence = false,
    public bool $noBackslashEscapes = false,
    public bool $ignoreSpace = false,
)

Parameters

$ansiQuotesboolWhether double quotes delimit identifiers instead of strings
$pipesAsConcatboolWhether `||` is string concatenation instead of `OR`
$highNotPrecedenceboolWhether `NOT` binds as tightly as `!`
$noBackslashEscapesboolWhether a backslash in a string is an ordinary character
$ignoreSpaceboolWhether a function name may be followed by spaces before its parenthesis
public static function fromString(string $modes): self
public function toString(): string

Answers the recorded modes in the canonical spelling the language profile keeps.

Returns

string
Test cases 1
Called from 1
Calls 1

Test cases 20§

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

Dedicated tests 4
Other tests reaching this symbol 16

Relations§

Instantiated in 1
Method calls 1
Type checks 1