ResultStatement.php 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 MIT license. For more information, see
  17. * <http://www.doctrine-project.org>.
  18. */
  19. namespace Doctrine\DBAL\Driver;
  20. /**
  21. * Interface for the reading part of a prepare statement only.
  22. *
  23. * @author Benjamin Eberlei <kontakt@beberlei.de>
  24. */
  25. interface ResultStatement extends \Traversable
  26. {
  27. /**
  28. * Closes the cursor, enabling the statement to be executed again.
  29. *
  30. * @return boolean TRUE on success or FALSE on failure.
  31. */
  32. public function closeCursor();
  33. /**
  34. * Returns the number of columns in the result set
  35. *
  36. * @return integer The number of columns in the result set represented
  37. * by the PDOStatement object. If there is no result set,
  38. * this method should return 0.
  39. */
  40. public function columnCount();
  41. /**
  42. * Sets the fetch mode to use while iterating this statement.
  43. *
  44. * @param integer $fetchMode
  45. * @param mixed $arg2
  46. * @param mixed $arg3
  47. *
  48. * @return boolean
  49. */
  50. public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null);
  51. /**
  52. * @see Query::HYDRATE_* constants
  53. *
  54. * @param integer|null $fetchMode 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. * @return mixed
  59. */
  60. public function fetch($fetchMode = null);
  61. /**
  62. * Returns an array containing all of the result set rows.
  63. *
  64. * @param integer|null $fetchMode Controls how the next row will be returned to the caller.
  65. * This value must be one of the Query::HYDRATE_* constants,
  66. * defaulting to Query::HYDRATE_BOTH
  67. *
  68. * @return array
  69. */
  70. public function fetchAll($fetchMode = null);
  71. /**
  72. * Returns a single column from the next row of a result set or FALSE if there are no more rows.
  73. *
  74. * @param integer $columnIndex 0-indexed number of the column you wish to retrieve from the row.
  75. * If no value is supplied, PDOStatement->fetchColumn()
  76. * fetches the first column.
  77. *
  78. * @return string|boolean A single column in the next row of a result set, or FALSE if there are no more rows.
  79. */
  80. public function fetchColumn($columnIndex = 0);
  81. }