Skip to content

Commit

Permalink
DriverException: added params, ConnectionPanel shows them
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Dec 13, 2019
1 parent e6eadca commit 46e2302
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Bridges/DatabaseTracy/ConnectionPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static function renderException(?\Throwable $e): ?array
}
return isset($sql) ? [
'tab' => 'SQL',
'panel' => Helpers::dumpSql($sql),
'panel' => Helpers::dumpSql($sql, $e->params ?? []),
] : null;
}

Expand Down
8 changes: 8 additions & 0 deletions src/Database/DriverException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class DriverException extends \PDOException
/** @var string */
public $queryString;

/** @var array */
public $params;

/**
* @return static
Expand Down Expand Up @@ -58,4 +60,10 @@ public function getQueryString(): ?string
{
return $this->queryString;
}


public function getParameters(): ?array
{
return $this->params;
}
}
1 change: 1 addition & 0 deletions src/Database/ResultSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function __construct(Connection $connection, string $queryString, array $
} catch (\PDOException $e) {
$e = $connection->getSupplementalDriver()->convertException($e);
$e->queryString = $queryString;
$e->params = $params;
throw $e;
}
$this->time = microtime(true) - $time;
Expand Down

0 comments on commit 46e2302

Please sign in to comment.