Skip to content

Commit

Permalink
Cleanup: drop QueryUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
f3l1x committed Jul 3, 2023
1 parent 601f64e commit f543104
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 46 deletions.
12 changes: 6 additions & 6 deletions src/Tracy/BlueScreen/DbalBlueScreen.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,28 @@ public static function renderException(?Throwable $e): ?array
if (($prev = $e->getPrevious()) && ($item = Helpers::findTrace($e->getTrace(), Exception::class . '::driverExceptionDuringQuery'))) {
return [
'tab' => 'SQL',
'panel' => QueryUtils::highlight($item['args'][2]),
'panel' => $item['args'][2],
];
}
} elseif ($e instanceof QueryException) {
if (($prev = $e->getPrevious()) && preg_match('~^(SELECT|INSERT|UPDATE|DELETE)\s+.*~i', $prev->getMessage())) {
return [
'tab' => 'DQL',
'panel' => QueryUtils::highlight($prev->getMessage()),
'panel' => $prev->getMessage(),
];
}
} elseif ($e instanceof PDOException) {
if ($item = Helpers::findTrace($e->getTrace(), Connection::class . '::executeQuery')) {
if (($item = Helpers::findTrace($e->getTrace(), Connection::class . '::executeQuery')) !== null) {
$sql = $item['args'][0];
} elseif ($item = Helpers::findTrace($e->getTrace(), PDO::class . '::query')) {
} elseif (($item = Helpers::findTrace($e->getTrace(), PDO::class . '::query')) !== null) {
$sql = $item['args'][0];
} elseif ($item = Helpers::findTrace($e->getTrace(), PDO::class . '::prepare')) {
} elseif (($item = Helpers::findTrace($e->getTrace(), PDO::class . '::prepare')) !== null) {
$sql = $item['args'][0];
}

return isset($sql) ? [
'tab' => 'SQL',
'panel' => QueryUtils::highlight($sql),
'panel' => $sql,
] : null;
}

Expand Down
3 changes: 1 addition & 2 deletions src/Tracy/QueryPanel/QueryPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
class QueryPanel implements IBarPanel
{

/** @var ProfilerLogger */
protected $profiler;
protected ProfilerLogger $profiler;

public function __construct(ProfilerLogger $profiler)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Tracy/QueryPanel/templates/panel.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ use Tracy\Helpers;
<?php endif; ?>
</td>
<td class="tracy-dbal-sql">
<?= QueryUtils::highlight($q->sql); ?>
<?= $q->sql; ?>
<?php if (count($q->source) !== 0): ?>
<table class="nettrine-dbal-backtrace tracy-collapsed">
<?php foreach ($q->source as $s): ?>
Expand Down
37 changes: 0 additions & 37 deletions src/Utils/QueryUtils.php

This file was deleted.

0 comments on commit f543104

Please sign in to comment.