dongwei3866 2013-12-01 14:43
浏览 47
已采纳

获取 - 调试SQL查询 - Magento

How can i get the SQL query of this?

$product = Mage::getModel('catalog/product')->load(4329)->getCategoryIds();
  • 写回答

3条回答 默认 最新

  • doue9730 2013-12-02 05:33
    关注

    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 .

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?