1
0

IResult.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright 2021 Christoph Wurst <christoph@winzerhof-wurst.at>
  5. *
  6. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  7. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  8. *
  9. * @license GNU AGPL version 3 or any later version
  10. *
  11. * This program is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License as
  13. * published by the Free Software Foundation, either version 3 of the
  14. * License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. */
  25. namespace OCP\DB;
  26. use PDO;
  27. /**
  28. * This interface represents the result of a database query.
  29. *
  30. * Usage:
  31. *
  32. * ```php
  33. * $qb = $this->db->getQueryBuilder();
  34. * $qb->select(...);
  35. * $result = $query->executeQuery();
  36. * ```
  37. *
  38. * This interface must not be implemented in your application.
  39. *
  40. * @since 21.0.0
  41. */
  42. interface IResult {
  43. /**
  44. * @return true
  45. *
  46. * @since 21.0.0
  47. */
  48. public function closeCursor(): bool;
  49. /**
  50. * @param int $fetchMode
  51. *
  52. * @return mixed
  53. *
  54. * @since 21.0.0
  55. */
  56. public function fetch(int $fetchMode = PDO::FETCH_ASSOC);
  57. /**
  58. * @param int $fetchMode (one of PDO::FETCH_ASSOC, PDO::FETCH_NUM or PDO::FETCH_COLUMN (2, 3 or 7)
  59. *
  60. * @return list<mixed>
  61. *
  62. * @since 21.0.0
  63. */
  64. public function fetchAll(int $fetchMode = PDO::FETCH_ASSOC): array;
  65. /**
  66. * @return mixed
  67. *
  68. * @since 21.0.0
  69. * @deprecated 21.0.0 use \OCP\DB\IResult::fetchOne
  70. */
  71. public function fetchColumn();
  72. /**
  73. * Returns the first value of the next row of the result or FALSE if there are no more rows.
  74. *
  75. * @return false|mixed
  76. *
  77. * @since 21.0.0
  78. */
  79. public function fetchOne();
  80. /**
  81. * @return int
  82. *
  83. * @since 21.0.0
  84. */
  85. public function rowCount(): int;
  86. }