Jade's weblog Archive

Neat trick with db_list

For OpenACS, I always wondered why someone would want to use a db_list. Here is an example, from a bug fix by Lars Pinds:

The problem was that the code said:

db_foreach select_forums { select forum_id from ... } {
    notification::request::new ...
}

which caused the db_foreach and the notification::request::new to use different database handles, which happens to mean they'll not be part of the same transaction. Hence this caused a deadlock.

I serialized the two db-calls to say

foreach forum_id [db_list select_forums {}] {
    notification::request::new ...
}

so that the db_list call returns before the foreach loop starts, causing the two to use the same transaction (or, rather, the inner call uses the active transaction).

02:49 AM, 23 Aug 2003 by Jade Rubick Permalink | Comments (0)

Today, I wed.

01:22 PM, 16 Aug 2003 by Jade Rubick Permalink | Comments (0)

Notes on using list-builder, which is an improvement on ad_table.

12:58 PM, 08 Aug 2003 by Jade Rubick Permalink | Comments (0)

XML