Simplfied repro unit test bugs #240 and #296

This is about as simple as I can make it.
Fix for bugs #240 and #296

Properly handle escaped single quote character ('') in a quoted section during query parameter substitution.