Re: [PDO] Asynchronous requests

[email protected] (Lukas Kahwe Smith) Tue, 3 Nov 2009 14:37:20 +0100
Newsgroups php.pdo
Message-ID <[email protected]>
On 03.11.2009, at 14:26, Pierre Joye wrote:

> I would rather not implement them until we actually make the necessary
> changes to support them in all drivers, as long as a backend supports
> this given feature. We have to keep in mind that PDO does not aim to
> be a new native layer but to provide a common API to access all
> supported databases in portable way (from an API point of view, at
> least).


Well, but that means you cannot use PDO if you do want to use some of  
these features. This cannot be the long term vision. The long term  
vision imho must be to get rid of the old extensions (even if only in  
PHP7). Way back then I was hoping that we could cast PDO connections  
so that they could be used with the native extensions as a fallback,  
but this was apparently not possible. So I see no way around making it  
possible to provide such functionality inside PDO.

Lets think things further. We get a new driver that works with an  
RDBMS that doesnt support transactions .. or doesnt support  
autoincrement/sequences. I think we have to accept that not all  
drivers will support all features provided by PDO. What we do need to  
make sure is that there is proper error handling in place for this  
situation and that these issues are sufficiently documented.

To me the question is just when a feature is ready to become part of  
the unified layer and how to deal with features we are not yet sure  
about.

like with async .. lets say for now we are not yet sure enough about a  
unified API so we prefix:
PDO_MySQL::mysqlAsyncQuery()
PDO:PgSQL::pgsqlAsyncQuery()

one day we become more comfortable and add it to PDO core throwing an  
error/exception if the feature is not available:
PDO::asyncQuery()

regards,
Lukas Kahwe Smith
[email protected]