Skip to content

Commit 46e2302

Browse files
committed
DriverException: added params, ConnectionPanel shows them
1 parent e6eadca commit 46e2302

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/Bridges/DatabaseTracy/ConnectionPanel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public static function renderException(?\Throwable $e): ?array
9494
}
9595
return isset($sql) ? [
9696
'tab' => 'SQL',
97-
'panel' => Helpers::dumpSql($sql),
97+
'panel' => Helpers::dumpSql($sql, $e->params ?? []),
9898
] : null;
9999
}
100100

src/Database/DriverException.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class DriverException extends \PDOException
1818
/** @var string */
1919
public $queryString;
2020

21+
/** @var array */
22+
public $params;
2123

2224
/**
2325
* @return static
@@ -58,4 +60,10 @@ public function getQueryString(): ?string
5860
{
5961
return $this->queryString;
6062
}
63+
64+
65+
public function getParameters(): ?array
66+
{
67+
return $this->params;
68+
}
6169
}

src/Database/ResultSet.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public function __construct(Connection $connection, string $queryString, array $
7272
} catch (\PDOException $e) {
7373
$e = $connection->getSupplementalDriver()->convertException($e);
7474
$e->queryString = $queryString;
75+
$e->params = $params;
7576
throw $e;
7677
}
7778
$this->time = microtime(true) - $time;

0 commit comments

Comments
 (0)