MDB2 discussions
| From: | daniel at electroteque dot org | Date: | Fri, 31 Dec 2004 00:40:20 +0000 |
| Subject: | MDB2 discussions | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-16531@lists.php.net to get a copy of this message | ||
Hi list, sorry I have left everyone out in the cold with discussions on
MDB2, I have been talking with lukas about some legacy methods like getAll
which were moved in MDB2, here is the bulk of it. I was only looking at
getAll because I wanted to return all results as a nested array, so
queryAll does the same thing ?
I am looking at extending MDB2 to add extra functionality like a custom
select menu using possibly HTML_QuickForm with a caching mechanism I have
designed in my own db class whiuch serializes the results as a record in
the db to prevent returning all results as an array but then it got me
thinking maybe that could happen in queryAll because i would be
unserializing back as an array and generating the list again ? how would
this be possible ? by overriding the default queryall method ?
I am also considering extending MDB2 to add a method for generating paging
using the selectLimit method, the Pear db_pager is a bit bollox with the
build method by default, so i may still use it but extend that, rather than
extending mdb ? In my paging method i have the option to set the total
count in a session because, one of my systems would results thousands of
results and i found it to be slow to get a count on each page, does
db_pager cache the total ?
Daniel Rossi wrote:
> Hmm can you explain the reason behind this ?
>
> Var_Dump($db->loadModule('extended'));
> $result = $db->extended->limitQuery($query, null, 1, 1);
>
> I couldnt see myself doing $db->extended->getAll :| Why the shift ?
>
> If i intend to subclass MDB , do i have to set it up like the Extended
> class ?
yes .. those methods are legacy crap.
by calling setLimit() the limit will be set for the next query only. so
you can combine it with any query easily.
furthermore getAll() is useless crap imho. its an abuse of a feature
which is needlessly complex.
most people dont even use prepared queries with getAll() so they should
be using queryAll()
for those people using prepared they are misusing prepared queries where
they should be using a query builder for much cleaner and faster results.
btw: we should probably move these discussions to
pear-general@lists.php.net so that other people can chip in or just read
along
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