Interface.php 6.4 KB

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