Asynchronous queries with callbacks.

From: Вячеслав Блинников <slavmfm(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Asynchronous queries with callbacks.
Date: 2011-01-05 18:04:43
Message-ID: AANLkTinLp0Xe4dMapTGAsgKz_kRYa=+-2MHWKLERxgPQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello!
I connect to PostgreSQL database in my C++ program via libpq and I need to
implement the function like "void SendQuery(char* queryString, void
(*callback)(void*))" which will .
But how to bind the callback function data (and some parameters) to database
request?
I intended to put queries into queue (along with callback and param data)
and after fetching each result via "PQgetResult()" obtain callback and param
from the queue, but documentation says that "PQexec can return only one
PGresult structure. If the submitted query string contains multiple SQL
commands, all but the last PGresult are discarded by PQexec." so it is
impossible to organize a queries queue because some queries will return more
than one results and it will shift the "callbacks and params" queue.
Is it possible to implement? Or there is only one way - send queries
one-by-one?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Geoghegan 2011-01-05 18:11:01 Re: Asynchronous queries with callbacks.
Previous Message Scott Ribe 2011-01-05 17:48:37 Re: *****SPAM***** Re: UUID column as pimrary key?