nd_pdo_mysql和pdo_mysql扩展之间有什么区别? [英] What is the difference between the nd_pdo_mysql and pdo_mysql extensions?

查看:135
本文介绍了nd_pdo_mysql和pdo_mysql扩展之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某种原因,我们托管服务器上的 pdo_mysql PHP扩展无法运行带有此错误消息的使用MySQL视图的查询.

For some reason the pdo_mysql PHP extension, on our hosted server, fails to run a query that uses a MySQL view, with this error message.

SQLSTATE [HY000]:常规错误:1615准备的语句需要重新准备

SQLSTATE[HY000]: General error: 1615 Prepared statement needs to be re-prepared

(关于 Bug#42041的讨论,当MySQL-Server失败时,Prepared-Statement失败负载,以及有关堆栈溢出的众多问题.)

(There is a discussion on Bug #42041 Prepared-Statement fails when MySQL-Server under load, as well as numerous questions on Stack Overflow.)

由于某种原因,如果我们切换到使用 nd_pdo_mysql 扩展名(用于MySQL本机驱动程序( mysqlnd )),则使用视图的查询运行得很好.

For some reason, the query using the view runs just fine, if we switch to using the nd_pdo_mysql extension, which is for the MySQL Native Driver (mysqlnd).

pdo_mysql nd_pdo_mysql 有什么区别?为什么要选择一个而不是另一个?

What is the difference between pdo_mysql and nd_pdo_mysql? Why would one be chosen over the other one?

谢谢.

推荐答案

要从PHP连接到MySQL服务器,有两种版本的驱动程序:

To connect to your MySQL server from PHP, there are two versions of drivers:

  1. mysqlnd
  2. libmysql
  1. mysqlnd
  2. libmysql

要使用mysqlnd驱动程序连接到MySQL服务器,请使用nd_pdo_mysql扩展名,如下面的屏幕截图所示.

In order to connect to your MySQL server using mysqlnd driver, you use the nd_pdo_mysql extension, as seen in below screenshot.

由于libmysql以字符串形式返回数字类型,因此我将mysqlndnd_pdo_mysql一起使用以获取本机/严格数据,因此以字符串形式返回数字类型.

Since libmysql returns numeric types as strings, I use mysqlnd with nd_pdo_mysql in order to get native/strict data, so that numeric types are NOT returned as Strings.

在MySQL官方网站上: https://dev.mysql.com/downloads/connector/php-mysqlnd/

From the MySQL official website: https://dev.mysql.com/downloads/connector/php-mysqlnd/

PHP mysqlnd的MySQL本机驱动程序替代了PHP脚本语言的MySQL客户端库libmysql.

The MySQL native driver for PHP mysqlnd is a drop-in replacement for the MySQL Client Library libmysql for the PHP script language.

这篇关于nd_pdo_mysql和pdo_mysql扩展之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