Received: from globe.nexus.co.uk (nexusel.demon.co.uk [158.152.30.195]) by hub.org (8.8.8/8.7.5) with SMTP id FAA26292 for ; Wed, 15 Jul 1998 05:22:23 -0400 (EDT) Received: from (plough) [192.0.0.9] (em) by globe.nexus.co.uk with smtp (Exim 1.82 #1) id 0ywNiX-0002BL-00; Wed, 15 Jul 1998 10:19:17 +0100 Sender: em Message-ID: <35AC7414.12D680B@nexus.co.uk> Date: Wed, 15 Jul 1998 10:19:16 +0100 From: Ewan Mellor Organization: Nexus Electronics X-Mailer: Mozilla 3.01 (X11; I; Linux 2.1.99 i686) MIME-Version: 1.0 To: PostgreSQL Interfaces Subject: Non-blocking queries using libpq Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I am having trouble using libpq to query my database in a non-blocking manner. My test program looks like this: #include #include main() { PGconn *conn; PGresult *res; conn = PQsetdb(NULL, NULL, NULL, NULL, "test"); PQsendQuery(conn, "select * from test_tbl"); while(PQisBusy(conn)) ; res = PQgetResult(conn); printf("%s.\n", PQgetvalue(res, 0, 0)); PQclear(res); PQfinish(conn); return 0; } First off, is this OK? (Of course, my real program does things whilst PQisBusy() and checks for errors etc.) My problem is that PQisBusy() is never returning FALSE because conn->asyncStatus is always PGASYNC_BUSY. PQisBusy() looks like this: int PQisBusy(PGconn *conn) { if (!conn) return FALSE; /* Parse any available data, if our state permits. */ parseInput(conn); /* PQgetResult will return immediately in all states except BUSY. */ return (conn->asyncStatus == PGASYNC_BUSY); } It seems to me that the call to parseInput() will never do anything because there is no way that data will be read from the backend. Is that correct? Is the user application supposed to do that? I am using a snapshot dated a month or two ago. Thanks in advance, Ewan Mellor.