2
0

QueryAdapter.php 3.4 KB

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