From 954fa71e2e290a0b8d6ae48b96ceedf1841838eb Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Wed, 24 Aug 2005 11:07:45 +0000 Subject: [PATCH] Address bug 34231 (MySQL doesn't handle DDL in transactions). git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@194303 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../pdo/functions/PDO-beginTransaction.xml | 22 ++++++++++++++++--- reference/pdo/functions/PDO-rollBack.xml | 16 +++++++++++++- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/reference/pdo/functions/PDO-beginTransaction.xml b/reference/pdo/functions/PDO-beginTransaction.xml index a91e40295d..99de73786e 100644 --- a/reference/pdo/functions/PDO-beginTransaction.xml +++ b/reference/pdo/functions/PDO-beginTransaction.xml @@ -1,5 +1,5 @@ - + @@ -19,15 +19,31 @@ Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO object instance are not committed until - you end the transaction by calling either - PDO::commit or PDO::rollback. + you end the transaction by calling PDO::commit. + Calling PDO::rollback will roll back all changes to + the database and return the connection to autocommit mode. + + 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. + + &reftitle.examples; 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. + - + @@ -26,12 +26,26 @@ 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. + &reftitle.examples; 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. +