PDO::rollBack
(no version information, might be only in CVS)
PDO::rollBack --
Rolls back a transaction
Descrição
bool
PDO::rollBack ( void )
Atenção |
Esta função é
EXPERIMENTAL. Isso quer dizer que o comportamento desta função
e seu nome, incluindo TUDO o que está documentado aqui
pode mudar em futuras versões do PHP, SEM QUALQUER NOTIFICAÇÃO.
Esteja avisado, e use esta função por sua própria conta e risco. |
When issued against databases that support transactions,
PDO::rollBack() rolls back any work in progress and
and returns the connection state to autocommit mode.
You must issue PDO::beginTransaction() to set the
connection state to manual commit mode before issuing
PDO::rollBack() has any effect.
Exemplos
Exemplo 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 */ ?>
|
|
Veja também
PDO::beginTransaction() |
PDO::commit() |