mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
New doc style for pg_get_result()
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@189802 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
14bf5b6d2b
commit
97459cd0e6
1 changed files with 83 additions and 8 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue