PDO::beginTransaction
(no version information, might be only in CVS)
PDO::beginTransaction --
Initiates a transaction
Beschreibung
bool
PDO::beginTransaction ( void )
Warnung |
Diese Funktion ist
EXPERIMENTELL. Das Verhalten, der Funktionsname und alles
Andere was hier dokumentiert ist, kann sich in zukünftigen PHP-Versionen ohne
Ankündigung ändern. Seien Sie gewarnt und verwenden Sie diese Funktion auf
eigenes Risiko. |
Turns off autocommit mode. Call PDO::commit() or
PDO::rollback() to end the transaction and return to
autocommit mode.
Beispiele
Beispiel 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 */ ?>
|
|
Siehe auch
PDO::commit() |
PDO::rollBack() |