| @@ 194-204 (lines=11) @@ | ||
| 191 | /** |
|
| 192 | * Begin transaction |
|
| 193 | */ |
|
| 194 | public function beginTransaction() |
|
| 195 | { |
|
| 196 | $this->transactional = true; |
|
| 197 | if (0 === $this->transactionalLevel) { |
|
| 198 | if ($this->conn->inTransaction()) { |
|
| 199 | $this->conn->beginTransaction(); |
|
| 200 | } |
|
| 201 | } |
|
| 202 | ||
| 203 | $this->transactionalLevel += 1; |
|
| 204 | } |
|
| 205 | ||
| 206 | /** |
|
| 207 | * Rollback transaction |
|
| @@ 209-218 (lines=10) @@ | ||
| 206 | /** |
|
| 207 | * Rollback transaction |
|
| 208 | */ |
|
| 209 | public function rollback() |
|
| 210 | { |
|
| 211 | if (true === $this->transactional) { |
|
| 212 | $this->transactionalLevel = 0; |
|
| 213 | $this->transactional = false; |
|
| 214 | if ($this->conn->inTransaction()) { |
|
| 215 | $this->conn->rollBack(); |
|
| 216 | } |
|
| 217 | } |
|
| 218 | } |
|
| 219 | ||
| 220 | /** |
|
| 221 | * Commit transaction. |
|
| @@ 223-234 (lines=12) @@ | ||
| 220 | /** |
|
| 221 | * Commit transaction. |
|
| 222 | */ |
|
| 223 | public function commit() |
|
| 224 | { |
|
| 225 | if (true === $this->transactional) { |
|
| 226 | $this->transactionalLevel -= 1; |
|
| 227 | if (0 === $this->transactionalLevel) { |
|
| 228 | $this->transactional = false; |
|
| 229 | if ($this->conn->inTransaction()) { |
|
| 230 | $this->conn->commit(); |
|
| 231 | } |
|
| 232 | } |
|
| 233 | } |
|
| 234 | } |
|
| 235 | ||
| 236 | /** |
|
| 237 | * Compute fields to expressions. |
|