transaction database php

Solutions on MaxInterview for transaction database php by the best coders in the world

showing results for - "transaction database php"
Jonathan
13 Mar 2017
11<?php
2// $conn instanceof Doctrine\DBAL\Connection
3$conn->beginTransaction(); // 0 => 1, "real" transaction started
4try {
5
6    ...
7
8    // nested transaction block, this might be in some other API/library code that is
9    // unaware of the outer transaction.
10    $conn->beginTransaction(); // 1 => 2
11    try {
12        ...
13
14        $conn->commit(); // 2 => 1
15    } catch (\Exception $e) {
16        $conn->rollBack(); // 2 => 1, transaction marked for rollback only
17        throw $e;
18    }
19
20    ...
21
22    $conn->commit(); // 1 => 0, "real" transaction committed
23} catch (\Exception $e) {
24    $conn->rollBack(); // 1 => 0, "real" transaction rollback
25    throw $e;
26}
272
283
294
305
316
327
338
349
3510
3611
3712
3813
3914
4015
4116
4217
4318
4419
4520
4621
4722
4823
4924
5025
5126