| @@ 2095-2114 (lines=20) @@ | ||
| 2092 | * (i.e. if the database/model does not support transactions, |
|
| 2093 | * or a transaction has not started). |
|
| 2094 | */ |
|
| 2095 | public function commit() { |
|
| 2096 | if (!$this->_transactionStarted) { |
|
| 2097 | return false; |
|
| 2098 | } |
|
| 2099 | ||
| 2100 | if ($this->_transactionNesting === 0) { |
|
| 2101 | if ($this->fullDebug) { |
|
| 2102 | $this->logQuery('COMMIT'); |
|
| 2103 | } |
|
| 2104 | $this->_transactionStarted = false; |
|
| 2105 | return $this->_connection->commit(); |
|
| 2106 | } |
|
| 2107 | ||
| 2108 | if ($this->nestedTransactionSupported()) { |
|
| 2109 | return $this->_commitNested(); |
|
| 2110 | } |
|
| 2111 | ||
| 2112 | $this->_transactionNesting--; |
|
| 2113 | return true; |
|
| 2114 | } |
|
| 2115 | ||
| 2116 | /** |
|
| 2117 | * Commit a nested transaction |
|
| @@ 2137-2156 (lines=20) @@ | ||
| 2134 | * (i.e. if the database/model does not support transactions, |
|
| 2135 | * or a transaction has not started). |
|
| 2136 | */ |
|
| 2137 | public function rollback() { |
|
| 2138 | if (!$this->_transactionStarted) { |
|
| 2139 | return false; |
|
| 2140 | } |
|
| 2141 | ||
| 2142 | if ($this->_transactionNesting === 0) { |
|
| 2143 | if ($this->fullDebug) { |
|
| 2144 | $this->logQuery('ROLLBACK'); |
|
| 2145 | } |
|
| 2146 | $this->_transactionStarted = false; |
|
| 2147 | return $this->_connection->rollBack(); |
|
| 2148 | } |
|
| 2149 | ||
| 2150 | if ($this->nestedTransactionSupported()) { |
|
| 2151 | return $this->_rollbackNested(); |
|
| 2152 | } |
|
| 2153 | ||
| 2154 | $this->_transactionNesting--; |
|
| 2155 | return true; |
|
| 2156 | } |
|
| 2157 | ||
| 2158 | /** |
|
| 2159 | * Rollback a nested transaction |
|