IQueryLogger.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Lukas Reschke <lukas@statuscode.ch>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Piotr Mrówczyński <mrow4a@yahoo.com>
  8. * @author Robin Appelman <robin@icewind.nl>
  9. *
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  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, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. namespace OCP\Diagnostics;
  26. use Doctrine\DBAL\Logging\SQLLogger;
  27. /**
  28. * Interface IQueryLogger
  29. *
  30. * @package OCP\Diagnostics
  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. }