first work on feed updater + pinger
[stapibas.git] / src / stapibas / PDO.php
1 <?php
2 namespace stapibas;
3
4 /**
5  * Small error-handling wrapper around PDO
6  */
7 class PDO extends \PDO
8 {
9     public function query()
10     {
11         $args = func_get_args();
12         $res = call_user_func_array(array('parent', 'query'), $args);
13         if ($res !== false) {
14             return $res;
15         }
16
17         $this->handleError();
18     }
19
20     protected function handleError()
21     {
22         echo "SQL error\n";
23         echo " " . $this->errorCode() . "\n";
24         echo " " . implode(' - ', $this->errorInfo()) . "\n";
25     }
26 }
27
28 ?>