Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
- force disconnect in case of connection error
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfy-j committed Nov 5, 2019
1 parent 47436af commit 290060a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Driver/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ public function beginTransaction(string $isolationLevel = null, bool $cacheState
$e instanceof StatementException\ConnectionException
&& $this->options['reconnect']
) {
$this->disconnect();

try {
return $this->getPDO()->beginTransaction();
} catch (\PDOException $e) {
Expand Down Expand Up @@ -527,6 +529,8 @@ private function statement(string $query, array $parameters = [], bool $retry =
&& $this->tScope->getLevel() === 0
&& $retry
) {
$this->disconnect();

// retrying
return $this->statement($query, $parameters, false);
}
Expand Down

0 comments on commit 290060a

Please sign in to comment.