默认情况下,PDO是否总是使用模拟的预处理语句? [英] Does PDO always use emulated prepared statements by default?

查看:50
本文介绍了默认情况下,PDO是否总是使用模拟的预处理语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PDO具有选项 PDO::ATTR_EMULATE_PREPARES ,该选项控制是否仅在不支持的情况下才模拟准备好的语句由数据库或始终.但是,它没有提及是否始终默认模拟它们.

PDO has the option PDO::ATTR_EMULATE_PREPARES which controls if prepared statements should be emulated only if not supported by the DB or always. However, it does not mention if it always emulates them by default or not.

通常,人们会假设仅在必要时才使用仿真,但是由于它是PHP,所以不能仅仅因为它是理智的就可以假设任何东西.

Usually one would assume that emulation is only used if necessary but since it's PHP nothing can be assumed just because it's sane...

推荐答案

取决于数据库驱动程序.它们是始终默认模拟对于MySql(当然,您当然可以手动关闭该选项);在Postgres中,正确的默认设置为动态检测到.

Depends on the database driver. They are always emulated by default for MySql (although of course you can turn the option off manually); in Postgres the proper default setting is detected dynamically.

这篇关于默认情况下,PDO是否总是使用模拟的预处理语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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