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

问题描述

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

I stumbled upon this question from two years ago.

获胜的答案表明

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

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. Howeverthere 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准备好的语句中检索(或模拟)完整查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 08:20
查看更多