Wednesday, May 3. 2006PDO_User and the effects of Slide Driven DevelopmentLast Fall, Wez and I (and others) met up at the Zend conferrence in Burlingame, CA (US). This was primarily a pre-PDM checkin for those of us who wouldn't be able to make it to Paris to get our thoughts in on the direction of PHP6. Apart from these topics, Wez mentioned wanting to have a userspace bridge for implementing PDO drivers, but that there was entirely too much going on that was (in all honesty) more important. I agreed on both counts. At the time I was doing my best to ignore the temptation to work on operator... Click through and you'll see just how weak willed I can be Fast forward to last week in Orlando, FL (US) and the php|tek conferrence. As mentioned in earlier blog posts, I think my presentations went over okay for a first couple of talks, but if I have to make one complaint, it's that the subject matter was ill-aimed. I spoke to Sean (one of the conferrence organizers) after the closing keynote and asked him about the upcoming php|works conf in toronto. When he said that one of the focuses would be on database interaction (since it would be taking place along side db|works), my thoughts immediately jumped to the PDO userspace driver which had been running around the back of my mind for months. By the end of my flight back I had half the implementation written and had generally come to the conclusion that the PDO API was pretty damned nice. Long story short, I've just uploaded release 0.1 of pdo_user which is ready for testing. The file you'll want to pay attention to is: README.OBJECTS as that describes the mechanics of actually implementing a driver in userspace. Another interresting spot to look is tests/globals.phpt which includes a simple, yet functional userspace driver for accessing variable contents as database resources. I don't expect it to work perfect right out of the box, but it should get the job done. Please Report Bugs when you find them so I can get 'em fixed. Trackbacks
Trackback specific URI for this entry
No Trackbacks
Comments
Display comments as
(Linear | Threaded)
Slide driven development; Is that a new methodology?
It's a term I heard Andrei use during his Unicode presentation at php|tek. He was going over features of the unicode implementation in PHP6 and the slide mentioned that the http:// wrapper would soon support content-type/charset detection (which he knew was coming because he'd been asking me to do it and I'd promised to make it happen).
By the time his talk had come up at the conferrence, the feature was in place and functioning. Now, I had planned on that feature anyway, but originally had it lower on my list (it's just a nice-to-have after all, not a must-have), what drove it up my TODO list was Andrei's slides; Hence Slide Driven Development. In this context I'm misusing the term a little as this is driven more by the entire presentation than a single slide, but the concept's the same... Something that was on my TODO (albiet down the ladder), bumped up due to a conferrence driven interrest. Does this mean we can still do :
function myFunction(PDO $pdo) { } meaning, does the user-pdo class extend the same base-interface? Short answer: Yes.
Long answer: No. You're thinking of a different layer of the PDO model. You can (and have always* been able to) extend the PDO class and override the specific statement class used by PDO. The interfaces exported and used by PDO_User are one layer back from this and only used by the driver libraries exporting new functionality. Thanks, then I have another question..
Will I be able to register a new DSN? And how will this look like? Very cool stuff btw > Will I be able to register a new DSN?
> Yes. I'll illustrate via example: class foo implements pdo_user_driver { ... } $p = new PDO('user:driver=foo'); Here, we're instantiating the pdo_user driver by way of the 'foo' class definition. The DSN doesn't have to be limited to the driver param however, you can add additional parameters based on what your driver needs: class foo implements pdo_user_driver { function __construct($dsn, $user, $pass, $driver_options) { $args = PDO_User::parseDSN($dsn, array('host','port')); $host = $args['host']; $port = $args['port']; ... } ... } $p = new PDO('user:driver=foo;host=localhost;port=1234'); Note: You're not limited to 'host' and 'port', those are just convenience examples. Documentation will come when the extension has stabilized. Thanks! Thats all I wanted to know =)
Looking forward to use this |
Buy My BookFavoritesPieces of string
Lies & References Opcodes Compiled Variables TSRMLS_CC Extension Writing Part 1 Part 2a Part 2b Part 3 Syndicate This BlogCategoriesQuicksearch |
Save to Del.icio.us
Save to MyWeb
Digg This
Flickr












![Validate my RSS feed [Valid RSS 2.0]](/uploads/valid-rss.png)
![Validate my Atom feed [Valid Atom 1.0]](/uploads/valid-atom.png)