nd_pdo_mysql和pdo_mysql擴展之間有什么區別?

[英]What is the difference between the nd_pdo_mysql and pdo_mysql extensions?


For some reason the PHP extension pdo_mysql on our hosted server fails to run a query that uses a mysql View, with this error message:

由於某些原因,我們托管服務器上的PHP擴展pdo_mysql無法運行使用mysql視圖的查詢,並使用此錯誤消息:

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

SQLSTATE[HY000]:一般錯誤:1615准備語句需要重新准備

of which there is discussion here:

這里有討論:

https://bugs.mysql.com/bug.php?id=42041

https://bugs.mysql.com/bug.php?id=42041

as well as numerous stackoverflow entries.

以及許多stackoverflow條目。

But for some reason the query using the View runs just fine, if we switch to connect using the extension nd_pdo_mysql, which is for MySQL Native Driver mysqlnd.

但由於某些原因,使用視圖的查詢運行良好,如果我們切換到使用擴展nd_pdo_mysql連接,這是MySQL本地驅動程序mysqlnd。

My question is: what is the difference between the two drivers and why would one typically choose one over the other?

我的問題是:這兩個司機之間的區別是什么?為什么一個人通常會選擇另一個?

Thanks.

謝謝。

1 个解决方案

#1


3  

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

要從PHP連接到MySQL服務器,有兩個版本的驅動程序:

  1. mysqlnd
  2. mysqlnd
  3. libmysql
  4. libmysql

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

為了使用mysqlnd驅動連接到MySQL服務器,需要使用nd_pdo_mysql擴展,如下面的截圖所示。

enter image description here

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.

由於libmysql將數字類型作為字符串返回,所以我使用mysqlnd和nd_pdo_mysql來獲得本機/嚴格的數據,這樣數字類型就不會作為字符串返回。

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

從MySQL官方網站:https://dev.mysql.com/downloads/connector/php-mysqlnd/

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

PHP mysqlnd的MySQL本地驅動程序是PHP腳本語言的MySQL客戶端庫libmysql的一個替代。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2017/09/25/729c5c99e3d99fbfa919dcaa31f32fe0.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com