... and I agree!
Each code chunk must be in its respective layer ( preferably in its own file). Meaning TCL must be in the TCL layer (.tcl files) as well ADP and SQL.
Plus, I've always preferred to use curly braces. It's even better/easier to indent code in Emacs editor.
The bad habit took place when I was learning to pass array variables within SQL blocks. Using double quotes becomes much simpler. For example:
db_foreach select_groups {
select ap.package_id, r.object_id_one as group_id, g.group_name, mr.member_state
from acs_rels r,
membership_rels mr,
groups g,
application_groups ap
where r.rel_type = 'membership_rel'
and r.object_id_two = $auth_info(user_id)
and mr.rel_id = r.rel_id
and g.group_id = r.object_id_one
and ap.group_id = g.group_id
order by lower(g.group_name)
" { ... }
As a matter of fact, I have no idea how one would pass TCL arrays within SQL blocks. Neither :authinfo(userid) nor :authinfo.userid work. Both return syntax error.
[21/Sep/2020:23:12:56][13720.7efbf356f700][-conn:qonteo:default:1:0-] Error: undefined variable 'auth_info'
: while executing
...