db配置里关于在mysql下设置emulatePrepare为true,请问这是干什么用啊?
网卡查找了PDO::ATTR_EMULATE_PREPARES这个东西,没说明白具体的用途,希望有人,帮我一下,谢谢!
db配置里关于在mysql下设置emulatePrepare为true,请问这是干什么用啊?
网卡查找了PDO::ATTR_EMULATE_PREPARES这个东西,没说明白具体的用途,希望有人,帮我一下,谢谢!
1.postgres has a particularly poor C API for communicating type
information in prepared statements.
You most likely need to add some kind of nasty cast for those statements
to work correctly, or sidestep the issue by preparing your statement
using:
$stmt = $db->prepare($sql,
array(PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT => true));
or, using the very latest snap:
$stmt = $db->prepare($sql, array(PDO::ATTR_EMULATE_PREPARES => true));
http://bugs.php.net/bug.php?id=36652
2.MySQL’s native prepared statements cannot take advantage of the Query Cache. Fortunately, in PHP 5.1.3 release and above there is a work around. Set the attribute PDO::ATTR_EMULATE_PREPARES to true.
http://www.weberdev.com/get_example-4905.html
摘抄了2部分,不知道你看见过没有?
whether to turn on prepare emulation. Defaults to false, meaning PDO will use the native prepare support if available. For some databases (such as MySQL), this may need to be set true so that PDO can emulate the prepare support to bypass the buggy native prepare support. Note, this property is only effective for PHP 5.1.3 or above.
我猜想:这都是为效率了吧。
emulatePrepare=true 配置后,将会记录查询变量值~
谢谢,明白些了
enableParamLogging
再次感谢 pangjanne Icon
呵呵,您有心了
如果强哥在,希望能再用中文解释一下