sqlite - PHP - How to extend SQLite3Result class -



sqlite - PHP - How to extend SQLite3Result class -

this came far:

class sqlite3_extended extends sqlite3 { public function query($string){ $result = parent::query($string); if(is_bool($result)) homecoming $result; else homecoming new sqlite3result_extended($this); } } class sqlite3result_extended extends sqlite3result { public function test(){ echo 'sqlite3result extended successfully!'; } }

and this: fatal error: phone call private sqlite3result::__construct() context 'sqlite3_extended

how extend sqlite3result class?

you can't. sqlite3result class can instantiated internally sqlite3::query(); there no way build instance of class, or of subclass, yourself.

if want extensible database class, utilize pdo. can utilize custom subclass statements/results calling pdo::setattribute() pdo::attr_statement_class argument. bonus, may enable back upwards database engines other sqlite.

php sqlite extend

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -