DB_dsql::getDebugQuery PHP Méthode

getDebugQuery() public méthode

Return formatted debug output.
public getDebugQuery ( string $r = null ) : string
$r string Rendered material
Résultat string SQL syntax of query
    public function getDebugQuery($r = null)
    {
        if ($r === null) {
            $r = $this->_render();
        }
        $d = $r;
        $pp = array();
        $d = preg_replace('/`([^`]*)`/', '`<font color="black">\\1</font>`', $d);
        foreach (array_reverse($this->params) as $key => $val) {
            if (is_string($val)) {
                $d = preg_replace('/' . $key . '([^_]|$)/', '"<font color="green">' . htmlspecialchars(addslashes($val)) . '</font>"\\1', $d);
            } elseif (is_null($val)) {
                $d = preg_replace('/' . $key . '([^_]|$)/', '<font color="black">NULL</font>\\1', $d);
            } elseif (is_numeric($val)) {
                $d = preg_replace('/' . $key . '([^_]|$)/', '<font color="red">' . $val . '</font>\\1', $d);
            } else {
                $d = preg_replace('/' . $key . '([^_]|$)/', $val . '\\1', $d);
            }
            $pp[] = $key;
        }
        return $d . " <font color='gray'>[" . implode(', ', $pp) . ']</font>';
    }