Skip site navigation (1) Skip section navigation (2)

Async PQgetResult() question.

From: Matthew Hagerty <mhagerty(at)voyager(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Async PQgetResult() question.
Date: 2001-07-07 03:09:40
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers

I'm working with pqlib in asynchronous mode and I have a question about 
PQgetResult.  I have this situation:

submit a query via PQsendQuery()
flush to the backend with PQflush()

set my read descriptor on the socket and enter a select()

select returns read_ready on the socket, so call PGconsumeInput()
PQisBusy() returns zero, so call PQgetResult()
PQgetResult() returns a pointer so do whatever with the result
call PQclear() on the result

Now what do I do?  The docs say that in async mode that PQgetResult() must 
be called until it returns NULL.  But, how do I know that calling 
PQgetResult() a second, third, fourth, etc. time will not block?  When 
PQisBusy() returns zero, does that mean that PQgetResult() is guaranteed 
not to block for all results, i.e. until it returns NULL and a new query is 



pgsql-hackers by date

Next:From: Lincoln YeohDate: 2001-07-07 08:17:57
Subject: Re: [GENERAL] Vacuum and Transactions
Previous:From: Alex PilosovDate: 2001-07-07 01:25:09
Subject: RE: New SQL Datatype RECURRINGCHAR

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group