Forum OpenACS Q&A: Asynchronous postgresql tcl interface, useful?

Is there any value to OpenACS in a tcl interface to postgresql which
permits asynchronous queries within a thread?

I ran up a SWIG interface to handle this which was much smaller and
neater than the postgresql one, and which I would have rolled into
postgresql (except they wanted to know if I'd maintain it to their
standards (whatever that means)).

It's out of date, wrt Postgresql releases, but it'd be the work of a
few hours to get it up to date, which I'll happily do iff the
aolserver interface can be written to take advantage of this in some
way.

Does the aolserver interface provide for asynch queries within a
thread?  Could it be useful to acs?

Collapse
Posted by Don Baccus on
The AOLserver Tcl API allows scripts to generate multiple threads if you want, so you can already do asynchronous queries if you need to, though it would be a bit laborious.  Each thread can grab its own db handles and query away to its heart's content if you want.

I don't think the ACS does this at all with code that hits the database.  Normally, query results are needed to return the page to the user, and there's not much the script can do but wait until the query's done before continuing its work.  I suppose it might be useful  for background or robot threads in some cases.

If you were to implement something like this, you'd want to make the Tcl API database independent.  That's one of the great things about AOLserver, and there's no point in breaking it.  Since we're thinking about supporting InterBase as well as Postgres with OpenACS, we'd be unlikely to make use of anything that wouldn't make directly to other database engines.