mirror of
https://github.com/php/doc-en.git
synced 2026-03-24 07:42:10 +01:00
140 lines
3.5 KiB
XML
140 lines
3.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.58 -->
|
|
<refentry xml:id="function.pg-get-result" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>pg_get_result</refname>
|
|
<refpurpose>
|
|
Get asynchronous query result
|
|
</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>PgSql\Result</type><type>false</type></type><methodname>pg_get_result</methodname>
|
|
<methodparam><type>PgSql\Connection</type><parameter>connection</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>pg_get_result</function> gets an <classname>PgSql\Result</classname> instance 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>
|
|
&pgsql.parameter.connection;
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
An <classname>PgSql\Result</classname> instance, or &false; if no more results are available.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
&pgsql.changelog.return-result-object;
|
|
&pgsql.changelog.connection-object;
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</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>
|
|
<!-- 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:"~/.phpdoc/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
|
|
-->
|