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
This commit is contained in:
Dan Scott 2005-08-24 11:07:45 +00:00
parent d068f3743f
commit 954fa71e2e
2 changed files with 34 additions and 4 deletions

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.3 $ -->
<!-- $Revision: 1.4 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDO-beginTransaction">
<refnamediv>
@ -19,15 +19,31 @@
<para>
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
<function>PDO::commit</function> or <function>PDO::rollback</function>.
you end the transaction by calling <function>PDO::commit</function>.
Calling <function>PDO::rollback</function> will roll back all changes to
the database and return the connection to autocommit mode.
</para>
<para>
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.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Roll back a transaction</title>
<para>
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.
</para>
<programlisting role='php'>
<![CDATA[
<?php

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDO-rollBack">
<refnamediv>
@ -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.
</para>
<para>
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.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example><title>Roll back a transaction</title>
<para>
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.
</para>
<programlisting role='php'>
<![CDATA[
<?php