Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I print all the queries in Magento?

Is it possible to display all the query strings in Magento? I really like to see what queries are executed.

Thanks

like image 359
Moon Avatar asked Mar 24 '10 02:03

Moon


People also ask

How do I print a collection query in Magento 2?

Save this question. Show activity on this post. $products = Mage::getModel('catalog/product') ->addAttributeToFilter('status', array('eq' => 1)); echo $products->getSelect()->__toString();

How do I print a Searchcriteriabuilder query in Magento 2?

When Magento builds a product collection, it layers the filters in one at a time so the full query is not assembled until time of collection load. You might want to do the following to force the collection to load and then print the query: $collection->getItems(); echo $collection->getSelectSql(true);


1 Answers

In Varien_Db_Adapter_Pdo_Mysql

Magento 1.4 : lib/varien/Db/Adapter/Pdo/Mysql.php

set

protected $_debug               = true;
protected $_logAllQueries       = true;

and (if nor already there) create the folder defined in

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

Give read / write permission

like image 82
Claudia Schasiepen Avatar answered Sep 29 '22 13:09

Claudia Schasiepen