2014-10-02 23:35:07 +00:00
|
|
|
<?php
|
2024-05-23 07:26:56 +00:00
|
|
|
|
2014-10-02 23:35:07 +00:00
|
|
|
/**
|
2024-05-23 07:26:56 +00:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2014-10-02 23:35:07 +00:00
|
|
|
*/
|
2014-10-03 18:39:09 +00:00
|
|
|
namespace OCP\Diagnostics;
|
2014-10-02 23:35:07 +00:00
|
|
|
|
|
|
|
use Doctrine\DBAL\Logging\SQLLogger;
|
|
|
|
|
2015-04-16 15:00:08 +00:00
|
|
|
/**
|
|
|
|
* Interface IQueryLogger
|
|
|
|
*
|
|
|
|
* @since 8.0.0
|
|
|
|
*/
|
2014-10-02 23:35:07 +00:00
|
|
|
interface IQueryLogger extends SQLLogger {
|
|
|
|
/**
|
2020-04-09 14:09:23 +00:00
|
|
|
* Mark the start of a query providing query SQL statement, its parameters and types.
|
|
|
|
* This method should be called as close to the DB as possible and after
|
|
|
|
* query is finished finalized with stopQuery() method.
|
|
|
|
*
|
2014-10-02 23:35:07 +00:00
|
|
|
* @param string $sql
|
2017-07-19 17:44:10 +00:00
|
|
|
* @param array|null $params
|
|
|
|
* @param array|null $types
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 8.0.0
|
2014-10-02 23:35:07 +00:00
|
|
|
*/
|
2024-03-28 15:13:19 +00:00
|
|
|
public function startQuery($sql, ?array $params = null, ?array $types = null);
|
2014-10-02 23:35:07 +00:00
|
|
|
|
2015-04-16 15:00:08 +00:00
|
|
|
/**
|
2017-04-20 09:31:00 +00:00
|
|
|
* Mark the end of the current active query. Ending query should store \OCP\Diagnostics\IQuery to
|
|
|
|
* be returned with getQueries() method.
|
2020-04-09 14:09:23 +00:00
|
|
|
*
|
2015-04-16 15:00:08 +00:00
|
|
|
* @return mixed
|
|
|
|
* @since 8.0.0
|
|
|
|
*/
|
2014-10-02 23:35:07 +00:00
|
|
|
public function stopQuery();
|
|
|
|
|
|
|
|
/**
|
2017-04-20 09:31:00 +00:00
|
|
|
* This method should return all \OCP\Diagnostics\IQuery objects stored using
|
|
|
|
* startQuery()/stopQuery() methods.
|
2020-04-09 14:09:23 +00:00
|
|
|
*
|
2014-10-03 18:39:09 +00:00
|
|
|
* @return \OCP\Diagnostics\IQuery[]
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 8.0.0
|
2014-10-02 23:35:07 +00:00
|
|
|
*/
|
|
|
|
public function getQueries();
|
2017-04-20 09:31:00 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Activate the module for the duration of the request. Deactivated module
|
|
|
|
* does not create and store \OCP\Diagnostics\IQuery objects.
|
2020-04-09 14:09:23 +00:00
|
|
|
* Only activated module should create and store objects to be
|
|
|
|
* returned with getQueries() call.
|
2017-04-20 09:31:00 +00:00
|
|
|
*
|
|
|
|
* @since 12.0.0
|
|
|
|
*/
|
|
|
|
public function activate();
|
2014-10-02 23:35:07 +00:00
|
|
|
}
|