I have spent money on this product and I would appreciate an answer.
As noted in the heading of the community forums, EllisLab does not provide technical support in these forums. Just thought I’d mention so you do not have mistaken expectations. For your support issues as a license holder, you should post to the Technical Support forums.
The template parser does not recognize escaped quotes. e.g.
Will be read with the parameter bar set to \. It’s very flexible, but the template parser is not a full-blown scripting engine - the overhead that would be required to parse such things would be prohibitive, as it’s using using an external library (PCRE) of an interpreted language (PHP) to do these things on the fly. In your case with this type of query, using PHP as Erdal suggested, though you could greatly simplify things by using EE’s built in Database class, is one option. Another option is to not escape the quotes in the query with REPLACE, but to handle it on output, either with a plugin or with PHP in your template, operating on the contents that the query outputs.
As an aside, aren’t double quotes in CSV escaped by putting two quotes together, and not by using backslashes?