PEAR::DB::showQuery()

From: Date: Wed, 25 Feb 2004 23:24:11 +0000
Subject: PEAR::DB::showQuery()
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-10939@lists.php.net to get a copy of this message
Hi all, I'm just getting used to using PEAR::DB so my question may be (or sound) weird. What I was looking for was a showQuery() method that would return the parsed(prepared, just before execution) query string, as it would be sent to the database. Not finding anything to resemble that, i edited my local copy of Pear/Db/common.php adding
    function &showQuery($stmt, $data = array())
    {
        $realquery = $this->executeEmulateQuery($stmt, $data);
        if (DB::isError($realquery)) {
            return $realquery;
        }
        return $realquery;
    }
which is basically a ripped off execute() and which simply returns the querystring. Now, I may be wrong, or going wrong about it, so please comment on this. I find it extremely usefull for debugging purposes. Maybe it's just me. Thanks and have a good one, negora

« previous php.pear.general (#10939) next »