|
1 <?php |
|
2 /** |
|
3 * LICENSE |
|
4 * |
|
5 * This source file is subject to the new BSD license that is bundled |
|
6 * with this package in the file LICENSE.txt. |
|
7 * It is also available through the world-wide-web at this URL: |
|
8 * http://framework.zend.com/license/new-bsd |
|
9 * If you did not receive a copy of the license and are unable to |
|
10 * obtain it through the world-wide-web, please send an email |
|
11 * to license@zend.com so we can send you a copy immediately. |
|
12 * |
|
13 * @category Zend |
|
14 * @package Zend_Cloud |
|
15 * @subpackage DocumentService |
|
16 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
17 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
18 */ |
|
19 |
|
20 /** |
|
21 * This interface describes the API that concrete query adapter should implement |
|
22 * |
|
23 * Common interface for document storage services in the cloud. This interface |
|
24 * supports most document services and provides some flexibility for |
|
25 * vendor-specific features and requirements via an optional $options array in |
|
26 * each method signature. Classes implementing this interface should implement |
|
27 * URI construction for collections and documents from the parameters given in each |
|
28 * method and the account data passed in to the constructor. Classes |
|
29 * implementing this interface are also responsible for security; access control |
|
30 * isn't currently supported in this interface, although we are considering |
|
31 * access control support in future versions of the interface. Query |
|
32 * optimization mechanisms are also not supported in this version. |
|
33 * |
|
34 * @category Zend |
|
35 * @package Zend_Cloud |
|
36 * @subpackage DocumentService |
|
37 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
38 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
39 */ |
|
40 interface Zend_Cloud_DocumentService_QueryAdapter |
|
41 { |
|
42 /** |
|
43 * SELECT clause (fields to be selected) |
|
44 * |
|
45 * @param string $select |
|
46 * @return Zend_Cloud_DocumentService_QueryAdapter |
|
47 */ |
|
48 public function select($select); |
|
49 |
|
50 /** |
|
51 * FROM clause (table name) |
|
52 * |
|
53 * @param string $from |
|
54 * @return Zend_Cloud_DocumentService_QueryAdapter |
|
55 */ |
|
56 public function from($from); |
|
57 |
|
58 /** |
|
59 * WHERE clause (conditions to be used) |
|
60 * |
|
61 * @param string $where |
|
62 * @param mixed $value Value or array of values to be inserted instead of ? |
|
63 * @param string $op Operation to use to join where clauses (AND/OR) |
|
64 * @return Zend_Cloud_DocumentService_QueryAdapter |
|
65 */ |
|
66 public function where($where, $value = null, $op = 'and'); |
|
67 |
|
68 /** |
|
69 * WHERE clause for item ID |
|
70 * |
|
71 * This one should be used when fetching specific rows since some adapters |
|
72 * have special syntax for primary keys |
|
73 * |
|
74 * @param mixed $value Row ID for the document |
|
75 * @return Zend_Cloud_DocumentService_QueryAdapter |
|
76 */ |
|
77 public function whereId($value); |
|
78 |
|
79 /** |
|
80 * LIMIT clause (how many rows ot return) |
|
81 * |
|
82 * @param int $limit |
|
83 * @return Zend_Cloud_DocumentService_QueryAdapter |
|
84 */ |
|
85 public function limit($limit); |
|
86 |
|
87 /** |
|
88 * ORDER BY clause (sorting) |
|
89 * |
|
90 * @param string $sort Column to sort by |
|
91 * @param string $direction Direction - asc/desc |
|
92 * @return Zend_Cloud_DocumentService_QueryAdapter |
|
93 */ |
|
94 public function order($sort, $direction = 'asc'); |
|
95 |
|
96 /** |
|
97 * Assemble the query into a format the adapter can utilize |
|
98 * |
|
99 * @return mixed |
|
100 */ |
|
101 public function assemble(); |
|
102 } |