Skip to content

Commit

Permalink
DEBUG verify
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Oct 3, 2023
1 parent 351d6bf commit e6e259a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions demos/init-db.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ public function atomic(\Closure $fx)
$eRollback = !$connection->inTransaction()
? new \Exception('Prevent modification')
: null; // TODO replace with atk4/data Connection before commit hook
if ($eRollback !== null) {
@$connection->outerFromHere = true;
} else {
if (!@$connection->outerFromHere) {
throw new \Error('Unexpected transaction state');
}
}
$res = null;
try {
parent::atomic(function () use ($fx, $eRollback, &$res) {
Expand All @@ -51,6 +58,8 @@ public function atomic(\Closure $fx)
});
} catch (\Exception $e) {
if ($e !== $eRollback) {
$connection->outerFromHere = false;

throw $e;
}
}
Expand Down

0 comments on commit e6e259a

Please sign in to comment.