php-doc-en/reference/oci8/functions/oci-commit.xml
2004-04-01 08:11:29 +00:00

98 lines
2.7 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<refentry id="function.oci-commit">
<refnamediv>
<refname>oci_commit</refname>
<refpurpose>Commits outstanding statements</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>oci_commit</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>oci_commit</function> commits all outstanding statements
for the active transaction on the Oracle connection
<parameter>connection</parameter>.
</para>
<para>
<example>
<title><function>oci_commit</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// Login to Oracle server
$conn = oci_connect('scott', 'tiger');
// Parse SQL
$stmt = oci_parse($conn, "
INSERT INTO
employees (name, surname)
VALUES
('Maxim', 'Maletsky')
");
/* Execute statement
OCI_DEFAULT tells oci_execute()
not to commit statement immediately */
oci_execute($stmt, OCI_DEFAULT);
/*
....
Parsing and executing other statements here ...
....
*/
// Commit transaction
$committed = oci_commit($conn);
// Test whether commit was successful. If error occurred, return error message
if (!$committed) {
$error = oci_error($conn);
echo 'Commit failed. Oracle reports: ' . $error['message'];
}
?>
]]>
</programlisting>
</example>
</para>
<para>
&return.success;
</para>
<note>
<para>
In PHP versions before 5.0.0 you must use <function>ocicommit</function> instead.
This name still can be used, it was left as alias of
<function>oci_commit</function> for downwards compatability.
This, however, is deprecated and not recommended.
</para>
</note>
<simpara>
See also <function>oci_rollback</function> and
<function>oci_execute</function>.
</simpara>
</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
-->