Re: MDB2 API
| From: | Davey Shafik | Date: | Fri, 15 Jul 2005 20:29:55 +0000 |
| Subject: | Re: MDB2 API | ||
| References: | 1 2 3 4 5 6 | Groups: | php.pear.dev php.pear.dev |
| Request: | Send a blank email to pear-dev+get-38661@lists.php.net to get a copy of this message | ||
Lukas Smith wrote:
Justin Patrin wrote:First off, you *cannot* extend PDO, the constructor is set as final, which means you cannot add one to your class, there are other issues which results in segfaults that I ran up against, all in all, its just not worth it. I chose to use __call() to wrap it quickly and easily.As a result MDB2 would have to wrap PDO instead of potentially simply extending PDO. Plus it means that the "upgrade" from PDO will be needlessly painful. But yes I think that the PDO API is not well fitted into the PHP world and makes alot of clever reuse of methods based on context making it very unfriendly in many details.The goal of PDO is faw away from the goal of MDB2. PDO is merely an internal database wrapper, MDB2 tends to be a real abstraction layer. I doubt mapping the PDO API will be of any help. I agree with Jan, go with yours.I also agree. If you think that the PDO API is user unfriendly then there's no reason to switch to it.
Davey: you have made some "real world" use of PDO. Whats your take on things? Other comments?Personally, I say if you have any methods in common (i.e. lastInsertID()), use the same name, but if not, don't bother. I believe that if you can make it similar such that people will be able to easily find what they need to replace what little PDO does on its own, you should have no problems. I'd hate to see you hand over the maintainership of MDB2, and I feel that if you can keep some sort of similarity to PDO, DB and MDB, you'll be golden :) My experience with using PDO is that I found it pretty easy and have had little trouble porting my MySQL/PgSQL procedural brain to it. This will not go for everyone, one of the reasons I'm writing Crtx_DB_DataObject I guess :) Finally, there is always the chance that someone will come up with a PDO API compatible wrapper, like the DB one for MDB (IIRC). - Davey