Re: Practical impediment to supporting multiple SSL libraries - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: Practical impediment to supporting multiple SSL libraries
Date
Msg-id 20060413153220.GJ7362@svana.org
Whole thread Raw
In response to Re: Practical impediment to supporting multiple SSL libraries  (Greg Stark <gsstark@mit.edu>)
Responses Re: Practical impediment to supporting multiple SSL libraries  (Greg Stark <gsstark@mit.edu>)
List 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@svana.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.

pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Practical impediment to supporting multiple SSL libraries
Next
From: Tom Lane
Date:
Subject: Re: two-argument aggregates and SQL 2003