kouber          Tue Oct  4 08:56:29 2005 EDT

  Modified files:              
    /phpdoc/en/reference/pgsql/functions        pg-query.xml 
  Log:
  Multiple statements example & transaction explanations added (Bug #34719).
  
http://cvs.php.net/diff.php/phpdoc/en/reference/pgsql/functions/pg-query.xml?r1=1.11&r2=1.12&ty=u
Index: phpdoc/en/reference/pgsql/functions/pg-query.xml
diff -u phpdoc/en/reference/pgsql/functions/pg-query.xml:1.11 
phpdoc/en/reference/pgsql/functions/pg-query.xml:1.12
--- phpdoc/en/reference/pgsql/functions/pg-query.xml:1.11       Mon Jul  4 
03:42:00 2005
+++ phpdoc/en/reference/pgsql/functions/pg-query.xml    Tue Oct  4 08:56:26 2005
@@ -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>
@@ -110,6 +112,28 @@
     </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>
+   </example>
+  </para>
  </refsect1>
  
  <refsect1 role="seealso">

Reply via email to