Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does PDO always use emulated prepared statements by default?

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.

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...

like image 253
ThiefMaster Avatar asked May 16 '12 10:05

ThiefMaster


1 Answers

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.

like image 69
Jon Avatar answered Nov 08 '22 18:11

Jon