pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
RES: How to use PQconsumeInput and PQisBusy correctly ?
2+ messages / 2 participants
[nested] [flat]

* RES: How to use PQconsumeInput and PQisBusy correctly ?
@ 2005-03-13 19:10  Rodrigo Moreno <rodrigo.miguel@terra.com.br>
  0 siblings, 1 reply; 2+ messages in thread

From: Rodrigo Moreno @ 2005-03-13 19:10 UTC (permalink / raw)
  To: 'Tom Lane' <tgl@sss.pgh.pa.us>; +Cc: pgsql-interfaces

Hi Tom
 
> It would work but it seems rather pointless; the only reason you would use
those functions is if you have something else > useful to do while waiting
for the query result ... and this program structure isn't very conducive to
doing other stuff > while waiting.  Usually you'd want to have a main loop
that can dispatch handling of various events, one of them being >  >
checking for an available query result.

This is only a sample to demonstrante that I want. But I have plans to do
something, in fact, it will be a win32 application , that shows a non modal
Dialog with a Cancel button and a progessbar. If user wanna cancel the
query, just press cancel button. So, I don't want allows the user to do
anything else, they can't navigate trough a program, because this will
generate another query to be submited to pg, and I don't have plans to
create another one connection for this user. So, they will wait for query to
be finish or then press cancel, that is it.

But, my question, I always should call pqconsume before a pqisbusy ? Can I
use it in a loop ? It will cause some kind of traffic ?

Best Regards
Rodrigo Moreno






^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: RES: How to use PQconsumeInput and PQisBusy correctly ?
@ 2005-03-13 19:21  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Rodrigo Moreno <rodrigo.miguel@terra.com.br>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2005-03-13 19:21 UTC (permalink / raw)
  To: Rodrigo Moreno <rodrigo.miguel@terra.com.br>; +Cc: pgsql-interfaces

"Rodrigo Moreno" <rodrigo.miguel@terra.com.br> writes:
> But, my question, I always should call pqconsume before a pqisbusy ?

Up to you.  You can always call either one safely, AFAIR.  The isbusy
result tells you whether you can call pqgetresult without blocking.
isbusy itself doesn't change any state --- to make something happen
(ie, collect data from the socket) you need to call consumeinput.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-03-13 19:21 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-03-13 19:10 RES: How to use PQconsumeInput and PQisBusy correctly ? Rodrigo Moreno <rodrigo.miguel@terra.com.br>
2005-03-13 19:21 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox