dsa4214 2012-06-25 19:11
浏览 27
已采纳

本地准备的陈述:它们是如此有限?

An informative-sounding blog post from 2006 states these facts about using native prepared statements in PDO:

  1. Native prepared statements cannot take advantage of the query cache, resulting in lower performance.
  2. Native prepared statements cannot execute certains types of queries, such as "SHOW TABLES".
  3. Native prepared statements don't correctly communicate column lengths for certain other "SHOW" queries, resulting in garbled results.

How much of this is still true today?

  • 写回答

2条回答 默认 最新

  • douzhenchun6782 2012-06-25 19:24
    关注

    No, this is not true if you are using a recent MySQL version. At least to the most part.

    1. Prepared statements make use of the query cache since MySQL 5.1.17.

    2. Nearly all SQL statements can be run as prepared statements. You can find a list in the MySQL docs. SHOW TABLES in particular is not in that list, but in all honestly, have you ever used that SQL statement from PHP?

    3. I don't know anything about that, but I'd assume that it is fixed.

    Don't forget that the emulation of prepared statements is not encoding-safe and as such may (depending on the exact condition) still allow SQL injections.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?
  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面