pdo-debug icon indicating copy to clipboard operation
pdo-debug copied to clipboard

Do not working this class!

Open ghost opened this issue 8 years ago • 0 comments

This Class do not work for me. I'm changed code Mark from php.net

`static public function show($sql_string, array $params = null) { if (!empty($params)) { $indexed = $params == array_values($params); foreach($params as $k=>$v) { if (is_object($v)) { if ($v instanceof \DateTime) $v = $v->format('Y-m-d H:i:s'); else continue; } elseif (is_string($v)) $v="'$v'"; elseif ($v === null) $v='NULL'; elseif (is_array($v)) $v = implode(',', $v);

            if ($indexed) {
                $sql_string = preg_replace('/\?/', $v, $sql_string, 1);
            }
            else {
                if ($k[0] != ':') $k = ':'.$k; //add leading colon if it was left out
                $sql_string = str_replace($k,$v,$sql_string);
            }
        }
    }
    return $sql_string;

}`

ghost avatar Feb 08 '17 13:02 ghost