getActive()) { $this->_nestedCount++; } } public function commit() { if ($this->_rolledBack) { $childTransaction = (bool)($this->_nestedCount); $this->rollback(); if (!$childTransaction) { throw new TDbException('Nested transaction was rolled back, unable to commit.'); } } else { if ($this->_nestedCount) { $this->_nestedCount--; } else { parent::commit(); } } } public function rollback() { if (!$this->getActive()) { $this->_nestedCount = 0; return; } if ($this->_nestedCount) { $this->_rolledBack = TRUE; $this->_nestedCount--; } else { parent::rollback(); $this->_nestedCount = 0; $this->_rolledBack = FALSE; } } } ?>