PDO MySQL: Use PDO::ATTR_EMULATE_PREPARES or not?

前端 未结 7 1943
南笙
南笙 2020-11-22 11:23

This is what I\'ve read so far about PDO::ATTR_EMULATE_PREPARES:

  1. PDO\'s prepare emulation is better for performance since MySQL\'s native prepare bypasses the
相关标签:
7条回答
  • 2020-11-22 12:01

    For the record

    PDO::ATTR_EMULATE_PREPARES=true

    It could generate a nasty side effect. It could return int values as string.

    PHP 7.4, pdo with mysqlnd.

    Running a query with PDO::ATTR_EMULATE_PREPARES=true

    Column : id
    Type :integer
    Value : 1

    Running a query with PDO::ATTR_EMULATE_PREPARES=false

    Column : id
    Type :string
    Value : "1"

    In any case, decimal values are always returned a string, regardless of the configuration :-(

    0 讨论(0)
提交回复
热议问题