dbs Wed Apr 20 18:18:43 2005 EDT
Modified files: /phpdoc/en/reference/ibm_db2/functions db2-num-fields.xml Log: First stab at db2_num_fields(). http://cvs.php.net/diff.php/phpdoc/en/reference/ibm_db2/functions/db2-num-fields.xml?r1=1.1&r2=1.2&ty=u Index: phpdoc/en/reference/ibm_db2/functions/db2-num-fields.xml diff -u phpdoc/en/reference/ibm_db2/functions/db2-num-fields.xml:1.1 phpdoc/en/reference/ibm_db2/functions/db2-num-fields.xml:1.2 --- phpdoc/en/reference/ibm_db2/functions/db2-num-fields.xml:1.1 Tue Apr 12 17:12:48 2005 +++ phpdoc/en/reference/ibm_db2/functions/db2-num-fields.xml Wed Apr 20 18:18:42 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. --> <refentry id="function.db2-num-fields"> <refnamediv> @@ -15,7 +15,14 @@ <methodparam><type>resource</type><parameter>stmt</parameter></methodparam> </methodsynopsis> - &warn.undocumented.func; + &warn.experimental.func; + + <para> + Returns the number of fields contained in a result set. This is most useful + for handling the result sets returned by dynamically generated queries, or + for result sets returned by stored procedures, where your application cannot + otherwise know how to retrieve and use the results. + </para> </refsect1> <refsect1 role="parameters"> @@ -24,102 +31,71 @@ <variablelist> <varlistentry> <term><parameter>stmt</parameter></term> - <listitem> - <para> - Its description - </para> - </listitem> - </varlistentry> + <listitem> + <para> + A valid statement resource containing a result set. + </para> + </listitem> + </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> - What the function returns, first on success, then on failure. See - also the &return.success; entity + Returns an integer value representing the number of fields in the result + set associated with the specified statement resource. Returns &false; if + the statement resource is not a valid input value. </para> </refsect1> - <!-- Use when EXCEPTIONS exist - <refsect1 role="exceptions"> - &reftitle.exceptions; - <para> - When does this function throw exceptions? - </para> - </refsect1> - --> - - - <!-- Use when a CHANGELOG exists - <refsect1 role="changelog"> - &reftitle.changelog; - <para> - <informaltable> - <tgroup cols="2"> - <thead> - <row> - <entry>&Version;</entry> - <entry>&Description</entry> - </row> - </thead> - <tbody> - <row> - <entry>Enter the PHP version of change here - <entry>Description of change - </row> - </tbody> - </tgroup> - </informaltable> - </para> - </refsect1> - --> - - - <!-- Use when examples exist <refsect1 role="examples"> &reftitle.examples; <para> <example> - <title>A <function>db2_num_fields</function> example</title> + <title>Retrieving the number of fields in a result set</title> <para> - Any text that describes the purpose of the example, or - what goes on in the example should go here (inside the - <example> tag, not out + The following example demonstrates how to retrieve the number of fields + returned in a result set. </para> <programlisting role="php"> <![CDATA[ <?php -if ($anexample === true) { - echo 'Use the PEAR Coding Standards'; -} + +$sql = "SELECT id, name, breed, weight FROM animals ORDER BY breed"; +$stmt = db2_prepare($conn, $sql); +$result = db2_execute($stmt, $sql); +$columns = db2_num_fields($result); + +echo "There are {$columns} columns in the result set."; ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ -Use the PEAR Coding Standards +There are 4 columns in the result set. ]]> </screen> </example> </para> </refsect1> - --> - - <!-- Use when adding See Also links <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> - <member><function></function></member> - <member>Or <link linkend="somethingelse">something else</link></member> + <member><function>db2_execute</function></member> + <member><function>db2_field_display_size</function></member> + <member><function>db2_field_name</function></member> + <member><function>db2_field_num</function></member> + <member><function>db2_field_precision</function></member> + <member><function>db2_field_scale</function></member> + <member><function>db2_field_type</function></member> + <member><function>db2_field_width</function></member> </simplelist> </para> </refsect1> - --> - </refentry>