1
0

IQueryLogger.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCP\Diagnostics;
  8. use Doctrine\DBAL\Logging\SQLLogger;
  9. /**
  10. * Interface IQueryLogger
  11. *
  12. * @since 8.0.0
  13. */
  14. interface IQueryLogger extends SQLLogger {
  15. /**
  16. * Mark the start of a query providing query SQL statement, its parameters and types.
  17. * This method should be called as close to the DB as possible and after
  18. * query is finished finalized with stopQuery() method.
  19. *
  20. * @param string $sql
  21. * @param array|null $params
  22. * @param array|null $types
  23. * @since 8.0.0
  24. */
  25. public function startQuery($sql, ?array $params = null, ?array $types = null);
  26. /**
  27. * Mark the end of the current active query. Ending query should store \OCP\Diagnostics\IQuery to
  28. * be returned with getQueries() method.
  29. *
  30. * @return mixed
  31. * @since 8.0.0
  32. */
  33. public function stopQuery();
  34. /**
  35. * This method should return all \OCP\Diagnostics\IQuery objects stored using
  36. * startQuery()/stopQuery() methods.
  37. *
  38. * @return \OCP\Diagnostics\IQuery[]
  39. * @since 8.0.0
  40. */
  41. public function getQueries();
  42. /**
  43. * Activate the module for the duration of the request. Deactivated module
  44. * does not create and store \OCP\Diagnostics\IQuery objects.
  45. * Only activated module should create and store objects to be
  46. * returned with getQueries() call.
  47. *
  48. * @since 12.0.0
  49. */
  50. public function activate();
  51. }