Prepared PDO messages that do not emulate

I've read several times that by default PDO doesn't use its own prepared statements, but prefers to mimic them. To include true prepared statements, you can add:

$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);

      

I've also read that this is the case for MySQL, but not PostgreSQL.

One place I really expected to read is the PHP website, but I don't mention it at all.

The closest I can find from http://php.net/manual/en/pdo.prepare.php :

PDO will emulate prepared statements / bound options for drivers that do not support them, and may also overwrite name or question style option markers to something more appropriate if the driver supports one style but not the other.

At http://www.php.net/manual/en/ref.pdo-mysql.php it says:

PDO_MYSQL will use the built-in operator support introduced in MySQL 4.1 and later. If you are using an older version of the mysql client libraries, PDO will mimic them for you.

Personally, I prefer to use true prepared statements, so it's easy enough to fix, especially in 2017 when the database support is pretty good.

This begs the question: where is it documented what PDO default fit prepares? Also, does this apply to all databases or some?

Note. There is an existing question. Does PDO use emulated prepared statements by default? ... This is not a duplicate (I read this already):

  • Question 5 years
  • Links are dead
  • There is dissent in the comments.

This question doesn't tell me where it is actually documented.

+3
php pdo prepared-statement


source to share


No one has answered this question yet

See similar questions:

ten
Does PDO use emulated prepared statements by default?

or similar:

558
Are PDO prepared statements sufficient to prevent SQL injection?
111
PDO MySQL: use PDO :: ATTR_EMULATE_PREPARES or not?
93
PDO support for multiple queries (PDO_MYSQL, PDO_MYSQLND)
ten
Does PDO use emulated prepared statements by default?
7
PDO, Mysql and Native Prepared Statements
6
Are instructions from the support server prepared with PDO?
five
Can I use real prepared statements for MySQL with PDO now?
4
Why does emulation of a prepared statement fail with Null?
4
PDO :: ATTR_EMULATE_PREPARES => false
3
Why PDO :: ATTR_EMULATE_PREPARES => TRUE returns all values ​​as strings



All Articles
Loading...
X
Show
Funny
Dev
Pics