interface CommandInterface (View source)

Methods

andWhere(string $condition, string $value = null)

Sets a where token using the AND operator.

from(array $target, boolean $append = true)

Sets the FROM clause of a SQL statement, injecting an array of $target and deciding to remove previously set targets or not with the $append parameter.

string
getRaw()

Returns the SQL generated within this command, replacing the tokens in the schema with their actual values.

array
getTokens()

Analizying the class SCHEMA, it returns an array containing all the tokens found there.

array
getTokenValue(string $token)

Returns the value of the given $token.

orWhere(string $condition, string $value = null)

Sets a where token using the OR operator.

true
resetWhere()

Deletes all the WHERE conditions in the current command.

where(string $condition, mixed $value = null, boolean $append = false, string $clause = "WHERE")

Sets a WHERE condition for the current query.

Details

Command andWhere(string $condition, string $value = null)

Sets a where token using the AND operator.

If the $condition contains a "?", it will be replaced by the $value.

Parameters

string $condition
string $value

Return Value

Command

Command from(array $target, boolean $append = true)

Sets the FROM clause of a SQL statement, injecting an array of $target and deciding to remove previously set targets or not with the $append parameter.

Parameters

array $target
boolean $append

Return Value

Command

string getRaw()

Returns the SQL generated within this command, replacing the tokens in the schema with their actual values.

Return Value

string

array getTokens()

Analizying the class SCHEMA, it returns an array containing all the tokens found there.

Return Value

array

array getTokenValue(string $token)

Returns the value of the given $token.

Token values are always expressed as a series of values in an array, also if the token does not support multiple values. For example, the WHERE condition supports multiple values: WHERE val1 = x AND val2 = y OR val3 = z while the LIMIT clause not: LIMIT 20 However, both those tokens values are an array: this is done to internally simplify things.

Parameters

string $token

Return Value

array

Command orWhere(string $condition, string $value = null)

Sets a where token using the OR operator.

If the $condition contains a "?", it will be replaced by the $value.

Parameters

string $condition
string $value

Return Value

Command

true resetWhere()

Deletes all the WHERE conditions in the current command.

Return Value

true

where(string $condition, mixed $value = null, boolean $append = false, string $clause = "WHERE")

Sets a WHERE condition for the current query.

You can set the $condition using a trailing question mark, that will be replaced and safely quoted with the $value. Where conditions can be nested using the $append parameter and pre-fixed with the right $clause preposition (WHERE, AND, OR).

Parameters

string $condition
mixed $value
boolean $append
string $clause