StatementInterface.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <?php
  2. /**
  3. *
  4. * Cube Framework $Id$ OJGsBso/Kf6cKBgxt346HnlkKxlvvOc04m2Izej414Y=
  5. *
  6. * @link http://codecu.be/framework
  7. * @copyright Copyright (c) 2014 CodeCube SRL
  8. * @license http://codecu.be/framework/license Commercial License
  9. *
  10. * @version 1.0
  11. */
  12. /**
  13. * db statement interface
  14. */
  15. namespace Cube\Db\Statement;
  16. interface StatementInterface
  17. {
  18. /**
  19. *
  20. * bind a column to a php variable
  21. *
  22. * @param string $column name or position of the column in the result set
  23. * @param mixed $param reference to the php variable to which the column will be bound
  24. * @param int $type data type of the parameter
  25. *
  26. * @return bool
  27. */
  28. public function bindColumn($column, &$param, $type = null);
  29. /**
  30. *
  31. * binds a parameter to the specified variable name
  32. *
  33. * @param int|string $parameter parameter identifier
  34. * @param mixed $variable name of the PHP variable to bind to the SQL statement parameter
  35. * @param int $type data type of the parameter
  36. * @param int $length length of the data type
  37. * @param mixed $options other driver options
  38. *
  39. * @return bool
  40. */
  41. public function bindParam($parameter, &$variable, $type = null, $length = null, $options = null);
  42. /**
  43. *
  44. * binds a value to a parameter
  45. *
  46. * @param int|string $parameter parameter identifier
  47. * @param mixed $value the value to bind to the parameter
  48. * @param string $type data type of the parameter
  49. *
  50. * @return bool
  51. */
  52. public function bindValue($parameter, &$value, $type = null);
  53. /**
  54. *
  55. * closes the cursor, allowing the statement to be executed again
  56. *
  57. * @return bool
  58. */
  59. public function closeCursor();
  60. /**
  61. *
  62. * returns the number of columns in the result set
  63. *
  64. * @return int
  65. */
  66. public function columnCount();
  67. /**
  68. *
  69. * fetch the error code associated with the last operation on the statement handle
  70. *
  71. * @return string
  72. */
  73. public function errorCode();
  74. /**
  75. *
  76. * fetch extended error information associated with the last operation on the statement handle
  77. *
  78. * @return array
  79. */
  80. public function errorInfo();
  81. /**
  82. *
  83. * execute a prepared statement
  84. *
  85. * @param array $params array of values with as many elements as there are bound parameters in the SQL statement being executed
  86. *
  87. * @return bool
  88. */
  89. public function execute(array $params = array());
  90. /**
  91. *
  92. * fetch the next row from the result set
  93. *
  94. * @param int $style fetch mode
  95. * @param int $cursor scrollable cursor
  96. * @param int $offset number of cursors
  97. *
  98. * @return mixed
  99. */
  100. public function fetch($style = null, $cursor = null, $offset = null);
  101. /**
  102. *
  103. * returns an array containing all of the result set rows
  104. *
  105. * @param int $style fetch mode
  106. * @param int $column column number, if fetch mode is by column
  107. *
  108. * @return array collection of rows, each in a format by fetch mode
  109. */
  110. public function fetchAll($style = null, $column = null);
  111. /**
  112. *
  113. * returns a single column from the next row of a result set
  114. *
  115. * @param int $column column number from the fetch row or the first column if no column is set
  116. *
  117. * @return string
  118. */
  119. public function fetchColumn($column = null);
  120. /**
  121. *
  122. * fetches the next row and returns it as an object
  123. *
  124. * @param string $class name of the class to create
  125. * @param array $config constructor arguments to add to the class
  126. *
  127. * @return mixed one object instance of the specified class
  128. */
  129. public function fetchObject($class = 'stdClass', array $config = array());
  130. /**
  131. *
  132. * retrieve a statement attribute
  133. *
  134. * @param string $attribute the attribute name
  135. */
  136. public function getAttribute($attribute);
  137. /**
  138. *
  139. * advances to the next rowset in a multi-rowset statement handle
  140. *
  141. * @return bool
  142. */
  143. public function nextRowset();
  144. /**
  145. *
  146. * returns the number of rows affected by the last SQL statement
  147. *
  148. * @return int the number of rows affected
  149. */
  150. public function rowCount();
  151. /**
  152. *
  153. * set a statement attribute
  154. *
  155. * @param string $key attribute name
  156. * @param mixed $value attribute value
  157. *
  158. * @return bool
  159. */
  160. public function setAttribute($key, $value);
  161. /**
  162. *
  163. * set the default fetch mode for this statement.
  164. *
  165. * @param int $mode the fetch mode
  166. *
  167. * @return bool
  168. */
  169. public function setFetchMode($mode);
  170. }