Max Schwanekamp Fri Mar 16 03:32:08 -0400 2012
Use a logger.
Print your PHP errors to a log, and if you're in development you can log the SQL being generated too. PEAR Log works for this, or any logger with a log()
public method.
To log the SQL, do something like this:
$log = Log::singleton('file', 'my.log'); //using PEAR Log
ActiveRecord\Config::instance()->set_logging(true);
ActiveRecord\Config::instance()->set_logger($log);
Your queries will be recorded in the log file. If you're logging your exceptions to that same log, you'll see the queries leading up to the one throwing the exception.
Tiago Lapa Fri Mar 16 07:25:10 -0400 2012
Thank you very much!
(1-2/2)
Subject: Show last SQL query
Hi.
How can I print the last SQL query?
I'm getting an Exception "ActiveRecord\DatabaseException" and can't read all the SQL printed in the exception error.
Apreciate any help. Thanks