ResultStatement.php 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 The fetch mode must be one of the PDO::FETCH_* constants.
  45. * @param mixed $arg2
  46. * @param mixed $arg3
  47. *
  48. * @return boolean
  49. *
  50. * @see PDO::FETCH_* constants.
  51. */
  52. public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null);
  53. /**
  54. * Returns the next row of a result set.
  55. *
  56. * @param integer|null $fetchMode Controls how the next row will be returned to the caller.
  57. * The value must be one of the PDO::FETCH_* constants,
  58. * defaulting to PDO::FETCH_BOTH.
  59. *
  60. * @return mixed The return value of this method on success depends on the fetch mode. In all cases, FALSE is
  61. * returned on failure.
  62. *
  63. * @see PDO::FETCH_* constants.
  64. */
  65. public function fetch($fetchMode = null);
  66. /**
  67. * Returns an array containing all of the result set rows.
  68. *
  69. * @param integer|null $fetchMode Controls how the next row will be returned to the caller.
  70. * The value must be one of the PDO::FETCH_* constants,
  71. * defaulting to PDO::FETCH_BOTH.
  72. *
  73. * @return array
  74. *
  75. * @see PDO::FETCH_* constants.
  76. */
  77. public function fetchAll($fetchMode = null);
  78. /**
  79. * Returns a single column from the next row of a result set or FALSE if there are no more rows.
  80. *
  81. * @param integer $columnIndex 0-indexed number of the column you wish to retrieve from the row.
  82. * If no value is supplied, PDOStatement->fetchColumn()
  83. * fetches the first column.
  84. *
  85. * @return string|boolean A single column in the next row of a result set, or FALSE if there are no more rows.
  86. */
  87. public function fetchColumn($columnIndex = 0);
  88. }