I presume I can extend the PDO_Statement class, but how do I get PDO to use the extended statment class (Or more precisely my extension of PDO to use it’s extended statement companion).?
Related stupid question - is there a separate mysqli driver for PDO? (I’m guessing not since mysqli predates PDO and is preferable to mysql in almost all circumstances)
What do you mean seperate mysqli driver for PDO? Do you mean: new PDO( 'mysqli...' )
type thing? As of PHP 5.3 Mysqli and PDO both use MySQL Native Driver by default. Making a need for that, superfluous.
Michael
I made a pretty disgusting way of doing it when I wanted to approach the same problem. Basically created a wrapper class: http://github.com/baileylo/Hammered-Forums/blob/master/jlogs/dbConn.php
Basic theory was I extended PDO so that instead of returning PDOStatement object it would return an instance of my PDOStatementWrapper which took a PDOStatement objecte as an object to its constructor function. This class pretty much implemented all the functions of PDOStatement just calling them on the PDOStatement that it had stored. And then I added custom functionality where i wanted.
Cannot be used with persistent pdo instances… So a child class can’t set this attribute I take it?
http://ca.php.net/manual/en/pdo.setattribute.php
PDO::ATTR_STATEMENT_CLASS: Set user-supplied statement class derived from PDOStatement. Cannot be used with persistent PDO instances. Requires array(string classname, array(mixed constructor_args)).
I haven’t used this myself but PHP Doctrine 2.0 does. By persistent I’m pretty sure they mean persistent database connection which no one uses anyways.