I've recently discovered a few things about how the mysql client library does things that seem a bit silly to me, so I'm going to share them with you.
- native prepared statements cannot take advantage of the query cache, resulting in lower performance.
- native prepared statements cannot execute certains types of queries, like "SHOW TABLES"
- native prepared statements don't correctly communicate column lengths for certain other "SHOW" queries, resulting in garbled results.
-
calling stored procedures multiple times using native prepared statements causes the connection to drop.
I recommend that you use the following attribute when working with PDO::MYSQL, available in the current PHP 5.1.3 release candidates and snapshots:
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES,
true);
This causes the PDO native query parser to …
[Read more]