| @@ 214-228 (lines=15) @@ | ||
| 211 | self::$transactions++; |
|
| 212 | } |
|
| 213 | ||
| 214 | public function commit() |
|
| 215 | { |
|
| 216 | if ($this->completed) return false; |
|
| 217 | ||
| 218 | self::$transactions--; |
|
| 219 | $this->completed = true; |
|
| 220 | ||
| 221 | if (0 === self::$transactions) { |
|
| 222 | return $this->connection->commit(); |
|
| 223 | } |
|
| 224 | ||
| 225 | else { |
|
| 226 | return $this->connection->exec('release savepoint trans' . self::$transactions); |
|
| 227 | } |
|
| 228 | } |
|
| 229 | ||
| 230 | public function rollBack() |
|
| 231 | { |
|
| @@ 230-244 (lines=15) @@ | ||
| 227 | } |
|
| 228 | } |
|
| 229 | ||
| 230 | public function rollBack() |
|
| 231 | { |
|
| 232 | if ($this->completed) return false; |
|
| 233 | ||
| 234 | self::$transactions--; |
|
| 235 | $this->completed = true; |
|
| 236 | ||
| 237 | if (0 === self::$transactions) { |
|
| 238 | return $this->connection->rollBack(); |
|
| 239 | } |
|
| 240 | ||
| 241 | else { |
|
| 242 | return $this->connection->exec('rollback to savepoint trans' . self::$transactions); |
|
| 243 | } |
|
| 244 | } |
|
| 245 | } |
|
| 246 | ||
| 247 | Class Database { |
|