Méthode |
Description |
|
__clone ( ) : void |
Do a deep clone on this object. |
|
__construct ( Cake\Datasource\ConnectionInterface $connection ) |
Constructor. |
|
__debugInfo ( ) : array |
Returns an array that can be used to describe the internal state of this
object. |
|
__toString ( ) : string |
Returns string representation of this query (complete SQL statement). |
|
andHaving ( string | array | Cake\Database\ExpressionInterface | callable $conditions, array $types = [] ) |
Connects any previously defined set of conditions to the provided list
using the AND operator in the HAVING clause. This method operates in exactly
the same way as the method andWhere() does. Please refer to its
documentation for an insight on how to using each parameter. |
|
andWhere ( string | array | Cake\Database\ExpressionInterface | callable $conditions, array $types = [] ) |
Connects any previously defined set of conditions to the provided list
using the AND operator. This function accepts the conditions list in the same
format as the method where does, hence you can use arrays, expression objects
callback functions or strings. |
|
bind ( string | integer $param, mixed $value, string | integer $type = 'string' ) |
Associates a query placeholder to a value and a type. |
|
bufferResults ( boolean | null $enable = null ) : boolean | $this |
Enable/Disable buffered results. |
|
clause ( string $name ) : mixed |
Returns any data that was stored in the specified clause. This is useful for
modifying any internal part of the query and it is used by the SQL dialects
to transform the query accordingly before it is executed. The valid clauses that
can be retrieved are: delete, update, set, insert, values, select, distinct,
from, join, set, where, group, having, order, limit, offset and union. |
|
connection ( Cake\Datasource\ConnectionInterface | null $connection = null ) |
Sets the connection instance to be used for executing and transforming this query
When called with a null argument, it will return the current connection instance. |
|
decorateResults ( callable | null $callback, boolean $overwrite = false ) |
Registers a callback to be executed for each result that is fetched from the
result set, the callback function will receive as first parameter an array with
the raw data from the database for every row that is fetched and must return the
row with any possible modifications. |
|
delete ( string | null $table = null ) |
Create a delete query. |
|
distinct ( array | Cake\Database\ExpressionInterface | string | boolean $on = [], boolean $overwrite = false ) |
Adds a DISTINCT clause to the query to remove duplicates from the result set. |
|
epilog ( string | Cake\Database\Expression\QueryExpression | null $expression = null ) |
A string or expression that will be appended to the generated query |
|
execute ( ) : Cake\Database\StatementInterface |
Compiles the SQL representation of this query and executes it using the
configured connection object. Returns the resulting statement object. |
|
from ( array | string $tables = [], boolean $overwrite = false ) |
Adds a single or multiple tables to be used in the FROM clause for this query. |
|
func ( ) : Cake\Database\FunctionsBuilder |
Returns an instance of a functions builder object that can be used for
generating arbitrary SQL functions. |
|
getIterator ( ) : Iterator |
Executes this query and returns a results iterator. This function is required
for implementing the IteratorAggregate interface and allows the query to be
iterated without having to call execute() manually, thus making it look like
a result set instead of the query itself. |
|
group ( array | Cake\Database\ExpressionInterface | string $fields, boolean $overwrite = false ) |
Adds a single or multiple fields to be used in the GROUP BY clause for this query. |
|
having ( string | array | Cake\Database\ExpressionInterface | callable | null $conditions = null, array $types = [], boolean $overwrite = false ) |
Adds a condition or set of conditions to be used in the HAVING clause for this
query. This method operates in exactly the same way as the method where()
does. Please refer to its documentation for an insight on how to using each
parameter. |
|
innerJoin ( string | array $table, string | array | Cake\Database\ExpressionInterface $conditions = [], array $types = [] ) |
Adds a single INNER JOIN clause to the query. |
|
insert ( array $columns, array $types = [] ) |
Create an insert query. |
|
into ( string $table ) |
Set the table name for insert queries. |
|
join ( array | string | null $tables = null, array $types = [], boolean $overwrite = false ) |
Adds a single or multiple tables to be used as JOIN clauses to this query. |
|
leftJoin ( string | array $table, string | array | Cake\Database\ExpressionInterface $conditions = [], array $types = [] ) |
Adds a single LEFT JOIN clause to the query. |
|
limit ( integer | Cake\Database\ExpressionInterface $num ) |
Sets the number of records that should be retrieved from database,
accepts an integer or an expression object that evaluates to an integer. |
|
modifier ( array | Cake\Database\ExpressionInterface | string $modifiers, boolean $overwrite = false ) |
Adds a single or multiple SELECT modifiers to be used in the SELECT. |
|
newExpr ( mixed $rawExpression = null ) : Cake\Database\Expression\QueryExpression |
Returns a new QueryExpression object. This is a handy function when
building complex queries using a fluent interface. You can also override
this function in subclasses to use a more specialized QueryExpression class
if required. |
|
offset ( integer | Cake\Database\ExpressionInterface $num ) |
Sets the number of records that should be skipped from the original result set
This is commonly used for paginating large results. Accepts an integer or an
expression object that evaluates to an integer. |
|
orHaving ( string | array | Cake\Database\ExpressionInterface | callable $conditions, array $types = [] ) |
Connects any previously defined set of conditions to the provided list
using the OR operator in the HAVING clause. This method operates in exactly
the same way as the method orWhere() does. Please refer to its
documentation for an insight on how to using each parameter. |
|
orWhere ( string | array | Cake\Database\ExpressionInterface | callable $conditions, array $types = [] ) |
Connects any previously defined set of conditions to the provided list
using the OR operator. This function accepts the conditions list in the same
format as the method where does, hence you can use arrays, expression objects
callback functions or strings. |
|
order ( array | Cake\Database\ExpressionInterface | string $fields, boolean $overwrite = false ) |
Adds a single or multiple fields to be used in the ORDER clause for this query. |
|
orderAsc ( string | Cake\Database\Expression\QueryExpression $field, boolean $overwrite = false ) |
Add an ORDER BY clause with an ASC direction. |
|
orderDesc ( string | Cake\Database\Expression\QueryExpression $field, boolean $overwrite = false ) |
Add an ORDER BY clause with a DESC direction. |
|
page ( integer $num, integer | null $limit = null ) |
Set the page of results you want. |
|
removeJoin ( string $name ) |
Remove a join if it has been defined. |
|
rightJoin ( string | array $table, string | array | Cake\Database\ExpressionInterface $conditions = [], array $types = [] ) |
Adds a single RIGHT JOIN clause to the query. |
|
select ( array | Cake\Database\ExpressionInterface | string | callable $fields = [], boolean $overwrite = false ) |
Adds new fields to be returned by a SELECT statement when this query is
executed. Fields can be passed as an array of strings, array of expression
objects, a single expression or a single string. |
|
selectTypeMap ( Cake\Database\TypeMap $typeMap = null ) |
Sets the TypeMap class where the types for each of the fields in the
select clause are stored. |
|
set ( string | array | callable | Cake\Database\Expression\QueryExpression $key, mixed $value = null, array $types = [] ) |
Set one or many fields to update. |
|
sql ( ValueBinder $generator = null ) : string |
Returns the SQL representation of this object. |
|
traverse ( callable $visitor, array $parts = [] ) |
Will iterate over every specified part. Traversing functions can aggregate
results using variables in the closure or instance variables. This function
is commonly used as a way for traversing all query parts that
are going to be used for constructing a query. |
|
traverseExpressions ( callable $callback ) |
This function works similar to the traverse() function, with the difference
that it does a full depth traversal of the entire expression tree. This will execute
the provided callback function for each ExpressionInterface object that is
stored inside this query at any nesting depth in any part of the query. |
|
type ( ) : string |
Returns the type of this query (select, insert, update, delete) |
|
union ( string | Query $query, boolean $overwrite = false ) |
Adds a complete query to be used in conjunction with an UNION operator with
this query. This is used to combine the result set of this query with the one
that will be returned by the passed query. You can add as many queries as you
required by calling multiple times this method with different queries. |
|
unionAll ( string | Query $query, boolean $overwrite = false ) |
Adds a complete query to be used in conjunction with the UNION ALL operator with
this query. This is used to combine the result set of this query with the one
that will be returned by the passed query. You can add as many queries as you
required by calling multiple times this method with different queries. |
|
update ( string $table ) |
Create an update query. |
|
valueBinder ( ValueBinder | null $binder = null ) |
Returns the currently used ValueBinder instance. If a value is passed,
it will be set as the new instance to be used. |
|
values ( array | Query $data ) |
Set the values for an insert query. |
|
where ( string | array | Cake\Database\ExpressionInterface | callable | null $conditions = null, array $types = [], boolean $overwrite = false ) |
Adds a condition or set of conditions to be used in the WHERE clause for this
query. Conditions can be expressed as an array of fields as keys with
comparison operators in it, the values for the array will be used for comparing
the field to such literal. Finally, conditions can be expressed as a single
string or an array of strings. |
|