Re: Column info without executing query

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Volkan YAZICI <yazicivo(at)ttnet(dot)net(dot)tr>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Column info without executing query
Date: 2006-07-21 15:26:41
Message-ID: 20060721152641.GE21076@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Erik Jones 2006-07-21 15:35:17 Re: Impact of vacuum full...
Previous Message Csaba Nagy 2006-07-21 15:25:19 Re: Impact of vacuum full...