mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
- Another ten functions updated
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@185049 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
25d578f482
commit
eeb7ede0c7
10 changed files with 519 additions and 45 deletions
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.61 -->
|
||||
<refentry id='function.pg-cancel-query'>
|
||||
<refnamediv>
|
||||
<refname>pg_cancel_query</refname>
|
||||
<refpurpose>
|
||||
Cancel asynchronous query
|
||||
Cancel an asynchronous query
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
|
@ -16,12 +16,72 @@
|
|||
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_cancel_query</function> cancel asynchronous query sent by
|
||||
<function>pg_send_query</function>. You cannot cancel query executed by
|
||||
<function>pg_cancel_query</function> cancels an asynchronous query sent with
|
||||
<function>pg_send_query</function>, <function>pg_send_query_params</function>
|
||||
or <function>pg_send_execute</function>. You cannot cancel a query executed using
|
||||
<function>pg_query</function>.
|
||||
</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>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>pg_cancel_query</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";
|
||||
|
||||
// Cancel the currently running query. Will be the second query if it is
|
||||
// still running.
|
||||
pg_cancel_query($dbconn);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
first call to pg_get_result(): Resource id #3
|
||||
Resource id #3 has 3 records
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
|
||||
<refentry id='function.pg-connection-busy'>
|
||||
<refnamediv>
|
||||
|
@ -16,12 +16,35 @@
|
|||
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_connection_busy</function> returns &true; if the
|
||||
connection is busy. If it is busy, a previous query is still executing.
|
||||
If <function>pg_get_result</function> is called, it will be blocked.
|
||||
<function>pg_connection_busy</function> determines whether or not a connection
|
||||
is busy. If it is busy, a previous query is still executing.
|
||||
If <function>pg_get_result</function> is used on the connection, it will be blocked.
|
||||
</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>
|
||||
Returns &true; if the connection is busy, &false; otherwise.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
|
||||
<refentry id='function.pg-connection-reset'>
|
||||
<refnamediv>
|
||||
|
@ -17,10 +17,33 @@
|
|||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_connection_reset</function> resets the connection.
|
||||
It is useful for error recovery. &return.success;
|
||||
It is useful for error recovery.
|
||||
</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>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
|
||||
<refentry id='function.pg-connection-status'>
|
||||
<refnamediv>
|
||||
|
@ -16,13 +16,35 @@
|
|||
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_connection_status</function> returns a connection status.
|
||||
Possible statuses are <constant>PGSQL_CONNECTION_OK</constant> and
|
||||
<constant>PGSQL_CONNECTION_BAD</constant>. The return value 0 as
|
||||
integer indicates a valid connection.
|
||||
<function>pg_connection_status</function> returns the status of
|
||||
the specified <parameter>connection</parameter>.
|
||||
</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>
|
||||
<constant>PGSQL_CONNECTION_OK</constant> or
|
||||
<constant>PGSQL_CONNECTION_BAD</constant>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
|
||||
<refentry id='function.pg-copy-from'>
|
||||
<refnamediv>
|
||||
|
@ -20,13 +20,94 @@
|
|||
<methodparam choice="opt"><type>string</type><parameter>null_as</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_copy_from</function> insert records into a table from
|
||||
<parameter>rows</parameter>. It issues <literal>COPY FROM</literal> SQL command
|
||||
<function>pg_copy_from</function> inserts records into a table from
|
||||
<parameter>rows</parameter>. It issues a <literal>COPY FROM</literal> SQL command
|
||||
internally to insert records.
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>connection</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
PostgreSQL database connection resource.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>table_name</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Name of the table into which to copy the <parameter>rows</parameter>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>rows</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
An <type>array</type> of data to be copied into <parameter>table_name</parameter>.
|
||||
Each value in <parameter>rows</parameter> becomes a row in <parameter>table_name</parameter>.
|
||||
Each value in <parameter>rows</parameter> should be a delimited string of the values
|
||||
to insert into each field. Values should be linefeed terminated.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>delimiter</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The token that separates values for each field in each element of
|
||||
<parameter>rows</parameter>. Default is <literal>TAB</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>null_as</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
How SQL <literal>NULL</literal> values are represented in the
|
||||
<parameter>rows</parameter>. Default is \N ("\\N").
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>pg_copy_from</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$db = pg_connect("dbname=publisher") or die("Could not connect");
|
||||
|
||||
$rows = pg_copy_to($db, $table_name);
|
||||
|
||||
pg_query($db, "DELETE FROM $table_name");
|
||||
|
||||
pg_copy_from($db, $table_name, $rows);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
|
||||
<refentry id='function.pg-copy-to'>
|
||||
<refnamediv>
|
||||
|
@ -21,11 +21,82 @@
|
|||
<para>
|
||||
<function>pg_copy_to</function> copies a table to an array. It
|
||||
issues <literal>COPY TO</literal> SQL command internally to
|
||||
retrieve records. The resulting array is returned. It returns
|
||||
&false; on failure.
|
||||
retrieve records.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>connection</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
PostgreSQL database connection resource.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>table_name</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Name of the table from which to copy the data into <parameter>rows</parameter>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>delimiter</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The token that separates values for each field in each element of
|
||||
<parameter>rows</parameter>. Default is <literal>TAB</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>null_as</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
How SQL <literal>NULL</literal> values are represented in the
|
||||
<parameter>rows</parameter>. Default is \N ("\\N").
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
An <type>array</type> with one element for each line of <literal>COPY</literal> data.
|
||||
It returns &false; on failure.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>pg_copy_to</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$db = pg_connect("dbname=publisher") or die("Could not connect");
|
||||
|
||||
$rows = pg_copy_to($db, $table_name);
|
||||
|
||||
pg_query($db, "DELETE FROM $table_name");
|
||||
|
||||
pg_copy_from($db, $table_name, $rows);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
|
||||
<refentry id='function.pg-result-error'>
|
||||
<refnamediv>
|
||||
|
@ -16,10 +16,14 @@
|
|||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_result_error</function> returns error message
|
||||
associated with <parameter>result</parameter> resource. Therefore,
|
||||
user has better chance to get better error message than
|
||||
<function>pg_last_error</function>.
|
||||
<function>pg_result_error</function> returns any error message
|
||||
associated with the <parameter>result</parameter> resource. Therefore,
|
||||
the user has a better chance of getting the correct error message than
|
||||
with <function>pg_last_error</function>.
|
||||
</para>
|
||||
<para>
|
||||
The function <function>pg_result_error_field</function> can give much greater
|
||||
detail on result errors than <function>pg_result_error</function>.
|
||||
</para>
|
||||
<para>
|
||||
Because <function>pg_query</function> returns &false; if the query fails,
|
||||
|
@ -28,10 +32,73 @@
|
|||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>result</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
PostgreSQL query result resource, returned by <function>pg_query</function>,
|
||||
<function>pg_query_params</function> or <function>pg_execute</function>
|
||||
(among others).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>offset</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Row to move the internal offset to in the <parameter>result</parameter> resource.
|
||||
Rows are numbered starting from zero.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>pg_result_seek</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// Connect to the database
|
||||
$conn = pg_pconnect("dbname=publisher");
|
||||
|
||||
// Execute a query
|
||||
$result = pg_query($conn, "SELECT author, email FROM authors");
|
||||
|
||||
// Seek to the 3rd row (assuming there are 3 rows)
|
||||
pg_result_seek($result, 2);
|
||||
|
||||
// Fetch the 3rd row
|
||||
$row = pg_fetch_row($result);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>pg_result_error_field</function></member>
|
||||
<member><function>pg_query</function></member>
|
||||
<member><function>pg_send_query</function></member>
|
||||
<member><function>pg_get_result</function></member>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.pg-result-seek">
|
||||
<refnamediv>
|
||||
|
@ -10,16 +10,78 @@
|
|||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>pg_result_seek</methodname>
|
||||
<type>bool</type><methodname>pg_result_seek</methodname>
|
||||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_result_seek</function> set internal row offset in
|
||||
result resource. It returns &false;, if there is error.
|
||||
<function>pg_result_seek</function> sets the internal row offset in
|
||||
a result resource.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>result</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
PostgreSQL query result resource, returned by <function>pg_query</function>,
|
||||
<function>pg_query_params</function> or <function>pg_execute</function>
|
||||
(among others).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>offset</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Row to move the internal offset to in the <parameter>result</parameter> resource.
|
||||
Rows are numbered starting from zero.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>pg_result_seek</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// Connect to the database
|
||||
$conn = pg_pconnect("dbname=publisher");
|
||||
|
||||
// Execute a query
|
||||
$result = pg_query($conn, "SELECT author, email FROM authors");
|
||||
|
||||
// Seek to the 3rd row (assuming there are 3 rows)
|
||||
pg_result_seek($result, 2);
|
||||
|
||||
// Fetch the 3rd row
|
||||
$row = pg_fetch_row($result);
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.58 -->
|
||||
<refentry id='function.pg-result-status'>
|
||||
<refnamediv>
|
||||
|
@ -17,25 +17,88 @@
|
|||
<methodparam choice="opt"><type>int</type><parameter>type</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_result_status</function> returns status of result
|
||||
resource, or the command tag associated with the result. Possible values
|
||||
of <parameter>type</parameter> are <constant>PGSQL_STATUS_LONG</constant>
|
||||
or <constant>PGSQL_STATUS_STRING</constant>. The default is
|
||||
<constant>PGSQL_STATUS_LONG</constant>.
|
||||
<function>pg_result_status</function> returns the status of a result
|
||||
resource, or the PostgreSQL command completion tag associated with the result
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>result</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
PostgreSQL query result resource, returned by <function>pg_query</function>,
|
||||
<function>pg_query_params</function> or <function>pg_execute</function>
|
||||
(among others).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>type</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Either <constant>PGSQL_STATUS_LONG</constant> to return the numeric status
|
||||
of the <parameter>result</parameter>, or <constant>PGSQL_STATUS_STRING</constant>
|
||||
to return the command tag of the <parameter>result</parameter>.
|
||||
If not specified, <constant>PGSQL_STATUS_LONG</constant> is the default.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Possible return values are <constant>PGSQL_EMPTY_QUERY</constant>,
|
||||
<constant>PGSQL_COMMAND_OK</constant>, <constant>PGSQL_TUPLES_OK</constant>, <constant>PGSQL_COPY_TO</constant>,
|
||||
<constant>PGSQL_COPY_FROM</constant>, <constant>PGSQL_BAD_RESPONSE</constant>, <constant>PGSQL_NONFATAL_ERROR</constant> and
|
||||
<constant>PGSQL_FATAL_ERROR</constant> if <constant>PGSQL_STATUS_LONG</constant> is
|
||||
specified.
|
||||
</para>
|
||||
<para>
|
||||
When <constant>PGSQL_STATUS_STRING</constant> is used, then the returned
|
||||
value is the command completion tag from PostgreSQL.
|
||||
specified. Otherwise, a <type>string</type> containing the PostgreSQL command tag is returned.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>pg_result_status</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// Connect to the database
|
||||
$conn = pg_pconnect("dbname=publisher");
|
||||
|
||||
// Execute a COPY
|
||||
$result = pg_query($conn, "COPY authors FROM STDIN;");
|
||||
|
||||
// Get the result status
|
||||
$status = pg_result_status($result);
|
||||
|
||||
// Determine status
|
||||
if ($status == PGSQL_COPY_FROM)
|
||||
echo "Copy began.";
|
||||
else
|
||||
echo "Copy failed.";
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Copy began.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
|
||||
<refentry id='function.pg-send-query-params'>
|
||||
<refnamediv>
|
||||
|
@ -67,8 +67,10 @@
|
|||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>Returns &true; on success, &false; on failure. Use <function>pg_get_result</function>
|
||||
to determine the query result.</para>
|
||||
<para>&return.success;</para>
|
||||
<para>
|
||||
Use <function>pg_get_result</function> to determine the query result.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
|
|
Loading…
Reference in a new issue