PDO::beginTransaction
(no version information, might be only in CVS)
PDO::beginTransaction --
Initiates a transaction
Descrizione
bool
PDO::beginTransaction ( void )
Avvertimento |
Questa funzione è
SPERIMENTALE. Ovvero, il comportamento di questa funzione,
il nome di questa funzione, in definitiva tutto ciò che è documentato qui
può cambiare nei futuri rilasci del PHP senza preavviso. Siete avvisati, l'uso di questa
funzione è a vostro rischio. |
Turns off autocommit mode. Call PDO::commit() or
PDO::rollback() to end the transaction and return to
autocommit mode.
Esempi
Esempio 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 */ ?>
|
|
Vedere anche:
PDO::commit() |
PDO::rollBack() |