Internal query for execution only
| package | salt\sql\queries |
|---|---|
| inherited_from | \salt\BaseQuery |
__construct(string $sqlText, array<mixed,mixed[]> $binds)
| inherited_from | \salt\BaseQuery::__construct() |
|---|
stringSQL text of the count query
array<mixed,mixed[]>binds of the query : array of bindName => array of ('value' => ..., 'type' => ...)
__construct(\salt\Base $obj)
\salt\Basethe object used for retrieve metadata.
disableIfEmpty(mixed $list)
This can be used if the query contains an IN where condition with an empty array : Executing the query result in an exception, but we can use this function for return an empty result without exception :
$q->whereAnd('ids', 'IN', $values); // will produce a bad where clause : "ids IN ()" if $values is empty
$q->disabledIfEmpty($values);
$db->execQuery($q); // valid, will not execute query, so not throw exception
mixed
escapeName(string $name) : string
stringa SQL name : database, table, field, alias, etc...
stringSQL escaped text with backquote.getBinds(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' => ...)getPaginationBinds(\salt\Pagination $pagination) : array<mixed,mixed[]>
\salt\Paginationthe Pagination object
array<mixed,mixed[]>binds for the Pagination : array of bindName => array of ('value' => ..., 'type' => ...)isEnabled() : boolean
booleanTRUE if the query can be executed, FALSE otherwiseisPrivateBinds() : boolean
booleanTRUE if privateBinds has been calledprivateBinds(boolean $privateBinds = TRUE) : \salt\SqlBindField
boolean(Optional, TRUE) hide binds values in debug queries
\salt\SqlBindFieldthe current objecttoCountQuery() : \salt\CountQuery
Have to be overrided by child classes if needed
\salt\SaltException |
if called on BaseQuery instance |
|---|
\salt\CountQuerythe SQL query for count querytoSQL() : string
stringthe memoized SQL textaddBind(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
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
resolveFieldName(string $source, mixed|\salt\SqlExpr $fieldNameOrValue, mixed|\salt\SqlExpr $fieldOfValue = NULL) : string | array<mixed,string>
stringcaller of resolve : ClauseType or specific text
mixed\salt\SqlExpra FieldName (string) or SqlExpr or potential value (int, string, array) if 3rd argument is provided
mixed\salt\SqlExpra Field related to the value. Can be a SqlExpr or a string. Can be NULL if 2nd argument is a string fieldName
stringarray<mixed,string>absolute field name (alias.fieldname) or string with bind values or array of bind values if 2nd argument is an array of valuescheckNotResolved()
\salt\SaltException |
if called after toSQL() |
|---|
getFieldType(string $field) : integer
stringthe fieldName
integerFiedType type of the field$_salt_obj : \salt\Base
$_salt__binds : array<mixed,mixed[]>
$_salt__text : string
$_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_enabled : boolean
TRUE$_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