Trying to learn something new - specifically trying to choose wether to use MySQLi or PDO for future projects when working with MySQL - I stumbled upon this page which shows an overview of options available to me.

在尝试学习一些新东西时——特别是尝试在使用MySQL时选择MySQLi或PDO作为未来项目的使用——我偶然发现了这个页面,它展示了我可以使用的选项的概述。

At the bottom of this page is a table comparing functionality of the three main methods of communicating with mysql. In the row "API supports client-side Prepared Statements", it says that PDO supports this and MySQLi doesn't.

在这个页面的底部是一个比较三种主要的与mysql通信的功能的表。在“API支持客户端准备语句”行中,它说PDO支持这个,MySQLi不支持。

I know what prepared statements are. The answer to this question is a simple example of what I believe is server-side prepared statements. And PHP is a server-side language, which in turn should mean that it doesn't matter if client-side prepared statements are available or not. But that makes me wonder why that is even listed in the PHP manual then.

我知道准备好的陈述是什么。这个问题的答案是我认为服务器端准备语句的一个简单示例。PHP是一种服务器端语言,这反过来意味着客户端准备语句是否可用并不重要。但这让我想知道为什么它会出现在PHP手册中。

So what are client-side prepared statements?

那么什么是客户端准备语句呢?

3 个解决方案

#1


28

Obviously, client-side prepared statements are statements that are prepared by the client, rather than the server.

显然,客户端准备语句是由客户端而不是服务器准备的语句。

PDO is a data-access abstraction layer that supports multiple DBMS interfaces (drivers), some of which support server-side prepared statements (e.g.: MySQL 4.1+), some of which don't (e.g.: MySQL 3).

PDO是一个数据访问抽象层,它支持多个DBMS接口(驱动程序),有些支持服务器端准备语句(例如:MySQL 4.1+),有些则不支持(例如:MySQL 3)。

In the event where the PDO driver does not support server-side prepared statements, PDO will emulate them on the client-side and use the generic query interface to execute them.

在PDO驱动程序不支持服务器端准备语句的情况下,PDO将在客户端模拟它们,并使用通用查询接口执行它们。

The reason why MySQLi doesn't support them is simple: MySQLi is a MySQL-specific extension, a RDBMS that indeed supports server-side prepared statements, so there is no reason to emulate them.

sqmyli不支持它们的原因很简单:MySQLi是一个特定于mysql的扩展,是一个RDBMS,它确实支持服务器端准备语句,因此没有理由去模仿它们。

更多相关文章

  1. 如何配置使用CAS的PHP客户端--迁移文章(blogspot爱你不容易)
  2. mysqli类使用预处理语句不返回任何数据
  3. PHP判断客户端是PCweb端还是移动手机端方法
  4. PHP实现字符串转换成查询语句
  5. Mysql数据库四大特性、事物的四个隔离、基本MySQL语句、独立表空
  6. 如何使用本地phmyadmin客户端访问远程服务器?
  7. 为什么准备好的语句由每个会话管理?
  8. MYSQL必知必会-SQL语句查询
  9. MySQL客户端输出窗口显示中文乱码问题解决办法

随机推荐

  1. android控件EditText
  2. Android--Listview横向滑动
  3. WebView中的视频播放
  4. android animaltion Interpolator使用
  5. android中通过拨号键打开contacts相关界
  6. 获取RadioButton选中的值
  7. [置顶] Android Studio Android SDK Andr
  8. Android Animation(API Guides翻译)
  9. 开机自启动3
  10. android 读取联系人