PHP Class SqlParser\Context

Afficher le fichier Open project: phpmyadmin/sql-parser Class Usage Examples

Méthodes publiques

Свойство Type Description
$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.

Méthodes publiques

Méthode Description
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.

Method Details

escape() public static méthode

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.
Résultat string

isBool() public static méthode

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.
Résultat boolean

isComment() public static méthode

Checks if the given string is the beginning of a whitespace.
public static isComment ( string $str ) : integer
$str string String to be checked.
Résultat integer The appropriate flag for the comment type.

isKeyword() public static méthode

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.
Résultat integer

isNumber() public static méthode

Checks if the given character can be a part of a number.
public static isNumber ( string $str ) : boolean
$str string String to be checked.
Résultat boolean

isOperator() public static méthode

Checks if the given string is an operator.
public static isOperator ( string $str ) : integer
$str string String to be checked.
Résultat integer The appropriate flag for the operator.

isSeparator() public static méthode

Checks if the given character can be a separator for two lexeme.
public static isSeparator ( string $str ) : boolean
$str string String to be checked.
Résultat boolean

isString() public static méthode

Checks if the given character is the beginning of a string.
public static isString ( string $str ) : integer
$str string String to be checked.
Résultat integer The appropriate flag for the string type.

isSymbol() public static méthode

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.
Résultat integer The appropriate flag for the symbol type.

isWhitespace() public static méthode

Checks if the given character is a whitespace.
public static isWhitespace ( string $str ) : boolean
$str string String to be checked.
Résultat boolean

load() public static méthode

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.
Résultat void

loadClosest() public static méthode

The closest context is found by replacing last digits with zero until one is loaded successfully.
See also: Context::load()
public static loadClosest ( string $context = '' ) : string
$context string Name of the context or full class name that defines the context.
Résultat string The loaded context. `null` if no context was loaded.

setMode() public static méthode

Sets the SQL mode.
public static setMode ( string $mode = '' ) : void
$mode string The list of modes. If empty, the mode is reset.
Résultat void

Property Details

$KEYWORDS public_oe static_oe property

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
Résultat array

$MODE public_oe static_oe property

The mode of the MySQL server that will be used in lexing, parsing and building the statements.
public static int $MODE
Résultat integer

$OPERATORS public_oe static_oe property

List of operators and their flags.
public static array $OPERATORS
Résultat array

$contextPrefix public_oe static_oe property

The prefix concatenated to the context name when an incomplete class name is specified.
public static string $contextPrefix
Résultat string

$defaultContext public_oe static_oe property

The name of the default content.
public static string $defaultContext
Résultat string

$loadedContext public_oe static_oe property

The name of the loaded context.
public static string $loadedContext
Résultat string