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 Releases from PHPClasses.org

Community News: Latest PECL Releases for 08.07.2012

Community News: Latest PECL Releases for 06.23.2009

Community News: Packagist Latest Releases for 02.20.2013

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


Community Events





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


interview release code podcast unittest introduction language series api refactor framework testing opinion community threedevsandamaybe wordpress list install developer laravel

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