conni           Tue Jul 15 18:36:03 2003 EDT

  Modified files:              
    /phpdoc/en/reference/pgsql/functions        pg-field-type.xml 
                                                pg-meta-data.xml 
                                                pg-field-size.xml 
                                                pg-send-query.xml 
                                                pg-connection-busy.xml 
                                                pg-field-is-null.xml 
                                                pg-field-name.xml 
                                                pg-field-num.xml 
                                                pg-field-prtlen.xml 
                                                pg-connection-status.xml 
  Log:
  minor fixes, some examples added
  
Index: phpdoc/en/reference/pgsql/functions/pg-field-type.xml
diff -u phpdoc/en/reference/pgsql/functions/pg-field-type.xml:1.4 
phpdoc/en/reference/pgsql/functions/pg-field-type.xml:1.5
--- phpdoc/en/reference/pgsql/functions/pg-field-type.xml:1.4   Sun Mar  2 20:43:31 
2003
+++ phpdoc/en/reference/pgsql/functions/pg-field-type.xml       Tue Jul 15 18:36:03 
2003
@@ -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.52 -->
   <refentry id="function.pg-field-type">
    <refnamediv>
@@ -20,6 +20,9 @@
      type name of the given <parameter>field_number</parameter> in the
      given PostgreSQL <parameter>result</parameter> resource.  Field
      numbering starts at 0.
+    </para>
+    <para>
+     See the example given at the <function>pg_field_name</function> page.
     </para>
     <note>
      <para>
Index: phpdoc/en/reference/pgsql/functions/pg-meta-data.xml
diff -u phpdoc/en/reference/pgsql/functions/pg-meta-data.xml:1.1 
phpdoc/en/reference/pgsql/functions/pg-meta-data.xml:1.2
--- phpdoc/en/reference/pgsql/functions/pg-meta-data.xml:1.1    Tue Oct  1 22:24:16 
2002
+++ phpdoc/en/reference/pgsql/functions/pg-meta-data.xml        Tue Jul 15 18:36:03 
2003
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
 <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.80 -->
   <refentry id='function.pg-meta-data'>
    <refnamediv>
@@ -20,6 +20,74 @@
      <literal>table_name</literal> as array. If there is error, it
      returns &false;
     </para>
+    <para>
+     <example>
+      <title>Getting table metadata</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+    $dbconn = pg_connect("dbname=publisher") or die ("Could not connect");
+
+    $meta = pg_meta_data($dbconn,'authors');
+    if (is_array ($meta)) {
+        echo '<pre>';
+        var_dump ($meta);
+        echo '</pre>';
+    }
+?>
+]]>
+      </programlisting>
+      <para>
+       The above example would produce the following output:
+      </para>
+      <screen>
+<![CDATA[
+array(3) {
+  ["author"]=>
+  array(5) {
+    ["num"]=>
+    int(1)
+    ["type"]=>
+    string(7) "varchar"
+    ["len"]=>
+    int(-1)
+    ["not null"]=>
+    bool(false)
+    ["has default"]=>
+    bool(false)
+  }
+  ["year"]=>
+  array(5) {
+    ["num"]=>
+    int(2)
+    ["type"]=>
+    string(4) "int2"
+    ["len"]=>
+    int(2)
+    ["not null"]=>
+    bool(false)
+    ["has default"]=>
+    bool(false)
+  }
+  ["title"]=>
+  array(5) {
+    ["num"]=>
+    int(3)
+    ["type"]=>
+    string(7) "varchar"
+    ["len"]=>
+    int(-1)
+    ["not null"]=>
+    bool(false)
+    ["has default"]=>
+    bool(false)
+  }
+}
+]]>
+      </screen>
+     </example> 
+    </para>
+
     <note>
      <para>
       This function is experimental.
Index: phpdoc/en/reference/pgsql/functions/pg-field-size.xml
diff -u phpdoc/en/reference/pgsql/functions/pg-field-size.xml:1.3 
phpdoc/en/reference/pgsql/functions/pg-field-size.xml:1.4
--- phpdoc/en/reference/pgsql/functions/pg-field-size.xml:1.3   Sat Aug 24 01:19:27 
2002
+++ phpdoc/en/reference/pgsql/functions/pg-field-size.xml       Tue Jul 15 18:36:03 
2003
@@ -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-field-size">
    <refnamediv>
@@ -21,6 +21,9 @@
      <parameter>result</parameter>. Field numbering starts at 0. A
      field size of -1 indicates a variable length field. This function
      will return &false; on error.
+    </para>
+    <para>
+     See the example given at the <function>pg_field_name</function> page.
     </para>
     <note>
      <para>
Index: phpdoc/en/reference/pgsql/functions/pg-send-query.xml
diff -u phpdoc/en/reference/pgsql/functions/pg-send-query.xml:1.3 
phpdoc/en/reference/pgsql/functions/pg-send-query.xml:1.4
--- phpdoc/en/reference/pgsql/functions/pg-send-query.xml:1.3   Thu Aug 22 08:26:11 
2002
+++ phpdoc/en/reference/pgsql/functions/pg-send-query.xml       Tue Jul 15 18:36:03 
2003
@@ -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'>
    <refnamediv>
