Wednesday, November 23, 2011

How to print all queries in Magneto

How to print all queries in Magneto Became simple

Follow the steps as per instruction

Note: Make sure that you will add the above code in local folder and back up your database

1) Open the Magento your version : lib/varien/Db/Adapter/Pdo/Mysql.php

2) Make the above setting as Yes
  protected $_debug               = true;
 protected $_logAllQueries       = true;

3)protected $_debugFile           = 'var/debug/sql.txt';

4)if it is already there then don't follow step(3)

5)Now open the local.xml and add the following code

below resources/default_setup/connection/
<profiler> 1< profiler>

6)Now open any template file or php file and add the following
$profiler = Mage::getSingleton('core/resource')->getConnection('core_write')->getProfiler();
To simply output all queries:

print_r($profiler); and check the var/debug/ folder you will get the all the selected query.

No comments:

Post a Comment

Thankyou for your Comments

LinkWithin

Blog has moved, searching new blog...