note 111824 added to mysqlinfo.api.choosing
| From: | roland at mxchange dot org | Date: | Tue, 02 Apr 2013 11:33:20 +0000 |
| Subject: | note 111824 added to mysqlinfo.api.choosing | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-194290@lists.php.net to get a copy of this message | ||
To solve PDO limitations as described by michaeln at associations plus dot see eh, you may try to
overwrite PDO methods:
<?php
class MyPdo extends PDO {
// What ever parameters PDO wants + prepend some own:
public function query($caller, $line, $foo, $bar, $bazz) {
// Do your stuff here with $caller, $line (e.g. logging for debug purposes)
// Then call the extended method
return parent::QUERY($foo, $bar, $bazz) or $this->myErrorHandler($caller, $line, $someSqlToLog);
}
}
?>
This is only a very basic example. You may otherwise choose to "wrap" the PDO class and
save an instance of the "underlaying" PDO class inside the wrapper class. This is maybe a
little more complex approach but allows you to have on interfaces in class signature + way better
flexibility.
----
Server IP: 213.172.110.14
Probable Submitter: 178.6.56.21
----
Manual Page -- http://php.net/manual/en/mysqlinfo.api.choosing.php
Edit -- https://master.php.net/note/edit/111824
Del: integrated -- https://master.php.net/note/delete/111824/integrated
Del: useless -- https://master.php.net/note/delete/111824/useless
Del: bad code -- https://master.php.net/note/delete/111824/bad+code
Del: spam -- https://master.php.net/note/delete/111824/spam
Del: non-english -- https://master.php.net/note/delete/111824/non-english
Del: in docs -- https://master.php.net/note/delete/111824/in+docs
Del: other reasons-- https://master.php.net/note/delete/111824
Reject -- https://master.php.net/note/reject/111824
Search -- https://master.php.net/manage/user-notes.php