2
0

Interface.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Db
  17. * @subpackage Statement
  18. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /**
  22. * Emulates a PDOStatement for native database adapters.
  23. *
  24. * @category Zend
  25. * @package Zend_Db
  26. * @subpackage Statement
  27. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  28. * @license http://framework.zend.com/license/new-bsd New BSD License
  29. */
  30. interface Zend_Db_Statement_Interface
  31. {
  32. /**
  33. * Bind a column of the statement result set to a PHP variable.
  34. *
  35. * @param string $column Name the column in the result set, either by
  36. * position or by name.
  37. * @param mixed $param Reference to the PHP variable containing the value.
  38. * @param mixed $type OPTIONAL
  39. * @return bool
  40. * @throws Zend_Db_Statement_Exception
  41. */
  42. public function bindColumn($column, &$param, $type = null);
  43. /**
  44. * Binds a parameter to the specified variable name.
  45. *
  46. * @param mixed $parameter Name the parameter, either integer or string.
  47. * @param mixed $variable Reference to PHP variable containing the value.
  48. * @param mixed $type OPTIONAL Datatype of SQL parameter.
  49. * @param mixed $length OPTIONAL Length of SQL parameter.
  50. * @param mixed $options OPTIONAL Other options.
  51. * @return bool
  52. * @throws Zend_Db_Statement_Exception
  53. */
  54. public function bindParam($parameter, &$variable, $type = null, $length = null, $options = null);
  55. /**
  56. * Binds a value to a parameter.
  57. *
  58. * @param mixed $parameter Name the parameter, either integer or string.
  59. * @param mixed $value Scalar value to bind to the parameter.
  60. * @param mixed $type OPTIONAL Datatype of the parameter.
  61. * @return bool
  62. * @throws Zend_Db_Statement_Exception
  63. */
  64. public function bindValue($parameter, $value, $type = null);
  65. /**
  66. * Closes the cursor, allowing the statement to be executed again.
  67. *
  68. * @return bool
  69. * @throws Zend_Db_Statement_Exception
  70. */
  71. public function closeCursor();
  72. /**
  73. * Returns the number of columns in the result set.
  74. * Returns null if the statement has no result set metadata.
  75. *
  76. * @return int The number of columns.
  77. * @throws Zend_Db_Statement_Exception
  78. */
  79. public function columnCount();
  80. /**
  81. * Retrieves the error code, if any, associated with the last operation on
  82. * the statement handle.
  83. *
  84. * @return string error code.
  85. * @throws Zend_Db_Statement_Exception
  86. */
  87. public function errorCode();
  88. /**
  89. * Retrieves an array of error information, if any, associated with the
  90. * last operation on the statement handle.
  91. *
  92. * @return array
  93. * @throws Zend_Db_Statement_Exception
  94. */
  95. public function errorInfo();
  96. /**
  97. * Executes a prepared statement.
  98. *
  99. * @param array $params OPTIONAL Values to bind to parameter placeholders.
  100. * @return bool
  101. * @throws Zend_Db_Statement_Exception
  102. */
  103. public function execute(array $params = array());
  104. /**
  105. * Fetches a row from the result set.
  106. *
  107. * @param int $style OPTIONAL Fetch mode for this fetch operation.
  108. * @param int $cursor OPTIONAL Absolute, relative, or other.
  109. * @param int $offset OPTIONAL Number for absolute or relative cursors.
  110. * @return mixed Array, object, or scalar depending on fetch mode.
  111. * @throws Zend_Db_Statement_Exception
  112. */
  113. public function fetch($style = null, $cursor = null, $offset = null);
  114. /**
  115. * Returns an array containing all of the result set rows.
  116. *
  117. * @param int $style OPTIONAL Fetch mode.
  118. * @param int $col OPTIONAL Column number, if fetch mode is by column.
  119. * @return array Collection of rows, each in a format by the fetch mode.
  120. * @throws Zend_Db_Statement_Exception
  121. */
  122. public function fetchAll($style = null, $col = null);
  123. /**
  124. * Returns a single column from the next row of a result set.
  125. *
  126. * @param int $col OPTIONAL Position of the column to fetch.
  127. * @return string
  128. * @throws Zend_Db_Statement_Exception
  129. */
  130. public function fetchColumn($col = 0);
  131. /**
  132. * Fetches the next row and returns it as an object.
  133. *
  134. * @param string $class OPTIONAL Name of the class to create.
  135. * @param array $config OPTIONAL Constructor arguments for the class.
  136. * @return mixed One object instance of the specified class.
  137. * @throws Zend_Db_Statement_Exception
  138. */
  139. public function fetchObject($class = 'stdClass', array $config = array());
  140. /**
  141. * Retrieve a statement attribute.
  142. *
  143. * @param string $key Attribute name.
  144. * @return mixed Attribute value.
  145. * @throws Zend_Db_Statement_Exception
  146. */
  147. public function getAttribute($key);
  148. /**
  149. * Retrieves the next rowset (result set) for a SQL statement that has
  150. * multiple result sets. An example is a stored procedure that returns
  151. * the results of multiple queries.
  152. *
  153. * @return bool
  154. * @throws Zend_Db_Statement_Exception
  155. */
  156. public function nextRowset();
  157. /**
  158. * Returns the number of rows affected by the execution of the
  159. * last INSERT, DELETE, or UPDATE statement executed by this
  160. * statement object.
  161. *
  162. * @return int The number of rows affected.
  163. * @throws Zend_Db_Statement_Exception
  164. */
  165. public function rowCount();
  166. /**
  167. * Set a statement attribute.
  168. *
  169. * @param string $key Attribute name.
  170. * @param mixed $val Attribute value.
  171. * @return bool
  172. * @throws Zend_Db_Statement_Exception
  173. */
  174. public function setAttribute($key, $val);
  175. /**
  176. * Set the default fetch mode for this statement.
  177. *
  178. * @param int $mode The fetch mode.
  179. * @return bool
  180. * @throws Zend_Db_Statement_Exception
  181. */
  182. public function setFetchMode($mode);
  183. }