numRows(), out of order row fetching and stuff?
| From: | Lukas Smith | Date: | Mon, 21 Jul 2003 13:27:12 +0000 |
| Subject: | numRows(), out of order row fetching and stuff? | ||
| Groups: | php.pear.dev php.pear.general | ||
| Request: | Send a blank email to pear-dev+get-18485@lists.php.net to get a copy of this message | ||
Hi,
as some of you may know I am working on the next version of MDB.
I am also involved in a working group that wants to integrate DB
abstraction more closely with the core of PHP.
As such I am wondering about the following:
MDB is currently jumping through a lot of hoops to offer stuff like
numRows(), and being able to fetch rows out of order.
Some background:
Backends like Oracle don't actually build up the entire result set
before they start to send data back to the client. This is important
especially with large result sets as otherwise the client has to wait
until the entire data is accumulated before doing any processing.
So why would you do something else?
1) If you want to know the number of rows in the result set before you
do any processing.
2) Or you want to fetch the rows out of order
3) Or you want to "cheaply" (not as in fast but as in easy to implement)
emulate LIMIT support
Then you might want to do something that mysql does in the mysql_query
function: buffer the result data
However since this is not implemented by most backends MDB has to buffer
the data itself. This kills performance and moreover makes the driver
overly complex.
I would love to drop this.
People that want to do 1) and 2) should just fetch the entire result set
using fetchAll() and the likes and then do what they want with it.
Especially since most people "misuse" numRows() instead of simply
checking if the result set is empty to find out if the result set was
empty :-)
3) is a critical feature however. So this feature needs to stay, and we
simply need to find cooler ways of implementing this.
So what are people thoughts on this?
Is it ok to drop numRows()?
Is it ok to drop the ability to specify the row number you want to fetch
in fetchInto and fetchRow?
Regards,
Lukas Smith
smith@backendmedia.com
_______________________________
BackendMedia
www.backendmedia.com
berlin@backendmedia.com
Linn Zwoch Smith GbR
Pariser Str. 44
D-10707 Berlin
Tel +49 30 83 22 50 00
Fax +49 30 83 22 50 07