diff --git a/src/Pdox.php b/src/Pdox.php index e90ce7f..fed3b49 100644 --- a/src/Pdox.php +++ b/src/Pdox.php @@ -969,7 +969,8 @@ public function repair() */ public function transaction() { - if (!$this->transactionCount++) { + if (!$this->transactionCount) { + $this->transactionCount++; return $this->pdo->beginTransaction(); } @@ -982,7 +983,7 @@ public function transaction() */ public function commit() { - if (!--$this->transactionCount) { + if ($this->transactionCount) { return $this->pdo->commit(); } @@ -994,8 +995,9 @@ public function commit() */ public function rollBack() { - if (--$this->transactionCount) { - $this->pdo->exec('ROLLBACK TO trans' . ($this->transactionCount + 1)); + if ($this->transactionCount) { + $this->pdo->exec('ROLLBACK TO trans' . $this->transactionCount); + $this->transactionCount--; return true; }