mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-23 04:18:56 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@297028 c90b9560-bf6c-de11-be94-00142212c4b1
186 lines
4.8 KiB
XML
186 lines
4.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
|
|
<refentry xml:id="function.db2-autocommit" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>db2_autocommit</refname>
|
|
<refpurpose>
|
|
Returns or sets the AUTOCOMMIT state for a database connection
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>mixed</type><methodname>db2_autocommit</methodname>
|
|
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
|
|
<methodparam choice="opt"><type>bool</type><parameter>value</parameter></methodparam>
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
Sets or gets the AUTOCOMMIT behavior of the specified connection resource.
|
|
</para>
|
|
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>connection</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
A valid database connection resource variable as returned from
|
|
<function>db2_connect</function> or <function>db2_pconnect</function>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>value</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
One of the following constants:
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><literal>DB2_AUTOCOMMIT_OFF</literal></term>
|
|
<listitem>
|
|
<para>
|
|
Turns AUTOCOMMIT off.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><literal>DB2_AUTOCOMMIT_ON</literal></term>
|
|
<listitem>
|
|
<para>
|
|
Turns AUTOCOMMIT on.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
When <function>db2_autocommit</function> receives only the
|
|
<parameter>connection</parameter> parameter, it returns the current state
|
|
of AUTOCOMMIT for the requested connection as an integer value. A value of
|
|
0 indicates that AUTOCOMMIT is off, while a value of 1 indicates that
|
|
AUTOCOMMIT is on.
|
|
</para>
|
|
<para>
|
|
When <function>db2_autocommit</function> receives both the
|
|
<parameter>connection</parameter> parameter and
|
|
<parameter>autocommit</parameter> parameter, it attempts to set the
|
|
AUTOCOMMIT state of the requested connection to the corresponding state.
|
|
&return.success;
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Retrieving the AUTOCOMMIT value for a connection</title>
|
|
<para>
|
|
In the following example, a connection which has been created with
|
|
AUTOCOMMIT turned off is tested with the
|
|
<function>db2_autocommit</function> function.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$options = array('autocommit' => DB2_AUTOCOMMIT_OFF);
|
|
$conn = db2_connect($database, $user, $password, $options);
|
|
$ac = db2_autocommit($conn);
|
|
if ($ac == 0) {
|
|
print "$ac -- AUTOCOMMIT is off.";
|
|
} else {
|
|
print "$ac -- AUTOCOMMIT is on.";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
0 -- AUTOCOMMIT is off.
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
<example>
|
|
<title>Setting the AUTOCOMMIT value for a connection</title>
|
|
<para>
|
|
In the following example, a connection which was initially created with
|
|
AUTOCOMMIT turned off has its behavior changed to turn AUTOCOMMIT on.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$options = array('autocommit' => DB2_AUTOCOMMIT_OFF);
|
|
$conn = db2_connect($database, $user, $password, $options);
|
|
|
|
// Turn AUTOCOMMIT on
|
|
$rc = db2_autocommit($conn, DB2_AUTOCOMMIT_ON);
|
|
if ($rc) {
|
|
print "Turning AUTOCOMMIT on succeeded.\n";
|
|
}
|
|
|
|
// Check AUTOCOMMIT state
|
|
$ac = db2_autocommit($conn);
|
|
if ($ac == 0) {
|
|
print "$ac -- AUTOCOMMIT is off.";
|
|
} else {
|
|
print "$ac -- AUTOCOMMIT is on.";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Turning AUTOCOMMIT on succeeded.
|
|
1 -- AUTOCOMMIT is on.
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>db2_connect</function></member>
|
|
<member><function>db2_pconnect</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:"~/.phpdoc/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
|
|
-->
|