[prev in list] [next in list] [prev in thread] [next in thread]
List: php-internals
Subject: [PHP-DEV] CVS update: php3/doc/functions
From: eschmid <php-dev () php ! iquest ! net>
Date: 1998-06-28 21:15:36
[Download RAW message or body]
Date: Sunday June 28, 1998 @ 17:15
Author: eschmid
Update of /repository/php3/doc/functions
In directory asf:/tmp/cvs-serv28555/functions
Modified Files:
pgsql.sgml
Log Message:
Recently added pgsql functions documented. Zeev can you provide an example for the object features?
Index: php3/doc/functions/pgsql.sgml
diff -c php3/doc/functions/pgsql.sgml:1.20 php3/doc/functions/pgsql.sgml:1.21
*** php3/doc/functions/pgsql.sgml:1.20 Thu Jun 25 13:37:57 1998
--- php3/doc/functions/pgsql.sgml Sun Jun 28 17:15:35 1998
***************
*** 235,240 ****
--- 235,388 ----
</refsect1>
</refentry>
+ <refentry id="function.pg-fetch-array">
+ <refnamediv>
+ <refname>pg_fetch_array</refname>
+ <refpurpose>fetch row as array</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Description</title>
+ <funcsynopsis>
+ <funcdef>array <function>pg_fetch_array</function></funcdef>
+ <paramdef>int <parameter>result</parameter></paramdef>
+ <paramdef>mixed <parameter>field</parameter></paramdef>
+ </funcsynopsis>
+ <para>
+ Returns: An array that corresponds to the fetched row, or false
+ if there are no more rows.
+ <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 of the result array, it also stores
+ the data in associative indices, using the field names as keys.
+ <para>
+ An important thing to note is that using
+ <function>pg_fetch_array</function> is NOT significantly
+ slower than using <function>pg_fetch_row</function>, while it
+ provides a significant added value.
+ <para>
+ For further details, also see
+ <function>pg_fetch_row</function>
+ </para>
+ <example>
+ <title>PostgreSQL fetch array</title>
+ <programlisting role=php>
+ <?php
+ $conn = pg_pconnect("","","","","publisher");
+ if (!$conn) {
+ echo "An error occured.\n";
+ exit;
+ }
+
+ $result = pg_Exec ($conn, "SELECT * FROM authors");
+ if (!$result) {
+ echo "An error occured.\n";
+ exit;
+ }
+
+ $arr = pg_fetch_array ($result, 0);
+ echo $arr[0] . " <- array\n";
+
+ $arr = pg_fetch_array ($result, 1);
+ echo $arr["author"] . " <- array\n";
+ ?>
+ </programlisting>
+ </example>
+
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.pg-fetch-object">
+ <refnamediv>
+ <refname>pg_fetch_object</refname>
+ <refpurpose>fetch row as object</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Description</title>
+ <funcsynopsis>
+ <funcdef>object <function>pg_fetch_object</function></funcdef>
+ <paramdef>int <parameter>result</parameter></paramdef>
+ <paramdef>mixed <parameter>field</parameter></paramdef>
+ </funcsynopsis>
+ <para>
+ Returns: An object with properties that correspond to the fetched
+ row, or false if there are no more rows.
+ <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).
+ <para>
+ Speed-wise, the function is identical to
+ <function>pg_fetch_array</function>, and almost as quick as
+ <function>pg_fetch_row</function> (the difference is
+ insignificant).
+ <para> See also: <function>pg_fetch_array</function> and
+ <function>pg_fetch_row</function>.
+ </refsect1>
+ </refentry>
+
+ <refentry id="function.pg-fetch-row">
+ <refnamediv>
+ <refname>pg_fetch_row</refname>
+ <refpurpose>get row as enumerated array</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Description</title>
+ <funcsynopsis>
+ <funcdef>array <function>pg_fetch_row</function></funcdef>
+ <paramdef>int <parameter>result</parameter></paramdef>
+ <paramdef>int <parameter>field</parameter></paramdef>
+ </funcsynopsis>
+ <para>
+ Returns: An array that corresponds to the fetched row, or false
+ if there are no more rows.
+ <para>
+ <function>pg_fetch_row</function> fetches one row of data from
+ the result associated with the specified result identifier. The
+ row is returned as an array. Each result column is stored in an
+ array offset, starting at offset 0.
+ <para>
+ Subsequent call to <function>pg_fetch_row</function> would
+ return the next row in the result set, or false if there are no
+ more rows.
+ <para>
+ See also: <function>pg_fetch_array</function>,
+ <function>pg_fetch_object</function>,
+ <function>pg_result</function>.
+
+ <example>
+ <title>Postgres fetch row</title>
+ <programlisting role=php>
+ <?php
+ $conn = pg_pconnect("","","","","publisher");
+ if (!$conn) {
+ echo "An error occured.\n";
+ exit;
+ }
+
+ $result = pg_Exec ($conn, "SELECT * FROM authors");
+ if (!$result) {
+ echo "An error occured.\n";
+ exit;
+ }
+
+ $row = pg_fetch_row ($result, 0);
+ echo $row[0] . " <- row\n";
+
+ $row = pg_fetch_row ($result, 1);
+ echo $row[0] . " <- row\n";
+
+ $row = pg_fetch_row ($result, 2);
+ echo $row[1] . " <- row\n";
+ ?>
+ </programlisting>
+ </example>
+
+ </refsect1>
+ </refentry>
+
<refentry id="function.pg-fieldisnull">
<refnamediv>
<refname>pg_FieldIsNull</refname>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic