[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[UDD] Changing aux.py to fix quoting



Hi,

since I switched to PostgreSQL 9.1 I realised that quoting "'"
characters does not work any mory by escaping it using "\" signs.
I wonder, how at all aux.py could work for others.  Because I have
the feeling that I missed something I'm just asking for comments
for the following patch to not break any UDD application.

So what do you think about this which is needed *at my machine running
testing*:

$ svn diff
Index: aux.py
===================================================================
--- aux.py      (Revision 2135)
+++ aux.py      (Arbeitskopie)
@@ -15,7 +15,7 @@
   "Quote a string for SQL and encode it to UTF-8 if it is a unicode string"
   if isinstance(s, unicode):
     s = s.encode('utf-8')
-  return "'" + s.replace("\\", "\\\\").replace("'", "\\'") + "'"
+  return "'" + s.replace("\\", "\\\\").replace("'", "''") + "'"
 
 def null_or_quote(dict, key):
   "If key is an element of dict, return it quoted. Return NULL otherwise"

Kind regards

        Andreas.

-- 
http://fam-tille.de


Reply to: