Page 1 of 1

Database Abstraction

Posted: Thu Feb 15, 2007 4:42 pm
by onion2k
What database abstraction library, if any, do you use? I'm after a fairly simple one but with a handful of specific requirements:

1. It's got to work in PHP 4. PHP 5 as well would be nice but it's not vital.
2. It's got to work *everywhere*. That means it can't rely on PEAR being available (hence no PearDB or MDB).
3. It only needs to work with MySQL really.
4. It needs to handle a few things:
a. Escaping data.
b. Monitoring connections (a simple count of queries would be enough).
c. Returning data in the same form as PHP (eg, array, assoc or object).

I can't find anything good and I'm on the verge of writing my own, but I thought I'd ask first.

Posted: Thu Feb 15, 2007 4:53 pm
by feyd
ADOdb and PJ's ADOdb Lite are used by many, I believe.

Posted: Thu Feb 15, 2007 5:06 pm
by Christopher
I use a very simple one like you do, and similar to the Connection classes that often pop-up around here. I tend to not do to much fancy database-wise out of habit. For example, I have more and more tended to push things like HTML into files rather than storing it in a database. If I am not querying the data -- just selecting by key -- then I think what the real use case is.

Posted: Thu Feb 15, 2007 6:01 pm
by AKA Panama Jack
My ADOdb Lite does all of what you ask. Check the link in my signature. :)

Plus, it even has a nifty debug console. :D

http://adodblite.sourceforge.net/debugconsole.php

Image

Posted: Thu Feb 15, 2007 9:29 pm
by Christopher
I would recommend ADOdb Lite if you are looking for features. However any library is going to be an order of magnitude bigger and probably do multiple includes as well. I think mine is under 3k and does everything on your list except monitoring.