News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Davey Shafik's Blog:
Extending PDO a Waste...
September 22, 2005 @ 06:29:31

In this latest blog entry from his site, Davey Shafik talks about some troubles that one of the PDO changes that were made the other day concerning contructor overloading.

I just spent some time writing a test script to compare using PDO by extending it, and by proxying it using __call(). Let me start out by saying, when I first wrote Crtx_DB, I extended PDO, this meant you could easily fall back to native PDO calls if the Crtx_DB_DataObject CRUD automaticn wasn't working for you, without needing to instantiate another object.

Then it was decided that PDO::__construct() would be made final because if a user extended PDO and overwrote __construct() without calling parent::__construct() it caused PHP to segfault (or otherwise do bad things).

A couple of days ago, Ilia announced that the ability to extend PDO and overwrite PDO::__construct() has not been restored.

He did some testing on extending PDO versus using __call() to make the sam types of requests and found some interesting results:

Extending PDO Vs using __call() to proxy it, is approximately 5.5% slower on average, what this means is, using __call() 100 times is slower than creating 100 new database connections.

0 comments voice your opinion now!



blog comments powered by Disqus

Similar Posts

Community News: Latest PECL Releases for 03.01.2011

Community News: Recent posts from PHP Quickfix

Community News: Packagist Latest Releases for 08.10.2014

Site News: Blast from the Past - One Year Ago in PHP

Community News: Latest Releases from PHPClasses.org


Community Events

Don't see your event here?
Let us know!


conference introduction podcast interview performance example series laravel framework release opinion api symfony2 configure voicesoftheelephpant community language part2 php7 application

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework