PDO::beginTransaction
(no version information, might be only in CVS)
PDO::beginTransaction --
Initiates a transaction
Opis
bool
PDO::beginTransaction ( void )
Ostrzeżenie |
Ta funkcja jest w stadium
EKSPERYMENTALNYM. Oznacza to, że zachowanie funkcji, jej
nazwa, w zasadzie wszystko udokumentowane tutaj może zostać zmienione w
przyszłych wersjach PHP bez wcześniejszego uprzedzenia. Używaj tej funkcji na
własne ryzyko. |
Turns off autocommit mode. Call PDO::commit() or
PDO::rollback() to end the transaction and return to
autocommit mode.
Przykłady
Przykład 1. Roll back a transaction
<?php /* Begin a transaction, turning off autocommit */ $dbh->beginTransaction();
/* Change the database schema and data */ $sth = $dbh->exec("DROP TABLE fruit"); $sth = $dbh->exec("UPDATE dessert SET name = 'hamburger'");
/* Recognize mistake and roll back changes */ $dbh->rollBack();
/* Database connection is now back in autocommit mode */ ?>
|
|
Patrz także
PDO::commit() |
PDO::rollBack() |