Re: Asynchronous queries with bound data. - Mailing list pgsql-general

From Peter Geoghegan
Subject Re: Asynchronous queries with bound data.
Date
Msg-id AANLkTi=myACs29=1EQ=pfrLHcmM6QbD7tf3vkn-4PyLc@mail.gmail.com
Whole thread Raw
In response to Asynchronous queries with bound data.  (Вячеслав Блинников <slavmfm@gmail.com>)
Responses Re: Asynchronous queries with bound data.  (Вячеслав Блинников <slavmfm@gmail.com>)
List pgsql-general
2011/1/5 Вячеслав Блинников <slavmfm@gmail.com>:
> Database connection using "libpq":
> So, generally speaking, I need:
> - send multiple queries using "PQsendQuery()" (or what else)
> - bind some data (void*) to each qeury
> - obtain results using "PQgetResult()" (or what else) and to know which data
> is bound to each result (correspondence between queries and results)
> How it can be implemented?

You cannot "bind" data to a query. You cannot execute two queries in
parallel with one connection. However, PGresults exist totally
independently or the connection or thread that originated them, so
feel free to stash them as you see fit.

libpq usually operates within the same thread context as the client
application, so in general it doesn't make sense to pass a function
pointer (which you suggested in a slightly earlier mail to the list)
that will be called back asynchronously like a signal handler.
Asynchronous command processing just exists as a way to keep a GUI
responsive and things like that, because PQExec() blocks.

Maybe it would help if you stepped back and described your problem in
broader terms.

--
Regards,
Peter Geoghegan

pgsql-general by date:

Previous
From: Alex Hunsaker
Date:
Subject: Re: How to build plperl with PostgreSQL 9 on Windows
Next
From: Scott Ribe
Date:
Subject: Re: *****SPAM***** Re: UUID column as pimrary key?