Skip to content

Commit

Permalink
coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Apr 26, 2018
1 parent 2ab51be commit edd8d9e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/Bridges/DatabaseTracy/ConnectionPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public function logQuery(Nette\Database\Connection $connection, $result): void
$trace = $result instanceof \PDOException ? $result->getTrace() : debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
foreach ($trace as $row) {
if (isset($row['file']) && is_file($row['file']) && !Tracy\Debugger::getBluescreen()->isCollapsed($row['file'])) {
if ((strpos($row['function'] ?? '', 'call_user_func') === 0)
if (
(strpos($row['function'] ?? '', 'call_user_func') === 0)
|| (is_subclass_of($row['class'] ?? '', '\\Nette\\Database\\Connection'))
) {
continue;
Expand Down
9 changes: 6 additions & 3 deletions src/Database/Drivers/SqliteDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,21 @@ public function convertException(\PDOException $e): Nette\Database\DriverExcepti
if ($code !== 19) {
return Nette\Database\DriverException::from($e);

} elseif (strpos($msg, 'must be unique') !== false
} elseif (
strpos($msg, 'must be unique') !== false
|| strpos($msg, 'is not unique') !== false
|| strpos($msg, 'UNIQUE constraint failed') !== false
) {
return Nette\Database\UniqueConstraintViolationException::from($e);

} elseif (strpos($msg, 'may not be null') !== false
} elseif (
strpos($msg, 'may not be null') !== false
|| strpos($msg, 'NOT NULL constraint failed') !== false
) {
return Nette\Database\NotNullConstraintViolationException::from($e);

} elseif (strpos($msg, 'foreign key constraint failed') !== false
} elseif (
strpos($msg, 'foreign key constraint failed') !== false
|| strpos($msg, 'FOREIGN KEY constraint failed') !== false
) {
return Nette\Database\ForeignKeyConstraintViolationException::from($e);
Expand Down

0 comments on commit edd8d9e

Please sign in to comment.