Class implementing Query adapter for working with SimpleDb queries in a structured way

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
inherited_from \Zend_Cloud_DocumentService_Query

 Methods

Generic clause

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

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

Constructor

__construct(\Zend_Cloud_DocumentService_Adapter_SimpleDb $adapter, null|string $collectionName = null) : void

Parameters

$adapter

\Zend_Cloud_DocumentService_Adapter_SimpleDb

$collectionName

nullstring

Assemble the query into a format the adapter can utilize

assemble($collectionName = null) : string

Simply returns the clauses present.

var

Name of collection from which to select

inherited_from \Zend_Cloud_DocumentService_Query::assemble()

Parameters

$collectionName

Returns

string

"Assemble" the query

assemble() : array
Inherited

Simply returns the clauses present.

inherited_from \Zend_Cloud_DocumentService_QueryAdapter::assemble()

Returns

array

FROM clause

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

Parameters

$name

string

Field names

Returns

\Zend_Cloud_DocumentService_Query

Get adapter

getAdapter() : \Zend_Cloud_DocumentService_Adapter_SimpleDb

Returns

\Zend_Cloud_DocumentService_Adapter_SimpleDb

Return query clauses as an array

getClauses() : array
Inherited

Returns

arrayClauses in the query

LIMIT clause (how many items to return)

limit(integer $limit) : \Zend_Cloud_DocumentService_Query
Inherited
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
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
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
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
Inherited

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

Parse a where statement into service-specific language

_parseWhere(string $where, array $args) : string
todo Ensure this fulfills the entire SimpleDB query specification for WHERE

Parameters

$where

string

$args

array

Returns

string

 Properties

 

$_adapter

$_adapter : \Zend_Cloud_DocumentService_Adapter_SimpleDb

Default

 

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'