Internal query for execution only

package salt\sql\queries
inherited_from \salt\BaseQuery

 Methods

Create a new CountQuery

__construct(string $sqlText, array<mixed,mixed[]> $binds) 
inherited_from \salt\BaseQuery::__construct()

Parameters

$sqlText

string

SQL text of the count query

$binds

array<mixed,mixed[]>

binds of the query : array of bindName => array of ('value' => ..., 'type' => ...)

Construct a new query

__construct(\salt\Base $obj) 
Inherited

Parameters

$obj

\salt\Base

the object used for retrieve metadata.

If parameter is empty, the query will not be executed

disableIfEmpty(mixed $list) 
Inherited

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

Parameters

$list

mixed

Escape a name for SQL use with backquote

escapeName(string $name) : string
InheritedStatic

Parameters

$name

string

a SQL name : database, table, field, alias, etc...

Returns

stringSQL escaped text with backquote.

{@inheritDoc}

getBinds(string $source = NULL
see

Parameters

$source

string

not used here

Return all binds

getBinds(string $source = \salt\ClauseType::ALL) : array<mixed,mixed[]>
Inherited

Parameters

$source

string

(Optional) ClauseType or specific text for restrict returned binds to specified source

Returns

array<mixed,mixed[]>list of binds : array of array('value' => ..., 'type' => ...)

Retrieve binds for pagination (LIMIT clause)

getPaginationBinds(\salt\Pagination $pagination) : array<mixed,mixed[]>
InheritedStatic

Parameters

$pagination

\salt\Pagination

the Pagination object

Returns

array<mixed,mixed[]>binds for the Pagination : array of bindName => array of ('value' => ..., 'type' => ...)

Check if we have to execute the query

isEnabled() : boolean
Inherited

Returns

booleanTRUE if the query can be executed, FALSE otherwise

Check binds are private

isPrivateBinds() : boolean
Inherited

Returns

booleanTRUE if privateBinds has been called

Set all binds values as private. They will be hidden in debug queries

privateBinds(boolean $privateBinds = TRUE) : \salt\SqlBindField
Inherited

Parameters

$privateBinds

boolean

(Optional, TRUE) hide binds values in debug queries

Returns

\salt\SqlBindFieldthe current object

Retrieve the COUNT query

toCountQuery() : \salt\CountQuery
Inherited

Have to be overrided by child classes if needed

Exceptions

\salt\SaltException if called on BaseQuery instance

Returns

\salt\CountQuerythe SQL query for count query

Retrieve the SQL text

toSQL() : string
Inherited

Returns

stringthe memoized SQL text

 Properties