File indexing completed on 2024-12-22 05:36:31

0001 <?php
0002 /**
0003  * LICENSE
0004  *
0005  * This source file is subject to the new BSD license that is bundled
0006  * with this package in the file LICENSE.txt.
0007  * It is also available through the world-wide-web at this URL:
0008  * http://framework.zend.com/license/new-bsd
0009  * If you did not receive a copy of the license and are unable to
0010  * obtain it through the world-wide-web, please send an email
0011  * to license@zend.com so we can send you a copy immediately.
0012  *
0013  * @category   Zend
0014  * @package    Zend_Cloud
0015  * @subpackage DocumentService
0016  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0017  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0018  */
0019 
0020 /**
0021  * This interface describes the API that concrete query adapter should implement
0022  *
0023  * Common interface for document storage services in the cloud. This interface
0024  * supports most document services and provides some flexibility for
0025  * vendor-specific features and requirements via an optional $options array in
0026  * each method signature. Classes implementing this interface should implement
0027  * URI construction for collections and documents from the parameters given in each
0028  * method and the account data passed in to the constructor. Classes
0029  * implementing this interface are also responsible for security; access control
0030  * isn't currently supported in this interface, although we are considering
0031  * access control support in future versions of the interface. Query
0032  * optimization mechanisms are also not supported in this version.
0033  *
0034  * @category   Zend
0035  * @package    Zend_Cloud
0036  * @subpackage DocumentService
0037  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0038  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0039  */
0040 interface Zend_Cloud_DocumentService_QueryAdapter
0041 {
0042     /**
0043      * SELECT clause (fields to be selected)
0044      *
0045      * @param string $select
0046      * @return Zend_Cloud_DocumentService_QueryAdapter
0047      */
0048     public function select($select);
0049 
0050     /**
0051      * FROM clause (table name)
0052      *
0053      * @param string $from
0054      * @return Zend_Cloud_DocumentService_QueryAdapter
0055      */
0056     public function from($from);
0057 
0058     /**
0059      * WHERE clause (conditions to be used)
0060      *
0061      * @param string $where
0062      * @param mixed $value Value or array of values to be inserted instead of ?
0063      * @param string $op Operation to use to join where clauses (AND/OR)
0064      * @return Zend_Cloud_DocumentService_QueryAdapter
0065      */
0066     public function where($where, $value = null, $op = 'and');
0067 
0068     /**
0069      * WHERE clause for item ID
0070      *
0071      * This one should be used when fetching specific rows since some adapters
0072      * have special syntax for primary keys
0073      *
0074      * @param mixed $value Row ID for the document
0075      * @return Zend_Cloud_DocumentService_QueryAdapter
0076      */
0077     public function whereId($value);
0078 
0079     /**
0080      * LIMIT clause (how many rows ot return)
0081      *
0082      * @param int $limit
0083      * @return Zend_Cloud_DocumentService_QueryAdapter
0084      */
0085     public function limit($limit);
0086 
0087     /**
0088      * ORDER BY clause (sorting)
0089      *
0090      * @param string $sort Column to sort by
0091      * @param string $direction Direction - asc/desc
0092      * @return Zend_Cloud_DocumentService_QueryAdapter
0093      */
0094     public function order($sort, $direction = 'asc');
0095 
0096     /**
0097      * Assemble the query into a format the adapter can utilize
0098      *
0099      * @return mixed
0100      */
0101     public function assemble();
0102 }