Asynchronous prepare
Rainer Weikusat <[email protected]> Fri, 26 Nov 2010 21:26:44 +0100
| Newsgroups | gmane.comp.db.postgresql.dbdpg |
|---|---|
| Message-ID | <[email protected]> |
I'm in the process of adding support for asynchronous server-side prepare to DBD::Pg because I need this for an application which is part of one of the products of my employer. The basic idea of operation is that the (...) complexities of the libpq asynchronous interface should remain hidden in the driver, in other words, that asychronous prepare requests should transparently happen as part of the operation of the existing asynchronous interface. My present implementation works by using a PQsendPrepare-call instead of a PQprepare call for queries supposed to be executed asynchronously. The imp_sth->async_status value is then set to '2' to indicate that an asychronous prepare is in process. This new 'magic value' is then used by the db_pg_ready subroutine to detect whether an async prepare is presently in progress and to deal with the result of that and start the actual query via PQsendQueryPrepared if the prepare has succeeded. I would be willing (and probably also allowed to) to submit this as 'feature contribution' if there was any interest in it.