Forum OpenACS Q&A: Response to Chat moderator error

Posted by Jerry Asher on
Due to it's misuse of handles, that whole page looks screwy to me.

If a page allocates a db handle from pool n, it needs to pass that handle to any function that wants to use a handle from pool n, so all those functions that alloc their own handles from main appear to be wrong: they need to accept the handle as an input param.

from AOLserver's docs:

ns_db gethandle returns the specified number of handles from the specified pool. If poolname is not specified, the Defaultpool from the configuration file is used. If nhandles is not specified, 1 handle is returned. (Note that if you specify nhandles, you must also specify a poolname.) If not enough handles are available to fulfill the request, it waits until they are available. You must request all the handles you will need for a specific pool with one call to ns_db gethandle. You must release all your database handles explicitly (with ns_db releasehandle) before acquiring more. If you request multiple handles from the database, this function returns a Tcl list of database handles (space delimited). In this case, each handle must be released with a separate call to ns_db releasehandle.
Oh well, it's off to Vacaville for a toddler party.