Re: PHP and Cursors?
| From: | Manuel Lemos | Date: | Wed, 10 May 2000 06:51:24 +0000 |
| Subject: | Re: PHP and Cursors? | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-14714@lists.php.net to get a copy of this message | ||
Hello Andrew,
On 05-May-00 17:41:14, you wrote:
>What is the state of PHP's support for scrollable cursors?
You mean server side or client side?
>How do I declare a cursor and set a position within that cursor?
That's DBMS dependent. Some DBMS do not client side cursors and many DBMS
don't support server side cursors at all.
For the client side, some DBMS API just require the number of row you want
others require that you fetch one row at a time sequencially.
For the server side, some databases let you specify a range of the a SELECT
query result rows. In others you jump to a specific row and start
retrieving data from that result row.
Since all this is very DBMS dependent, that was one the things that I
decided to normalize when I developed my PHP database abstraction package -
Metabase.
For the client side, you can always request data from result rows by
specifying the respective row number.
For DBMS API that fetch one row at a time, row data is cached by the DBMS
driver class. There is a function to tell if you the last row that was
retrieved was the last in the result set.
For server side, Metabase provides one function that lets you do what is
typical for web scripts: request a range of result rows starting from a
giving number and have up to given limit or rows.
The range has to be specified before executing a query, being either a
direct query or a prepared query. The returned result set is restricted to
the specified range of rows.
For DBMS that do not support server side cursors, the drivers just execute
the normal query and emulate the result set as if it was restricted to the
specified range of rows.
Go to Metabase page and read the supplied documentation if you want to
know more about it:
http://phpclasses.UpperDesign.com/browse.html/package/20
Regards,
Manuel Lemos
Web Programming Components using PHP Classes.
Look at: http://phpclasses.UpperDesign.com/?user=mlemos@acm.org
--
E-mail: mlemos@acm.org
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--