To check all queries by a specific piece of code I am using:
Modify from protected to public the variable $_debug in Varien_Db_Adapter_Pdo_Mysql
Do the same for $_logAllQueries
Add this before code executes:
$adapter = Mage::getSingleton('core/resource')->getConnection('core_write'); $adapter->_debug = true; $adapter->_logAllQueries = true;
Add this after the code
$adapter->_debug = false; $adapter->_logAllQueries = false;
so your final code will look like this:
$adapter = Mage::getSingleton('core/resource')->getConnection('core_write'); $adapter->_debug = true; $adapter->_logAllQueries = true; Mage::getModel('catalog/product')->load(1); $adapter->_debug = false; $adapter->_logAllQueries = false;
Is there any other more elegant solution?