PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Authentication » LiveUser_Admin » Bug #3900

Support limited queries with PEAR::DB

Details

Request #3900Support limited queries with PEAR::DB
Submitted2005-03-21 14:35 UTC
Frompasi at schnappshot dot de
StatusWont fix
PackageLiveUser_Admin
PHP Version5.0.3
OSUbuntu Linux 4.?
Roadmaps(Not assigned)

Comments

[2005-03-21 14:35 UTC] pasi at schnappshot dot de

Description:
------------
Version: CVS from 2005-03-21
File: LiveUser/Admin/Storage/DB.php

At the moment the PEAR::DB storage container does not support a limited query. This was essential for me so I made a quick hack to try it out.
So here are my results. It is 5 minutes work and really ugly. I also give a second, nicer version, that I just wrote down and didn't try yet.

Reproduce code:
---------------
Make diff with file:

http://www.schnappshot.de/DB.php.txt

Nicer version:

http://www.schnappshot.de/DB.php.2nd.txt

[2005-03-21 14:38 UTC] smith at backendmedia dot com

Could you provide us with a unified diff of your changes?

[2005-03-21 14:54 UTC] pasi at schnappshot dot de

Never made .diffs before, so I hope they are ok. The '2nd' version should be tried first and used when it works.

http://www.schnappshot.de/DB.diff
http://www.schnappshot.de/DB.2nd.diff

[2005-03-21 15:36 UTC] smith at backendmedia dot com

Well I kinda expected this kind of feature request for the DB backend. Essentially DB only provides limitQuery() where as MDB/MDB2 prodive a mechanism to combine any of the query methods with a limit. So the only solution is to throw code at the problem or ignore it and instead suggest people to move to a more advanced abstraction layer.

Since I am the author of MDB/MDB2 I am obviously biased towards having people move to MDB/MDB2 and this is also the decision we have made inside LiveUser. We have similar issues when it comes to datatypes. We also required MDB/MDB2/Metabase for the schema in order to be more portable.

As for throwing code at the issue we 3 options:
1) use modifyLimitQuery() like you did
2) use modifyQuery() and replicated the needed fetch calls
3) lobby DB to add the functionality

I find 1) a big kludgy, especially since this method is marked "protected".

2) doesnt violate visbilities but does replicate code, which is may or may not need continous attention later

3) Daniel recently closed a feature request on this: http://pear.php.net/bugs/bug.php?id=2223. The point here is that at some point you just have to break BC and clean up your API. MDB2 does just that for DB.

So to me the only feasible option is 2) while I personally prefer to just have people move towards MDB/MDB2 instead of forcing us to fix up the limitations of DB.

What do you other LiveUser devs think?