X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E45B052861 for ; Fri, 3 Jun 2005 10:56:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65061-08 for ; Fri, 3 Jun 2005 13:56:27 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) by svr1.postgresql.org (Postfix) with ESMTP id E8E7B52851 for ; Fri, 3 Jun 2005 10:56:25 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 69so295236wra for ; Fri, 03 Jun 2005 06:56:30 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=mwQB15dgaWcxP/Ou1eooq4kOVwBbv/vEVlQKkV1lgBfQBJYdJudLczQ3gjivsUP6tdmA24ih5BvPlWi1nvXXC2Y8dZd0B+fAjbixuwlDeMK8WC7fIu/mdJ7TlaV/cAmx1aAkDgDiGe4iW53XfLc0JcR/+rwHki/9YjhqyKejYUY= Received: by 10.54.13.66 with SMTP id 66mr1128414wrm; Fri, 03 Jun 2005 06:55:51 -0700 (PDT) Received: by 10.54.30.45 with HTTP; Fri, 3 Jun 2005 06:55:51 -0700 (PDT) Message-ID: <7104a73705060306553672f56a@mail.gmail.com> Date: Fri, 3 Jun 2005 16:55:51 +0300 From: Volkan YAZICI Reply-To: Volkan YAZICI To: Terry Lee Tucker Subject: Re: libpq, blocking/nonblocking mechanism Cc: PostgreSQL Interfaces In-Reply-To: <200506011510.10371.terry@esc1.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <7104a737050528133410045f04@mail.gmail.com> <200505310651.54505.terry@esc1.com> <7104a7370506011118270bf58f@mail.gmail.com> <200506011510.10371.terry@esc1.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.176 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/5 X-Sequence-Number: 5573 Hi, On 6/1/05, Terry Lee Tucker wrote: > PQsetnonblocking() causes PQsendQuery to send an sql string to the backen= d > and it returns immediately if you have set nonblocking to true. If you ha= ve > not set nonblocking to true, then PQsendQuery behaves just like PQexec; i= t > blocks, i.e., it waits for the query, update, delete, or whatever to comp= lete > before it returns program control back to your program. We set nonblockin= g to > True in our application and when the user queries a large table that coul= d > return thousands of records, we use PQsendQuery instead of PQexec; howeve= r, > if you do that, then you have to use PQconsumeInput and PQisBusy in > conjunction with a select statement to monitor the backend connection soc= ket > so you can process the results when the query finishes. Another reason fo= r > using asynchronous queries is that you can provide a mechanism for the us= er > 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.