Stan, why is there a problem with quoting HTML in a db_multirow? You can just modify they subject text in the code block:
db_multirow messages get messages {
select subject, content from forums_messages
} {
set subject [ad_quotehtml $subject]
}
This example probably doesn't match the actual tables, but is a very powerful way to work with db_multirow. I haven't seen anything it could not do where I needed to put Tcl code in an adp page (yet.)