Re: Column info without executing query - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Column info without executing query
Date
Msg-id 20060721152641.GE21076@svana.org
Whole thread Raw
In response to Re: Column info without executing query  (Volkan YAZICI <yazicivo@ttnet.net.tr>)
List pgsql-general
On Fri, Jul 21, 2006 at 05:47:32PM +0300, Volkan YAZICI wrote:
> > Did you see my comment about get partial result sets from libpq. for
> > asyncronous queries you can run PQftype as soon as you've received and
> > parsed the T record
>
> We can run PQftype() on what, conn->result? (We can't use a PGresult
> will be returned from a PQgetResult() in here; because, AFAIK, after
> a getRowDescriptions(), PQgetResult() still won't return a PGresult
> because of conn->asyncStatus is still PGASYNC_BUSY.) That's why I
> proposed generic methods to give user the conn->result access under
> control.

Well actually, that's exactly what you do. If you set libpq to
non-blocking mode and call PQgetResult() on an async query, it will in
fact give a result set that PQftype() works on.

Note that in this mode some functions sometimes return odd results. For
example, you only know that the query has finished executing when
PQgetResult returns a fatal error. Still, I and others have used this
technique successfully. See my mvcctest program:

http://svana.org/kleptog/pgsql/mvcctest.tar.gz

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-general by date:

Previous
From: Csaba Nagy
Date:
Subject: Re: Impact of vacuum full...
Next
From: Erik Jones
Date:
Subject: Re: Impact of vacuum full...