solved. Error while trying to Extend PDO
Posted: Fri May 29, 2009 3:23 pm
There isn't really much to comment. I can't figure out what is proper way to Extend PDO.
Code: Select all
/**
* Extends PDO and logs all queries that are executed and how long
* they take, including queries issued via prepared statements
*/
class ExtendedPDO extends PDO {
/**
* constructor
* @param string $dsn
* @param string $username
* @param string $password
*/
public function __construct($dsn, $username, $password) {
parent::__construct($dsn, $username, $password);
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('ExtendedPDOStatement', array()));
}
// write your methods here, eg.
}
class ExtendedPDOStatement extends ExtendedPDO {
// write your methods here
}
Code: Select all
<b>Warning</b>: PDO::setAttribute() [<a href='pdo.setattribute'>pdo.setattribute</a>]: SQLSTATE[HY000]: General error: user-supplied statement class must be derived from PDOStatement in <b>C:\Program Files\Zend\Apache2\htdocs\gcms\gcms\applications\backend\framework.php</b> on line <b>214</b><br />