From 97459cd0e6e5d25943140407dfb0d8ea238e9506 Mon Sep 17 00:00:00 2001 From: Christopher Kings-Lynne <chriskl@php.net> Date: Sun, 3 Jul 2005 14:59:21 +0000 Subject: [PATCH] New doc style for pg_get_result() git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@189802 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/pgsql/functions/pg-get-result.xml | 91 +++++++++++++++++++-- 1 file changed, 83 insertions(+), 8 deletions(-) diff --git a/reference/pgsql/functions/pg-get-result.xml b/reference/pgsql/functions/pg-get-result.xml index 50ca024216..339970a411 100644 --- a/reference/pgsql/functions/pg-get-result.xml +++ b/reference/pgsql/functions/pg-get-result.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.58 --> <refentry id='function.pg-get-result'> <refnamediv> @@ -16,13 +16,88 @@ <methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam> </methodsynopsis> <para> - <function>pg_get_result</function> get result resource from async - query executed by - <function>pg_send_query</function>. <function>pg_send_query</function> - can send multiple queries to PostgreSQL server and - <function>pg_get_result</function> is used to get query result - one by one. It returns result resource. If there is no more - results, it returns &false;. + <function>pg_get_result</function> gets the result resource from + an asynchronous query executed by + <function>pg_send_query</function>, <function>pg_send_query_params</function> or + <function>pg_send_execute</function>. + </para> + <para><function>pg_send_query</function> and the + other asynchronous query functions + can send multiple queries to a PostgreSQL server and + <function>pg_get_result</function> is used to get each query's results, + one by one. + </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>connection</parameter></term> + <listitem> + <para> + PostgreSQL database connection resource. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + The result <type>resource</type>, or &false; if no more results are available. + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>pg_get_result</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php + $dbconn = pg_connect("dbname=publisher") or die("Could not connect"); + + if (!pg_connection_busy($dbconn)) { + pg_send_query($dbconn, "select * from authors; select count(*) from authors;"); + } + + $res1 = pg_get_result($dbconn); + echo "First call to pg_get_result(): $res1\n"; + $rows1 = pg_num_rows($res1); + echo "$res1 has $rows1 records\n\n"; + + $res2 = pg_get_result($dbconn); + echo "second call to pg_get_result(): $res2\n"; + $rows2 = pg_num_rows($res2); + echo "$res2 has $rows2 records\n"; +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +first call to pg_get_result(): Resource id #3 +Resource id #3 has 3 records + +second call to pg_get_result(): Resource id #4 +Resource id #4 has 1 records +]]> + </screen> + </example> + </para> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>pg_send_query</function></member> + </simplelist> </para> </refsect1> </refentry>