PHP Класс SqlParser\Context

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$KEYWORDS array Because, PHP's associative arrays are basically hash tables, it is more efficient to store keywords as keys instead of values. The value associated to each keyword represents its flags.
$MODE integer The mode of the MySQL server that will be used in lexing, parsing and building the statements.
$OPERATORS array List of operators and their flags.
$contextPrefix string The prefix concatenated to the context name when an incomplete class name is specified.
$defaultContext string The name of the default content.
$loadedContext string The name of the loaded context.

Открытые методы

Метод Описание
escape ( array | string $str, string $quote = '`' ) : string Escapes the symbol by adding surrounding backticks.
isBool ( string $str ) : boolean Checks if the given string is a boolean value.
isComment ( string $str ) : integer Checks if the given string is the beginning of a whitespace.
isKeyword ( string $str, boolean $isReserved = false ) : integer Checks if the given string is a keyword.
isNumber ( string $str ) : boolean Checks if the given character can be a part of a number.
isOperator ( string $str ) : integer Checks if the given string is an operator.
isSeparator ( string $str ) : boolean Checks if the given character can be a separator for two lexeme.
isString ( string $str ) : integer Checks if the given character is the beginning of a string.
isSymbol ( string $str ) : integer Checks if the given character is the beginning of a symbol. A symbol can be either a variable or a field name.
isWhitespace ( string $str ) : boolean Checks if the given character is a whitespace.
load ( string $context = '' ) : void Loads the specified context.
loadClosest ( string $context = '' ) : string Loads the context with the closest version to the one specified.
setMode ( string $mode = '' ) : void Sets the SQL mode.

Описание методов

escape() публичный статический Метод

Escapes the symbol by adding surrounding backticks.
public static escape ( array | string $str, string $quote = '`' ) : string
$str array | string The string to be escaped.
$quote string Quote to be used when escaping.
Результат string

isBool() публичный статический Метод

This actually check only for TRUE and FALSE because 1 or 0 are actually numbers and are parsed by specific methods.
public static isBool ( string $str ) : boolean
$str string String to be checked.
Результат boolean

isComment() публичный статический Метод

Checks if the given string is the beginning of a whitespace.
public static isComment ( string $str ) : integer
$str string String to be checked.
Результат integer The appropriate flag for the comment type.

isKeyword() публичный статический Метод

Checks if the given string is a keyword.
public static isKeyword ( string $str, boolean $isReserved = false ) : integer
$str string String to be checked.
$isReserved boolean Checks if the keyword is reserved.
Результат integer

isNumber() публичный статический Метод

Checks if the given character can be a part of a number.
public static isNumber ( string $str ) : boolean
$str string String to be checked.
Результат boolean

isOperator() публичный статический Метод

Checks if the given string is an operator.
public static isOperator ( string $str ) : integer
$str string String to be checked.
Результат integer The appropriate flag for the operator.

isSeparator() публичный статический Метод

Checks if the given character can be a separator for two lexeme.
public static isSeparator ( string $str ) : boolean
$str string String to be checked.
Результат boolean

isString() публичный статический Метод

Checks if the given character is the beginning of a string.
public static isString ( string $str ) : integer
$str string String to be checked.
Результат integer The appropriate flag for the string type.

isSymbol() публичный статический Метод

Checks if the given character is the beginning of a symbol. A symbol can be either a variable or a field name.
public static isSymbol ( string $str ) : integer
$str string String to be checked.
Результат integer The appropriate flag for the symbol type.

isWhitespace() публичный статический Метод

Checks if the given character is a whitespace.
public static isWhitespace ( string $str ) : boolean
$str string String to be checked.
Результат boolean

load() публичный статический Метод

Contexts may be used by accessing the context directly.
public static load ( string $context = '' ) : void
$context string Name of the context or full class name that defines the context.
Результат void

loadClosest() публичный статический Метод

The closest context is found by replacing last digits with zero until one is loaded successfully.
См. также: Context::load()
public static loadClosest ( string $context = '' ) : string
$context string Name of the context or full class name that defines the context.
Результат string The loaded context. `null` if no context was loaded.

setMode() публичный статический Метод

Sets the SQL mode.
public static setMode ( string $mode = '' ) : void
$mode string The list of modes. If empty, the mode is reset.
Результат void

Описание свойств

$KEYWORDS публичное статическое свойство

Because, PHP's associative arrays are basically hash tables, it is more efficient to store keywords as keys instead of values. The value associated to each keyword represents its flags.
public static array $KEYWORDS
Результат array

$MODE публичное статическое свойство

The mode of the MySQL server that will be used in lexing, parsing and building the statements.
public static int $MODE
Результат integer

$OPERATORS публичное статическое свойство

List of operators and their flags.
public static array $OPERATORS
Результат array

$contextPrefix публичное статическое свойство

The prefix concatenated to the context name when an incomplete class name is specified.
public static string $contextPrefix
Результат string

$defaultContext публичное статическое свойство

The name of the default content.
public static string $defaultContext
Результат string

$loadedContext публичное статическое свойство

The name of the loaded context.
public static string $loadedContext
Результат string