Greetings,
I was reading through the docs for libpq and in the Asynchronous Query
Processing section there is mention of an example program that demonstrates
the use of select(2) to wait for the backend. I could not find the
example, does anyone have one? I understand what needs to be done, however
it is always nice to have some sort of reference program to follow.
What I am hoping to accomplish is to have my frontend accept a query, pass
it to the backend, and build the output based on the query. I would also
like the user to be able to limit the number of records (tuples) returned
and cancel the query if necessary; hence the use of the async functions and
select(2).
I know psql does this and I'm about to go poking around in its source, but
the Asynchronous Query Processing doc mentions the psql uses the PQexec
function in conjunction with PQrequestCancel, so I'm not sure if it will
give me the example I'm looking for.
If someone has a function that does what I'm looking for, hey that would be
swell ;), or just a simple example of async processing would be nice too.
Thanks,
Matthew