@@ -27,7 +27,7 @@
      <function>pg_get_result</function>. Script execution is not blocked
      while query is executing. Use
      <function>pg_connection_busy</function> to check connection is
-     busy (i.e. query is executing). Query may be canceled by calling
+     busy (i.e. query is executing). Query may be cancelled by calling
      <function>pg_cancel_query</function>.
     </para>
     <para>
@@ -35,6 +35,43 @@
      multiple query over busy connection. If query is sent while
      connection is busy, it waits until last query is finished and
      discards all result.
+    </para>
+    <para>
+     <example>
+      <title>Asynchronous Queries</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.'<br>';
+    $rows1 = pg_num_rows($res1);
+    echo $res1.' has '.$rows1.' records<br><br>';
+
+    $res2 = pg_get_result($dbconn);
+    echo 'second call to pg_get_result(): '.$res2.'<br>';
+    $rows2 = pg_num_rows($res2);
+    echo $res2.' has '.$rows2.' records<br>';
+?>
+]]>
+      </programlisting>
+      <para>
+       The above example would produce the following output:
+      </para>
+      <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>
     <para>
      See also <function>pg_query</function>,
Index: phpdoc/en/reference/pgsql/functions/pg-connection-busy.xml
diff -u phpdoc/en/reference/pgsql/functions/pg-connection-busy.xml:1.3 
phpdoc/en/reference/pgsql/functions/pg-connection-busy.xml:1.4
--- phpdoc/en/reference/pgsql/functions/pg-connection-busy.xml:1.3      Tue Apr 23 
20:18:22 2002
+++ phpdoc/en/reference/pgsql/functions/pg-connection-busy.xml  Tue Jul 15 18:36:03 
2003
@@ -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-connection-busy'>
    <refnamediv>
@@ -19,6 +19,28 @@
      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.
     </para>
+    <para>
+     <example>
+      <title>pg_connection_busy</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+    $dbconn = pg_connect("dbname=publisher") or die ("Could not connect");
+    $bs = pg_connection_busy($dbconn);
+    if ($bs) {
+        echo 'connection is busy';
+    }
+    else {
+       echo 'connection is not busy';
+    }
+?>
+]]>
+      </programlisting>
+     </example>
+    </para>
+
+
+
     <para>
      See also <function>pg_connection_status</function> and
      <function>pg_get_result</function>
Index: phpdoc/en/reference/pgsql/functions/pg-field-is-null.xml
diff -u phpdoc/en/reference/pgsql/functions/pg-field-is-null.xml:1.2 
phpdoc/en/reference/pgsql/functions/pg-field-is-null.xml:1.3
--- phpdoc/en/reference/pgsql/functions/pg-field-is-null.xml:1.2        Wed Apr 17 
02:43:19 2002
+++ phpdoc/en/reference/pgsql/functions/pg-field-is-null.xml    Tue Jul 15 18:36:03 
2003
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
 <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
   <refentry id="function.pg-field-is-null">
    <refnamediv>
@@ -15,12 +15,35 @@
       <methodparam><type>mixed</type><parameter>field</parameter></methodparam>
      </methodsynopsis>
     <para>
-     <function>pg_field_is_null</function> test if a field is &null; or
+     <function>pg_field_is_null</function> tests if a field is &null; or
      not. It returns 1 if the field in the given row is &null;. It
      returns 0 if the field in the given row is NOT &null;. Field can
      be specified as column index (number) or fieldname (string). Row
      numbering starts at 0.
     </para>
+    <para>
+     <example>
+      <title>pg_field_is_null</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+    $dbconn = pg_connect("dbname=publisher") or die ("Could not connect");
+    $res = pg_query($dbconn, "select * from authors where author = 'Orwell'");
+    if ($res) {
+        if (pg_field_is_null($res, 0, "year") == 1) {
+            echo 'The value of the field year is null.';
+        }
+        if (pg_field_is_null($res, 0, "year") == 0) {
+            echo 'The value of the field year is not null.';
+      }
+   }
+?>
+]]>
+      </programlisting>
+     </example>
+    </para>
+
+
     <note>
      <para>
       This function used to be called <literal>pg_fieldisnull()</literal>.
Index: phpdoc/en/reference/pgsql/functions/pg-field-name.xml
diff -u phpdoc/en/reference/pgsql/functions/pg-field-name.xml:1.2 
phpdoc/en/reference/pgsql/functions/pg-field-name.xml:1.3
--- phpdoc/en/reference/pgsql/functions/pg-field-name.xml:1.2   Wed Apr 17 02:43:19 
2002
+++ phpdoc/en/reference/pgsql/functions/pg-field-name.xml       Tue Jul 15 18:36:03 
2003
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
 <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
   <refentry id="function.pg-field-name">
    <refnamediv>
