class ContextMySql50600 extends Context (View source)

Context for MySQL 5.6.

This class was auto-generated from tools/contexts/*.txt. Use tools/run_generators.sh for update.

Constants

KEYWORD_MAX_LENGTH

The maximum length of a keyword.

LABEL_MAX_LENGTH

The maximum length of a label.

Ref: https://dev.mysql.com/doc/refman/5.7/en/statement-labels.html

OPERATOR_MAX_LENGTH

The maximum length of an operator.

SQL_MODE_NONE

SQL_MODE_ALLOW_INVALID_DATES

SQL_MODE_ANSI_QUOTES

SQL_MODE_COMPAT_MYSQL

Compatibility mode for Microsoft's SQL server. This is the equivalent of {SQL_MODE_ANSI_QUOTES}.

SQL_MODE_ERROR_FOR_DIVISION_BY_ZERO

SQL_MODE_HIGH_NOT_PRECEDENCE

SQL_MODE_IGNORE_SPACE

SQL_MODE_NO_AUTO_CREATE_USER

SQL_MODE_NO_AUTO_VALUE_ON_ZERO

SQL_MODE_NO_BACKSLASH_ESCAPES

SQL_MODE_NO_DIR_IN_CREATE

SQL_MODE_NO_ENGINE_SUBSTITUTION

SQL_MODE_NO_FIELD_OPTIONS

SQL_MODE_NO_KEY_OPTIONS

SQL_MODE_NO_TABLE_OPTIONS

SQL_MODE_NO_UNSIGNED_SUBTRACTION

SQL_MODE_NO_ZERO_DATE

SQL_MODE_NO_ZERO_IN_DATE

SQL_MODE_ONLY_FULL_GROUP_BY

SQL_MODE_PIPES_AS_CONCAT

SQL_MODE_REAL_AS_FLOAT

SQL_MODE_STRICT_ALL_TABLES

SQL_MODE_STRICT_TRANS_TABLES

SQL_MODE_NO_ENCLOSING_QUOTES

Custom mode.

The table and column names and any other field that must be escaped will not be. Reserved keywords are being escaped regardless this mode is used or not.

SQL_MODE_ANSI

Equivalent to {SQL_MODE_REAL_AS_FLOAT}, {SQL_MODE_PIPES_AS_CONCAT}, {SQL_MODE_ANSI_QUOTES}, {@see SQL_MODE_IGNORE_SPACE}.

SQL_MODE_DB2

Equivalent to {SQL_MODE_PIPES_AS_CONCAT}, {SQL_MODE_ANSI_QUOTES}, {SQL_MODE_IGNORE_SPACE}, {@see SQL_MODE_NO_KEY_OPTIONS}, {SQL_MODE_NO_TABLE_OPTIONS}, {SQL_MODE_NO_FIELD_OPTIONS}.

SQL_MODE_MAXDB

Equivalent to {SQL_MODE_PIPES_AS_CONCAT}, {SQL_MODE_ANSI_QUOTES}, {SQL_MODE_IGNORE_SPACE}, {@see SQL_MODE_NO_KEY_OPTIONS}, {SQL_MODE_NO_TABLE_OPTIONS}, {SQL_MODE_NO_FIELD_OPTIONS}, {@see SQL_MODE_NO_AUTO_CREATE_USER}.

SQL_MODE_MSSQL

Equivalent to {SQL_MODE_PIPES_AS_CONCAT}, {SQL_MODE_ANSI_QUOTES}, {SQL_MODE_IGNORE_SPACE}, {@see SQL_MODE_NO_KEY_OPTIONS}, {SQL_MODE_NO_TABLE_OPTIONS}, {SQL_MODE_NO_FIELD_OPTIONS}.

SQL_MODE_ORACLE

Equivalent to {SQL_MODE_PIPES_AS_CONCAT}, {SQL_MODE_ANSI_QUOTES}, {SQL_MODE_IGNORE_SPACE}, {@see SQL_MODE_NO_KEY_OPTIONS}, {SQL_MODE_NO_TABLE_OPTIONS}, {SQL_MODE_NO_FIELD_OPTIONS}, {@see SQL_MODE_NO_AUTO_CREATE_USER}.

SQL_MODE_POSTGRESQL

Equivalent to {SQL_MODE_PIPES_AS_CONCAT}, {SQL_MODE_ANSI_QUOTES}, {SQL_MODE_IGNORE_SPACE}, {@see SQL_MODE_NO_KEY_OPTIONS}, {SQL_MODE_NO_TABLE_OPTIONS}, {SQL_MODE_NO_FIELD_OPTIONS}.

SQL_MODE_TRADITIONAL

Equivalent to {SQL_MODE_STRICT_TRANS_TABLES}, {SQL_MODE_STRICT_ALL_TABLES}, {@see SQL_MODE_NO_ZERO_IN_DATE}, {SQL_MODE_NO_ZERO_DATE}, {SQL_MODE_ERROR_FOR_DIVISION_BY_ZERO}, {@see SQL_MODE_NO_AUTO_CREATE_USER}.

Properties

static string $loadedContext

The name of the loaded context.

from  Context
static string $contextPrefix

The prefix concatenated to the context name when an incomplete class name is specified.

from  Context
static array<string,int> $keywords

List of keywords.

static array<string,int> $operators

List of operators and their flags.

from  Context
static int internal $mode

The mode of the MySQL server that will be used in lexing, parsing and building the statements.

from  Context

Methods

static int|null
isKeyword(string $string, bool $isReserved = false)

Checks if the given string is a keyword.

from  Context
static int|null
isOperator(string $string)

Checks if the given string is an operator and returns the appropriate flag for the operator.

from  Context
static bool
isWhitespace(string $string)

Checks if the given character is a whitespace.

from  Context
static int|null
isComment(string $string, bool $end = false)

Checks if the given string is the beginning of a whitespace.

from  Context
static bool
isBool(string $string)

Checks if the given string is a boolean value.

from  Context
static bool
isNumber(string $string)

Checks if the given character can be a part of a number.

from  Context
static int|null
isSymbol(string $string)

Checks if the given character is the beginning of a symbol. A symbol can be either a variable or a field name.

from  Context
static int|null
isString(string $string)

Checks if the given character is the beginning of a string.

from  Context
static bool
isSeparator(string $string)

Checks if the given character can be a separator for two lexeme.

from  Context
static bool
load(string $context = '')

Loads the specified context.

from  Context
static string|null
loadClosest(string $context = '')

Loads the context with the closest version to the one specified.

from  Context
static int
getMode()

Gets the SQL mode.

from  Context
static void
setMode(int|string $mode = self::SQL_MODE_NONE)

Sets the SQL mode.

from  Context
static string
escape(string $str, string $quote = '`')

Escapes the symbol by adding surrounding backticks.

from  Context
static array
escapeAll(array $strings)

Escapes the symbol by adding surrounding backticks.

from  Context
static bool
hasMode(int|null $flag = null)

Function verifies that given SQL Mode constant is currently set

from  Context

Details

static int|null isKeyword(string $string, bool $isReserved = false)

Checks if the given string is a keyword.

Parameters

string $string
bool $isReserved

checks if the keyword is reserved

Return Value

int|null

static int|null isOperator(string $string)

Checks if the given string is an operator and returns the appropriate flag for the operator.

Parameters

string $string

Return Value

int|null

static bool isWhitespace(string $string)

Checks if the given character is a whitespace.

Parameters

string $string

Return Value

bool

static int|null isComment(string $string, bool $end = false)

Checks if the given string is the beginning of a whitespace.

Parameters

string $string
bool $end

Return Value

int|null

the appropriate flag for the comment type

static bool isBool(string $string)

Checks if the given string is a boolean value.

This actually check only for TRUE and FALSE because 1 or 0 are actually numbers and are parsed by specific methods.

Parameters

string $string

Return Value

bool

static bool isNumber(string $string)

Checks if the given character can be a part of a number.

Parameters

string $string

Return Value

bool

static int|null isSymbol(string $string)

Checks if the given character is the beginning of a symbol. A symbol can be either a variable or a field name.

Parameters

string $string

Return Value

int|null

the appropriate flag for the symbol type

static int|null isString(string $string)

Checks if the given character is the beginning of a string.

Parameters

string $string

string to be checked

Return Value

int|null

the appropriate flag for the string type

static bool isSeparator(string $string)

Checks if the given character can be a separator for two lexeme.

Parameters

string $string

string to be checked

Return Value

bool

static bool load(string $context = '')

Loads the specified context.

Contexts may be used by accessing the context directly.

Parameters

string $context

name of the context or full class name that defines the context

Return Value

bool

true if the context was loaded, false otherwise

static string|null loadClosest(string $context = '')

Loads the context with the closest version to the one specified.

The closest context is found by replacing last digits with zero until one is loaded successfully.

Parameters

string $context

name of the context or full class name that defines the context

Return Value

string|null

The loaded context. null if no context was loaded.

See also

Context::load

static int getMode()

Gets the SQL mode.

Return Value

int

static void setMode(int|string $mode = self::SQL_MODE_NONE)

Sets the SQL mode.

Parameters

int|string $mode

Return Value

void

static string escape(string $str, string $quote = '`')

Escapes the symbol by adding surrounding backticks.

Parameters

string $str

the string to be escaped

string $quote

quote to be used when escaping

Return Value

string

static array escapeAll(array $strings)

Escapes the symbol by adding surrounding backticks.

Parameters

array $strings

the string to be escaped

Return Value

array

static bool hasMode(int|null $flag = null)

Function verifies that given SQL Mode constant is currently set

Parameters

int|null $flag

for example {\PhpMyAdmin\SqlParser\Context::SQL_MODE_ANSI_QUOTES}

Return Value

bool

false on empty param, true/false on given constant/int value