Generalize string escape method
Escape query criteria