I wouldn't call that better. I'd much rather have a self escaping sql literal, something like:
var query = "select id, name from table where id = #{id:int}" var query = "select id, name from table where id = #{id:int}"