Improve sql string literal escaping

Related to #630 
Yes, sounds reasonable. I will replace toString() with String.valueOf().