Result.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. declare(strict_types=1);
  3. namespace Doctrine\DBAL\Driver;
  4. /**
  5. * Driver-level result statement execution result.
  6. */
  7. interface Result
  8. {
  9. /**
  10. * Returns the next row of the result as a numeric array or FALSE if there are no more rows.
  11. *
  12. * @return array<int,mixed>|false
  13. *
  14. * @throws Exception
  15. */
  16. public function fetchNumeric();
  17. /**
  18. * Returns the next row of the result as an associative array or FALSE if there are no more rows.
  19. *
  20. * @return array<string,mixed>|false
  21. *
  22. * @throws Exception
  23. */
  24. public function fetchAssociative();
  25. /**
  26. * Returns the first value of the next row of the result or FALSE if there are no more rows.
  27. *
  28. * @return mixed|false
  29. *
  30. * @throws Exception
  31. */
  32. public function fetchOne();
  33. /**
  34. * Returns an array containing all of the result rows represented as numeric arrays.
  35. *
  36. * @return array<int,array<int,mixed>>
  37. *
  38. * @throws Exception
  39. */
  40. public function fetchAllNumeric(): array;
  41. /**
  42. * Returns an array containing all of the result rows represented as associative arrays.
  43. *
  44. * @return array<int,array<string,mixed>>
  45. *
  46. * @throws Exception
  47. */
  48. public function fetchAllAssociative(): array;
  49. /**
  50. * Returns an array containing the values of the first column of the result.
  51. *
  52. * @return array<int,mixed>
  53. *
  54. * @throws Exception
  55. */
  56. public function fetchFirstColumn(): array;
  57. /**
  58. * Returns the number of rows affected by the DELETE, INSERT, or UPDATE statement that produced the result.
  59. *
  60. * If the statement executed a SELECT query or a similar platform-specific SQL (e.g. DESCRIBE, SHOW, etc.),
  61. * some database drivers may return the number of rows returned by that query. However, this behaviour
  62. * is not guaranteed for all drivers and should not be relied on in portable applications.
  63. *
  64. * @return int The number of rows.
  65. */
  66. public function rowCount();
  67. /**
  68. * Returns the number of columns in the result
  69. *
  70. * @return int The number of columns in the result. If the columns cannot be counted,
  71. * this method must return 0.
  72. */
  73. public function columnCount();
  74. /**
  75. * Discards the non-fetched portion of the result, enabling the originating statement to be executed again.
  76. */
  77. public function free(): void;
  78. }