From 1abfde6192a49a818c3febfca29428436e42598b Mon Sep 17 00:00:00 2001 From: Marc Boeren Date: Fri, 5 Sep 2003 09:19:15 +0000 Subject: [PATCH] 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! git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@139654 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/dbx/constants.xml | 13 +++- reference/dbx/functions/dbx-fetch-row.xml | 80 +++++++++++++++++++++++ reference/dbx/functions/dbx-query.xml | 48 ++++++++++++-- reference/dbx/reference.xml | 6 +- 4 files changed, 137 insertions(+), 10 deletions(-) create mode 100644 reference/dbx/functions/dbx-fetch-row.xml diff --git a/reference/dbx/constants.xml b/reference/dbx/constants.xml index 8f6f5cc27a..72cb18ef72 100644 --- a/reference/dbx/constants.xml +++ b/reference/dbx/constants.xml @@ -1,5 +1,5 @@ - +
&reftitle.constants; &extension.constants; @@ -136,6 +136,17 @@ + + + DBX_RESULT_UNBUFFERED + (integer) (CVS only) + + + + + + + DBX_COLNAMES_UNCHANGED diff --git a/reference/dbx/functions/dbx-fetch-row.xml b/reference/dbx/functions/dbx-fetch-row.xml new file mode 100644 index 0000000000..f4d56eac1c --- /dev/null +++ b/reference/dbx/functions/dbx-fetch-row.xml @@ -0,0 +1,80 @@ + + + + + dbx_fetch_row + Fetches rows from a query-result that had the + DBX_RESULT_UNBUFFERED flag set + + + Description + + objectdbx_fetch_row + objectresult_identifier + + + dbx_fetch_row returns a row on success, and + 0 on failure (e.g. when no more rows are available). + When the DBX_RESULT_UNBUFFERED is not set in the + query, dbx_fetch_row will fail as all rows have + already been fetched into the results data property. + + + As a side effect, the rows property of the query-result + object is incremented for each successful call to + dbx_fetch_row. + + + How to handle the returned value + +\n"; +while ( $row = dbx_fetch_row($result) ) { + echo "\n"; + foreach ( $row as $field ) { + echo "$field"; + } + echo "\n"; +} +echo "\n"; +]]> + + + + The result_identifier parameter is the result + object returned by a call to dbx_query. + + + The returned array contains the same information as any row would have + in the dbx_query result data property, including + columns accessable by index or fieldname when the flags for dbx_guery + were set that way. + + + See also dbx_query. + + + + + diff --git a/reference/dbx/functions/dbx-query.xml b/reference/dbx/functions/dbx-query.xml index 32506d87da..1e601a0706 100644 --- a/reference/dbx/functions/dbx-query.xml +++ b/reference/dbx/functions/dbx-query.xml @@ -1,5 +1,5 @@ - + @@ -47,7 +47,6 @@ dbx_close($link); ]]> - The flags parameter is used to control the amount of information that is returned. It may be any combination of the following @@ -102,6 +101,24 @@ dbx_close($link); + + + DBX_RESULT_UNBUFFERED (CVS only) + + + + This flag will not create the data property, and + the rows property will initially be 0. Use this + flag for large datasets, and use dbx_fetch_row to + retrieve the results row by row. + + + The dbx_fetch_row function will return rows that + are conformant to the flags set with this query. Incidentally, it will + also update the rows each time it is called. + + + DBX_COLNAMES_UNCHANGED (available from PHP 4.3.0) @@ -137,7 +154,7 @@ dbx_close($link); Note that DBX_RESULT_INDEX is always used, regardless of the actual value of flags parameter. This means - that the following combinations is effective only: + that only the following combinations are effective: @@ -161,7 +178,7 @@ dbx_close($link); - The returing object has four or five + The returned object has four or five properties depending on flags: @@ -268,7 +285,25 @@ echo "\n"; ]]> - + + How to handle UNBUFFERED queries + +\n"; +while ( $row = dbx_fetch_row($result) ) { + echo "\n"; + foreach ( $row as $field ) { + echo "$field"; + } + echo "\n"; +} +echo "\n"; +]]> + + + @@ -282,7 +317,8 @@ echo "\n"; - See also dbx_escape_string and + See also dbx_escape_string, + dbx_fetch_row and dbx_connect. diff --git a/reference/dbx/reference.xml b/reference/dbx/reference.xml index c0c9dee2bb..5a020a467b 100644 --- a/reference/dbx/reference.xml +++ b/reference/dbx/reference.xml @@ -1,5 +1,5 @@ - +