API Documentation

Cloud/DocumentService/Query.php

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

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

\Zend_Cloud_DocumentService_Query

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.

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

Constants

Constant  QUERY_SELECT = 'select'

Known query types

Constant  QUERY_FROM = 'from'
Constant  QUERY_WHERE = 'where'
Constant  QUERY_WHEREID = 'whereid'
Constant  QUERY_LIMIT = 'limit'
Constant  QUERY_ORDER = 'order'

Properties

Propertyprotectedarray  $_clauses= 'array'

Clause list

Default valuearrayDetails
Type
array

Methods

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

Generic clause

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 Type Description
$name string

Clause/method name

$args mixed
Returns
Type Description
\Zend_Cloud_DocumentService_Query
methodpublicassemble( ) : array

"Assemble" the query

Simply returns the clauses present.

Returns
Type Description
array
methodpublicfrom( string $name ) : \Zend_Cloud_DocumentService_Query

FROM clause

Parameters
Name Type Description
$name string Field names
Returns
Type Description
\Zend_Cloud_DocumentService_Query
methodpublicgetClauses( ) : array

Return query clauses as an array

Returns
Type Description
array Clauses in the query
methodpubliclimit( int $limit ) : \Zend_Cloud_DocumentService_Query

LIMIT clause (how many items to return)

Parameters
Name Type Description
$limit int
Returns
Type Description
\Zend_Cloud_DocumentService_Query
methodpublicorder( string|int|array $sort, string $direction = asc ) : \Zend_Cloud_DocumentService_Query

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

Parameters
Name Type Description
$sort string|int|array
$direction string
Returns
Type Description
\Zend_Cloud_DocumentService_Query
methodpublicselect( null|string|array $select ) : \Zend_Cloud_DocumentService_Query

SELECT clause (fields to be selected)

Parameters
Name Type Description
$select null|string|array
Returns
Type Description
\Zend_Cloud_DocumentService_Query
methodpublicwhere( string $cond,  $value = null, string $op = and ) : \Zend_Cloud_DocumentService_Query

WHERE query

Parameters
Name Type Description
$cond string Condition
$value
$op string

relation to other clauses - and/or

Returns
Type Description
\Zend_Cloud_DocumentService_Query
methodpublicwhereId( string|int $value ) : \Zend_Cloud_DocumentService_Query

Select record or fields by ID

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

Parameters
Name Type Description
$value string|int Identifier to select by
Returns
Type Description
\Zend_Cloud_DocumentService_Query
Documentation was generated by DocBlox 0.13.3.