ResultStatement.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. /*
  3. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  4. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  5. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  6. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  9. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. *
  15. * This software consists of voluntary contributions made by many individuals
  16. * and is licensed under the LGPL. For more information, see
  17. * <http://www.doctrine-project.org>.
  18. */
  19. namespace Doctrine\DBAL\Driver;
  20. use PDO;
  21. /**
  22. * Interface for the reading part of a prepare statement only.
  23. *
  24. * @author Benjamin Eberlei <kontakt@beberlei.de>
  25. */
  26. interface ResultStatement extends \Traversable
  27. {
  28. /**
  29. * Closes the cursor, enabling the statement to be executed again.
  30. *
  31. * @return boolean Returns TRUE on success or FALSE on failure.
  32. */
  33. function closeCursor();
  34. /**
  35. * columnCount
  36. * Returns the number of columns in the result set
  37. *
  38. * @return integer Returns the number of columns in the result set represented
  39. * by the PDOStatement object. If there is no result set,
  40. * this method should return 0.
  41. */
  42. function columnCount();
  43. /**
  44. * setFetchMode
  45. * Set the fetch mode to use while iterating this statement.
  46. *
  47. * @param integer $fetchStyle
  48. */
  49. public function setFetchMode($fetchStyle);
  50. /**
  51. * fetch
  52. *
  53. * @see Query::HYDRATE_* constants
  54. * @param integer $fetchStyle Controls how the next row will be returned to the caller.
  55. * This value must be one of the Query::HYDRATE_* constants,
  56. * defaulting to Query::HYDRATE_BOTH
  57. *
  58. * @param integer $cursorOrientation For a PDOStatement object representing a scrollable cursor,
  59. * this value determines which row will be returned to the caller.
  60. * This value must be one of the Query::HYDRATE_ORI_* constants, defaulting to
  61. * Query::HYDRATE_ORI_NEXT. To request a scrollable cursor for your
  62. * PDOStatement object,
  63. * you must set the PDO::ATTR_CURSOR attribute to Doctrine::CURSOR_SCROLL when you
  64. * prepare the SQL statement with Doctrine_Adapter_Interface->prepare().
  65. *
  66. * @param integer $cursorOffset For a PDOStatement object representing a scrollable cursor for which the
  67. * $cursorOrientation parameter is set to Query::HYDRATE_ORI_ABS, this value specifies
  68. * the absolute number of the row in the result set that shall be fetched.
  69. *
  70. * For a PDOStatement object representing a scrollable cursor for
  71. * which the $cursorOrientation parameter is set to Query::HYDRATE_ORI_REL, this value
  72. * specifies the row to fetch relative to the cursor position before
  73. * PDOStatement->fetch() was called.
  74. *
  75. * @return mixed
  76. */
  77. function fetch($fetchStyle = PDO::FETCH_BOTH);
  78. /**
  79. * Returns an array containing all of the result set rows
  80. *
  81. * @param integer $fetchStyle Controls how the next row will be returned to the caller.
  82. * This value must be one of the Query::HYDRATE_* constants,
  83. * defaulting to Query::HYDRATE_BOTH
  84. *
  85. * @param integer $columnIndex Returns the indicated 0-indexed column when the value of $fetchStyle is
  86. * Query::HYDRATE_COLUMN. Defaults to 0.
  87. *
  88. * @return array
  89. */
  90. function fetchAll($fetchStyle = PDO::FETCH_BOTH);
  91. /**
  92. * fetchColumn
  93. * Returns a single column from the next row of a
  94. * result set or FALSE if there are no more rows.
  95. *
  96. * @param integer $columnIndex 0-indexed number of the column you wish to retrieve from the row. If no
  97. * value is supplied, PDOStatement->fetchColumn()
  98. * fetches the first column.
  99. *
  100. * @return string returns a single column in the next row of a result set.
  101. */
  102. function fetchColumn($columnIndex = 0);
  103. }