<small id='OzI4H'></small><noframes id='OzI4H'>

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

      <legend id='OzI4H'><style id='OzI4H'><dir id='OzI4H'><q id='OzI4H'></q></dir></style></legend>

      • <bdo id='OzI4H'></bdo><ul id='OzI4H'></ul>

        从 PDO 准备好的语句中检索(或模拟)完整查询

        时间:2023-09-19
        <legend id='LwCPj'><style id='LwCPj'><dir id='LwCPj'><q id='LwCPj'></q></dir></style></legend>
      1. <tfoot id='LwCPj'></tfoot>
            • <bdo id='LwCPj'></bdo><ul id='LwCPj'></ul>

              <small id='LwCPj'></small><noframes id='LwCPj'>

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

                1. 本文介绍了从 PDO 准备好的语句中检索(或模拟)完整查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我在两年前偶然发现了这个问题.

                  I stumbled upon this question from two years ago.

                  有没有办法在准备好的语句上调用 PDOStatement::execute() 时执行原始 SQL 字符串?出于调试目的,这将非常有用.

                  Is there a way to get the raw SQL string executed when calling PDOStatement::execute() on a prepared statement? For debugging purposes this would be extremely useful.

                  获胜答案指出

                  [...] 你也可以得到你想要的设置 PDO 属性PDO::ATTR_EMULATE_PREPARES.在这模式,PDO 将参数插入到SQL查询并发送整个执行时查询.

                  [...] You can also get what you want if you set the PDO attribute PDO::ATTR_EMULATE_PREPARES. In this mode, PDO interpolate parameters into the SQL query and sends the whole query when you execute().

                  但它没有提到如何获取结果查询字符串.我知道在性能方面这是一个坏主意,但这在调试模式下不会打扰我.有人知道怎么做吗?

                  But it doesn't mention how to get the resulting query string. I know it's a bad idea performance wise but that doesn't bother me in debug mode. Does anybody know how to do this?

                  PS 如果有什么办法可以让我重新打开/引起人们对原来两年前的话题的关注而不是打开一个新话题,请告诉我.

                  推荐答案

                  我相信这是在这个问题中引用的原始问题中提到的.然而实际上应该有一种方法来检索这些数据.

                  I believe this is mentioned in the original question that was reference in this one. However there is actually supposed to be a method for retrieving this data.

                  PDOStatement::debugDumpParams

                  然而,它目前并没有按照文档工作.这里有一个错误报告和补丁提交给它http://bugs.php.net/bug.php?id=52384 以防有人对它感兴趣.在修复之前,您似乎只能使用查询日志记录或使用 PDO::ATTR_STATEMENT_CLASS 属性设置自定义语句类.

                  However it isn't currently working as documented. There is a bug report and patch submitted for it here http://bugs.php.net/bug.php?id=52384 in case anyone is interested in voting on it. Until it's fixed it seems like you are left to use query logging or setting a custom statement class using the PDO::ATTR_STATEMENT_CLASS attribute.

                  这篇关于从 PDO 准备好的语句中检索(或模拟)完整查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:函数中的 PDO try-catch 用法 下一篇:尝试访问 bool 类型值的数组偏移量

                  相关文章

                  最新文章

                  <tfoot id='Fpd2H'></tfoot>
                2. <legend id='Fpd2H'><style id='Fpd2H'><dir id='Fpd2H'><q id='Fpd2H'></q></dir></style></legend>

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

                      <small id='Fpd2H'></small><noframes id='Fpd2H'>