Re: PQisBusy() always returns TRUE

From: ntinos(at)aueb(dot)gr
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: PQisBusy() always returns TRUE
Date: 2005-01-15 21:44:20
Message-ID: courier.41E98EB5.00005257@red.servers.aueb.gr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martijn van Oosterhout writes:

> On Sat, Jan 15, 2005 at 09:50:35PM +0200, ntinos(at)aueb(dot)gr wrote:
>> PQconsumeInput(conn); //Try to collect the results
>> while (PQisBusy(conn)) // while not ready ...
>> PQconsumeInput(conn); //...retry
>>
>> res=PQgetResult(conn); // Now get the results
>>
> I belive if you're waiting in an event loop, you can use PQsocket() to
> return the fd to use in select. Or if you're doing other work, do that
> while you're waiting and check isBusy when you have time...

Well, I do use select() before calling PQconsumeInput, but I'm not sure what
an event loop would be like.I have more than one (remotly executed) queries
and I want to pick whatever results are available without being blocked (and
even abord a delaying query), i.e. I do have other work to do. Having said
that, I think that an event loop would be appropriate but I'm a little
confused on its structure. Any pointers?

Thanks,
Ntinos Katsaros

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Berteun Damman 2005-01-15 21:56:50 Re: Pgsql taking a *lot* of CPU time (unkillable).
Previous Message Bruce Momjian 2005-01-15 21:42:58 Re: OID Usage