Generic query object

Aggregates operations in an array of clauses, where the first element describes the clause type, and the next element describes the criteria.

category Zend
package Zend_Cloud
subpackage DocumentService
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License

 Methods

Generic clause

__call(string $name, mixed $args) : \Zend_Cloud_DocumentService_Query

You can use any clause by doing $query->foo('bar') but concrete adapters should be able to recognise it

The call will be iterpreted as clause 'foo' with argument 'bar'

Parameters

$name

string

Clause/method name

$args

mixed

Returns

\Zend_Cloud_DocumentService_Query

"Assemble" the query

assemble() : array

Simply returns the clauses present.

inherited_from \Zend_Cloud_DocumentService_QueryAdapter::assemble()

Returns

array

FROM clause

from(string $name) : \Zend_Cloud_DocumentService_Query
inherited_from \Zend_Cloud_DocumentService_QueryAdapter::from()

Parameters

$name

string

Field names

Returns

\Zend_Cloud_DocumentService_Query

Return query clauses as an array

getClauses() : array

Returns

arrayClauses in the query

LIMIT clause (how many items to return)

limit(integer $limit) : \Zend_Cloud_DocumentService_Query
inherited_from \Zend_Cloud_DocumentService_QueryAdapter::limit()

Parameters

$limit

integer

Returns

\Zend_Cloud_DocumentService_Query

ORDER clause; field or fields to sort by, and direction to sort

order(string|integer|array $sort, string $direction = 'asc') : \Zend_Cloud_DocumentService_Query
inherited_from \Zend_Cloud_DocumentService_QueryAdapter::order()

Parameters

$sort

stringintegerarray

$direction

string

Returns

\Zend_Cloud_DocumentService_Query

SELECT clause (fields to be selected)

select(null|string|array $select) : \Zend_Cloud_DocumentService_Query
inherited_from \Zend_Cloud_DocumentService_QueryAdapter::select()

Parameters

$select

nullstringarray

Returns

\Zend_Cloud_DocumentService_Query

WHERE query

where(string $cond, mixed $value = null, string $op = 'and') : \Zend_Cloud_DocumentService_Query
inherited_from \Zend_Cloud_DocumentService_QueryAdapter::where()

Parameters

$cond

string

Condition

$value

$op

string

relation to other clauses - and/or

Returns

\Zend_Cloud_DocumentService_Query

Select record or fields by ID

whereId(string|integer $value) : \Zend_Cloud_DocumentService_Query

This one should be used when fetching specific rows since some adapters have special syntax for primary keys

inherited_from \Zend_Cloud_DocumentService_QueryAdapter::whereId()

Parameters

$value

stringinteger

Identifier to select by

Returns

\Zend_Cloud_DocumentService_Query

 Properties

 

Clause list

$_clauses : array

Default

array()

 Constants

 

QUERY_FROM

QUERY_FROM = 'from' 
 

QUERY_LIMIT

QUERY_LIMIT = 'limit' 
 

QUERY_ORDER

QUERY_ORDER = 'order' 
 

Known query types

QUERY_SELECT = 'select' 
 

QUERY_WHERE

QUERY_WHERE = 'where' 
 

QUERY_WHEREID

QUERY_WHEREID = 'whereid'