php-doc-en/reference/pdo/functions/PDO-rollBack.xml
2004-11-19 15:55:49 +00:00

72 lines
1.9 KiB
XML

<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.2 $ -->
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
<refentry id="function.PDO-rollBack">
<refnamediv>
<refname>PDO::rollBack</refname>
<refpurpose>
Rolls back a transaction
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>PDO::rollBack</methodname>
<void/>
</methodsynopsis>
&warn.experimental.func;
<para>
When issued against databases that support transactions,
<function>PDO::rollBack</function> rolls back any work in progress and
and returns the connection state to autocommit mode.
</para>
<para>
You must issue <function>PDO::beginTransaction</function> to set the
connection state to manual commit mode before issuing
<function>PDO::rollBack</function> has any effect.
</para>
<example><title>Roll back a transaction</title>
<programlisting role='php'>
<![CDATA[
<?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 */
$sth->rollBack();
/* Database connection is now back in autocommit mode */
?>
]]>
</programlisting>
</example>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->