| @@ 2343-2355 (lines=13) @@ | ||
| 2340 | * |
|
| 2341 | * @see Alpha\Model\ActiveRecordProviderInterface::begin() |
|
| 2342 | */ |
|
| 2343 | public static function begin() |
|
| 2344 | { |
|
| 2345 | if (self::$logger == null) { |
|
| 2346 | self::$logger = new Logger('ActiveRecordProviderMySQL'); |
|
| 2347 | } |
|
| 2348 | self::$logger->debug('>>begin()'); |
|
| 2349 | ||
| 2350 | if (!self::getConnection()->autocommit(false)) { |
|
| 2351 | throw new AlphaException('Error beginning a new transaction, error is ['.self::getConnection()->error.']'); |
|
| 2352 | } |
|
| 2353 | ||
| 2354 | self::$logger->debug('<<begin'); |
|
| 2355 | } |
|
| 2356 | ||
| 2357 | /** |
|
| 2358 | * (non-PHPdoc). |
|
| @@ 2362-2374 (lines=13) @@ | ||
| 2359 | * |
|
| 2360 | * @see Alpha\Model\ActiveRecordProviderInterface::commit() |
|
| 2361 | */ |
|
| 2362 | public static function commit() |
|
| 2363 | { |
|
| 2364 | if (self::$logger == null) { |
|
| 2365 | self::$logger = new Logger('ActiveRecordProviderMySQL'); |
|
| 2366 | } |
|
| 2367 | self::$logger->debug('>>commit()'); |
|
| 2368 | ||
| 2369 | if (!self::getConnection()->commit()) { |
|
| 2370 | throw new FailedSaveException('Error commiting a transaction, error is ['.self::getConnection()->error.']'); |
|
| 2371 | } |
|
| 2372 | ||
| 2373 | self::$logger->debug('<<commit'); |
|
| 2374 | } |
|
| 2375 | ||
| 2376 | /** |
|
| 2377 | * (non-PHPdoc). |
|
| @@ 2381-2393 (lines=13) @@ | ||
| 2378 | * |
|
| 2379 | * @see Alpha\Model\ActiveRecordProviderInterface::rollback() |
|
| 2380 | */ |
|
| 2381 | public static function rollback() |
|
| 2382 | { |
|
| 2383 | if (self::$logger == null) { |
|
| 2384 | self::$logger = new Logger('ActiveRecordProviderMySQL'); |
|
| 2385 | } |
|
| 2386 | self::$logger->debug('>>rollback()'); |
|
| 2387 | ||
| 2388 | if (!self::getConnection()->rollback()) { |
|
| 2389 | throw new AlphaException('Error rolling back a transaction, error is ['.self::getConnection()->error.']'); |
|
| 2390 | } |
|
| 2391 | ||
| 2392 | self::$logger->debug('<<rollback'); |
|
| 2393 | } |
|
| 2394 | ||
| 2395 | /** |
|
| 2396 | * (non-PHPdoc). |
|
| @@ 2255-2267 (lines=13) @@ | ||
| 2252 | * |
|
| 2253 | * @see Alpha\Model\ActiveRecordProviderInterface::begin() |
|
| 2254 | */ |
|
| 2255 | public static function begin() |
|
| 2256 | { |
|
| 2257 | if (self::$logger == null) { |
|
| 2258 | self::$logger = new Logger('ActiveRecordProviderSQLite'); |
|
| 2259 | } |
|
| 2260 | self::$logger->debug('>>begin()'); |
|
| 2261 | ||
| 2262 | if (!self::getConnection()->exec('BEGIN')) { |
|
| 2263 | throw new AlphaException('Error beginning a new transaction, error is ['.self::getLastDatabaseError().']'); |
|
| 2264 | } |
|
| 2265 | ||
| 2266 | self::$logger->debug('<<begin'); |
|
| 2267 | } |
|
| 2268 | ||
| 2269 | /** |
|
| 2270 | * (non-PHPdoc). |
|
| @@ 2274-2286 (lines=13) @@ | ||
| 2271 | * |
|
| 2272 | * @see Alpha\Model\ActiveRecordProviderInterface::commit() |
|
| 2273 | */ |
|
| 2274 | public static function commit() |
|
| 2275 | { |
|
| 2276 | if (self::$logger == null) { |
|
| 2277 | self::$logger = new Logger('ActiveRecordProviderSQLite'); |
|
| 2278 | } |
|
| 2279 | self::$logger->debug('>>commit()'); |
|
| 2280 | ||
| 2281 | if (!self::getConnection()->exec('COMMIT')) { |
|
| 2282 | throw new AlphaException('Error commiting a transaction, error is ['.self::getLastDatabaseError().']'); |
|
| 2283 | } |
|
| 2284 | ||
| 2285 | self::$logger->debug('<<commit'); |
|
| 2286 | } |
|
| 2287 | ||
| 2288 | /** |
|
| 2289 | * (non-PHPdoc). |
|