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 OC\Diagnostics;
|
2014-10-02 23:35:07 +00:00
|
|
|
|
2014-10-03 18:39:09 +00:00
|
|
|
use OCP\Diagnostics\IQuery;
|
2014-10-02 23:35:07 +00:00
|
|
|
|
|
|
|
class Query implements IQuery {
|
|
|
|
private $sql;
|
|
|
|
|
|
|
|
private $params;
|
|
|
|
|
|
|
|
private $start;
|
|
|
|
|
|
|
|
private $end;
|
|
|
|
|
2016-08-24 12:37:15 +00:00
|
|
|
private $stack;
|
|
|
|
|
2014-10-02 23:35:07 +00:00
|
|
|
/**
|
|
|
|
* @param string $sql
|
|
|
|
* @param array $params
|
|
|
|
* @param int $start
|
|
|
|
*/
|
2016-08-24 12:37:15 +00:00
|
|
|
public function __construct($sql, $params, $start, array $stack) {
|
2014-10-02 23:35:07 +00:00
|
|
|
$this->sql = $sql;
|
|
|
|
$this->params = $params;
|
|
|
|
$this->start = $start;
|
2016-08-24 12:37:15 +00:00
|
|
|
$this->stack = $stack;
|
2014-10-02 23:35:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function end($time) {
|
|
|
|
$this->end = $time;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getParams() {
|
|
|
|
return $this->params;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getSql() {
|
|
|
|
return $this->sql;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-04-20 09:31:00 +00:00
|
|
|
* @return float
|
|
|
|
*/
|
|
|
|
public function getStart() {
|
|
|
|
return $this->start;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return float
|
2014-10-02 23:35:07 +00:00
|
|
|
*/
|
|
|
|
public function getDuration() {
|
|
|
|
return $this->end - $this->start;
|
|
|
|
}
|
2016-08-24 12:37:15 +00:00
|
|
|
|
|
|
|
public function getStartTime() {
|
|
|
|
return $this->start;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getStacktrace() {
|
|
|
|
return $this->stack;
|
|
|
|
}
|
2014-10-02 23:35:07 +00:00
|
|
|
}
|