PHP Class SqlParser\Statement

Author: Dan Ungureanu ([email protected])
ファイルを表示 Open project: phpmyadmin/sql-parser Class Usage Examples

Public Properties

Property Type Description
$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.

Public Methods

Method Description
__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

Method Details

__construct() public method

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() public method

Builds the string representation of this statement.
See also: static::build
public __toString ( ) : string
return string

after() public method

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.
return void

before() public method

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.
return void

build() public method

Builds the string representation of this statement.
public build ( ) : string
return string

getClauses() public method

Gets the clauses of this statement.
public getClauses ( ) : array
return array

parse() public method

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.
return void

validateClauseOrder() public method

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.
return boolean

Property Details

$CLAUSES public_oe static_oe property

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
return array

$OPTIONS public_oe static_oe property

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
return array

$first public_oe property

The index of the first token used in this statement.
public int $first
return integer

$last public_oe property

The index of the last token used in this statement.
public int $last
return integer

$options public_oe property

The options of this query.
See also: static::$OPTIONS
public OptionsArray,SqlParser\Components $options
return SqlParser\Components\OptionsArray