RE: [PEAR-DEV] PEAR::DB getAll feature request (limit from,count)
| From: | Lukas Smith | Date: | Thu, 27 Feb 2003 16:57:09 +0000 |
| Subject: | RE: [PEAR-DEV] PEAR::DB getAll feature request (limit from,count) | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-14001@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Yavor Shahpasov [mailto:yavo@siava.org]
> Sent: Thursday, February 27, 2003 5:57 PM
> To: pear-dev@lists.php.net
> Subject: [PEAR-DEV] PEAR::DB getAll feature request (limit from,count)
>
> What are the chanses of adding two extra parameters to getAll in DB,
> from and count, and if set use limitQuery instead of query (this would
> have to be added to DB_Common excute too though).
>
> Since we are talking about two new parameters this would not break BC
> but it would have to be implemented . plus it would probably be good
to
> be added to getCol and getAssoc too.
>
> It would be really usefull for me and am sure for others. If people
are
> too busy to implement this I would provide the patches (no some
backends
> atleast am thinking mysql/pgsql) assuming this feature gets approved.
>
> here is and example
> +getAll($query, $params = null, $fetchmode = DB_FETCHMODE_DEFAULT)
> -getAll($query, $params = null, $fetchmode = DB_FETCHMODE_DEFAULT,
> $from=null, $count=null)
Noooooo please don't!
MDB has a much cleaner method for this:
Before any method call that sends a query to the DB you can use the
setSelectedRowRange() method to set offset/limit.
This does away with any need for this kind of API bloat.
I don't know if anyone feels like porting this feature to DB, but I
certainly hope we will not further add changes to the DB API for which
there are much better solutions already in MDB or we can soon forget
about calling MDB the next gen DB because the API differences will be
too great.
Regards,
Lukas