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 07.20.2010

Community News: Latest Releases from PHPClasses.org

Community News: Latest PECL Releases for 04.02.2013

Community News: Packagist Latest Releases for 03.27.2014

Community News: Latest Releases from PHPClasses.org


Community Events





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


tips install zendserver deployment laravel api podcast library package update list interview opinion community release language symfony framework series introduction

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