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.
signature.asc
Description: Digital signature