mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
More work on updating pgsql docs. Constants tagged as constants. Use global entities when appropriate. All pg_fetch_* functions done. pg_fetch_object() prototype fixed to match CVS.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@183744 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
106a14c5c7
commit
c30a486ae2
13 changed files with 422 additions and 140 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
|
||||
<refentry id="function.pg-close">
|
||||
<refnamediv>
|
||||
|
@ -53,7 +53,7 @@
|
|||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&true; on success, &false; on failure.
|
||||
&return.success;
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
|
|
@ -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-status'>
|
||||
<refnamediv>
|
||||
|
@ -17,8 +17,8 @@
|
|||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_connection_status</function> returns a connection status.
|
||||
Possible statuses are <literal>PGSQL_CONNECTION_OK</literal> and
|
||||
<literal>PGSQL_CONNECTION_BAD</literal>. The return value 0 as
|
||||
Possible statuses are <constant>PGSQL_CONNECTION_OK</constant> and
|
||||
<constant>PGSQL_CONNECTION_BAD</constant>. The return value 0 as
|
||||
integer indicates a valid connection.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -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-fetch-all">
|
||||
<refnamediv>
|
||||
|
@ -15,12 +15,41 @@
|
|||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_fetch_all</function> returns an array that
|
||||
contains all rows (tuples/records) in result resource. It returns
|
||||
&false;, if there are no rows.
|
||||
contains all rows (records) in the result resource.
|
||||
</para>
|
||||
&database.fetch-null;
|
||||
</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>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
An <type>array</type> with all rows in the result. Each row is an array
|
||||
of field values indexed by field name.
|
||||
</para>
|
||||
<para>
|
||||
&false; is returned if there are no rows in the result, or on any
|
||||
other error.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<!-- $Revision: 1.13 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.pg-fetch-array">
|
||||
<refnamediv>
|
||||
|
@ -17,52 +17,92 @@
|
|||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_fetch_array</function> returns an array that
|
||||
corresponds to the fetched row (tuples/records). It returns
|
||||
&false;, if there are no more rows.
|
||||
corresponds to the fetched row (record).
|
||||
</para>
|
||||
<para>
|
||||
<function>pg_fetch_array</function> is an extended version of
|
||||
<function>pg_fetch_row</function>. In addition to storing the
|
||||
data in the numeric indices (field index) to the result array, it
|
||||
also stores the data in associative indices (field name) by
|
||||
default.
|
||||
data in the numeric indices (field number) to the result array, it
|
||||
can also store the data using associative indices (field name).
|
||||
It stores both indicies by default.
|
||||
</para>
|
||||
&database.fetch-null;
|
||||
<para>
|
||||
<parameter>row</parameter> is row (record) number to be
|
||||
retrieved. First row is 0.
|
||||
</para>
|
||||
<para>
|
||||
<parameter>result_type</parameter> is an optional parameter that controls
|
||||
how the return value is initialized.
|
||||
<parameter>result_type</parameter> is a constant and can take the
|
||||
following values: <constant>PGSQL_ASSOC</constant>,
|
||||
<constant>PGSQL_NUM</constant>, and <constant>PGSQL_BOTH</constant>.
|
||||
Using <constant>PGSQL_NUM</constant>, <function>pg_fetch_array</function>
|
||||
will return an array with numerical indices, using
|
||||
<constant>PGSQL_ASSOC</constant> will return only associative indices
|
||||
while <constant>PGSQL_BOTH</constant>, the default, will return both
|
||||
numerical and associative indices.
|
||||
<note>
|
||||
<para>
|
||||
<parameter>result_type</parameter> was added in PHP 4.0.
|
||||
</para>
|
||||
</note>
|
||||
</para>
|
||||
<para>
|
||||
<function>pg_fetch_array</function> is NOT significantly
|
||||
slower than using <function>pg_fetch_row</function>, while it
|
||||
provides a significant ease of use.
|
||||
slower than using <function>pg_fetch_row</function>, and
|
||||
is significantly easier to use.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
From 4.1.0, <parameter>row</parameter> became optional.
|
||||
Calling <function>pg_fetch_array</function> will increment
|
||||
the internal row counter by one.
|
||||
<parameter>row</parameter> became optional in PHP 4.1.0.
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>
|
||||
<parameter>result_type</parameter> was added in PHP 4.0.0.
|
||||
</para>
|
||||
</note>
|
||||
</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>row</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Row number in result to fetch. Rows are numbered from 0 upwards. If omitted,
|
||||
next row is fetched.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>result_type</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
An optional parameter that controls
|
||||
how the returned <type>array</type> is indexed.
|
||||
<parameter>result_type</parameter> is a constant and can take the
|
||||
following values: <constant>PGSQL_ASSOC</constant>,
|
||||
<constant>PGSQL_NUM</constant> and <constant>PGSQL_BOTH</constant>.
|
||||
Using <constant>PGSQL_NUM</constant>, <function>pg_fetch_array</function>
|
||||
will return an array with numerical indices, using
|
||||
<constant>PGSQL_ASSOC</constant> it will return only associative indices
|
||||
while <constant>PGSQL_BOTH</constant>, the default, will return both
|
||||
numerical and associative indices.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
An <type>array</type> indexed numerically (beginning with 0) or
|
||||
associatively (indexed by field name), or both.
|
||||
Each value in the <type>array</type> is represented as a
|
||||
<type>string</type>. Database <literal>NULL</literal>
|
||||
values are returned as &null;.
|
||||
</para>
|
||||
<para>
|
||||
&false; is returned if <parameter>row</parameter> exceeds the number
|
||||
of rows in the set, there are no more rows, or on any other error.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.pg-fetch-assoc">
|
||||
<refnamediv>
|
||||
|
@ -16,35 +16,69 @@
|
|||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_fetch_assoc</function> returns an associative array that
|
||||
corresponds to the fetched row (tuples/records). It returns
|
||||
&false;, if there are no more rows.
|
||||
corresponds to the fetched row (records).
|
||||
</para>
|
||||
<para>
|
||||
<function>pg_fetch_assoc</function> is equivalent to calling
|
||||
<function>pg_fetch_array</function> with PGSQL_ASSOC for the
|
||||
<function>pg_fetch_array</function> with <constant>PGSQL_ASSOC</constant> as the
|
||||
optional third parameter. It only returns an associative array.
|
||||
If you need the numeric indices, use
|
||||
<function>pg_fetch_row</function>.
|
||||
</para>
|
||||
&database.fetch-null;
|
||||
<para>
|
||||
<parameter>row</parameter> is row (record) number to be
|
||||
retrieved. First row is 0.
|
||||
</para>
|
||||
<para>
|
||||
<function>pg_fetch_assoc</function> is NOT significantly
|
||||
slower than using <function>pg_fetch_row</function>, while it
|
||||
provides a significant ease of use.
|
||||
slower than using <function>pg_fetch_row</function>, and
|
||||
is significantly easier to use.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
From 4.1.0, <parameter>row</parameter> became optional.
|
||||
Calling <function>pg_fetch_assoc</function> will increment
|
||||
the internal row counter by one.
|
||||
<parameter>row</parameter> became optional in PHP 4.1.0.
|
||||
</para>
|
||||
</note>
|
||||
</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>row</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Row number in result to fetch. Rows are numbered from 0 upwards. If omitted,
|
||||
next row is fetched.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
An <type>array</type> indexed associatively (by field name).
|
||||
Each value in the <type>array</type> is represented as a
|
||||
<type>string</type>. Database <literal>NULL</literal>
|
||||
values are returned as &null;.
|
||||
</para>
|
||||
<para>
|
||||
&false; is returned if <parameter>row</parameter> exceeds the number
|
||||
of rows in the set, there are no more rows, or on any other error.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.15 $ -->
|
||||
<!-- $Revision: 1.16 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.pg-fetch-object">
|
||||
<refnamediv>
|
||||
|
@ -15,48 +15,113 @@
|
|||
<methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>result_type</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis>
|
||||
<type>object</type><methodname>pg_fetch_object</methodname>
|
||||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>class_name</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>array</type><parameter>params</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_fetch_object</function> returns an object with
|
||||
properties that correspond to the fetched row. It returns &false;
|
||||
if there are no more rows or error.
|
||||
</para>
|
||||
<para>
|
||||
<function>pg_fetch_object</function> is similar to
|
||||
<function>pg_fetch_array</function>, with one difference - an
|
||||
object is returned, instead of an array. Indirectly, that means
|
||||
that you can only access the data by the field names, and not by
|
||||
their offsets (numbers are illegal property names).
|
||||
properties that correspond to the fetched row's field names. It can optionally
|
||||
instantiate an object of a specific class, and pass parameters to that
|
||||
class's constructor.
|
||||
</para>
|
||||
&database.fetch-null;
|
||||
<para>
|
||||
<parameter>row</parameter> is row (record) number to be
|
||||
retrieved. First row is 0.
|
||||
</para>
|
||||
<para>
|
||||
Speed-wise, the function is identical to
|
||||
<function>pg_fetch_array</function>, and almost as quick as
|
||||
<function>pg_fetch_array</function>, and almost as fast as
|
||||
<function>pg_fetch_row</function> (the difference is
|
||||
insignificant).
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
From 4.3.0, <parameter>result_type</parameter> is default to PGSQL_ASSOC while
|
||||
older versions' default was PGSQL_BOTH. There is no use for numeric property,
|
||||
since numeric property name is invalid in PHP.
|
||||
</para>
|
||||
<para>
|
||||
<parameter>result_type</parameter> may be deleted in future versions.
|
||||
<parameter>row</parameter> became optional in PHP 4.1.0.
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>
|
||||
From 4.1.0, <parameter>row</parameter> became optional.
|
||||
Calling <function>pg_fetch_object</function> will increment
|
||||
the internal row counter counter by one.
|
||||
<parameter>result_type</parameter> default changed from <constant>PGSQL_BOTH</constant>
|
||||
to <constant>PGSQL_ASSOC</constant> from PHP 4.3.0, since the numeric index was
|
||||
illegal.
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>
|
||||
<parameter>class_name</parameter> and <parameter>params</parameter> were
|
||||
added in PHP 5.0. The old form with <parameter>result_type</parameter>
|
||||
still exists for backwards compatibility.
|
||||
</para>
|
||||
</note>
|
||||
</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>row</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Row number in result to fetch. Rows are numbered from 0 upwards. If omitted,
|
||||
next row is fetched.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>result_type</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Ignored and deprecated. Defaults to <constant>PGSQL_ASSOC</constant>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>class_name</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The name of the class to instantiate, set the properties of and return.
|
||||
If not specified, an unnamed object is returned.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>params</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
An optional <type>array</type> of parameters to pass to the constructor
|
||||
for <parameter>class_name</parameter> objects.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
An <type>object</type> with one attribute for each field
|
||||
name in the result. Database <literal>NULL</literal>
|
||||
values are returned as &null;.
|
||||
</para>
|
||||
<para>
|
||||
&false; is returned if <parameter>row</parameter> exceeds the number
|
||||
of rows in the set, there are no more rows, or on any other error.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<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-fetch-result">
|
||||
<refnamediv>
|
||||
|
@ -21,29 +21,106 @@
|
|||
<methodparam><type>mixed</type><parameter>field</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_fetch_result</function> returns values from a
|
||||
<parameter>result</parameter> resource returned by
|
||||
<function>pg_query</function>. <parameter>row</parameter>
|
||||
is integer. <parameter>field</parameter> is field name (string)
|
||||
or field index (integer). The <parameter>row</parameter>
|
||||
and <parameter>field</parameter> specify what cell in the table
|
||||
of results to return. Row numbering starts from 0. Instead of
|
||||
naming the field, you may use the field index as an unquoted
|
||||
number. Field indices start from 0.
|
||||
<function>pg_fetch_result</function> returns the value of a particular
|
||||
row and field (column) in a PostgreSQL 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>row</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Row number in result to fetch. Rows are numbered from 0 upwards. If omitted,
|
||||
next row is fetched.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>field</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
A <type>string</type> representing the name of the field (column) to fetch, otherwise
|
||||
and <type>int</type> representing the field number to fetch. Fields are
|
||||
numbered from 0 upwards.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
PostgreSQL has many built in types and only the basic ones are
|
||||
directly supported here. All forms of <type>integer</type> <!--
|
||||
directly supported here. All forms of integer database <!--
|
||||
FIXME: is that still true? PHP supports boolean&null now... -->
|
||||
<!-- Yes, supporting boolean&null breaks
|
||||
scripts. pg_fetch_array() can be used instead. I might take of
|
||||
this issue with additional ini directive. yohgaki@php.net -->
|
||||
types are returned as <type>integer</type> values. All forms of
|
||||
float, and real types are returned as <type>float</type> values.
|
||||
float and real types are returned as <type>float</type> values.
|
||||
Boolean is returned as "t" or "f". All
|
||||
other types, including arrays are returned as strings formatted
|
||||
in the same default PostgreSQL manner that you would see in the
|
||||
<command>psql</command> program.
|
||||
<command>psql</command> program. Database <literal>NULL</literal>
|
||||
values are returned as &null;.
|
||||
</para>
|
||||
<para>
|
||||
&false; is returned if <parameter>row</parameter> exceeds the number
|
||||
of rows in the set, or on any other error.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>pg_fetch_result</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$db = pg_connect("dbname=users user=me") || die();
|
||||
|
||||
$res = pg_query($db, "SELECT 1 UNION ALL SELECT 2");
|
||||
|
||||
$val = pg_fetch_result($res, 1, 0);
|
||||
|
||||
echo "First field in the second row is: ", $val, "\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
First field in the second row is: 2
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>pg_query</function></member>
|
||||
<member><function>pg_fetch_array</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.pg-fetch-row">
|
||||
<refnamediv>
|
||||
|
@ -17,24 +17,56 @@
|
|||
<para>
|
||||
<function>pg_fetch_row</function> fetches one row of data from
|
||||
the result associated with the specified
|
||||
<parameter>result</parameter> resource. The row (record) is
|
||||
returned as an array. Each result column is stored in an array
|
||||
offset, starting at offset 0.
|
||||
</para>
|
||||
<para>
|
||||
It returns an array that corresponds to the fetched row, or &false;
|
||||
if there are no more rows.
|
||||
<parameter>result</parameter> resource.
|
||||
</para>
|
||||
&database.fetch-null;
|
||||
<note>
|
||||
<para>
|
||||
From 4.1.0, <parameter>row</parameter> became optional.
|
||||
Calling <function>pg_fetch_row</function> will increment
|
||||
the internal row counter by one.
|
||||
From PHP 4.1.0, <parameter>row</parameter> became optional.
|
||||
</para>
|
||||
</note>
|
||||
</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>row</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Row number in result to fetch. Rows are numbered from 0 upwards. If omitted,
|
||||
next row is fetched.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
An <type>array</type>, indexed from 0 upwards, with each value
|
||||
represented as a <type>string</type>. Database <literal>NULL</literal>
|
||||
values are returned as &null;.
|
||||
</para>
|
||||
<para>
|
||||
&false; is returned if <parameter>row</parameter> exceeds the number
|
||||
of rows in the set, there are no more rows, or on any other error.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
|
|
|
@ -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.2 -->
|
||||
<refentry id='function.pg-lo-seek'>
|
||||
<refnamediv>
|
||||
|
@ -19,8 +19,8 @@
|
|||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_lo_seek</function> seeks position of large object
|
||||
resource. <parameter>whence</parameter> is PGSQL_SEEK_SET,
|
||||
PGSQL_SEEK_CUR or PGSQL_SEEK_END.
|
||||
resource. <parameter>whence</parameter> is <constant>PGSQL_SEEK_SET</constant>,
|
||||
<constant>PGSQL_SEEK_CUR</constant> or <constant>PGSQL_SEEK_END</constant>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.58 -->
|
||||
<refentry id='function.pg-result-error-field'>
|
||||
<refnamediv>
|
||||
|
@ -25,6 +25,11 @@
|
|||
you must use <function>pg_send_query</function> and
|
||||
<function>pg_get_result</function> to get the result handle.
|
||||
</para>
|
||||
<para>
|
||||
If you need to get additional error information from failed <function>pg_query</function> queries,
|
||||
use <function>pg_set_error_verbosity</function> and <function>pg_last_error</function>
|
||||
and then parse the result.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
|
@ -44,15 +49,15 @@
|
|||
<term><parameter>fieldcode</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Possible <parameter>fieldcode</parameter> values are: <literal>PGSQL_DIAG_SEVERITY</literal>,
|
||||
<literal>PGSQL_DIAG_SQLSTATE</literal>, <literal>PGSQL_DIAG_MESSAGE_PRIMARY</literal>,
|
||||
<literal>PGSQL_DIAG_MESSAGE_DETAIL</literal>,
|
||||
<literal>PGSQL_DIAG_MESSAGE_HINT</literal>, <literal>PGSQL_DIAG_STATEMENT_POSITION</literal>,
|
||||
<literal>PGSQL_DIAG_INTERNAL_POSITION</literal> (PostgreSQL 8.0+ only),
|
||||
<literal>PGSQL_DIAG_INTERNAL_QUERY</literal> (PostgreSQL 8.0+ only),
|
||||
<literal>PGSQL_DIAG_CONTEXT</literal>, <literal>PGSQL_DIAG_SOURCE_FILE</literal>,
|
||||
<literal>PGSQL_DIAG_SOURCE_LINE</literal> or
|
||||
<literal>PGSQL_DIAG_SOURCE_FUNCTION</literal>.
|
||||
Possible <parameter>fieldcode</parameter> values are: <constant>PGSQL_DIAG_SEVERITY</constant>,
|
||||
<constant>PGSQL_DIAG_SQLSTATE</constant>, <constant>PGSQL_DIAG_MESSAGE_PRIMARY</constant>,
|
||||
<constant>PGSQL_DIAG_MESSAGE_DETAIL</constant>,
|
||||
<constant>PGSQL_DIAG_MESSAGE_HINT</constant>, <constant>PGSQL_DIAG_STATEMENT_POSITION</constant>,
|
||||
<constant>PGSQL_DIAG_INTERNAL_POSITION</constant> (PostgreSQL 8.0+ only),
|
||||
<constant>PGSQL_DIAG_INTERNAL_QUERY</constant> (PostgreSQL 8.0+ only),
|
||||
<constant>PGSQL_DIAG_CONTEXT</constant>, <constant>PGSQL_DIAG_SOURCE_FILE</constant>,
|
||||
<constant>PGSQL_DIAG_SOURCE_LINE</constant> or
|
||||
<constant>PGSQL_DIAG_SOURCE_FUNCTION</constant>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
|
|
@ -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.58 -->
|
||||
<refentry id='function.pg-result-status'>
|
||||
<refnamediv>
|
||||
|
@ -19,19 +19,19 @@
|
|||
<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 <literal>PGSQL_STATUS_LONG</literal>
|
||||
or <literal>PGSQL_STATUS_STRING</literal>. The default is
|
||||
<literal>PGSQL_STATUS_LONG</literal>.
|
||||
of <parameter>type</parameter> are <constant>PGSQL_STATUS_LONG</constant>
|
||||
or <constant>PGSQL_STATUS_STRING</constant>. The default is
|
||||
<constant>PGSQL_STATUS_LONG</constant>.
|
||||
</para>
|
||||
<para>
|
||||
Possible return values are <literal>PGSQL_EMPTY_QUERY</literal>,
|
||||
<literal>PGSQL_COMMAND_OK</literal>, <literal>PGSQL_TUPLES_OK</literal>, <literal>PGSQL_COPY_TO</literal>,
|
||||
<literal>PGSQL_COPY_FROM</literal>, <literal>PGSQL_BAD_RESPONSE</literal>, <literal>PGSQL_NONFATAL_ERROR</literal> and
|
||||
<literal>PGSQL_FATAL_ERROR</literal> if <literal>PGSQL_STATUS_LONG</literal> is
|
||||
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 <literal>PGSQL_STATUS_STRING</literal> is used, then the returned
|
||||
When <constant>PGSQL_STATUS_STRING</constant> is used, then the returned
|
||||
value is the command completion tag from PostgreSQL.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.16 -->
|
||||
<refentry id="function.pg-set-error-verbosity">
|
||||
<refnamediv>
|
||||
|
@ -27,10 +27,10 @@
|
|||
</para>
|
||||
<para>
|
||||
<function>pg_set_error_verbosity</function> sets the verbosity mode, returning the connection's previous
|
||||
setting. In <literal>TERSE</literal> mode, returned messages include severity, primary text, and
|
||||
position only; this will normally fit on a single line. The default mode
|
||||
setting. In <constant>PGSQL_ERRORS_TERSE</constant> mode, returned messages include severity, primary text, and
|
||||
position only; this will normally fit on a single line. The default mode (<constant>PGSQL_ERRORS_DEFAULT</constant>)
|
||||
produces messages that include the above plus any detail, hint, or context
|
||||
fields (these may span multiple lines). The <literal>VERBOSE</literal> mode includes all available
|
||||
fields (these may span multiple lines). The <constant>PGSQL_ERRORS_VERBOSE</constant> mode includes all available
|
||||
fields. Changing the verbosity does not affect the messages available from
|
||||
already-existing result objects, only subsequently-created ones.
|
||||
</para>
|
||||
|
@ -55,9 +55,9 @@
|
|||
<term><parameter>verbosity</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The required verbosity: <literal>PGSQL_ERRORS_TERSE</literal>,
|
||||
<literal>PGSQL_ERRORS_DEFAULT</literal>
|
||||
or <literal>PGSQL_ERRORS_VERBOSE</literal>.
|
||||
The required verbosity: <constant>PGSQL_ERRORS_TERSE</constant>,
|
||||
<constant>PGSQL_ERRORS_DEFAULT</constant>
|
||||
or <constant>PGSQL_ERRORS_VERBOSE</constant>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -68,9 +68,9 @@
|
|||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
The previous verbosity level: <literal>PGSQL_ERRORS_TERSE</literal>,
|
||||
<literal>PGSQL_ERRORS_DEFAULT</literal>
|
||||
or <literal>PGSQL_ERRORS_VERBOSE</literal>.
|
||||
The previous verbosity level: <constant>PGSQL_ERRORS_TERSE</constant>,
|
||||
<constant>PGSQL_ERRORS_DEFAULT</constant>
|
||||
or <constant>PGSQL_ERRORS_VERBOSE</constant>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
|
|
@ -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.82 -->
|
||||
<refentry id='function.pg_transaction_status'>
|
||||
<refnamediv>
|
||||
|
@ -44,12 +44,12 @@
|
|||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>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
|
||||
<para>The status can be <constant>PGSQL_TRANSACTION_IDLE</constant> (currently idle),
|
||||
<constant>PGSQL_TRANSACTION_ACTIVE</constant> (a command is in progress),
|
||||
<constant>PGSQL_TRANSACTION_INTRANS</constant> (idle, in a valid transaction block),
|
||||
or <constant>PGSQL_TRANSACTION_INERROR</constant> (idle, in a failed transaction block).
|
||||
<constant>PGSQL_TRANSACTION_UNKNOWN</constant> is reported if the connection is bad.
|
||||
<constant>PGSQL_TRANSACTION_ACTIVE</constant> is reported only when a query
|
||||
has been sent to the server and not yet completed.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
|
Loading…
Reference in a new issue