On 1/24/14, 1:03 PM, Arvids Godjuks wrote:
> The PDO. This is something that needs so much improvement that it's
> ridicilous it has survived till this time. I use Yii framework as my tool,
> they use PDO as their base. I have considered many times to integrate a
> mysqli to PDO wrapper to bring things like mysqli_ping, unbuffered queries
> and lost more. At this point I can do without those things because I do not
> have a lot of load on my projects, but they are growing and at some point
> abandoning the PDO will be a nesesity due to it's lack of features.
> I think PDO is a bad idea for PHP as a whole. We are better of with a
> consisten API through the native drivers and maybe a PDO like thing that
> gives us data objects, but still provides ability to get to the low level
> stuff that is sometimes needed. PHP lately has moved to projects that
> previosly where done on Java and some other move advanced tech. And lack of
> frameworks using the native drivers is kind'a bad, because in really
> advanced projects you have to create your own framewok...
But note, if you blindly switch from PDO to mysqli, which in turn
usually means moving from client-side prepares to server-side prepares,
chances are you are going to take a significant performance hit. Like I
said, it means two extra network roundtrips per sql query and for one
large project I worked on that meant an extra 40ms latency per web request.
So I don't think PDO is a bad idea. Having a single source of common
functionality needed by all DB drivers makes sense. Imagine if every
lower-level driver needed to implement their own client-side prepare
feature? And a consistent API across the low-level drivers isn't
feasible since each DB has a lot of specialization. It would end up
looking exactly like PDO but with a bunch of special calls for each one.
If you could bounce back and forth between PDO and the lower-level
driver easily you get the consistent API and you get access to all the
lower-level features. Also, from a migration point of view, scrapping
PDO and rewriting all the low-level drivers to be "consistent" would be
an absolute nightmare.
-Rasmus
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc