1. <legend id='As7c3'><style id='As7c3'><dir id='As7c3'><q id='As7c3'></q></dir></style></legend>
        <bdo id='As7c3'></bdo><ul id='As7c3'></ul>

      1. <small id='As7c3'></small><noframes id='As7c3'>

      2. <tfoot id='As7c3'></tfoot>
        <i id='As7c3'><tr id='As7c3'><dt id='As7c3'><q id='As7c3'><span id='As7c3'><b id='As7c3'><form id='As7c3'><ins id='As7c3'></ins><ul id='As7c3'></ul><sub id='As7c3'></sub></form><legend id='As7c3'></legend><bdo id='As7c3'><pre id='As7c3'><center id='As7c3'></center></pre></bdo></b><th id='As7c3'></th></span></q></dt></tr></i><div id='As7c3'><tfoot id='As7c3'></tfoot><dl id='As7c3'><fieldset id='As7c3'></fieldset></dl></div>

        如何在 zend 框架中打印精确的 sql 查询?

        时间:2023-10-03
          <bdo id='26zmx'></bdo><ul id='26zmx'></ul>
          <legend id='26zmx'><style id='26zmx'><dir id='26zmx'><q id='26zmx'></q></dir></style></legend>

            <small id='26zmx'></small><noframes id='26zmx'>

              <tbody id='26zmx'></tbody>

              • <tfoot id='26zmx'></tfoot>
                <i id='26zmx'><tr id='26zmx'><dt id='26zmx'><q id='26zmx'><span id='26zmx'><b id='26zmx'><form id='26zmx'><ins id='26zmx'></ins><ul id='26zmx'></ul><sub id='26zmx'></sub></form><legend id='26zmx'></legend><bdo id='26zmx'><pre id='26zmx'><center id='26zmx'></center></pre></bdo></b><th id='26zmx'></th></span></q></dt></tr></i><div id='26zmx'><tfoot id='26zmx'></tfoot><dl id='26zmx'><fieldset id='26zmx'></fieldset></dl></div>
                  本文介绍了如何在 zend 框架中打印精确的 sql 查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我从模型中提取了以下代码,

                  I have the following piece of code which i taken from model,

                      ...
                                    $select = $this->_db->select()
                                      ->from($this->_name)
                                      ->where('shipping=?',$type)
                                      ->where('customer_id=?',$userid);
                                   echo  $select; exit; // which gives exact mysql query.
                              .....
                  

                  当我在 zend 中使用更新查询时,

                  When i use update query in zend like ,

                  $up_value = array('billing'=> '0');
                  $this->update($up_value,'customer_id ='.$userid.' and address_id <> '.$data['address_Id']);      
                  

                  在这里我想知道确切的 mysql 查询.有没有办法在 zend 中打印 mysql 查询?善意的建议

                  Here i want to know the exact mysql query. Is there any possible way to print the mysql query in zend ? kindly advice

                  推荐答案

                  选择对象在 Zend Framework 中具有 __toString() 方法.

                  Select objects have a __toString() method in Zend Framework.

                  来自 Zend 框架手册:

                  From the Zend Framework manual:

                  $select = $db->select()
                               ->from('products');
                  
                  $sql = $select->__toString();
                  echo "$sql
                  ";
                  
                  // The output is the string:
                  //   SELECT * FROM "products"
                  

                  另一种解决方案是使用 Zend_Db_Profiler.即

                  An alternative solution would be to use the Zend_Db_Profiler. i.e.

                  $db->getProfiler()->setEnabled(true);
                  
                  // your code
                  $this->update($up_value,'customer_id ='.$userid.' and address_id <> '.$data['address_Id']); 
                  
                  Zend_Debug::dump($db->getProfiler()->getLastQueryProfile()->getQuery());
                  Zend_Debug::dump($db->getProfiler()->getLastQueryProfile()->getQueryParams());
                  $db->getProfiler()->setEnabled(false);
                  

                  http://framework.zend.com/manual/en/zend.db.select.html

                  这篇关于如何在 zend 框架中打印精确的 sql 查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 Zend 2 框架应用程序中的请求 url 上找不到页面 下一篇:Zend Framework 表单、装饰器和验证:我应该回到纯

                  相关文章

                  最新文章

                1. <tfoot id='5GKRb'></tfoot>
                2. <small id='5GKRb'></small><noframes id='5GKRb'>

                      <i id='5GKRb'><tr id='5GKRb'><dt id='5GKRb'><q id='5GKRb'><span id='5GKRb'><b id='5GKRb'><form id='5GKRb'><ins id='5GKRb'></ins><ul id='5GKRb'></ul><sub id='5GKRb'></sub></form><legend id='5GKRb'></legend><bdo id='5GKRb'><pre id='5GKRb'><center id='5GKRb'></center></pre></bdo></b><th id='5GKRb'></th></span></q></dt></tr></i><div id='5GKRb'><tfoot id='5GKRb'></tfoot><dl id='5GKRb'><fieldset id='5GKRb'></fieldset></dl></div>
                    1. <legend id='5GKRb'><style id='5GKRb'><dir id='5GKRb'><q id='5GKRb'></q></dir></style></legend>
                      • <bdo id='5GKRb'></bdo><ul id='5GKRb'></ul>