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

Site News: Job Postings for the week of 08.22.2010

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

Community News: Packagist Latest Releases for 01.11.2013

Community News: Latest PECL Releases for 12.27.2011

Community News: Latest PEAR Releases for 08.24.2009


Community Events





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


composer framework laravel install voicesoftheelephpant interview release package version security opinion update community library podcast language introduction tool symfony series

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