Skip to content

Commit

Permalink
Merge pull request #6 from netbrothers-gmbh/issue-5
Browse files Browse the repository at this point in the history
Issue 5
  • Loading branch information
netbrothers-sw authored Feb 18, 2022
2 parents ab3ff7b + d0d78f9 commit 1046e65
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog for NetBrothers Versions
===================================

Version 0.0.4 - 18.02.2022
----------------------------------
- Fixing Bug "There is no active transaction".
- Upgrading Version-Number

Version 0.0.3 - 03.02.2022
----------------------------------
- Adding "?ExtensionInterface" as a native return type declaration in class `NetBrothers\VersionBundle\NetBrothersVersionBundle`.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "netbrothers-gmbh/version-bundle",
"description": "SymfonyBundle for handling versions based on triggers in mysql with doctrine",
"version": "0.0.3",
"version": "0.0.4",
"keywords": ["symfony","bundle","versioning","doctrine","mysql"],
"type": "symfony-bundle",
"require": {
Expand Down
6 changes: 0 additions & 6 deletions src/Services/Sql/ExecuteService.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,13 @@ public function execute(array $sql = []): bool
throw new \Exception(__CLASS__ . ': only sql-statements packed in array can be executed.');
}
if (0 < count($sql)) {
$this->connection->beginTransaction();
try {
foreach ($sql as $query) {
if (true !== $this->_execute($query)) {
return false;
}
}
$this->connection->commit();
} catch (\Exception $e) {
$this->connection->rollBack();
$this->connection->setAutoCommit(true);
throw new \Exception("Cannot commit", 500, $e);
}
}
Expand All @@ -86,8 +82,6 @@ private function _execute(string $query): bool
$result = $statement->executeQuery();
return true;
} catch ( DriverException $e) {
$this->connection->rollBack();
$this->connection->setAutoCommit(true);
$this->errMsg = "Cannot execute SQL: $query";
return false;
}
Expand Down

0 comments on commit 1046e65

Please sign in to comment.