Page 1 of 1
PDO
Posted: Sat Dec 10, 2005 1:20 am
by m3mn0n
Has anyone seen an open source application that make effective use of
PDO?
Or if you, yourself, have made an application using PDO (any db system) what sort of practical benefits do
you think it has over the traditional methods of db integration into scripts?
Posted: Mon Dec 12, 2005 9:31 am
by Maugrim_The_Reaper
Besides the common behaviour and standard API?

Re: PDO
Posted: Mon Dec 12, 2005 9:39 am
by Roja
Sami wrote:Has anyone seen an open source application that make effective use of
PDO?
adodb now uses PDO when available, and in some situations.
Posted: Mon Dec 12, 2005 10:26 am
by Maugrim_The_Reaper
PDO is a step up from the individual database extensions of PHP4. Think of it this way. Instead of having 14 different ways to do the same thing, you now have one. And that single one has a lot of added flexibility. Its the future. Of course its not database abstraction as we're used to per se, hence why ADOdb and other current libraries will (and should) offer a PDO driver. PDO is not about to replace ADOdb for example since there's a bit more to database abstraction than a unified API, and standardised behaviour...plus everyone on the Design Patterns drug would probably need to Facade PDO anyways.
Should you use PDO? Definitely - so long as you are aware its going to be PHP5.1 centric phenomenon for a while yet. PHP4 is still a powerful force on the vast majority of shared hosts. Its a big step forward though when you can use it. One API for MySQL and Oracle. About time I say.
Why not use it? If its not optional, and you expect to meet PHP4 at some stage. Unfortunate, but that's PHP5 at the moment. Great for an application on dedicated hosting, absolute suicide (without a PHP4 fallback) on shared hosting.
The other consideration I've already hinted at - PDO is not an abstraction layer. It does away with certain things the traditional abstraction layers did (manageing varying APIs) but it doesn't replace all the various database differences. For that reason you still need an abstraction layer of some description so don't throw ADOdb out just yet...
I think its a no brainer really. If its available, and stable (not a certainty just yet) then use it. Otherwise, don't. Since you still need an abstraction layer its probably a very simple addition - most applications with ADOdb could probably switch across very quickly. I'm sure those other PEAR database abstraction libraries have something similar...
Posted: Mon Dec 12, 2005 12:08 pm
by GRemm
It looks as if the PDO extension is php5 specific.
If you need php 4 support the PEAR:DataObjects should offer much of the same functionality (but not quite)