PDO::beginTransaction
(no version information, might be only in CVS)
PDO::beginTransaction --
Initiates a transaction
Popis
bool
PDO::beginTransaction ( void )
Varování |
Tato funkce je
EXPERIMENTÁLNÍ. Chování této funkce, její
název a všechno ostatní, co je zde zdokumentováno, se v budoucích verzích
PHP může BEZ OHLÁŠENÍ změnit. Berte to v úvahu a používejte tuto funkci na
vlastní nebezpečí. |
Turns off autocommit mode. Call PDO::commit() or
PDO::rollback() to end the transaction and return to
autocommit mode.
Příklady
Příklad 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 */ ?>
|
|
Viz také
PDO::commit() |
PDO::rollBack() |