How can i get the SQL query of this?
$product = Mage::getModel('catalog/product')->load(4329)->getCategoryIds();
How can i get the SQL query of this?
$product = Mage::getModel('catalog/product')->load(4329)->getCategoryIds();
To enable the sql debugging in magento , open the file lib/Varien/Db/Adapter/Pdo/Mysql.php
in your favorite text editor. Down around line 86, you’ll see the following class variables:
/*
* Write SQL debug data to file
*
* @var bool
*/
protected $_debug = false;
/**
* Minimum query duration time to be logged
*
* @var unknown_type
*/
protected $_logQueryTime = 0.05;
/**
* Log all queries (ignored minimum query duration time)
*
* @var bool
*/
protected $_logAllQueries = false;
/**
* Add to log call stack data (backtrace)
*
* @var bool
*/
protected $_logCallStack = false;
/**
* Path to SQL debug data log
*
* @var string
*/
protected $_debugFile = 'var/debug/sql.txt';
Change the following variables :
protected $_debug = true; //false;
And
protected $_logAllQueries = true; //false;.
This is all.After running app goto sql.txt you will see all the queries .