Hướng dẫn dùng rollback straps trong PHP
(PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.1.0) PDO::rollBack — Rolls back a transaction Descriptionpublic PDO::rollBack(): bool If the database was set to autocommit mode, this function will restore autocommit mode after it has rolled back the transaction. Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit COMMIT will prevent you from rolling back any other changes within the transaction boundary. ParametersThis function has no parameters. Return Values Returns
Errors/ExceptionsThrows a PDOException if there is no active transaction.
ExamplesExample #1 Roll back a transaction The following example begins a transaction and issues two statements that modify the database before rolling back the changes. On MySQL, however, the DROP TABLE statement automatically commits the transaction so that none of the changes in the transaction are rolled back.
See Also
JonasJ ¶ 14 years ago
brian at diamondsea dot com ¶ 14 years ago
Petros Giakouvakis ¶ 11 years ago
linfo2003 at libero dot it ¶ 15 years ago
|