Connection.php
2 years ago
DebugStack.php
2 years ago
Driver.php
2 years ago
LoggerChain.php
2 years ago
Middleware.php
2 years ago
SQLLogger.php
2 years ago
Statement.php
2 years ago
index.php
2 years ago
DebugStack.php
32 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor\Doctrine\DBAL\Logging; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use MailPoetVendor\Doctrine\Deprecations\Deprecation; |
| 5 | use function microtime; |
| 6 | class DebugStack implements SQLLogger |
| 7 | { |
| 8 | public $queries = []; |
| 9 | public $enabled = \true; |
| 10 | public $start = null; |
| 11 | public $currentQuery = 0; |
| 12 | public function __construct() |
| 13 | { |
| 14 | Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4967', 'DebugStack is deprecated.'); |
| 15 | } |
| 16 | public function startQuery($sql, ?array $params = null, ?array $types = null) |
| 17 | { |
| 18 | if (!$this->enabled) { |
| 19 | return; |
| 20 | } |
| 21 | $this->start = microtime(\true); |
| 22 | $this->queries[++$this->currentQuery] = ['sql' => $sql, 'params' => $params, 'types' => $types, 'executionMS' => 0]; |
| 23 | } |
| 24 | public function stopQuery() |
| 25 | { |
| 26 | if (!$this->enabled) { |
| 27 | return; |
| 28 | } |
| 29 | $this->queries[$this->currentQuery]['executionMS'] = microtime(\true) - $this->start; |
| 30 | } |
| 31 | } |
| 32 |