class Expression extends Component (View source)

Parses a reference to an expression (column, table or database name, function call, mathematical expression, etc.).

Properties

string $database The name of this database.
string $table The name of this table.
string $column The name of the column.
string $expr The sub-expression.
string $alias The alias of this expression.
mixed $function The name of the function.
string $subquery The type of subquery.

Methods

static mixed
parse(Parser $parser, TokensList $list, array $options = [])

Possible options:.

static mixed
build(mixed $component, array $options = [])

No description

string
__toString()

Builds the string representation of a component of this type.

__construct(string $database = null, string $table = null, string $column = null, string $alias = null)

Syntax: new Expression('expr') new Expression('expr', 'alias') new Expression('database', 'table', 'column') new Expression('database', 'table', 'column', 'alias')

Details

static mixed parse(Parser $parser, TokensList $list, array $options = [])

Possible options:.

field

First field to be filled.
If this is not specified, it takes the value of `parseField`.

parseField

Specifies the type of the field parsed. It may be `database`,
`table` or `column`. These expressions may not include
parentheses.

breakOnAlias

If not empty, breaks when the alias occurs (it is not included).

breakOnParentheses

If not empty, breaks when the first parentheses occurs.

parenthesesDelimited

If not empty, breaks after last parentheses occurred.

Parameters

Parser $parser the parser that serves as context
TokensList $list the list of tokens that are being parsed
array $options parameters for parsing

Return Value

mixed

Exceptions

ParserException

static mixed build(mixed $component, array $options = [])

Parameters

mixed $component the component to be built
array $options parameters for building

Return Value

mixed

string __toString()

Builds the string representation of a component of this type.

Return Value

string

See also

static::build

__construct(string $database = null, string $table = null, string $column = null, string $alias = null)

Syntax: new Expression('expr') new Expression('expr', 'alias') new Expression('database', 'table', 'column') new Expression('database', 'table', 'column', 'alias')

If the database, table or column name is not required, pass an empty string.

Parameters

string $database The name of the database or the the expression. the the expression.
string $table The name of the table or the alias of the expression. the alias of the expression.
string $column the name of the column
string $alias the name of the alias