@@ -18,6 +18,53 @@
      occupying the given <parameter>field_number</parameter> in the
      given PostgreSQL <parameter>result</parameter> resource.  Field
      numbering starts from 0.
+    </para>
+    <para>
+     <example>
+      <title>Getting informations about fields</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+    $dbconn = pg_connect("dbname=publisher") or die ("Could not connect");
+
+    $res = pg_query($dbconn, "select * from authors where author = 'Orwell'");
+    $i = pg_num_fields($res);
+    for ($j = 0; $j < $i; $j++) {
+        echo "column $j\n";
+        $fieldname = pg_field_name($res, $j);
+        echo "fieldname: $fieldname\n";
+        echo "printed length: ".pg_field_prtlen($res, $fieldname)." characters\n";
+        echo "storage length: ".pg_field_size($res, $j)." bytes\n";
+        echo "field type: ".pg_field_type($res, $j)." \n\n";
+}
+?>
+]]>
+      </programlisting>
+      <para>
+       The above example would produce the following output:
+      </para>
+      <screen>
+<![CDATA[
+column 0
+fieldname: author
+printed length: 6 characters
+storage length: -1 bytes
+field type: varchar 
+
+column 1
+fieldname: year
+printed length: 4 characters
+storage length: 2 bytes
+field type: int2 
+
+column 2
+fieldname: title
+printed length: 24 characters
+storage length: -1 bytes
+field type: varchar 
+]]>
+      </screen>
+     </example> 
     </para>
     <note>
      <para>
Index: phpdoc/en/reference/pgsql/functions/pg-field-num.xml
diff -u phpdoc/en/reference/pgsql/functions/pg-field-num.xml:1.2 
phpdoc/en/reference/pgsql/functions/pg-field-num.xml:1.3
--- phpdoc/en/reference/pgsql/functions/pg-field-num.xml:1.2    Wed Apr 17 02:43:19 
2002
+++ phpdoc/en/reference/pgsql/functions/pg-field-num.xml        Tue Jul 15 18:36:03 
2003
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
 <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
   <refentry id="function.pg-field-num">
    <refnamediv>
@@ -18,7 +18,10 @@
      column (field) slot that corresponds to the
      <parameter>field_name</parameter> in the given PostgreSQL
      <parameter>result</parameter> resource.  Field numbering starts
-     at 0.  This function will return -1 on error.
+     at 0.  This function will return -1 on error. 
+    </para>
+    <para>
+     See the example given at the <function>pg_field_name</function> page.
     </para>
     <note>
      <para>
Index: phpdoc/en/reference/pgsql/functions/pg-field-prtlen.xml
diff -u phpdoc/en/reference/pgsql/functions/pg-field-prtlen.xml:1.2 
phpdoc/en/reference/pgsql/functions/pg-field-prtlen.xml:1.3
--- phpdoc/en/reference/pgsql/functions/pg-field-prtlen.xml:1.2 Wed Apr 17 02:43:19 
2002
+++ phpdoc/en/reference/pgsql/functions/pg-field-prtlen.xml     Tue Jul 15 18:36:03 
2003
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
 <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
   <refentry id="function.pg-field-prtlen">
    <refnamediv>
@@ -20,9 +20,12 @@
      <parameter>result</parameter>.  Row numbering starts at 0.  This
      function will return -1 on an error.
     </para>
+    <para>
+     See the example given at the <function>pg_field_name</function> page.
+    </para>
     <note>
      <para>
-      This function used to be called <literal>pg_field_prtlen()</literal>.
+      This function used to be called <literal>pg_fieldprtlen()</literal>.
      </para>
     </note>
     <para>
Index: phpdoc/en/reference/pgsql/functions/pg-connection-status.xml
diff -u phpdoc/en/reference/pgsql/functions/pg-connection-status.xml:1.2 
phpdoc/en/reference/pgsql/functions/pg-connection-status.xml:1.3
--- phpdoc/en/reference/pgsql/functions/pg-connection-status.xml:1.2    Wed Apr 17 
02:43:17 2002
+++ phpdoc/en/reference/pgsql/functions/pg-connection-status.xml        Tue Jul 15 
18:36:03 2003
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
 <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
   <refentry id='function.pg-connection-status'>
    <refnamediv>
@@ -19,6 +19,23 @@
      status. Possible statuses are <literal>PGSQL_CONNECTION_OK</literal>
      and <literal>PGSQL_CONNECTION_BAD</literal>.
     </para>
+    <para>
+     <example>
+      <title>pg_connection_status</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+    $dbconn = pg_connect("dbname=publisher") or die ("Could not connect");
+    $stat = pg_connection_status($dbconn);
+    echo 'connection_status: '.$stat;
+?>
+]]>
+      </programlisting>
+     </example>
+    </para>
+
+
+
     <para>
      See also <function>pg_connection_busy</function>.
     </para>

-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to