Thanks, will check it out. MS
On Mon, Mar 29, 2010 at 8:33 AM, Chris Morrell <[email protected]> wrote: > If you find yourself needing to see your SQL queries all the time, I would > recommend either attaching a logger to your application that logs all your > queries (during development—obviously you would want to turn this off for > production), or look into the > Zend_Db_Profiler_Firebug<http://bit.ly/9e1uqY>component which will let you > view your queries right inside of Firebug. > > CM > > <http://cmorrell.com/> *Chris Morrell* Web: http://cmorrell.com Twitter: > @inxilpro <http://twitter.com/inxilpro> > > > On Mon, Mar 29, 2010 at 10:21 AM, Narinder Chandi < > [email protected]> wrote: > >> Hi. Just to give full details, I put this static function into a custom DB >> debug class that extends Zend_Db. Also the function (for more brute >> force(!) >> needs) accepts a boolean to force the output stream to terminate. >> >> Then, you can simply cal this function anywhere you need by: >> Database_Debug ::dumpSQL(); >> >> Hope you find it useful. I've been working with ZF only for a short while, >> but I really like it - sorry if this way is not the best(!) way to debug >> but >> I find this a quite useful way to quickly debug SQL calls. >> >> class Database_Debug extends Zend_Db >> { >> /** >> * The Class constructor. >> * >> * @param void >> * @return void >> */ >> public function __construct() >> { >> parent::__construct(); >> } >> >> /** >> * Dumps the last constructed SQL statement into the output stream. >> * >> * @param boolean $exit - Whether to exit the output stream. >> * @return void >> */ >> public static function dumpSQL($exit = true) >> { >> $db = Zend_Db_Table::getDefaultAdapter(); >> $dbProfiler = $db->getProfiler(); >> $dbQuery = $dbProfiler->getLastQueryProfile(); >> $dbSQL = $dbQuery->getQuery(); >> >> print_r($dbSQL); >> >> if ($exit) >> { >> exit; >> } >> } >> } >> >> Regards, >> >> Narinder. >> -- >> >> >> on 29/03/2010 14:58, Sergio Rinaudo at [email protected] wrote: >> >> > >> > Very nice :) >> > Thank you! >> > >> > Sergio Rinaudo >> > >> > >> >> Date: Mon, 29 Mar 2010 09:09:04 +0100 >> >> From: [email protected] >> >> To: [email protected] >> >> Subject: Re: [fw-general] Get query and error messages from $db->update >> >> >> >> Hi. Something like this will work: >> >> >> >> public function dumpSQL() >> >> { >> >> $db = Zend_Db_Table::getDefaultAdapter(); >> >> $dbProfiler = $db->getProfiler(); >> >> $dbQuery = $dbProfiler->getLastQueryProfile(); >> >> $dbSQL = $dbQuery->getQuery(); >> >> >> >> print_r($dbSQL); >> >> } >> >> >> >> Regards, >> >> >> >> Narinder. >> >> -- >> >> >> >> ______________________________________________________ >> >> | Narinder Chandi, Director, >> >> | ToolBox Systems Limited, Surrey, England, UK. >> >> | tel : +44 (0)1372 720117, mob : +44 (0)7973 512495 >> >> | www : http://www.toolbox.uk.com >> >> | Skype : NarinderChandi >> >> | LinkedIn : http://www.linkedin.com/in/toolboxsystems >> >> | Twitter : @ToolBoxSystems >> >> |______________________________________________________ >> >> | Consultancy * Development * Support >> >> |______________________________________________________ >> >> >> >> >> >> on 29/03/2010 09:01, Sergio Rinaudo at [email protected] wrote: >> >> >> >>> >> >>> Hi everybody, >> >>> if I construct an update query programmatically using Zend_Db, how can >> I get >> >>> this query and how to get what is the problem if the query fails? >> >>> Thanks >> >>> >> >>> Sergio Rinaudo >> >>> >> >> >> >> > -- ----------------------------------------- Mark Steudel P: 206.375.7244 [email protected] . : Work : . http://www.mindfulinteractive.com . : Play : . http://www.steudel.org/blog
