public function getDebugQuery($html = null)
    {
        $d = $this->render();
        $pp = [];
        foreach (array_reverse($this->params) as $key => $val) {
            if (is_numeric($val)) {
                $d = preg_replace(
                    '/'.$key.'([^_]|$)/',
                    $val.'\1',
                    $d
                );
            } elseif (is_string($val)) {
                $d = preg_replace('/'.$key.'([^_]|$)/', "'".addslashes($val)."'\\1", $d);
            } elseif ($val === null) {
                $d = preg_replace(
                    '/'.$key.'([^_]|$)/',
                    'NULL\1',
                    $d
                );
            } else {
                $d = preg_replace('/'.$key.'([^_]|$)/', $val.'\\1', $d);
            }
            $pp[] = $key;
        }
        if (class_exists('SqlFormatter')) {
            if ($html) {
                $result = \SqlFormatter::format($d);
            } else {
                $result = \SqlFormatter::format($d, false);
            }
        } else {
            $result = $d;  // output as-is
        }
        if (!$html) {
            return str_replace('#lte#', '<=', strip_tags(str_replace('<=', '#lte#', $result), '<>'));
        }

        return $result;
    }