有没有办法查看准备好的查询,因为它将在数据库上执行? [英] Is there a way to see a prepared query as it will be executed on the database?

查看:58
本文介绍了有没有办法查看准备好的查询,因为它将在数据库上执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
PDO准备语句

Possible Duplicate:
PDO Prepared Statements

我在PHP中使用mysqli扩展名,我想知道有没有办法查看准备好的查询,因为它将在服务器上执行,例如查询是这样的

I'm using the mysqli extension in PHP and I'm wondering, is there possibly any way to see a prepared query as it will be executed on the server, e.g. The query is something like this

select * from table1 where id = ? and name = ?

但是我想在值填写后看到查询,像这样:

but I want to see the query after the values are filled in, like this:

select * from table1 where id = 20 and name = "John"

推荐答案

重复的 PDO准备语句

Duplicate of PDO Prepared Statements

简短的回答:没有.准备好的查询将永远不会转换为您期望的查询.它直接由数据库服务器执行.您可以使用mysql的查询日志或PDO的未记录功能debugDumpParams,但这两者只是近似值.

Short answer: no. A prepared query will never be converted to the query you expect. It's executed directly by the database server. You can use mysql's query log or PDO's undocumented function debugDumpParams, but both are just approximations.

这篇关于有没有办法查看准备好的查询,因为它将在数据库上执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