| @@ 2340-2352 (lines=13) @@ | ||
| 2337 | * |
|
| 2338 | * @see Alpha\Model\ActiveRecordProviderInterface::begin() |
|
| 2339 | */ |
|
| 2340 | public static function begin() |
|
| 2341 | { |
|
| 2342 | if (self::$logger == null) { |
|
| 2343 | self::$logger = new Logger('ActiveRecordProviderMySQL'); |
|
| 2344 | } |
|
| 2345 | self::$logger->debug('>>begin()'); |
|
| 2346 | ||
| 2347 | if (!self::getConnection()->autocommit(false)) { |
|
| 2348 | throw new AlphaException('Error beginning a new transaction, error is ['.self::getConnection()->error.']'); |
|
| 2349 | } |
|
| 2350 | ||
| 2351 | self::$logger->debug('<<begin'); |
|
| 2352 | } |
|
| 2353 | ||
| 2354 | /** |
|
| 2355 | * (non-PHPdoc). |
|
| @@ 2359-2371 (lines=13) @@ | ||
| 2356 | * |
|
| 2357 | * @see Alpha\Model\ActiveRecordProviderInterface::commit() |
|
| 2358 | */ |
|
| 2359 | public static function commit() |
|
| 2360 | { |
|
| 2361 | if (self::$logger == null) { |
|
| 2362 | self::$logger = new Logger('ActiveRecordProviderMySQL'); |
|
| 2363 | } |
|
| 2364 | self::$logger->debug('>>commit()'); |
|
| 2365 | ||
| 2366 | if (!self::getConnection()->commit()) { |
|
| 2367 | throw new FailedSaveException('Error commiting a transaction, error is ['.self::getConnection()->error.']'); |
|
| 2368 | } |
|
| 2369 | ||
| 2370 | self::$logger->debug('<<commit'); |
|
| 2371 | } |
|
| 2372 | ||
| 2373 | /** |
|
| 2374 | * (non-PHPdoc). |
|
| @@ 2378-2390 (lines=13) @@ | ||
| 2375 | * |
|
| 2376 | * @see Alpha\Model\ActiveRecordProviderInterface::rollback() |
|
| 2377 | */ |
|
| 2378 | public static function rollback() |
|
| 2379 | { |
|
| 2380 | if (self::$logger == null) { |
|
| 2381 | self::$logger = new Logger('ActiveRecordProviderMySQL'); |
|
| 2382 | } |
|
| 2383 | self::$logger->debug('>>rollback()'); |
|
| 2384 | ||
| 2385 | if (!self::getConnection()->rollback()) { |
|
| 2386 | throw new AlphaException('Error rolling back a transaction, error is ['.self::getConnection()->error.']'); |
|
| 2387 | } |
|
| 2388 | ||
| 2389 | self::$logger->debug('<<rollback'); |
|
| 2390 | } |
|
| 2391 | ||
| 2392 | /** |
|
| 2393 | * (non-PHPdoc). |
|
| @@ 2305-2317 (lines=13) @@ | ||
| 2302 | * |
|
| 2303 | * @see Alpha\Model\ActiveRecordProviderInterface::begin() |
|
| 2304 | */ |
|
| 2305 | public static function begin() |
|
| 2306 | { |
|
| 2307 | if (self::$logger == null) { |
|
| 2308 | self::$logger = new Logger('ActiveRecordProviderSQLite'); |
|
| 2309 | } |
|
| 2310 | self::$logger->debug('>>begin()'); |
|
| 2311 | ||
| 2312 | if (!self::getConnection()->exec('BEGIN')) { |
|
| 2313 | throw new AlphaException('Error beginning a new transaction, error is ['.self::getLastDatabaseError().']'); |
|
| 2314 | } |
|
| 2315 | ||
| 2316 | self::$logger->debug('<<begin'); |
|
| 2317 | } |
|
| 2318 | ||
| 2319 | /** |
|
| 2320 | * (non-PHPdoc). |
|
| @@ 2324-2336 (lines=13) @@ | ||
| 2321 | * |
|
| 2322 | * @see Alpha\Model\ActiveRecordProviderInterface::commit() |
|
| 2323 | */ |
|
| 2324 | public static function commit() |
|
| 2325 | { |
|
| 2326 | if (self::$logger == null) { |
|
| 2327 | self::$logger = new Logger('ActiveRecordProviderSQLite'); |
|
| 2328 | } |
|
| 2329 | self::$logger->debug('>>commit()'); |
|
| 2330 | ||
| 2331 | if (!self::getConnection()->exec('COMMIT')) { |
|
| 2332 | throw new AlphaException('Error commiting a transaction, error is ['.self::getLastDatabaseError().']'); |
|
| 2333 | } |
|
| 2334 | ||
| 2335 | self::$logger->debug('<<commit'); |
|
| 2336 | } |
|
| 2337 | ||
| 2338 | /** |
|
| 2339 | * (non-PHPdoc). |
|