Answers for "what is Transaction in php"

SQL
0

transaction database php

1<?php
// $conn instanceof DoctrineDBALConnection
$conn->beginTransaction(); // 0 => 1, "real" transaction started
try {

    ...

    // nested transaction block, this might be in some other API/library code that is
    // unaware of the outer transaction.
    $conn->beginTransaction(); // 1 => 2
    try {
        ...

        $conn->commit(); // 2 => 1
    } catch (Exception $e) {
        $conn->rollBack(); // 2 => 1, transaction marked for rollback only
        throw $e;
    }

    ...

    $conn->commit(); // 1 => 0, "real" transaction committed
} catch (Exception $e) {
    $conn->rollBack(); // 1 => 0, "real" transaction rollback
    throw $e;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Posted by: Guest on May-11-2021
0

transaction php

<?php
/* Démarre une transaction, désactivation de l'auto-commit */
$dbh->beginTransaction();

/* Modification du schéma de la base ainsi que des données */
$sth = $dbh->exec("DROP TABLE fruit");
$sth = $dbh->exec("UPDATE dessert
SET name = 'hamburger'");

/* On s'aperçoit d'une erreur et on annule les modifications */
$dbh->rollBack();

/* Le connexion à la base de données est maintenant de retour en mode auto-commit */
?>
Posted by: Guest on May-11-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language