Not with hdbc directly but i do it with the help of the shakespeare-text package:
quickQuery cn (T.unpack
[st|select bar, baz, foo
from table1 r
inner join location l on r.locat_id = l.location_id
where r.record_id = #{pageIdxId page}
and foo > #{var1 + var2}
order by 1|]) []
Notice haskell variables and expressions in #{} placeholders.
be careful with string splicing though.
use sql escaping function with string values.
sqlEscape :: Text -> Text
sqlEscape = T.replace "'" "''"
then
[st|update foo set bar = '#{sqlEscape someString}' where recid = #{myRecId}|]
Or if you are up to the task, you can take the shakespeare-text library and add a small change to it to automatically escape all isString types.