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 263DF52A93 for ; Sun, 13 Mar 2005 18:54:23 +0000 (GMT) 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 02480-07 for ; Sun, 13 Mar 2005 18:54:14 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 568C6564A1 for ; Sun, 13 Mar 2005 18:54:13 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j2DIsElI018234; Sun, 13 Mar 2005 13:54:14 -0500 (EST) To: "Rodrigo Moreno" Cc: pgsql-interfaces@postgresql.org Subject: Re: How to use PQconsumeInput and PQisBusy correctly ? In-reply-to: <20050313155643.687B23C00B@talara.terra.com.br> References: <20050313155643.687B23C00B@talara.terra.com.br> Comments: In-reply-to "Rodrigo Moreno" message dated "Sun, 13 Mar 2005 12:56:32 -0300" Date: Sun, 13 Mar 2005 13:54:14 -0500 Message-ID: <18233.1110740054@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/36 X-Sequence-Number: 5365 "Rodrigo Moreno" writes: > What's the right way to use pqconsumeinput and pqisbusy ? > The below code could be used to do that ? 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. The whole thing is a bit of a stone-age technique anyway; if you were thinking of starting a new program today you'd probably use threads in preference to an event loop. regards, tom lane