PHP Класс SqlParser\Statement

Автор: Dan Ungureanu ([email protected])
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$CLAUSES array The value attributed to each clause is used by the builder and it may have one of the following values: - 1 = 01 - add the clause only - 2 = 10 - add the keyword - 3 = 11 - add both the keyword and the clause
$OPTIONS array The option would be the key and the value can be an integer or an array. The integer represents only the index used. The array may have two keys: 0 is used to represent the index used and 1 is the type of the option (which may be 'var' or 'var='). Both options mean they expect a value after the option (e.g. A = B or A B, in which case A is the key and B is the value). The only difference is in the building process. var options are built as A B and var= options are built as A = B Two options that can be used together must have different values for indexes, else, when they will be used together, an error will occur.
$first integer The index of the first token used in this statement.
$last integer The index of the last token used in this statement.
$options SqlParser\Components\OptionsArray The options of this query.

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

Метод Описание
__construct ( Parser $parser = null, TokensList $list = null ) Constructor.
__toString ( ) : string Builds the string representation of this statement.
after ( Parser $parser, TokensList $list, Token $token ) : void Function called after the token was processed.
before ( Parser $parser, TokensList $list, Token $token ) : void Function called before the token is processed.
build ( ) : string Builds the string representation of this statement.
getClauses ( ) : array Gets the clauses of this statement.
parse ( Parser $parser, TokensList $list ) : void Parses the statements defined by the tokens list.
validateClauseOrder ( Parser $parser, TokensList $list ) : boolean Validates the order of the clauses in parsed statement Ideally this should be called after successfully completing the parsing of each statement

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

__construct() публичный Метод

Constructor.
public __construct ( Parser $parser = null, TokensList $list = null )
$parser Parser The instance that requests parsing.
$list TokensList The list of tokens to be parsed.

__toString() публичный Метод

Builds the string representation of this statement.
См. также: static::build
public __toString ( ) : string
Результат string

after() публичный Метод

Function called after the token was processed.
public after ( Parser $parser, TokensList $list, Token $token ) : void
$parser Parser The instance that requests parsing.
$list TokensList The list of tokens to be parsed.
$token Token The token that is being parsed.
Результат void

before() публичный Метод

Function called before the token is processed.
public before ( Parser $parser, TokensList $list, Token $token ) : void
$parser Parser The instance that requests parsing.
$list TokensList The list of tokens to be parsed.
$token Token The token that is being parsed.
Результат void

build() публичный Метод

Builds the string representation of this statement.
public build ( ) : string
Результат string

getClauses() публичный Метод

Gets the clauses of this statement.
public getClauses ( ) : array
Результат array

parse() публичный Метод

Parses the statements defined by the tokens list.
public parse ( Parser $parser, TokensList $list ) : void
$parser Parser The instance that requests parsing.
$list TokensList The list of tokens to be parsed.
Результат void

validateClauseOrder() публичный Метод

Validates the order of the clauses in parsed statement Ideally this should be called after successfully completing the parsing of each statement
public validateClauseOrder ( Parser $parser, TokensList $list ) : boolean
$parser Parser The instance that requests parsing.
$list TokensList The list of tokens to be parsed.
Результат boolean

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

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

The value attributed to each clause is used by the builder and it may have one of the following values: - 1 = 01 - add the clause only - 2 = 10 - add the keyword - 3 = 11 - add both the keyword and the clause
public static array $CLAUSES
Результат array

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

The option would be the key and the value can be an integer or an array. The integer represents only the index used. The array may have two keys: 0 is used to represent the index used and 1 is the type of the option (which may be 'var' or 'var='). Both options mean they expect a value after the option (e.g. A = B or A B, in which case A is the key and B is the value). The only difference is in the building process. var options are built as A B and var= options are built as A = B Two options that can be used together must have different values for indexes, else, when they will be used together, an error will occur.
public static array $OPTIONS
Результат array

$first публичное свойство

The index of the first token used in this statement.
public int $first
Результат integer

$last публичное свойство

The index of the last token used in this statement.
public int $last
Результат integer

$options публичное свойство

The options of this query.
См. также: static::$OPTIONS
public OptionsArray,SqlParser\Components $options
Результат SqlParser\Components\OptionsArray