默认情况下,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.
相关文章