OpenACS stores all it's SQL code in .xql files. At least this is the convention. Though this adds an extra burden to the development, please adhere to this standard to make it easy to support OpenACS on multiple databases.
A small reminder, all changes on an .xql file need to be followed by a reload of this file to become effective
Excemption to the rule of "No SQL code in .tcl" is when you build up your SQL query dynamically, so whenever you only have a partial SQL query, using this in tcl is fine if it is following SQL 99 standard. Usually you will find this in listbuilder, where you add the "where_clause".