DB Abstraction

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
Overunner
Forum Newbie
Posts: 9
Joined: Sat Dec 13, 2003 5:28 am

DB Abstraction

Post by Overunner »

After 3 days of research about the existing DB Abstraction Layers, I haven't decided which one I will implement in my project. (I am currently using PEAR DB). Here are some of the benchmarks I came across:

http://phplens.com/lens/adodb/#1
http://freshmeat.net/screenshots/30313/

As you can see, the PEAR DB package does not perform very well. I verified the results above by running some tests on my own computer, and I got pretty much the same results (4-5% difference at most).
I also tried PEAR's MDB package, which seemed to be an excellent abstraction with the nice support of setting up your DB-scheme with XML (you can find some info about it here: http://www.php-mag.net/itr/online_a...3&p=0&nodeid=11)
, but it adds far too much runtime execution overhead.
And the PDO extension is not compatible with PHP 4.

Maybe I should write my own abstraction class which only provides a common API? Or maybe I shouldn't worry so much about the runtime execution overhead since it maybe won't be my primarly bottleneck?

I am also curious what DB abstraction you guys use, and why you chose that abstraction layer.

Thanks
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

I use Eclipse's database abstraction layer, mostly because the API is pretty simple. Remember, when you are looking at Database Abstraction, it's mostly a myth. Any abstraction layer that promises complete independence from the database isn't being entirely truthful. To be fair, ADOdb and PEAR don't claim 100% independence.

The common API approach is probably the best. I found it easiest to work with, as that is how the Eclipse abstraction layer works.

I will, however, have to package up my updates, as I add a number of rather useful features that make using the layer even easier.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

I use adoDB for commercial projects (non-commercial ones don't need that much power, usually) - and once you've wrapped your head around it, it's extremely powerful and very, very fast.
User avatar
BDKR
DevNet Resident
Posts: 1207
Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:

Post by BDKR »

I have to agree with Jason and patrikG both on this one. Eclipse is by far the most reasonable and elegant (as well as small) while ADODB has impresssive speed in comparison to the others in spite of it's size.

The problems:
* Eclipse may not have enough for certain projects. Get hackin'!
* While ADODB is fast in the execution stage, it's slow (just like
the others) in the upfront parsing stage. Use an accellerator.

I've used both at various times and have my own approach that is influenced by my own peculiuar experience. However, both of these are good products.

Cheers,
BDKR
Post Reply