Re: New PDO-based DBAL/ORM for PEAR2
| From: | Michael J. I. Jackson | Date: | Tue, 20 Nov 2007 18:54:21 +0000 |
| Subject: | Re: New PDO-based DBAL/ORM for PEAR2 | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-48518@lists.php.net to get a copy of this message | ||
On Nov 20, 2007, at 11:18 AM, David Coallier wrote:
Ok let's try to make a deal, what about a driver design that by default is using pdo ? That way, one could use it with or without PDO. If I look at your code, it really is based on PDO.I chose to base the code on PDO because that's the direction that PHP is going generally. At the last meeting of PHP core developers, there was actually some discussion about moving the native DBMS extensions out of the PHP core entirely and putting them in PECL. This of course will not be done for PHP6, however, as PDO develops and supports more drivers, it will gradually become the standard for connecting to databases in PHP. And as PDO gets better, my code will be able to evolve with it. Besides, using PDO (written in C) is much faster than the native DBMS PHP functions.
I am +1 on having a PDO driver DBAL in PEAR2, however, I think we need to support native dbs as well.By this do you mean supporting the native PHP functions?
Hmm, perhaps that should be two packages. 1. DBAL 2. PHPORM which plugs in the DBAL you made. That way, they are ... independant each another and people that want to use the DBAL only, will get the DBAL only :-)If I understand correctly what you're saying, that's exactly how my package works. If someone just wants a DBAL, then just use PDORM_Connection. No other classes will be loaded. However, if you want a database manager, load it: // DBAL only require_once 'PDORM.php'; $db = PDORM::factory('mysql:host=localhost', 'user', 'pass'); $db->query($sql); $db->manager->createTable( ... ); // loaded PDORM_Manager module However, if you'd like to have some ORM, it's there for the using: require_once 'PDORM/Domain.php'; class Mapper_Person extends PDORM_Domain_Mapper { ... } // ORM classes loaded If people have a problem installing a few extra files of code on their machines that they will never use (assuming they only want a basic DBAL without any extra modules), we can just separate them out into subpackages and they don't have to install them. However, I don't think that creating two completely separate packages is necessary. Thanks, Michael