Multiple statements example & transaction explanations added (Bug #34719).

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@197546 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Kouber Saparev 2005-10-04 12:56:26 +00:00
parent cf05ac7d25
commit 31089b442d

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.11 $ -->
<!-- $Revision: 1.12 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-query">
<refnamediv>
@ -64,7 +64,9 @@
<term><parameter>query</parameter></term>
<listitem>
<para>
The SQL statement or statements to be executed.
The SQL statement or statements to be executed. When multiple statements are passed to the function,
they are automatically executed as one transaction, unless there are explicit BEGIN/COMMIT commands
included in the query string. However, using multiple transactions in one function call is not recommended.
</para>
</listitem>
</varlistentry>
@ -105,6 +107,28 @@ while ($row = pg_fetch_row($result)) {
echo "<br />\n";
}
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>Using pg_query() with multiple statements</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = pg_pconnect("dbname=publisher");
// these statements will be executed as one transaction
$query = "UPDATE authors SET author=UPPER(author) WHERE id=1;";
$query .= "UPDATE authors SET author=LOWER(author) WHERE id=2;";
$query .= "UPDATE authors SET author=NULL WHERE id=3;";
pg_query($conn, $query);
?>
]]>
</programlisting>