public function exec($query, $input_param = false) { $this->lastError = null; try { if (is_array($input_param)) { $res = $this->prepare($query); $res->execute($input_param); return $res; } return parent::exec($query); } catch (\PDOException $e) { echo '<pre>'; print_r($e); echo '</pre>'; exit('Stoped: <b>' . mf_get_spath() . '</b>'); $this->lastError = $e->getMessage(); $debug = debug_backtrace(); Exc::log('SQL_ERROR', "SQL ошибка:{$e->getMessage()} в запросе: {$query}", $debug[1]['line'], $debug[1]['file'], true); if ($this->inTransaction()) { throw new \PDOException($e->getMessage()); } else { return false; } } }
/** * Public constructor * * @param string $message Exception message * @param int $code Exception code */ public function __construct($message, $code = 0) { parent::__construct($message, $code); }