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

查看:22
本文介绍了默认情况下,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天全站免登陆