New PDO-based DBAL/ORM for PEAR2
| From: | Michael J. I. Jackson | Date: | Mon, 19 Nov 2007 15:57:34 +0000 |
| Subject: | New PDO-based DBAL/ORM for PEAR2 | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-48488@lists.php.net to get a copy of this message | ||
Hello all,
As Lukas Smith suggested on an earlier thread, it's time we got the ball rolling for a new DBAL for PEAR2 and PHP5. This package should employ PDO under the hood, but should strive to keep an API consistent with MDB2 as much as possible. I've already written a lot of code for such a package, but I'm sure that there are some others out there who have either done the same thing or would like to have some sort of input. Also, it's not currently possible for me to test my code on every single DBMS. For these reasons, I would like to know if there is anybody on this list who would be interested in working on this project. Here are the features that I've maintained/ported from MDB2 so far:
- Lazy and active database connections (although I think this sort of thing should really be implemented in the PDO libraries)
- Singleton factory for retrieving the same database connection
- Support for various modules (including user-defined modules) using loadModule() as well as the magic methods
- Manager module (partial)
- Datatype module (partial)
- Native module
- Function module
The following are features that I've implemented myself:
- Listener interface to replace driver debug() method
- Query class to replace Extended module and provide increased flexibility in crafting common queries
- ORM domain layer with support for ROR/CakePHP style object management (this is still buggy and not complete)
- Custom exception classes (extending PEAR_Exception) for common driver error codes (because SQLSTATE is a mess) and pretty printing!
It should be a very easy task to port the DBMS-specific classes from MDB2. Only a few method names have changed. However, I believe this task is better suited for those who are more familiar with the DBMS for which these classes have been created and have the ability to test their work. As I am most familiar with MySQL, I have already ported (most of) the MySQL subpackage.
Please feel free to check out the code if you'd like to try it out or provide encouragement/suggestions/criticisms. The code is hosted on Google code, so bugs can be reported on the issues tracking system there (until it's ready to be voted on for inclusion in PEAR). Also, I'll be maintaining a wiki at that site that will contain details on how to use the package. I'd like to get a lot of people testing out the package and posting questions to the wiki so we can get a good idea what information the docs need to contain. Once we get a good set of wiki pages, it will be easy to port the content they contain to DocBook format. The package is very well documented and should be fairly easy to understand for anybody who's familiar with MDB2 and/or PDO.
The package is called PDORM (PHP database object relational management) and can be downloaded using SVN:
svn co http://pdorm.googlecode.com/svn/trunk/ pdorm
Thanks,
Michael J. I. Jackson
mjijackson@gmail.com
Attachment: [application/pkcs7-signature] smime.p7s
Attachment: [application/pkcs7-signature] smime.p7s