chriskl         Sun Mar 20 03:54:31 2005 EDT

  Added files:                 
    /phpdoc/en/reference/pgsql/functions        pg-execute.xml pg-prepare.xml 
                                                pg-query-params.xml 
                                                pg-result-error-field.xml 
                                                pg-send-execute.xml 
                                                pg-send-prepare.xml 
                                                pg-send-query-params.xml 
                                                pg-transaction-status.xml 

  Modified files:              
    /phpdoc/en/reference/pgsql  constants.xml reference.xml 
  Log:
  Add basic documentation for all the new pgsql module functions
  
http://cvs.php.net/diff.php/phpdoc/en/reference/pgsql/constants.xml?r1=1.2&r2=1.3&ty=u
Index: phpdoc/en/reference/pgsql/constants.xml
diff -u phpdoc/en/reference/pgsql/constants.xml:1.2 
phpdoc/en/reference/pgsql/constants.xml:1.3
--- phpdoc/en/reference/pgsql/constants.xml:1.2 Wed May 28 19:03:09 2003
+++ phpdoc/en/reference/pgsql/constants.xml     Sun Mar 20 03:54:30 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
 <section id="pgsql.constants">
  &reftitle.constants;
  &extension.constants;
@@ -202,6 +202,195 @@
     </simpara>
    </listitem>
   </varlistentry>
+  <varlistentry>
+   <term>
+    <constant>PGSQL_TRANSACTION_IDLE</constant> 
+    (<type>integer</type>)
+   </term>
+   <listitem>
+    <simpara>
+     
+    </simpara>
+   </listitem>
+  </varlistentry>
+  <varlistentry>
+   <term>
+    <constant>PGSQL_TRANSACTION_ACTIVE</constant> 
+    (<type>integer</type>)
+   </term>
+   <listitem>
+    <simpara>
+     
+    </simpara>
+   </listitem>
+  </varlistentry>
+  <varlistentry>
+   <term>
+    <constant>PGSQL_TRANSACTION_INTRANS</constant> 
+    (<type>integer</type>)
+   </term>
+   <listitem>
+    <simpara>
+     
+    </simpara>
+   </listitem>
+  </varlistentry>
+  <varlistentry>
+   <term>
+    <constant>PGSQL_TRANSACTION_INERROR</constant> 
+    (<type>integer</type>)
+   </term>
+   <listitem>
+    <simpara>
+     
+    </simpara>
+   </listitem>
+  </varlistentry>
+  <varlistentry>
+   <term>
+    <constant>PGSQL_TRANSACTION_UNKNOWN</constant> 
+    (<type>integer</type>)
+   </term>
+   <listitem>
+    <simpara>
+     
+    </simpara>
+   </listitem>
+  </varlistentry>
+  <varlistentry>
+   <term>
+    <constant>PGSQL_DIAG_SEVERITY</constant> 
+    (<type>integer</type>)
+   </term>
+   <listitem>
+    <simpara>
+     
+    </simpara>
+   </listitem>
+  </varlistentry>
+  <varlistentry>
+   <term>
+    <constant>PGSQL_DIAG_SQLSTATE</constant> 
+    (<type>integer</type>)
+   </term>
+   <listitem>
+    <simpara>
+     
+    </simpara>
+   </listitem>
+  </varlistentry>
+  <varlistentry>
+   <term>
+    <constant>PGSQL_DIAG_MESSAGE_PRIMARY</constant> 
+    (<type>integer</type>)
+   </term>
+   <listitem>
+    <simpara>
+     
+    </simpara>
+   </listitem>
+  </varlistentry>
+  <varlistentry>
+   <term>
+    <constant>PGSQL_DIAG_MESSAGE_DETAIL</constant> 
+    (<type>integer</type>)
+   </term>
+   <listitem>
+    <simpara>
+     
+    </simpara>
+   </listitem>
+  </varlistentry>
+  <varlistentry>
+   <term>
+    <constant>PGSQL_DIAG_MESSAGE_HINT</constant> 
+    (<type>integer</type>)
+   </term>
+   <listitem>
+    <simpara>
+     
+    </simpara>
+   </listitem>
+  </varlistentry>
+  <varlistentry>
+   <term>
+    <constant>PGSQL_DIAG_STATEMENT_POSITION</constant> 
+    (<type>integer</type>)
+   </term>
+   <listitem>
+    <simpara>
+     
+    </simpara>
+   </listitem>
+  </varlistentry>
+  <varlistentry>
+   <term>
+    <constant>PGSQL_DIAG_INTERNAL_POSITION</constant> 
+    (<type>integer</type>)
+   </term>
+   <listitem>
+    <simpara>
+     
+    </simpara>
+   </listitem>
+  </varlistentry>
+  <varlistentry>
+   <term>
+    <constant>PGSQL_DIAG_INTERNAL_QUERY</constant> 
+    (<type>integer</type>)
+   </term>
+   <listitem>
+    <simpara>
+     
+    </simpara>
+   </listitem>
+  </varlistentry>
+  <varlistentry>
+   <term>
+    <constant>PGSQL_DIAG_CONTEXT</constant> 
+    (<type>integer</type>)
+   </term>
+   <listitem>
+    <simpara>
+     
+    </simpara>
+   </listitem>
+  </varlistentry>
+  <varlistentry>
+   <term>
+    <constant>PGSQL_DIAG_SOURCE_FILE</constant> 
+    (<type>integer</type>)
+   </term>
+   <listitem>
+    <simpara>
+     
+    </simpara>
+   </listitem>
+  </varlistentry>
+  <varlistentry>
+   <term>
+    <constant>PGSQL_DIAG_SOURCE_LINE</constant> 
+    (<type>integer</type>)
+   </term>
+   <listitem>
+    <simpara>
+     
+    </simpara>
+   </listitem>
+  </varlistentry>
+  <varlistentry>
+   <term>
+    <constant>PGSQL_DIAG_SOURCE_FUNCTION</constant> 
+    (<type>integer</type>)
+   </term>
+   <listitem>
+    <simpara>
+     
+    </simpara>
+   </listitem>
+  </varlistentry>
+
+
  </variablelist>
 </section>
 
