Published January 22nd, 2003 by Jim O'Halloran

PHP DB Wrappers

PHP Traveller has an article entitled The state of PHP DB wrappers, which didn’t seem to ring true to me. I did initally wonder about the author’s bias towards one particular wrapper, but I’m assured (by the author) that there is no association between the author and PEAR DB.

Take a look at the benchmark. The difference is quite dramatic, but you can see how MDB has come very close to ADOdb. One has to say that these benchmarks work with large number of queries and that is quite unlikely that you will be having 400 queries on a single page. A more realistic number is 20 or so. In that case, the speed difference between ADOdb and MDB becomes insignificant.

A large number of query repeitions gives a meaningful comparison of speed, when one query executes too fast to measure. But trying to argue that the speed difference is insignificant because no one does 400 queries on a single page is a bit much isn’t it? If your 20 query page is hit simultaneously by 20 users, aren’t we trying to execute 400 queries anyway? Speed on an individual query may not be significant, but surely any speed penalty has to affect overall scalability of your system? Your little PHP page may be on a low traffic site, but one day you’re going to be “slashdotted”, and when that happens you’ll wish you thought of scalability in the first place.

Both ADODb and Metabase are excellent wrappers but there must exist only one official way to work with databases on a given platform.

When I first started working with PHP, the lack of a standard database library seemed odd to me. How would I write database independent PHP scripts? But then I discovered ezSQL which wraps up everything nicely for me. Sure, I could have used PEAR DB, or ADOdb, or Metabase or now PEAR MDB? I guess each has their own advantages or disadvantages, but the fact that there is a choice means we can pick the best tool for the job. For what I’m doing right now, thats ezSQL. Why should I use a more bloated DB library when I’m not going to use most of its features?

Update (26/5/03): When I originally wrote this article, I made a strong statement to the effect that the autor of it must have been a developr of PEAR DB. However, I’m assured by the author that this is not the case. Sorry if I caused offence.


1 Response to “PHP DB Wrappers”

Feed for this Entry
  1. 1

    Amir Says

    Hello,

    I downloaded ezSQL on my NT box and could write a PHP application to connect to a remote MS-SQL server and everything worked great.

    When I moved my code to a Linux box, it doesn’t work. Does anybody have a clue why it may happen.

    Thanks _Amir.

Leave a Reply

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>