ResultStatement.php 5.6 KB

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