Re: [PDO] Asynchronous requests

[email protected] (Johannes Schlüter) Tue, 03 Nov 2009 11:49:40 +0100
Newsgroups php.pdo
Organization Sun Microsystems
Message-ID <1257245380.1807.61.camel@guybrush>
On Tue, 2009-11-03 at 10:11 +0100, Matteo Beccati wrote:
> Johannes Schlüter wrote:
> > having the currentarchitecture optional stuff is bad.
> 
> what do you mean by that?

Currently PDO has the PDO and PDOStatement as precise classes and this
class implementation then calls the driver's method. Drivers can add
their own messages which is solved using a __call()-like mechanism, so
the only way to check whether a method exists is by calling it and
checking the failure or by knowing what driver is being used and what
methods they provide.

To solve that one has to make PDO either an interface or an abstract
class which then can be extended with the optional/driver-specific
methods.

And even then PDO should be generic and do stuff the same way with as
many drivers as possible. That's the point of abstraction. Different
databases, client-server protocols, client libraries, ... offer
different functionality which sometimes can't be emulated properly. The
aim of abstraction is that I can - as simple as possible - switch over
from one database to another, now consider having use async switching
from psotgresql to sqlite (for whatever reason) - you have to change the
whole architecture[1].

johannes

[1] Yes, I know, the SQL statements alone will produce some trouble,
too ... oh and not sure whether async sqlite might be possible ...
-- 
Johannes Schlüter - MySQL Engineering, Connectors and Client Connectivity

Sun Microsystems GmbH, Sonnenallee 1, 85551 Kirchheim-Heimstetten
Amtsgericht München: HRB161028
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Haering