問題描述
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 是否總是使用模擬準備好的語句?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!