class QueryExpression (View source)

Class QueryExpression

Methods

__construct(QueryInterface $query)

No description

static boolean
isExpression(string $value)

isExpression

mixed|QueryElement
buildExpression(string $name)

buildExpression

string
concatenate(array $values, string $separator = null)

Concatenates an array of column names or values.

string
concat(array $values, string $separator = null)

Concatenates an array of column names or values.

string
current_timestamp()

Gets the current date and time.

string
year(string $date)

Used to get a string to extract year from date column.

string
month(string $date)

Used to get a string to extract month from date column.

string
day(string $date)

Used to get a string to extract day from date column.

string
hour(string $date)

Used to get a string to extract hour from date column.

string
minute(string $date)

Used to get a string to extract minute from date column.

string
second(string $date)

Used to get a string to extract seconds from date column.

integer
length(string $value)

Get the length of a string in bytes.

string
char_length(string $field, string $operator = null, string $condition = null)

Gets the number of characters in a string.

string
cast_as_char(string $value)

Casts a value to a char.

string
caseCondition(array $cases, string $else = null)

caseCondition

Details

at line line 28
__construct(QueryInterface $query)

Parameters

QueryInterface $query

at line line 40
static boolean isExpression(string $value)

isExpression

Parameters

string $value

Return Value

boolean

at line line 52
mixed|QueryElement buildExpression(string $name)

buildExpression

Parameters

string $name

Return Value

mixed|QueryElement

at line line 71
QueryInterface getQuery()

getQuery

Return Value

QueryInterface

at line line 83
QueryExpression setQuery(QueryInterface $query)

setQuery

Parameters

QueryInterface $query

Return Value

QueryExpression Return self to support chaining.

at line line 103
string concatenate(array $values, string $separator = null)

Concatenates an array of column names or values.

Usage: $query->select($query->concatenate(array('a', 'b')));

Parameters

array $values An array of values to concatenate.
string $separator As separator to place between each value.

Return Value

string The concatenated values.

at line line 128
string concat(array $values, string $separator = null)

Concatenates an array of column names or values.

Usage: $query->select($query->concatenate(array('a', 'b')));

Parameters

array $values An array of values to concatenate.
string $separator As separator to place between each value.

Return Value

string The concatenated values.

at line line 140
string current_timestamp()

Gets the current date and time.

Return Value

string

at line line 157
string year(string $date)

Used to get a string to extract year from date column.

Usage: $query->select($query->year($query->quoteName('dateColumn')));

Parameters

string $date Date column containing year to be extracted.

Return Value

string Returns string to extract year from a date.

at line line 174
string month(string $date)

Used to get a string to extract month from date column.

Usage: $query->select($query->month($query->quoteName('dateColumn')));

Parameters

string $date Date column containing month to be extracted.

Return Value

string Returns string to extract month from a date.

at line line 191
string day(string $date)

Used to get a string to extract day from date column.

Usage: $query->select($query->day($query->quoteName('dateColumn')));

Parameters

string $date Date column containing day to be extracted.

Return Value

string Returns string to extract day from a date.

at line line 208
string hour(string $date)

Used to get a string to extract hour from date column.

Usage: $query->select($query->hour($query->quoteName('dateColumn')));

Parameters

string $date Date column containing hour to be extracted.

Return Value

string Returns string to extract hour from a date.

at line line 225
string minute(string $date)

Used to get a string to extract minute from date column.

Usage: $query->select($query->minute($query->quoteName('dateColumn')));

Parameters

string $date Date column containing minute to be extracted.

Return Value

string Returns string to extract minute from a date.

at line line 242
string second(string $date)

Used to get a string to extract seconds from date column.

Usage: $query->select($query->second($query->quoteName('dateColumn')));

Parameters

string $date Date column containing second to be extracted.

Return Value

string Returns string to extract second from a date.

at line line 261
integer length(string $value)

Get the length of a string in bytes.

Note, use 'charLength' to find the number of characters in a string.

Usage: query->where($query->length('a').' > 3');

Parameters

string $value The string to measure.

Return Value

integer

at line line 279
string char_length(string $field, string $operator = null, string $condition = null)

Gets the number of characters in a string.

Note, use 'length' to find the number of bytes in a string.

Parameters

string $field A value.
string $operator Comparison operator between charLength integer value and $condition
string $condition Integer value to compare charLength with.

Return Value

string The required char length call.

at line line 295
string cast_as_char(string $value)

Casts a value to a char.

Ensure that the value is properly quoted before passing to the method.

Parameters

string $value The value to cast as a char.

Return Value

string Returns the cast value.

at line line 310
string caseCondition(array $cases, string $else = null)

caseCondition

Parameters

array $cases
string $else

Return Value

string