File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ public function startTransaction(): bool
4747
4848 $ result = $ this ->getPDO ()->beginTransaction ();
4949 } else {
50+ $ this ->getPDO ()->exec ('SAVEPOINT transaction ' . $ this ->inTransaction );
5051 $ result = true ;
5152 }
5253 } catch (PDOException $ e ) {
@@ -72,9 +73,16 @@ public function rollbackTransaction(): bool
7273 }
7374
7475 try {
76+ if ($ this ->inTransaction > 1 ) {
77+ $ this ->getPDO ()->exec ('ROLLBACK TO transaction ' . ($ this ->inTransaction - 1 ));
78+ $ this ->inTransaction --;
79+ return true ;
80+ }
81+
7582 $ result = $ this ->getPDO ()->rollBack ();
7683 $ this ->inTransaction = 0 ;
7784 } catch (PDOException $ e ) {
85+ $ this ->inTransaction = 0 ;
7886 throw new DatabaseException ('Failed to rollback transaction: ' . $ e ->getMessage (), $ e ->getCode (), $ e );
7987 }
8088
You can’t perform that action at this time.
0 commit comments