ResultStatement.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. 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 $fetchMode
  48. */
  49. function setFetchMode($fetchMode, $arg2 = null, $arg3 = null);
  50. /**
  51. * fetch
  52. *
  53. * @see Query::HYDRATE_* constants
  54. * @param integer $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. function fetch($fetchMode = null);
  61. /**
  62. * Returns an array containing all of the result set rows
  63. *
  64. * @param integer $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. function fetchAll($fetchMode = null);
  71. /**
  72. * fetchColumn
  73. * Returns a single column from the next row of a
  74. * result set or FALSE if there are no more rows.
  75. *
  76. * @param integer $columnIndex 0-indexed number of the column you wish to retrieve from the row. If no
  77. * value is supplied, PDOStatement->fetchColumn()
  78. * fetches the first column.
  79. *
  80. * @return string returns a single column in the next row of a result set.
  81. */
  82. function fetchColumn($columnIndex = 0);
  83. }