http://cvs.php.net/diff.php/phpdoc/en/reference/pgsql/reference.xml?r1=1.22&r2=1.23&ty=u
Index: phpdoc/en/reference/pgsql/reference.xml
diff -u phpdoc/en/reference/pgsql/reference.xml:1.22 
phpdoc/en/reference/pgsql/reference.xml:1.23
--- phpdoc/en/reference/pgsql/reference.xml:1.22        Mon Mar  7 19:06:31 2005
+++ phpdoc/en/reference/pgsql/reference.xml     Sun Mar 20 03:54:30 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.22 $ -->
+<!-- $Revision: 1.23 $ -->
 <reference id="ref.pgsql">
  <title>PostgreSQL Functions</title>
  <titleabbrev>PostgreSQL</titleabbrev>
@@ -22,7 +22,7 @@
    &reftitle.required;
    <para>
     To use PostgreSQL support, you need PostgreSQL 6.5 or
-    later, PostgreSQL 7.0 or later to enable all PostgreSQL module
+    later, PostgreSQL 7.4 or later to enable all PostgreSQL module
     features. PostgreSQL supports many character encoding including
     multibyte character encoding. The current version and more
     information about PostgreSQL is available at 

http://cvs.php.net/co.php/phpdoc/en/reference/pgsql/functions/pg-execute.xml?r=1.1&p=1
Index: phpdoc/en/reference/pgsql/functions/pg-execute.xml
+++ phpdoc/en/reference/pgsql/functions/pg-execute.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-execute">
 <refnamediv>
  <refname>pg_execute</refname>
  <refpurpose>Execute a previously prepared query</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>resource</type><methodname>pg_execute</methodname>
   <methodparam><type>string</type><parameter>stmtname</parameter></methodparam>
   <methodparam><type>array</type><parameter>params</parameter></methodparam>
  </methodsynopsis>
  <methodsynopsis>
   <type>resource</type><methodname>pg_execute</methodname>
   
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
   <methodparam><type>string</type><parameter>stmtname</parameter></methodparam>
   <methodparam><type>array</type><parameter>params</parameter></methodparam>
  </methodsynopsis>
  <para>
   <function>pg_execute</function> returns a query result resource if
   the named prepared query could be executed with the given parameters.  
   It returns &false; on failure or if
   connection is not a valid connection. Details about the error can
   be retrieved using the <function>pg_last_error</function>
   function if connection is valid.
   <function>pg_execute</function> executes a previously prepared
   query on the
   <parameter>connection</parameter> resource with the specified
   parameters.  It is identical to <function>pg_query_params</function>
   except that it takes the name of a previously prepared query instead
   of an actual query. The
   <parameter>connection</parameter> must be a valid connection that
   was returned by <function>pg_connect</function> or
   <function>pg_pconnect</function>. The return value of this
   function is an query result resource to be used to access the
   results from other PostgreSQL functions such as
   <function>pg_fetch_array</function>.
   <note>
    <simpara>
     <parameter>connection</parameter> is an optional parameter for
     <function>pg_execute</function>. If
     <parameter>connection</parameter> is not set, default
     connection is used. Default connection is the last connection
     made by <function>pg_connect</function> or
     <function>pg_pconnect</function>.
    </simpara>
    <simpara>
     Although <parameter>connection</parameter> can be omitted, it
     is not recommended, since it could be a cause of hard to find
     bug in script.
    </simpara>
   </note>
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Using <function>pg_execute</function></title>
    <programlisting role="php">
