Система управления «Сайт PRO»
Версия 20240107

Класс Debug

Объект $Debug: Cms\Root\Data\Debug наследует Cms\Root\Data\Base

Драйвер для работы с базой данных с отладкой

Исходный код
class Debug extends \Cms\Root\Data\Base { … }

Методы

query()

$Debug->query($q);

Выполнение запроса и получение результата

Параметры:

ИмяОписание
$q

string запрос

Возвращает: object|false

Исходный код
    function query($q) {
        if (false) {
            $time0 = microtime(true);
            $r = parent::query($q);
            $time1 = microtime(true);
            if (!$this->_Fd) {
                $this->time0 = $time0;
                $root = $this->root();
                $this->_Fd = @fopen("$root/cms/queries.log", "a");
            }
            if ($this->_Fd) {
                fwrite($this->_Fd, trim($this->query) . ";\n -- " . number_format($time1 - $time0, 4, ".", "") . " = " . number_format($time1 - $this->time0, 4, ".", "") . " - " . number_format($time0 - $this->time0, 4, ".", "") . "\n\n");
                fflush($this->_Fd);
            }
        }
        return $r;
    }