1
0

IResult.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\DB;
  8. use PDO;
  9. /**
  10. * This interface represents the result of a database query.
  11. *
  12. * Usage:
  13. *
  14. * ```php
  15. * $qb = $this->db->getQueryBuilder();
  16. * $qb->select(...);
  17. * $result = $query->executeQuery();
  18. * ```
  19. *
  20. * This interface must not be implemented in your application.
  21. *
  22. * @since 21.0.0
  23. */
  24. interface IResult {
  25. /**
  26. * @return true
  27. *
  28. * @since 21.0.0
  29. */
  30. public function closeCursor(): bool;
  31. /**
  32. * @param int $fetchMode
  33. *
  34. * @return mixed
  35. *
  36. * @since 21.0.0
  37. */
  38. public function fetch(int $fetchMode = PDO::FETCH_ASSOC);
  39. /**
  40. * @param int $fetchMode (one of PDO::FETCH_ASSOC, PDO::FETCH_NUM or PDO::FETCH_COLUMN (2, 3 or 7)
  41. *
  42. * @return mixed[]
  43. *
  44. * @since 21.0.0
  45. */
  46. public function fetchAll(int $fetchMode = PDO::FETCH_ASSOC): array;
  47. /**
  48. * @return mixed
  49. *
  50. * @since 21.0.0
  51. * @deprecated 21.0.0 use \OCP\DB\IResult::fetchOne
  52. */
  53. public function fetchColumn();
  54. /**
  55. * Returns the first value of the next row of the result or FALSE if there are no more rows.
  56. *
  57. * @return false|mixed
  58. *
  59. * @since 21.0.0
  60. */
  61. public function fetchOne();
  62. /**
  63. * @return int
  64. *
  65. * @since 21.0.0
  66. */
  67. public function rowCount(): int;
  68. }