Re: DB, MDB2, PDO - Future of DB-Abstraction in PEAR

From: Date: Wed, 03 Aug 2005 22:15:13 +0000
Subject: Re: DB, MDB2, PDO - Future of DB-Abstraction in PEAR
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-39183@lists.php.net to get a copy of this message
Andreas Korthaus wrote:
Lukas Smith wrote:
Well MDB2 has all the makings of exactly this. MDB2 is a thin layer with lots of optional modules. This could be pushed a bit more (like using prepared queries forces you to load the datatype module), but its one of the key ideas of MDB2.
But If I look at PDO, the only additional functionality I need is portable LIMIT support and portable sequences (like $db->nextId()).
Well limit is slightly more tricky, but atleast nextID() can best be handled inside the schema, this way you can get any popular database to produce auto increment like behaviour. This is exactly what the lastInsertId() method in PDO tries to facilitate. This leaves LIMIT support. MySQL, SQLite and PostGreSQL all support this natively (though PostGreSQL's implementation sucks AFAIK). For all others there are no beautiful solutions. However since PDO supports cursors you can get around alot of the network traffic which is the key aspect with LIMIT. Beyond that you can play around with single function that rewrites the SQL using the following recommendations: http://troels.arvin.dk/db/rdbms/#select-limit
bug-tracker: http://pecl.php.net/bugs/bug.php?id=4732
PDO::query() that way: http://pecl.php.net/bugs/bug.php?id=4987
I am quite certain that both of these will be addressed.
idea if other people want to use it too) I must use __call() to make it work in a nice way - but without a prefix ;-)
The __call() method implements two different modes. One using prefixes (and loading on demand) and one simply sequentially searches through all the loaded modules. regards, Lukas

« previous php.pear.dev (#39183) next »