klompdb: replace an empty query with 1=1
klompdb: assert that only subquery and close parens can be at the end of the query
klompdb: trim query