mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-04-25 09:38:03 +02:00
107d3b624b
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@260753 c90b9560-bf6c-de11-be94-00142212c4b1
182 lines
4.4 KiB
XML
182 lines
4.4 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.8 $ -->
|
|
<!-- EN-Revision: 1.6 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.maxdb-rollback">
|
|
<refnamediv>
|
|
<refname>maxdb_rollback</refname>
|
|
<refname>maxdb->rollback</refname>
|
|
<refpurpose>Annule la transaction courante</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>maxdb_rollback</methodname>
|
|
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<classsynopsis>
|
|
<ooclass><classname>maxdb</classname></ooclass>
|
|
<methodsynopsis>
|
|
<type>bool</type>
|
|
<methodname>rollback</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
</classsynopsis>
|
|
<para>
|
|
Annule la transaction courante pour la base de données spécifiée par
|
|
le paramètre <parameter>link</parameter>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.success;
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title>Style orienté objet</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
|
|
|
/* Vérification de la connexion */
|
|
if (maxdb_connect_errno()) {
|
|
printf("Echec de la connexion : %s\n", maxdb_connect_error());
|
|
exit();
|
|
}
|
|
|
|
/* Désactive l'auto-commit */
|
|
$maxdb->autocommit(FALSE);
|
|
|
|
$maxdb->query("CREATE TABLE temp.mycity LIKE hotel.city");
|
|
$maxdb->query("INSERT INTO temp.mycity SELECT * FROM hotel.city");
|
|
|
|
/* Exécution */
|
|
$maxdb->commit();
|
|
|
|
/* Efface toutes les lignes */
|
|
$maxdb->query("DELETE FROM temp.mycity");
|
|
|
|
if ($result = $maxdb->query("SELECT COUNT(*) FROM temp.mycity")) {
|
|
$row = $result->fetch_row();
|
|
printf("%d rows in table mycity.\n", $row[0]);
|
|
/* Free result */
|
|
$result->close();
|
|
}
|
|
|
|
/* Rollback */
|
|
$maxdb->rollback();
|
|
|
|
if ($result = $maxdb->query("SELECT COUNT(*) FROM temp.mycity")) {
|
|
$row = $result->fetch_row();
|
|
printf("%d ligne dans la table mycity (après annulation).\n", $row[0]);
|
|
/* Libération du résultat */
|
|
$result->close();
|
|
}
|
|
|
|
/* Effacement de la table myCity */
|
|
$maxdb->query("DROP TABLE temp.mycity");
|
|
|
|
$maxdb->close();
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<example>
|
|
<title>Style procédural</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
|
|
|
/* Vérification de la connexion */
|
|
if (maxdb_connect_errno()) {
|
|
printf("Echec de la connexion : %s\n", maxdb_connect_error());
|
|
exit();
|
|
}
|
|
|
|
/* Désactive l'auto-commit */
|
|
maxdb_autocommit($link, FALSE);
|
|
|
|
maxdb_query($link, "CREATE TABLE temp.mycity LIKE hotel.city");
|
|
maxdb_query($link, "INSERT INTO temp.mycity SELECT * FROM hotel.city");
|
|
|
|
/* Exécution */
|
|
maxdb_commit($link);
|
|
|
|
/* Efface toutes les lignes */
|
|
maxdb_query($link, "DELETE FROM temp.mycity");
|
|
|
|
if ($result = maxdb_query($link, "SELECT COUNT(*) FROM temp.mycity")) {
|
|
$row = maxdb_fetch_row($result);
|
|
printf("%d ligne dans la table mycity.\n", $row[0]);
|
|
/* Libération du résultats */
|
|
maxdb_free_result($result);
|
|
}
|
|
|
|
/* Annulation */
|
|
maxdb_rollback($link);
|
|
|
|
if ($result = maxdb_query($link, "SELECT COUNT(*) FROM temp.mycity")) {
|
|
$row = maxdb_fetch_row($result);
|
|
printf("%d lignes dans la table mycity (après annulation).\n", $row[0]);
|
|
/* Libération du résultat */
|
|
maxdb_free_result($result);
|
|
}
|
|
|
|
/* Effacement de la table myCity */
|
|
maxdb_query($link, "DROP TABLE temp.mycity");
|
|
|
|
maxdb_close($link);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
0 ligne dans la table mycity.
|
|
25 lignes dans la table mycity (après annulation).
|
|
]]>
|
|
</screen>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>maxdb_commit</function></member>
|
|
<member><function>maxdb_autocommit</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</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
|
|
--> |