ResultStatement.php 5.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. namespace Doctrine\DBAL\Driver;
  3. use PDO;
  4. use Traversable;
  5. /**
  6. * Interface for the reading part of a prepare statement only.
  7. */
  8. interface ResultStatement extends Traversable
  9. {
  10. /**
  11. * Closes the cursor, enabling the statement to be executed again.
  12. *
  13. * @return bool TRUE on success or FALSE on failure.
  14. */
  15. public function closeCursor();
  16. /**
  17. * Returns the number of columns in the result set
  18. *
  19. * @return int The number of columns in the result set represented
  20. * by the PDOStatement object. If there is no result set,
  21. * this method should return 0.
  22. */
  23. public function columnCount();
  24. /**
  25. * Sets the fetch mode to use while iterating this statement.
  26. *
  27. * @param int $fetchMode The fetch mode must be one of the {@link \Doctrine\DBAL\FetchMode} constants.
  28. * @param mixed $arg2
  29. * @param mixed $arg3
  30. *
  31. * @return bool
  32. */
  33. public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null);
  34. /**
  35. * Returns the next row of a result set.
  36. *
  37. * @param int|null $fetchMode Controls how the next row will be returned to the caller.
  38. * The value must be one of the {@link \Doctrine\DBAL\FetchMode} constants,
  39. * defaulting to {@link \Doctrine\DBAL\FetchMode::MIXED}.
  40. * @param int $cursorOrientation For a ResultStatement object representing a scrollable cursor,
  41. * this value determines which row will be returned to the caller.
  42. * This value must be one of the \PDO::FETCH_ORI_* constants,
  43. * defaulting to \PDO::FETCH_ORI_NEXT. To request a scrollable
  44. * cursor for your ResultStatement object, you must set the \PDO::ATTR_CURSOR
  45. * attribute to \PDO::CURSOR_SCROLL when you prepare the SQL statement with
  46. * \PDO::prepare().
  47. * @param int $cursorOffset For a ResultStatement object representing a scrollable cursor for which the
  48. * cursorOrientation parameter is set to \PDO::FETCH_ORI_ABS, this value
  49. * specifies the absolute number of the row in the result set that shall be
  50. * fetched.
  51. * For a ResultStatement object representing a scrollable cursor for which the
  52. * cursorOrientation parameter is set to \PDO::FETCH_ORI_REL, this value
  53. * specifies the row to fetch relative to the cursor position before
  54. * ResultStatement::fetch() was called.
  55. *
  56. * @return mixed The return value of this method on success depends on the fetch mode. In all cases, FALSE is
  57. * returned on failure.
  58. */
  59. public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0);
  60. /**
  61. * Returns an array containing all of the result set rows.
  62. *
  63. * @param int|null $fetchMode Controls how the next row will be returned to the caller.
  64. * The value must be one of the {@link \Doctrine\DBAL\FetchMode} constants,
  65. * defaulting to {@link \Doctrine\DBAL\FetchMode::MIXED}.
  66. * @param int|null $fetchArgument This argument has a different meaning depending on the value of the $fetchMode parameter:
  67. * * {@link \Doctrine\DBAL\FetchMode::COLUMN}:
  68. * Returns the indicated 0-indexed column.
  69. * * {@link \Doctrine\DBAL\FetchMode::CUSTOM_OBJECT}:
  70. * Returns instances of the specified class, mapping the columns of each row
  71. * to named properties in the class.
  72. * * \PDO::FETCH_FUNC: Returns the results of calling the specified function, using each row's
  73. * columns as parameters in the call.
  74. * @param mixed[]|null $ctorArgs Controls how the next row will be returned to the caller.
  75. * The value must be one of the {@link \Doctrine\DBAL\FetchMode} constants,
  76. * defaulting to {@link \Doctrine\DBAL\FetchMode::MIXED}.
  77. *
  78. * @return mixed[]
  79. */
  80. public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null);
  81. /**
  82. * Returns a single column from the next row of a result set or FALSE if there are no more rows.
  83. *
  84. * @param int $columnIndex 0-indexed number of the column you wish to retrieve from the row.
  85. * If no value is supplied, fetches the first column.
  86. *
  87. * @return mixed|false A single column in the next row of a result set, or FALSE if there are no more rows.
  88. */
  89. public function fetchColumn($columnIndex = 0);
  90. }