/** * Обертка для query() * * @param string $sql * * @return void */ public function query($sql) { try { $result = parent::query($sql); } catch (\PDOException $e) { $this->error = $e->getMessage(); $result = false; } if (!empty($this->debugger)) { $this->debugger->trace = debug_backtrace(); $this->debugger->db = $this; $this->debugger->component = 'PDO'; $this->debugger->run($sql, $result); } elseif (empty($this->debugger) && $this->test) { trigger_error(ABC_BAD_FUNCTION_CALL_EX . 'Component PDO: ' . ABC_NO_SQL_DEBUGGER, E_USER_NOTICE); } if (!$result) { throw $e; } return $result; }
/** * Обертка для query() * * @param string $sql * * @return void */ public function query($sql) { try { $result = parent::query($sql); } catch (\PDOException $e) { $this->error = $e->getMessage(); $result = false; } if (!empty($this->debugger)) { $this->debugger->trace = debug_backtrace(); $this->debugger->db = $this; $this->debugger->component = 'PDO'; $this->debugger->run($sql, $result); } elseif (empty($this->debugger) && $this->test) { AbcError::badFunctionCall('Component PDO: ' . ABC_NO_SQL_DEBUGGER); } if (!$result) { throw $e; } return $result; }