pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Volkan YAZICI <volkan.yazici@gmail.com>
To: Terry Lee Tucker <terry@esc1.com>
Cc: PostgreSQL Interfaces <pgsql-interfaces@postgresql.org>
Subject: Re: libpq, blocking/nonblocking mechanism
Date: Fri, 3 Jun 2005 16:55:51 +0300
Message-ID: <7104a73705060306553672f56a@mail.gmail.com> (raw)
In-Reply-To: <200506011510.10371.terry@esc1.com>
References: <7104a737050528133410045f04@mail.gmail.com>
	<200505310651.54505.terry@esc1.com>
	<7104a7370506011118270bf58f@mail.gmail.com>
	<200506011510.10371.terry@esc1.com>

Hi,

On 6/1/05, Terry Lee Tucker <terry@esc1.com> wrote:
> PQsetnonblocking() causes PQsendQuery to send an sql string to the backend
> and it returns immediately if you have set nonblocking to true. If you have
> not set nonblocking to true, then PQsendQuery behaves just like PQexec; it
> blocks, i.e., it waits for the query, update, delete, or whatever to complete
> before it returns program control back to your program. We set nonblocking to
> True in our application and when the user queries a large table that could
> return thousands of records, we use PQsendQuery instead of PQexec; however,
> if you do that, then you have to use PQconsumeInput and PQisBusy in
> conjunction with a select statement to monitor the backend connection socket
> so you can process the results when the query finishes. Another reason for
> using asynchronous queries is that you can provide a mechanism for the user
> to cancel the operation.

Thanks so much for the explanation.

> Our application is X-Windows based written in C.
> All my examples are C. If you want to see any of it, you can let me know.

I'd be so appreciated to see them.

Regards.



view thread (5+ messages)

Message-ID: <7104a73705060306553672f56a@mail.gmail.com>
Permalink:  ../7104a73705060306553672f56a@mail.gmail.com/
Also on:    postgresql.org/message-id/7104a73705060306553672f56a@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: volkan.yazici@gmail.com, terry@esc1.com
  Subject: Re: libpq, blocking/nonblocking mechanism
  In-Reply-To: <7104a73705060306553672f56a@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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