Expand php pdo to support impala, but the setAttribute() function failed -


expand php pdo support impala, setattribute() function failed. code is:

class impalapdo extends pdo {      public function __construct($dsn, $username, $passwd, $options)     {         parent::__construct($dsn, $username, $passwd, $options);         $impala = new impalapdostatement();         $impala->test();         $this->setattribute(pdo::attr_statement_class, array('impalapdostatement', array($this)));     } }  class impalapdostatement extends pdostatement {      public function test() {         print "aaa";     } } 

the error message is: sqlstate[hy000]: general error: pdo::attr_statement_class requires format array(classname, array(ctor_args)); classname must string specifying existing class. can confirm impalapdostatement existing, because $impala->test() print string successfully. don't know error message mean.

you must override protected constructor of pdostatement:

class impalapdostatement extends pdostatement {     public $dbh;      // constructor must overrided     protected function __construct($dbh) {         $this->dbh = $dbh;     }      public function test() {         print "aaa";     } } 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -