PDO::beginTransaction

(no version information, might be only in CVS)

PDO::beginTransaction --  Initiates a transaction

Popis

bool PDO::beginTransaction ( void )

Varovanie

T�to funkcia je EXPERIMENT�LNA. Spr�vanie tejto funkcie, n�zov tejto funkcie a hoci�o in� zdokumentovan� o tejto funkcii sa m�e zmeni� bez pov�imnutia v bud�com vydan� PHP. Pou��vajte t�to funkcii na svoje vlastn� riziko.

Turns off autocommit mode. Call PDO::commit() or PDO::rollback() to end the transaction and return to autocommit mode.

Príklady

Prí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 */
?>

Tiež pozri

PDO::commit()
PDO::rollBack()