mboeren Fri Sep 5 05:19:15 2003 EDT Added files: /phpdoc/en/reference/dbx/functions dbx-fetch-row.xml
Modified files: /phpdoc/en/reference/dbx constants.xml reference.xml /phpdoc/en/reference/dbx/functions dbx-query.xml Log: Added documentation for the new DBX_RESULT_UNBUFFERED flag and the new dbx_fetch_row function. # untested xml-files, if someone with a working setup could test them # please? Thanks!
Index: phpdoc/en/reference/dbx/constants.xml diff -u phpdoc/en/reference/dbx/constants.xml:1.7 phpdoc/en/reference/dbx/constants.xml:1.8 --- phpdoc/en/reference/dbx/constants.xml:1.7 Wed Jul 9 12:40:04 2003 +++ phpdoc/en/reference/dbx/constants.xml Fri Sep 5 05:19:14 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <section id="constants.dbx"> &reftitle.constants; &extension.constants; @@ -129,6 +129,17 @@ <term> <constant>DBX_RESULT_ASSOC</constant> (<type>integer</type>) + </term> + <listitem> + <simpara> + + </simpara> + </listitem> + </varlistentry> + <varlistentry> + <term> + <constant>DBX_RESULT_UNBUFFERED</constant> + (<type>integer</type>) (CVS only) </term> <listitem> <simpara> Index: phpdoc/en/reference/dbx/reference.xml diff -u phpdoc/en/reference/dbx/reference.xml:1.12 phpdoc/en/reference/dbx/reference.xml:1.13 --- phpdoc/en/reference/dbx/reference.xml:1.12 Wed Jul 9 12:40:04 2003 +++ phpdoc/en/reference/dbx/reference.xml Fri Sep 5 05:19:14 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> +<!-- $Revision: 1.13 $ --> <!-- If anyone from the translator group has problems with the @@ -29,7 +29,7 @@ <para> To be able to use a database with the dbx-module, the module must be either linked or loaded into PHP, and the database module must be supported by the - dbx-module. Currently, following databases are supported, but others + dbx-module. Currently, the following databases are supported, but others will follow: <itemizedlist> <listitem> @@ -89,7 +89,7 @@ <para> There are two resource types used in the dbx module. The first one is the link-<type>object</type> for a database connection, the second a - result-<type>object</type> which helds the result of a query. + result-<type>object</type> which holds the result of a query. </para> </section> Index: phpdoc/en/reference/dbx/functions/dbx-query.xml diff -u phpdoc/en/reference/dbx/functions/dbx-query.xml:1.10 phpdoc/en/reference/dbx/functions/dbx-query.xml:1.11 --- phpdoc/en/reference/dbx/functions/dbx-query.xml:1.10 Sat Aug 16 14:59:11 2003 +++ phpdoc/en/reference/dbx/functions/dbx-query.xml Fri Sep 5 05:19:15 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> +<!-- $Revision: 1.11 $ --> <!-- splitted from ./en/functions/dbx.xml, last change in rev 1.3 --> <refentry id="function.dbx-query"> <refnamediv> @@ -47,7 +47,6 @@ ]]> </programlisting> </example> - <para> The <parameter>flags</parameter> parameter is used to control the amount of information that is returned. It may be any combination of the following @@ -104,6 +103,24 @@ </varlistentry> <varlistentry> <term> + <constant>DBX_RESULT_UNBUFFERED</constant> (CVS only) + </term> + <listitem> + <simpara> + This flag will not create the <property>data</property> property, and + the <property>rows</property> property will initially be 0. Use this + flag for large datasets, and use <function>dbx_fetch_row</function> to + retrieve the results row by row. + </simpara> + <simpara> + The <function>dbx_fetch_row</function> function will return rows that + are conformant to the flags set with this query. Incidentally, it will + also update the <property>rows</property> each time it is called. + </simpara> + </listitem> + </varlistentry> + <varlistentry> + <term> <constant>DBX_COLNAMES_UNCHANGED</constant> (available from PHP 4.3.0) </term> <listitem> @@ -137,7 +154,7 @@ </variablelist> Note that <constant>DBX_RESULT_INDEX</constant> is always used, regardless of the actual value of <parameter>flags</parameter> parameter. This means - that the following combinations is effective only: + that only the following combinations are effective: <itemizedlist> <listitem> <simpara> @@ -161,7 +178,7 @@ </itemizedlist> </para> <para> - The returing <varname>object</varname> has four or five + The returned <varname>object</varname> has four or five properties depending on <parameter>flags</parameter>: <variablelist> <varlistentry> @@ -268,7 +285,25 @@ ]]> </programlisting> </example> - </listitem> + <example> + <title>How to handle UNBUFFERED queries</title> + <programlisting role="php"> +<![CDATA[ +$result = dbx_query ($link, 'SELECT id, parentid, description FROM table', DBX_RESULT_UNBUFFERED); + +echo "<table>\n"; +while ( $row = dbx_fetch_row($result) ) { + echo "<tr>\n"; + foreach ( $row as $field ) { + echo "<td>$field</td>"; + } + echo "</tr>\n"; +} +echo "</table>\n"; +]]> + </programlisting> + </example> + </listitem> </varlistentry> </variablelist> </para> @@ -282,7 +317,8 @@ </para> </note> <para> - See also <function>dbx_escape_string</function> and + See also <function>dbx_escape_string</function>, + <function>dbx_fetch_row</function> and <function>dbx_connect</function>. </para> </refsect1> Index: phpdoc/en/reference/dbx/functions/dbx-fetch-row.xml +++ phpdoc/en/reference/dbx/functions/dbx-fetch-row.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.dbx-fetch-row"> <refnamediv> <refname>dbx_fetch_row</refname> <refpurpose>Fetches rows from a query-result that had the <constant>DBX_RESULT_UNBUFFERED</constant> flag set</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>object</type><methodname>dbx_fetch_row</methodname> <methodparam><type>object</type><parameter>result_identifier</parameter></methodparam> </methodsynopsis> <simpara> <function>dbx_fetch_row</function> returns a row on success, and <literal>0</literal> on failure (e.g. when no more rows are available). When the <constant>DBX_RESULT_UNBUFFERED</constant> is not set in the query, <function>dbx_fetch_row</function> will fail as all rows have already been fetched into the results <property>data</property> property. </simpara> <simpara> As a side effect, the <property>rows</property> property of the query-result object is incremented for each successful call to <function>dbx_fetch_row</function>. </simpara> <example> <title>How to handle the returned value</title> <programlisting role="php"> <![CDATA[ $result = dbx_query ($link, 'SELECT id, parentid, description FROM table', DBX_RESULT_UNBUFFERED); echo "<table>\n"; while ( $row = dbx_fetch_row($result) ) { echo "<tr>\n"; foreach ( $row as $field ) { echo "<td>$field</td>"; } echo "</tr>\n"; } echo "</table>\n"; ]]> </programlisting> </example> <para> The <parameter>result_identifier</parameter> parameter is the result object returned by a call to <function>dbx_query</function>. </para> <para> The returned array contains the same information as any row would have in the dbx_query result <property>data</property> property, including columns accessable by index or fieldname when the flags for dbx_guery were set that way. </para> <para> See also <function>dbx_query</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->