Brent, it sounds like this solution/idea of yours will work, but there's
some hacking to make it work.
Yes, a cleaner technique for suspending the page from within the domain
handler and completing it would be nice.
Basically, what I'd need is the ability to specify that once a certain
event occurs (eg: the sql query completes), that a specific procedure be
called with the socket passed to it, so that proc can return the completed
html for the page.
This gets a little bit tricky if there are several conditionally-effect SQL
queries (eg: query1 determines what query2 is), but should be doable.
|--------+------------------------------>
| | Brent Welch |
| | <welch@ajubasolution|
| | s.com> |
| | |
| | 07/24/00 03:33 PM |
| | |
|--------+------------------------------>
>--------------------------------------------------------------------------------------------------------------------------------------|
|
|
| To: "John Buckman" <[EMAIL PROTECTED]>
|
| cc: [EMAIL PROTECTED]
|
| Subject: Re: async page rendering for SQL ?
|
>--------------------------------------------------------------------------------------------------------------------------------------|
There is an Httpd_Suspend call that mostly just turns off the
fileevents on the socket. If you call that and then return from
your domain handler, then the request will just hang around until
you ultimately call Httpd_ReturnData or Httpd_ReturnFile.
Unfortunately, the standard domain handers don't have any protocol
that understands this. One idea is to use a special error code,
much like the "HTTPD_REDIRECT" error code used to trigger page requests.
Assume you set up some event that will complete your page,
suppose you could
return -code error -errorCode HTTPD_SUSPEND
to unwind the current page. Then, augment the back-stop in Url_Dispatch
to understand this error code and call Httpd_Suspend, and it might work
nicely.
I'll append a patch, but take it with a grain of salt - not much testing
has been done on it.
>>>"John Buckman" said:
> We're completing our own Tcl-to-SQL library, and have the opportunity of
> implementing the SQL library with async-calls.
>
> So, for example, a SQL select query would have some --code "..."
associated
> with it, that runs once the SQL select query completes
>
> The reason I bring this up here, is that instead of using multithreading
> inside TclHttpd, we'd prefer to use the single-threaded version of
> TclHttpd, and pages that render asynchronously, when the operation
> completes. I have some ideas on how I could hack TclHttpd to do this,
but
> I'm wondering (Brent?) if there could be a standard mechanism for doing
> this. Perhaps one could register a page as "unfinished" and then call a
> "finisher" proc once the page was available.
>
> --
>
> About our TclDBTools library:
>
> We're using Rogue Wave's DBTools library (a commercial C++ library
> (www.roguewave.com), and it will support Oracle, ODBC, Microsoft-SQL,
> Sybase, DB2 & Informix, all native, on both Unix and Windows. We're
going
> to make the library open-source and available to all, in a few weeks.
>
>
>
-- Brent Welch <[EMAIL PROTECTED]>
http://www.ajubasolutions.com
Scriptics changes to Ajuba Solutions
scriptics.com => ajubasolutions.com
(See attached file: url.patch)
url.patch