/** * Обертка для query() * * $param string $sql * * @return void */ public function query($sql) { $result = parent::query($sql); if (!empty($this->debugger) && (false === $result || $this->test)) { $trace = debug_backtrace(); $this->debugger->db = $this; $this->debugger->type = 'pdo'; if ($this->test) { $this->debugger->testReport($trace, $sql, $this->error); } else { $this->debugger->errorReport($trace, $sql, $this->error); } } elseif (empty($this->debugger) && $this->test) { throw new \BadFunctionCallException('SQL debugger is inactive. Set to true debug configuration.', E_USER_WARNING); } 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) { 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; }