Construct a complex SQL expression
| package | salt\sql |
|---|---|
| inherited_from | \salt\SqlBindField |
__callstatic(string $func, mixed | \salt\SqlExpr $args) : \salt\SqlExpr
stringname 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\SqlExprafter(mixed|\salt\SqlExpr $arg) : \salt\SqlExpr
mixed\salt\SqlExprconverted with SqlExpr::value() if needed
\salt\SqlExprcurrent objectasBoolean() : \salt\SqlExpr
\salt\SqlExprcurrent objectasDate(string $format = NULL) : \salt\SqlExpr
stringformat of the source, used for convert to date.
\salt\SaltException |
|---|
\salt\SqlExprcurrent objectasNumber() : \salt\SqlExpr
\salt\SqlExprcurrent objectasSetter(\salt\Field $field) : \salt\SqlExpr
\salt\Fieldthe field to use for configure SqlExpr
\salt\SqlExprcurrent objectasText() : \salt\SqlExpr
\salt\SqlExprcurrent objectasTimestamp(string $format = NULL) : \salt\SqlExpr
stringformat of the source, used for convert to date.
\salt\SaltException |
|---|
\salt\SqlExprcurrent objectbefore(mixed|\salt\SqlExpr $arg) : \salt\SqlExpr
mixed\salt\SqlExprconverted with SqlExpr::value() if needed
\salt\SqlExprcurrent objectdistinct() : \salt\SqlExpr
\salt\SqlExprcurrent objectescapeName(string $name) : string
stringa SQL name : database, table, field, alias, etc...
stringSQL escaped text with backquote.field(string $alias, \salt\Field $field) : \salt\SqlExpr
Do not use this method, but Query::getField($fieldName) instead
stringalias of the table of the field
\salt\Fieldfield
\salt\SqlExprgetAllUsedTableAlias() : 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
stringthe field name if SqlExpr is a FIELD expr, NULL otherwisegetPaginationBinds(\salt\Pagination $pagination) : array<mixed,mixed[]>
\salt\Paginationthe Pagination object
array<mixed,mixed[]>binds for the Pagination : array of bindName => array of ('value' => ..., 'type' => ...)getType() : integer
integerFieldType the type of the SqlExprimplode(string $separator, \salt\SqlExpr | mixed $args) : \salt\SqlExpr
stringtext to use for join parameters
\salt\SqlExprmixed... $args list of parameters. Parameters that are not SqlExpr are converted with SqlExpr::value()
\salt\SqlExprcurrent objectisPrivateBinds() : boolean
booleanTRUE if privateBinds has been callednot() : \salt\SqlExpr
\salt\SqlExprcurrent objectparenthesis() : \salt\SqlExpr
\salt\SqlExprcurrent objetplus(integer $value = 1) : \salt\SqlExpr
integervalue to increment (if positive) or decrement (if negative)
\salt\SqlExprcurrent objectprivateBinds(boolean $privateBinds = TRUE) : \salt\SqlBindField
boolean(Optional, TRUE) hide binds values in debug queries
\salt\SqlBindFieldthe current objectquery(\salt\BaseQuery $query) : \salt\SqlExpr
\salt\BaseQuerya query that return a compatible value with the usage of the SqlExpr.
\salt\SqlExprtemplate(string $template, \salt\SqlExpr | mixed $args = NULL) : \salt\SqlExpr
stringtemplate with TEMPLATE_MAIN and TEMPLATE_PARAM if necessary
\salt\SqlExprmixed... $args list of parameters. Parameters that are not SqlExpr are converted with SqlExpr::value()
\salt\SqlExprcurrent objecttext(mixed $text) : \salt\SqlExpr
Warning : $text HAVE TO BE escaped for sql usage, we recommand to DO NO USE user input in it.
mixedtext to transform in SqlExpr.
\salt\SqlExprtoSQL() : string
stringthe memoized SQL texttuple(mixed|\salt\SqlExpr $args) : \salt\SqlExpr
..)
mixed\salt\SqlExpr...
\salt\SqlExprcurrent objectvalue(mixed $value) : \salt\SqlExpr
mixedvalue to transform in SqlExpr. Can be NULL
\salt\SqlExpr__construct(integer $objectType, mixed $data)
integertype of SqlExpr : FUNC|VALUE|FIELD
mixedsource of SqlExpr, can be a scalar value or an array
addBind(mixed $value, integer $type, string $source = \salt\ClauseType::ALL) : string
mixedvalue 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
stringthe bind namebuildSQL() : string
| inherited_from | \salt\SqlBindField::buildSQL() |
|---|
stringthe SQL text for SqlExprbuildSQL() : string
stringthe SQL textlinkBindsOf(\salt\SqlBindField $other, string $source= \salt\ClauseType::ALL, string $otherSource= \salt\ClauseType::ALL)
\salt\SqlBindFieldthe other SqlBindField to link
stringclause usage of the SqlBindField if we known it
stringrestrict link to this source in $other
\salt\SaltException |
if this SqlBindField is already resolved |
|---|
removeBinds(string $source)
stringClauseType 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
stringorigin date format
stringdestination date format
stringtemplate 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
NULLFIELD = 2
FUNC = 0
QUERY = 4
TEMPLATE_MAIN = "\1:main\2"
TEMPLATE_PARAM = "\3?\4"
TEXT = 3
VALUE = 1