X-Git-Url: https://git.cweiske.de/stapibas.git/blobdiff_plain/66e2a68f902cfa132a22b02892871d0be375d1c2..HEAD:/src/stapibas/PDO.php diff --git a/src/stapibas/PDO.php b/src/stapibas/PDO.php index a85008b..65a6b73 100644 --- a/src/stapibas/PDO.php +++ b/src/stapibas/PDO.php @@ -6,8 +6,9 @@ namespace stapibas; */ class PDO extends \PDO { - public function query() - { + public function query( + string $query, ?int $fetchMode = null, mixed ...$fetchModeArgs + ): \PDOStatement|false { $args = func_get_args(); $res = call_user_func_array(array('parent', 'query'), $args); if ($res !== false) { @@ -17,12 +18,23 @@ class PDO extends \PDO $this->handleError(); } + public function exec(string $statement): int|false + { + $res = parent::exec($statement); + if ($res !== false) { + return $res; + } + + $this->handleError(); + } + protected function handleError() { echo "SQL error\n"; echo " " . $this->errorCode() . "\n"; echo " " . implode(' - ', $this->errorInfo()) . "\n"; + exit(2); } } -?> \ No newline at end of file +?>