<![CDATA[
<?php
// Connect to a database named "mary"
$dbconn = pg_connect("dbname=mary");

// Prepare a query for execution
$result = pg_prepare($dbconn, "my_query", 'SELECT * FROM shops WHERE name = 
$1');

// Execute the prepared query.  Note that it is not necessary to escape
// the string "Joe's Widgets" in any way
$result = pg_execute($dbconn, "my_query", array("Joe's Widgets"));

// Execute the same prepared query, this time with a different parameter
$result = pg_execute($dbconn, "my_query", array("Clothes Clothes Clothes"));

?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>
 
 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>pg_connect</function></member>
    <member><function>pg_pconnect</function></member>
    <member><function>pg_prepare</function></member>
    <member><function>pg_send_execute</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
-->

http://cvs.php.net/co.php/phpdoc/en/reference/pgsql/functions/pg-prepare.xml?r=1.1&p=1
Index: phpdoc/en/reference/pgsql/functions/pg-prepare.xml
+++ phpdoc/en/reference/pgsql/functions/pg-prepare.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-prepare">
 <refnamediv>
  <refname>pg_prepare</refname>
  <refpurpose>Prepares a query for future execution</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>resource</type><methodname>pg_prepare</methodname>
   <methodparam><type>string</type><parameter>stmtname</parameter></methodparam>
   <methodparam><type>string</type><parameter>query</parameter></methodparam>
  </methodsynopsis>
  <methodsynopsis>
   <type>resource</type><methodname>pg_prepare</methodname>
   
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
   <methodparam><type>string</type><parameter>stmtname</parameter></methodparam>
   <methodparam><type>string</type><parameter>query</parameter></methodparam>
  </methodsynopsis>
  <para>
   <function>pg_prepare</function> returns a query result resource if
   query could be prepared.  It returns &false; on failure or if
   connection is not a valid connection. Details about the error can
   be retrieved using the <function>pg_last_error</function>
   function if connection is valid.
   <function>pg_prepare</function> prepares an SQL statement for 
   the PostgreSQL database connection specified by the
   <parameter>connection</parameter> resource. The
   <parameter>connection</parameter> must be a valid connection that
   was returned by <function>pg_connect</function> or
   <function>pg_pconnect</function>. The return value of this
   function is an query result resource.  The <parameter>stmtname</parameter>
   is the name of the prepared query, for future use with 
   <function>pg_execute</function> or <function>pg_send_execute</function>.
   <note>
    <simpara>
     <parameter>connection</parameter> is an optional parameter for
     <function>pg_prepare</function>. If
     <parameter>connection</parameter> is not set, default
     connection is used. Default connection is the last connection
     made by <function>pg_connect</function> or
     <function>pg_pconnect</function>.
    </simpara>
    <simpara>
     Although <parameter>connection</parameter> can be omitted, it
     is not recommended, since it could be a cause of hard to find
     bug in script.
    </simpara>
   </note>
  </para>
  <para>
   Parameters to <function>pg_prepare</function> are specified
   using placeholders in the query.  It is not necessary to quote
   parameters as quoting and escaping is done automatically.
  Placeholders are indicated in the <parameter>query</parameter>
   by $1, $2, $3 and so on.
  </para>
  <para>Using prepared queries means you can prepare one and
  then execute many times, with different parameters.  PostgreSQL
  will cache the query plan on the prepare, then re-use it for
  each execute, resulting in speed improvements.  There is no
  need to use a prepared query if it will only be executed once.
  In this case, it is simpler to use <function>pg_query_params</function>.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Using <function>pg_prepare</function></title>
    <programlisting role="php">
<![CDATA[
<?php
// Connect to a database named "mary"
$dbconn = pg_connect("dbname=mary");

// Prepare a query for execution
$result = pg_prepare($dbconn, "my_query", 'SELECT * FROM shops WHERE name = 
$1');

// Execute the prepared query.  Note that it is not necessary to escape
// the string "Joe's Widgets" in any way
$result = pg_execute($dbconn, "my_query", array("Joe's Widgets"));

// Execute the same prepared query, this time with a different parameter
$result = pg_execute($dbconn, "my_query", array("Clothes Clothes Clothes"));

?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>
 
 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>pg_connect</function></member>
    <member><function>pg_pconnect</function></member>
    <member><function>pg_execute</function></member>
    <member><function>pg_send_execute</function></member>
    <member><function>pg_query_params</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
-->

http://cvs.php.net/co.php/phpdoc/en/reference/pgsql/functions/pg-query-params.xml?r=1.1&p=1
Index: phpdoc/en/reference/pgsql/functions/pg-query-params.xml
+++ phpdoc/en/reference/pgsql/functions/pg-query-params.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-query-params">
 <refnamediv>
  <refname>pg_query_params</refname>
  <refpurpose>Execute a query, specifying query variables as separate 
parameters</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>resource</type><methodname>pg_query_params</methodname>
   <methodparam><type>string</type><parameter>query</parameter></methodparam>
   <methodparam><type>array</type><parameter>params</parameter></methodparam>
  </methodsynopsis>
  <methodsynopsis>
   <type>resource</type><methodname>pg_query_params</methodname>
   
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
   <methodparam><type>string</type><parameter>query</parameter></methodparam>
   <methodparam><type>array</type><parameter>params</parameter></methodparam>
  </methodsynopsis>
  <para>
   <function>pg_query_params</function> works identically to
   <function>pg_query</function>, except that instead of putting
   query parameters directly into the <parameter>query</parameter>
   <type>string</type>, placeholders are used and the parameters are
   passed in separately. Unlike <function>pg_query</function>,
   only one non-empty SQL statement can be executed at a time.
  </para>
  <para>
   Parameters passed in this way are automatically quoted and escaped
   if necessary.  This is an effective way of improving the security
   of your scripts and eliminating the need for manual quoting and
   escaping of parameters.
  </para>
  <para>Placeholders are indicated in the <parameter>query</parameter>
   by $1, $2, $3 and so on.  The first parameter will be substituted for
   $1, the second for $2, the third for $3.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Using <function>pg_query_params</function></title>
    <programlisting role="php">
<![CDATA[
<?php
// Connect to a database named "mary"
$dbconn = pg_connect("dbname=mary");

// Find all shops named Joe's Widgets.  Note that it is not necessary to
// escape "Joe's Widgets"
$result = pg_query_params($dbconn, 'SELECT * FROM shops WHERE name = $1', 
array("Joe's Widgets"));

// Compare against just using pg_query
$str = pg_escape_string("Joe's Widgets");
$result = pg_query($dbconn, "SELECT * FROM shops WHERE name = '{$str}'");

?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>
 
 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>pg_query</function></member>
    <member><function>pg_connect</function></member>
    <member><function>pg_escape_string</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
-->

http://cvs.php.net/co.php/phpdoc/en/reference/pgsql/functions/pg-result-error-field.xml?r=1.1&p=1
Index: phpdoc/en/reference/pgsql/functions/pg-result-error-field.xml
+++ phpdoc/en/reference/pgsql/functions/pg-result-error-field.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.58 -->
<refentry id='function.pg-result-error-field'>
 <refnamediv>
  <refname>pg_result_error_field</refname>
  <refpurpose>
   Get error message field associated with result
  </refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>string</type><methodname>pg_result_error_field</methodname>
   <methodparam><type>resource</type><parameter>result</parameter></methodparam>
   <methodparam><type>int</type><parameter>fieldcode</parameter></methodparam>
  </methodsynopsis>
  <para>
   <function>pg_result_error_field</function> returns one of the detailed error 
message
   fields associated with <parameter>result</parameter> resource. It is only 
available
   against a PostgreSQL 7.4 or above server.  The error field is specified by
   the <parameter>fieldcode</parameter>.
  </para>
  <para>
   Because <function>pg_query</function> and 
<function>pg_query_params</function> return &false; if the query fails,
   you must use <function>pg_send_query</function> and
   <function>pg_get_result</function> to get the result handle.
  </para>
  <para>
   Possible <parameter>fieldcode</parameter> values are:
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>pg_result_error</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
-->

http://cvs.php.net/co.php/phpdoc/en/reference/pgsql/functions/pg-send-execute.xml?r=1.1&p=1
Index: phpdoc/en/reference/pgsql/functions/pg-send-execute.xml
+++ phpdoc/en/reference/pgsql/functions/pg-send-execute.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-send-execute">
 <refnamediv>
  <refname>pg_send_execute</refname>
  <refpurpose>Asynchronously execute a previously prepared query</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>resource</type><methodname>pg_send_execute</methodname>
   <methodparam><type>string</type><parameter>stmtname</parameter></methodparam>
   <methodparam><type>array</type><parameter>params</parameter></methodparam>
  </methodsynopsis>
  <methodsynopsis>
   <type>resource</type><methodname>pg_send_execute</methodname>
   
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
   <methodparam><type>string</type><parameter>stmtname</parameter></methodparam>
   <methodparam><type>array</type><parameter>params</parameter></methodparam>
  </methodsynopsis>
  <para>
   <function>pg_send_execute</function> executes a previously prepared
   named query on the <parameter>connection</parameter>, with the
   specified parameters.  Unlike <function>pg_execute</function>, script 
execution 
   is not blocked while the query is executing.
  </para>
  <para>
   <function>pg_send_execute</function> returns a query result resource if
   the named prepared query could be executed with the given parameters.  
   It returns &false; on failure or if connection is not a valid connection.
   It is identical to <function>pg_send_query_params</function>
   except that it takes the name of a previously prepared query instead
   of an actual query.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Using <function>pg_send_execute</function></title>
    <programlisting role="php">
<![CDATA[
<?php
  $dbconn = pg_connect("dbname=publisher") or die("Could not connect");

  // Prepare a query for execution
  if (!pg_connection_busy($dbconn)) {
    pg_send_prepare($dbconn, "my_query", 'SELECT * FROM shops WHERE name = $1');
    $res1 = pg_get_result($dbconn);
  }

  // Execute the prepared query.  Note that it is not necessary to escape
  // the string "Joe's Widgets" in any way
  if (!pg_connection_busy($dbconn)) {
    pg_send_execute($dbconn, "my_query", array("Joe's Widgets"));
    $res2 = pg_get_result($dbconn);
  }
  
  // Execute the same prepared query, this time with a different parameter
  if (!pg_connection_busy($dbconn)) {
    pg_send_execute($dbconn, "my_query", array("Clothes Clothes Clothes"));
    $res3 = pg_get_result($dbconn);
  }
  
?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>
 
 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>pg_connect</function></member>
    <member><function>pg_pconnect</function></member>
    <member><function>pg_prepare</function></member>
    <member><function>pg_send_prepare</function></member>
    <member><function>pg_execute</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
-->

http://cvs.php.net/co.php/phpdoc/en/reference/pgsql/functions/pg-send-prepare.xml?r=1.1&p=1
Index: phpdoc/en/reference/pgsql/functions/pg-send-prepare.xml
+++ phpdoc/en/reference/pgsql/functions/pg-send-prepare.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-send-prepare">
 <refnamediv>
  <refname>pg_send_prepare</refname>
  <refpurpose>Asynchronously prepares a query for future execution</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>resource</type><methodname>pg_send_prepare</methodname>
   <methodparam><type>string</type><parameter>stmtname</parameter></methodparam>
   <methodparam><type>string</type><parameter>query</parameter></methodparam>
  </methodsynopsis>
  <methodsynopsis>
   <type>resource</type><methodname>pg_send_prepare</methodname>
   
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
   <methodparam><type>string</type><parameter>stmtname</parameter></methodparam>
   <methodparam><type>string</type><parameter>query</parameter></methodparam>
  </methodsynopsis>
  <para>
   <function>pg_send_prepare</function> asynchronously prepares a query
   on the <parameter>connection</parameter>.  Unlike 
<function>pg_prepare</function>,
   script execution is not blocked while the query is being prepared.  It
   behaves in the same fashion as <function>pg_send_query</function>.
  </para>
  <para>
   Parameters to <function>pg_prepare</function> are specified
   using placeholders in the query.  It is not necessary to quote
   parameters as quoting and escaping is done automatically.
  Placeholders are indicated in the <parameter>query</parameter>
   by $1, $2, $3 and so on.
  </para>
  <para>Using prepared queries means you can prepare one and
  then execute many times, with different parameters.  PostgreSQL
  will cache the query plan on the prepare, then re-use it for
  each execute, resulting in speed improvements.  There is no
  need to use a prepared query if it will only be executed once.
  In this case, it is simpler to use <function>pg_query_params</function>.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Using <function>pg_send_prepare</function></title>
    <programlisting role="php">
<![CDATA[
<?php
  $dbconn = pg_connect("dbname=publisher") or die("Could not connect");

  // Prepare a query for execution
  if (!pg_connection_busy($dbconn)) {
    pg_send_prepare($dbconn, "my_query", 'SELECT * FROM shops WHERE name = $1');
    $res1 = pg_get_result($dbconn);
  }

  // Execute the prepared query.  Note that it is not necessary to escape
  // the string "Joe's Widgets" in any way
  if (!pg_connection_busy($dbconn)) {
    pg_send_execute($dbconn, "my_query", array("Joe's Widgets"));
    $res2 = pg_get_result($dbconn);
  }
  
  // Execute the same prepared query, this time with a different parameter
  if (!pg_connection_busy($dbconn)) {
    pg_send_execute($dbconn, "my_query", array("Clothes Clothes Clothes"));
    $res3 = pg_get_result($dbconn);
  }
  
?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>
 
 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>pg_connect</function></member>
    <member><function>pg_pconnect</function></member>
    <member><function>pg_execute</function></member>
    <member><function>pg_send_execute</function></member>
    <member><function>pg_send_query_params</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
-->

http://cvs.php.net/co.php/phpdoc/en/reference/pgsql/functions/pg-send-query-params.xml?r=1.1&p=1
Index: phpdoc/en/reference/pgsql/functions/pg-send-query-params.xml
+++ phpdoc/en/reference/pgsql/functions/pg-send-query-params.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id='function.pg-send-query-params'>
 <refnamediv>
  <refname>pg_send_query_params</refname>
  <refpurpose>
   Sends asynchronous query, specifying query variables as separate parameters
  </refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>bool</type><methodname>pg_send_query_params</methodname>
   
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
   <methodparam><type>string</type><parameter>query</parameter></methodparam>
   <methodparam><type>array</type><parameter>params</parameter></methodparam>
  </methodsynopsis>
  <para>
   <function>pg_send_query_params</function> works identically to
   <function>pg_send_query</function>, except that instead of putting
   query parameters directly into the <parameter>query</parameter>
   <type>string</type>, placeholders are used and the parameters are
   passed in separately.  Unlike <function>pg_send_query</function>,
   only one non-empty SQL statement can be executed at a time.
  </para>
  <para>
   Parameters passed in this way are automatically quoted and escaped
   if necessary.  This is an effective way of improving the security
   of your scripts and eliminating the need for manual quoting and
   escaping of parameters.
  </para>
  <para>Placeholders are indicated in the <parameter>query</parameter>
   by $1, $2, $3 and so on.  The first parameter will be substituted for
   $1, the second for $2, the third for $3.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Using <function>pg_send_query_params</function></title>
    <programlisting role="php">
<![CDATA[
<?php
  $dbconn = pg_connect("dbname=publisher") or die("Could not connect");

  // Using parameters.  Note that it is not necessary to quote or escape
  // the parameter.
  pg_send_query_params($dbconn, 'select count(*) from authors where city = $1', 
array('Perth'));
  
  // Compare against basic pg_send_query usage
  $str = pg_escape_string('Perth');
  pg_send_query($dbconn, "select count(*) from authors where city = '${str}'");
?>
]]>
    </programlisting>
   </example> 
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>pg_send_query</function></member>
    <member><function>pg_connect</function></member>
    <member><function>pg_escape_string</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
-->

http://cvs.php.net/co.php/phpdoc/en/reference/pgsql/functions/pg-transaction-status.xml?r=1.1&p=1
Index: phpdoc/en/reference/pgsql/functions/pg-transaction-status.xml
+++ phpdoc/en/reference/pgsql/functions/pg-transaction-status.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
<refentry id='function.pg_transaction_status'>
 <refnamediv>
  <refname>pg_transaction_status</refname>
  <refpurpose>
   Get transaction status
  </refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>int</type><methodname>pg_transaction_status</methodname>
   
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
  </methodsynopsis>
  <para>
   <function>pg_transaction_status</function> returns the current 
in-transaction status 
   of the server.
   The status can be <literal>PGSQL_TRANSACTION_IDLE</literal> (currently idle),
   <literal>PGSQL_TRANSACTION_ACTIVE</literal> (a command is in progress),
   <literal>PGSQL_TRANSACTION_INTRANS</literal> (idle, in a valid transaction 
block),
   or <literal>PGSQL_TRANSACTION_INERROR</literal> (idle, in a failed 
transaction block).
   <literal>PGSQL_TRANSACTION_UNKNOWN</literal> is reported if the connection 
is bad.
   <literal>PGSQL_TRANSACTION_ACTIVE</literal> is reported only when a query
   has been sent to the server and not yet completed.
   </para>
   <caution>
   <para>
     <function>pg_transaction_status</function> will give incorrect results 
when using
     a PostgreSQL 7.3 server that has the parameter 
<literal>autocommit</literal>
     set to off.  The server-side autocommit feature has been
     deprecated and does not exist in later server versions.
   </para>
   </caution>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title><function>pg_transaction_status</function> example</title>
    <programlisting role="php">
<![CDATA[
<?php
  $dbconn = pg_connect("dbname=publisher") or die("Could not connect");
  $stat = pg_transaction_status($dbconn);
  if ($stat === PGSQL_TRANSACTION_UNKNOWN) {
      echo 'Connection is bad';
  } else if ($stat === PGSQL_TRANSACTION_IDLE) {
      echo 'Connection is currently idle';
  } else {
      echo 'Connection is in a transaction state';
  }    
?>
]]>
    </programlisting>
   </example>
  </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
-->

Reply via email to