Thanks
I did build something similar (although in python and with some other hard requirements).
My problem, and seems that your experience it too, is that the users will never know that the query is invalid. They will get a result for sure, but the SQL could be totally wrong.