diff options
author | Harel Ben-Attia <harelba@gmail.com> | 2015-12-08 10:33:58 +0200 |
---|---|---|
committer | Harel Ben-Attia <harelba@gmail.com> | 2015-12-08 10:33:58 +0200 |
commit | 9167ea05fb56c878c33684e52c842c7ff59c42a2 (patch) | |
tree | abb041259c194832a6ab31d912e9f24c3c6df48f /bin | |
parent | 55d062b61a5b84ff8bc1ca883c452628afa417d3 (diff) |
Fixed bug in escaping double-quotes (#115) + #116
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/q | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -1271,6 +1271,10 @@ class QTextAsData(object): return q_output +def escape_double_quotes_if_needed(v): + x = v.replace('"','""') + return x + def quote_none_func(output_delimiter,v): return v @@ -1278,19 +1282,22 @@ def quote_minimal_func(output_delimiter,v): if v is None: return v t = type(v) - if t == str or t == unicode and output_delimiter in v: - return '"%s"' % (v) + if t == str or t == unicode and ((output_delimiter in v) or ('"' in v)): + return '"%s"' % (escape_double_quotes_if_needed(v)) return v; def quote_nonnumeric_func(output_delimiter,v): if v is None: return v if type(v) == str or type(v) == unicode: - return '"%s"' % (v) + return '"%s"' % (escape_double_quotes_if_needed(v)) return v; def quote_all_func(output_delimiter,v): - return '"%s"' % (v) + if type(v) == str or type(v) == unicode: + return '"%s"' % (escape_double_quotes_if_needed(v)) + else: + return '"%s"' % v class QOutputParams(object): def __init__(self, |