1
0

IQueryLogger.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Lukas Reschke <lukas@statuscode.ch>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Piotr Mrówczyński <mrow4a@yahoo.com>
  9. * @author Robin Appelman <robin@icewind.nl>
  10. *
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. namespace OCP\Diagnostics;
  27. use Doctrine\DBAL\Logging\SQLLogger;
  28. /**
  29. * Interface IQueryLogger
  30. *
  31. * @since 8.0.0
  32. */
  33. interface IQueryLogger extends SQLLogger {
  34. /**
  35. * Mark the start of a query providing query SQL statement, its parameters and types.
  36. * This method should be called as close to the DB as possible and after
  37. * query is finished finalized with stopQuery() method.
  38. *
  39. * @param string $sql
  40. * @param array|null $params
  41. * @param array|null $types
  42. * @since 8.0.0
  43. */
  44. public function startQuery($sql, ?array $params = null, ?array $types = null);
  45. /**
  46. * Mark the end of the current active query. Ending query should store \OCP\Diagnostics\IQuery to
  47. * be returned with getQueries() method.
  48. *
  49. * @return mixed
  50. * @since 8.0.0
  51. */
  52. public function stopQuery();
  53. /**
  54. * This method should return all \OCP\Diagnostics\IQuery objects stored using
  55. * startQuery()/stopQuery() methods.
  56. *
  57. * @return \OCP\Diagnostics\IQuery[]
  58. * @since 8.0.0
  59. */
  60. public function getQueries();
  61. /**
  62. * Activate the module for the duration of the request. Deactivated module
  63. * does not create and store \OCP\Diagnostics\IQuery objects.
  64. * Only activated module should create and store objects to be
  65. * returned with getQueries() call.
  66. *
  67. * @since 12.0.0
  68. */
  69. public function activate();
  70. }