From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Greg Stark <gsstark(at)mit(dot)edu> |
Cc: | Dave Page <dpage(at)vale-housing(dot)co(dot)uk>, pgsql-hackers(at)postgresql(dot)org, Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp> |
Subject: | Re: Practical impediment to supporting multiple SSL libraries |
Date: | 2006-04-13 15:32:20 |
Message-ID: | 20060413153220.GJ7362@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Apr 13, 2006 at 11:14:57AM -0400, Greg Stark wrote:
> That could be useful for applications but I think a driver really wants to
> retain control of the flow of control. To make use of a callback it would have
> to have an awkward dance of calling whatever function gives libpq license to
> call the callback, having the callback stuff the data in a temporary space,
> then checking for new data in the temporary space, and returning it to the
> user.
We have an asyncronous interface. I was thinking like:
PQsendQuery( conn, query );
res = PQgetResult( conn );
gotenough = FALSE;
PQsetcallback( res, mycallback );
while( !gotenough )
PQconsumeinput(conn);
/* When we reach here we have at least five rows in our data structure */
sub mycallback(res,data)
{
/* stuff data in memory structure */
if( row_count > 5 )
gotenough = TRUE;
}
If you set non-blocking you can even go off and do other things while
waiting. No need for temporary space...
Does this seem too complex?
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2006-04-13 15:33:36 | Re: Practical impediment to supporting multiple SSL libraries |
Previous Message | Martijn van Oosterhout | 2006-04-13 15:23:04 | Re: Practical impediment to supporting multiple SSL libraries |