Re: [PHP-WEBMASTER] Can you tell me the detailed difference between PDO and Mysql_connect?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/4/21 éçäåååç-çææ <wangxiaoming.bj@xxxxxxxxxx>

> Dear PHP Officer,
>
> From China.
> I have heard of PDO extension for more than one year, but I havn't test the
> difference between PDO and Mysql_connect.
> I search a very long time for other programers' test report from google,
> but failed. There isn't any wholeside report of it.
> Only anyone said that PDO has a more efficiency when high concurrent.
>
> I have no idea about more detail of PDO. Can you give me a list about it? I
> mean, I want a roughly list, describing what efficiency is about PDO when
> compare with Mysql?
>
> Sorry for my poor English. and wait for your reply.
>
> Your Sincely......
>
> Steven.
> 21/04/2011
>
>
> --
> PHP Webmaster List Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Hi.

first of all: security@xxxxxxx is for reporting security problems in the php
infrastructure or in the language.
php-webmaster is for reporting technical problems about the
php.netinfrastructure.
this is mentioned on the http://php.net/mailing-lists.php
none of this channels is about supporting php related questions, you should
use the "php-general" <php-general@xxxxxxxxxxxxx> for that.
please watch out for that in the future.

about mysql vs PDO:

You should check out the documentation,
http://hu.php.net/manual/en/intro.pdo.php is a good start.
Basically the PDO extension is a lightweight abstraction/wrapper layer which
tries to provide a consistent interface for multiple database through
drivers: http://hu.php.net/manual/en/pdo.drivers.php

the mysql and mysqli extension only exports the functionality of the
libmysql, the mysql PDO driver does the same, but transforms that into the
PDO generic interface.
with PHP 5.3 and the introduction of mysqlnd things got a little bit
complicated, you can now use the mysqlnd extension instead of the libmysql
and if you do, then every mysql extension (mysql, mysqli, PDO mysql driver)
will use that AFAIK.
I don't know which PHP version do you use, but a few advice:
you should use the mysqli extension over the mysql extension (mysqli_connect
over mysql_connect), but in the performance point of view, mysqli can be
always a little bit faster than PDO mysql, because they use the same
underlying lib, but PDO does more abstraction over it.
but the performance hit isn't too much either:
http://jonathanrobson.me/2010/06/mysqli-vs-pdo-benchmarks

Tyrael

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux