class ContextMySql50000 extends Context (View source)

Context for MySQL 5.0.

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.

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 $defaultContext

The name of the default content.

from  Context
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 $str, bool $isReserved = false)

Checks if the given string is a keyword.

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

Checks if the given string is an operator.

from  Context
static bool
isWhitespace(string $str)

Checks if the given character is a whitespace.

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

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

from  Context
static bool
isBool(string $str)

Checks if the given string is a boolean value.

from  Context
static bool
isNumber(string $str)

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

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

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 $str)

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

from  Context
static bool
isSeparator(string $str)

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

from  Context
static void
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|string[]
escape(string[]|string $str, string $quote = '`')

Escapes the symbol by adding surrounding backticks.

from  Context
static string
getIdentifierQuote()

Returns char used to quote identifiers based on currently set SQL Mode (ie. standard or ANSI_QUOTES)

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

Function verifies that given SQL Mode constant is currently set

from  Context

Details

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

Checks if the given string is a keyword.

Parameters

string $str

string to be checked

bool $isReserved

checks if the keyword is reserved

Return Value

int|null

static int|null isOperator(string $str)

Checks if the given string is an operator.

Parameters

string $str

string to be checked

Return Value

int|null

the appropriate flag for the operator

static bool isWhitespace(string $str)

Checks if the given character is a whitespace.

Parameters

string $str

string to be checked

Return Value

bool

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

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

Parameters

string $str

string to be checked

mixed $end

Return Value

int|null

the appropriate flag for the comment type

static bool isBool(string $str)

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 $str

string to be checked

Return Value

bool

static bool isNumber(string $str)

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

Parameters

string $str

string to be checked

Return Value

bool

static int|null isSymbol(string $str)

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

Parameters

string $str

string to be checked

Return Value

int|null

the appropriate flag for the symbol type

static int|null isString(string $str)

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

Parameters

string $str

string to be checked

Return Value

int|null

the appropriate flag for the string type

static bool isSeparator(string $str)

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

Parameters

string $str

string to be checked

Return Value

bool

static void 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

void

Exceptions

LoaderException

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|string[] escape(string[]|string $str, string $quote = '`')

Escapes the symbol by adding surrounding backticks.

Parameters

string[]|string $str

the string to be escaped

string $quote

quote to be used when escaping

Return Value

string|string[]

static string getIdentifierQuote()

Returns char used to quote identifiers based on currently set SQL Mode (ie. standard or ANSI_QUOTES)

Return Value

string

either " (double quote, ansi_quotes mode) or ` (backtick, standard mode)

static bool hasMode(int $flag = null)

Function verifies that given SQL Mode constant is currently set

Parameters

int $flag

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

Return Value

bool

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