Construct a complex SQL expression
package | salt\sql |
---|---|
inherited_from | \salt\SqlBindField |
__callstatic(string $func, mixed | \salt\SqlExpr $args) : \salt\SqlExpr
string
name of the SQL function with an underscore prefix for avoid collision with PHP keywords or other defined functions
mixed
\salt\SqlExpr
... $args list of function arguments. All arg that is not a SqlExpr is converted with SqlExpr::value($arg)
\salt\SqlExpr
after(mixed|\salt\SqlExpr $arg) : \salt\SqlExpr
mixed
\salt\SqlExpr
converted with SqlExpr::value() if needed
\salt\SqlExpr
current objectasBoolean() : \salt\SqlExpr
\salt\SqlExpr
current objectasDate(string $format = NULL
) : \salt\SqlExpr
string
format of the source, used for convert to date.
\salt\SaltException |
---|
\salt\SqlExpr
current objectasNumber() : \salt\SqlExpr
\salt\SqlExpr
current objectasSetter(\salt\Field $field) : \salt\SqlExpr
\salt\Field
the field to use for configure SqlExpr
\salt\SqlExpr
current objectasText() : \salt\SqlExpr
\salt\SqlExpr
current objectasTimestamp(string $format = NULL
) : \salt\SqlExpr
string
format of the source, used for convert to date.
\salt\SaltException |
---|
\salt\SqlExpr
current objectbefore(mixed|\salt\SqlExpr $arg) : \salt\SqlExpr
mixed
\salt\SqlExpr
converted with SqlExpr::value() if needed
\salt\SqlExpr
current objectdistinct() : \salt\SqlExpr
\salt\SqlExpr
current objectescapeName(string $name) : string
string
a SQL name : database, table, field, alias, etc...
string
SQL escaped text with backquote.field(string $alias, \salt\Field $field) : \salt\SqlExpr
Do not use this method, but Query::getField($fieldName) instead
string
alias of the table of the field
\salt\Field
field
\salt\SqlExpr
getAllUsedTableAlias() : array<mixed,string>
array<mixed,string>
all table aliasgetBinds(string $source = \salt\ClauseType::ALL
) : array<mixed,mixed[]>
string
(Optional) ClauseType or specific text for restrict returned binds to specified source
array<mixed,mixed[]>
list of binds : array of array('value' => ..., 'type' => ...)getFieldName() : string
string
the field name if SqlExpr is a FIELD expr, NULL otherwisegetPaginationBinds(\salt\Pagination $pagination) : array<mixed,mixed[]>
\salt\Pagination
the Pagination object
array<mixed,mixed[]>
binds for the Pagination : array of bindName => array of ('value' => ..., 'type' => ...)getType() : integer
integer
FieldType the type of the SqlExprimplode(string $separator, \salt\SqlExpr | mixed $args) : \salt\SqlExpr
string
text to use for join parameters
\salt\SqlExpr
mixed
... $args list of parameters. Parameters that are not SqlExpr are converted with SqlExpr::value()
\salt\SqlExpr
current objectisPrivateBinds() : boolean
boolean
TRUE if privateBinds has been callednot() : \salt\SqlExpr
\salt\SqlExpr
current objectparenthesis() : \salt\SqlExpr
\salt\SqlExpr
current objetplus(integer $value = 1
) : \salt\SqlExpr
integer
value to increment (if positive) or decrement (if negative)
\salt\SqlExpr
current objectprivateBinds(boolean $privateBinds = TRUE
) : \salt\SqlBindField
boolean
(Optional, TRUE) hide binds values in debug queries
\salt\SqlBindField
the current objectquery(\salt\BaseQuery $query) : \salt\SqlExpr
\salt\BaseQuery
a query that return a compatible value with the usage of the SqlExpr.
\salt\SqlExpr
template(string $template, \salt\SqlExpr | mixed $args = NULL
) : \salt\SqlExpr
string
template with TEMPLATE_MAIN and TEMPLATE_PARAM if necessary
\salt\SqlExpr
mixed
... $args list of parameters. Parameters that are not SqlExpr are converted with SqlExpr::value()
\salt\SqlExpr
current objecttext(mixed $text) : \salt\SqlExpr
Warning : $text HAVE TO BE escaped for sql usage, we recommand to DO NO USE user input in it.
mixed
text to transform in SqlExpr.
\salt\SqlExpr
toSQL() : string
string
the memoized SQL texttuple(mixed|\salt\SqlExpr $args) : \salt\SqlExpr
..)
mixed
\salt\SqlExpr
...
\salt\SqlExpr
current objectvalue(mixed $value) : \salt\SqlExpr
mixed
value to transform in SqlExpr. Can be NULL
\salt\SqlExpr
__construct(integer $objectType, mixed $data)
integer
type of SqlExpr : FUNC|VALUE|FIELD
mixed
source of SqlExpr, can be a scalar value or an array
addBind(mixed $value, integer $type, string $source = \salt\ClauseType::ALL
) : string
mixed
value of bind
integer
(FieldType) type of the field
string
(Optional) ClauseType or other text : clause where the bind will be used, if we know it
string
the bind namebuildSQL() : string
inherited_from | \salt\SqlBindField::buildSQL() |
---|
string
the SQL text for SqlExprbuildSQL() : string
string
the SQL textlinkBindsOf(\salt\SqlBindField $other, string $source= \salt\ClauseType::ALL
, string $otherSource= \salt\ClauseType::ALL
)
\salt\SqlBindField
the other SqlBindField to link
string
clause usage of the SqlBindField if we known it
string
restrict link to this source in $other
\salt\SaltException |
if this SqlBindField is already resolved |
---|
removeBinds(string $source)
string
ClauseType of specific text
arrayToSqlExpr(array<mixed,mixed> $args) : array<mixed,\salt\SqlExpr>
If element is not already an SqlExpr, it will be converted with SqlExpr::value
array<mixed,mixed>
all elements
array<mixed,\salt\SqlExpr>
list of SqlExprcheckNotResolved()
\salt\SaltException |
if called after toSQL() |
---|
getTemplateForConvertSqlDate(string $origin, string $destination) : string
string
origin date format
string
destination date format
string
template for conversion, with ? as placeholder$_salt_bindNumber : integer
0
$_salt_bindPaginationNumber : integer
0
$_salt_binds : array<mixed,mixed>
array()
content | array of bindName => array( 'value' => mixed // value of bind 'type' => int FieldType // type of field 'private' => boolean // if value is private data (like passwords) ) |
---|
$_salt_others : array<mixed,\salt\SqlBindField[][]>
array()
content | array of (ClauseType (source) => array of ClauseType(dest) => array of SqlBindField) |
---|
$_salt_privateBinds : boolean
FALSE
$_salt_sources : array<mixed,string[]>
array()
content | array of (ClauseType => array of bindName) |
---|
$_salt_text : string
NULL
$data : mixed
NULL
$dateFormat : string
NULL
$objectType : integer
NULL
$setter : \salt\Field
NULL
$template : array<mixed,mixed[]>
array()
content | array of array of (template, param1, param2, ...) |
---|
$type : integer
NULL
FIELD = 2
FUNC = 0
QUERY = 4
TEMPLATE_MAIN = "\1:main\2"
TEMPLATE_PARAM = "\3?\4"
TEXT = 3
VALUE = 1