Fix failing tests for single quotes in strings.

Make everything use the same method for escaping. It was couple of
inline `.replace` calls before (in base and mysql drivers).