Thanks Bill.
I used expanded class of Zend_Db for debugging requests.
and use the following code :
$profiler = Portal_Db_Zend::getInstance()->getProfiler();
foreach ( $profiler->getQueryProfiles() as $query ) {
echo $query->getQuery() . ' '
. round( $query->getElapsedSecs(),5 );
}
I could not understand why no outstanding requests.
Today i see Zend Framework sources and found that getQueryProfiles ()
have second parameter $showUnfinished = false .
It is a pity that the documentation says nothing about that.
Currently the exceptions do not provide the SQL string as part of their content.
We have this as a feature request to develop at a later date.
http://framework.zend.com/issues/browse/ZF-1399
In the meantime, another solution might be to enable the Zend_Db_Profiler. It
can tell you the SQL statement that was executed. However, you would need to
enable the profiler before running the query.
$db->getProfiler()->setEnabled(true);
try {
$db->update(...);
} catch (Zend_Db_Exception $e) {
$p = $db->getProfiler()->getLastQueryProfile();
$sql = $p->getQuery();
echo "Problem in query: $sql\n";
}
Regards,
Bill Karwin
-----Original Message-----
Subject: [fw-general] how get query from Zend_Db in Exception
How can I get sql query from Zend_DB using update (), delete
(), insert
() in the case of Exception ?