2014-10-02 19:35:07 -04:00
|
|
|
<?php
|
2024-05-23 03:26:56 -04:00
|
|
|
|
2014-10-02 19:35:07 -04:00
|
|
|
/**
|
2024-05-23 03:26:56 -04: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 19:35:07 -04:00
|
|
|
*/
|
2014-10-03 14:39:09 -04:00
|
|
|
namespace OC\Diagnostics;
|
2014-10-02 19:35:07 -04:00
|
|
|
|
2014-10-03 14:39:09 -04:00
|
|
|
use OCP\Diagnostics\IQuery;
|
2014-10-02 19:35:07 -04:00
|
|
|
|
|
|
|
|
class Query implements IQuery {
|
2025-11-18 11:36:29 -05:00
|
|
|
private ?float $end = null;
|
2014-10-02 19:35:07 -04:00
|
|
|
|
2025-11-17 09:32:54 -05:00
|
|
|
public function __construct(
|
2025-11-18 11:36:29 -05:00
|
|
|
private string $sql,
|
|
|
|
|
private array $params,
|
|
|
|
|
private float $start,
|
2025-11-17 09:32:54 -05:00
|
|
|
private array $stack,
|
|
|
|
|
) {
|
2014-10-02 19:35:07 -04:00
|
|
|
}
|
|
|
|
|
|
2025-11-18 11:36:29 -05:00
|
|
|
public function end($time): void {
|
2014-10-02 19:35:07 -04:00
|
|
|
$this->end = $time;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-18 11:36:29 -05:00
|
|
|
public function getParams(): array {
|
2014-10-02 19:35:07 -04:00
|
|
|
return $this->params;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-18 11:36:29 -05:00
|
|
|
public function getSql(): string {
|
2014-10-02 19:35:07 -04:00
|
|
|
return $this->sql;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-18 11:36:29 -05:00
|
|
|
public function getStart(): float {
|
2017-04-20 05:31:00 -04:00
|
|
|
return $this->start;
|
|
|
|
|
}
|
2025-06-30 09:04:05 -04:00
|
|
|
|
2025-11-18 11:36:29 -05:00
|
|
|
public function getDuration(): float {
|
2014-10-02 19:35:07 -04:00
|
|
|
return $this->end - $this->start;
|
|
|
|
|
}
|
2016-08-24 08:37:15 -04:00
|
|
|
|
2025-11-18 11:36:29 -05:00
|
|
|
public function getStartTime(): float {
|
2016-08-24 08:37:15 -04:00
|
|
|
return $this->start;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-18 11:36:29 -05:00
|
|
|
public function getStacktrace(): array {
|
2016-08-24 08:37:15 -04:00
|
|
|
return $this->stack;
|
|
|
|
|
}
|
2014-10-02 19:35:07 -04:00
|
|
|
}
|