Skip to content

Commit

Permalink
Throw exception in case we are not able to start a transaction (#487)
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored Dec 14, 2022
1 parent 71321fe commit 246281f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/QueryReflection/PdoMysqlQueryReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ protected function simulateQuery(string $queryString)
$this->pdo->beginTransaction();
} catch (PDOException $e) {
// not all drivers may support transactions
throw new \RuntimeException('Failed to start transaction', $e->getCode(), $e);
}

try {
Expand All @@ -60,6 +61,7 @@ protected function simulateQuery(string $queryString)
$this->pdo->rollBack();
} catch (PDOException $e) {
// not all drivers may support transactions
throw new \RuntimeException('Failed to rollback transaction', $e->getCode(), $e);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/QueryReflection/PdoPgSqlQueryReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ protected function simulateQuery(string $queryString)
$this->pdo->beginTransaction();
} catch (PDOException $e) {
// not all drivers may support transactions
throw new \RuntimeException('Failed to start transaction', $e->getCode(), $e);
}

try {
Expand All @@ -56,6 +57,7 @@ protected function simulateQuery(string $queryString)
$this->pdo->rollBack();
} catch (PDOException $e) {
// not all drivers may support transactions
throw new \RuntimeException('Failed to rollback transaction', $e->getCode(), $e);
}
}

Expand Down

0 comments on commit 246281f

Please sign in to comment.