Modify

Opened 13 years ago

Closed 13 years ago

#7876 closed defect (fixed)

Double quotes do not work with PostgreSQL

Reported by: max Owned by: Radek Bartoň
Priority: normal Component: DiscussionPlugin
Severity: normal Keywords:
Cc: pipern Trac Release: 0.12

Description

Need to replace double quotes with odinary. I am using TracDiscussion 0.7-r8725

Here is the patch

--- api.py      2010-10-22 14:02:46.000000000 +0400
+++ api.py.orig 2010-10-22 14:02:32.000000000 +0400
@@ -1716,7 +1716,7 @@
         values = item.values()
         sql_values = {'table' : table,
          'fields' : ', '.join(fields),
-         'values' : ', '.join(["'%s'" % to_unicode(value) for value in
+         'values' : ', '.join(["\"%s\"" % to_unicode(value) for value in
            values])}
         sql = ("INSERT INTO %(table)s "
                "(%(fields)s) "

Attachments (0)

Change History (3)

comment:1 Changed 13 years ago by max

Opps. Not so quick. Some more places:

diff -u  api.py api.py.orig 
--- api.py      2010-10-22 14:17:35.000000000 +0400
+++ api.py.orig 2010-10-22 14:02:32.000000000 +0400
@@ -1716,7 +1716,7 @@
         values = item.values()
         sql_values = {'table' : table,
          'fields' : ', '.join(fields),
-         'values' : ', '.join(["'%s'" % to_unicode(value) for value in
+         'values' : ', '.join(["\"%s\"" % to_unicode(value) for value in
            values])}
         sql = ("INSERT INTO %(table)s "
                "(%(fields)s) "
@@ -1799,7 +1799,7 @@
           'value' : to_unicode(value),
           'where' : 'WHERE ' + where if where else ''}
         sql = ("UPDATE %(table)s "
-               "SET %(column)s = '%(value)s' "
+               "SET %(column)s = \"%(value)s\" "
                "%(where)s" % (sql_values))
         self.log.debug(sql % values)
         context.cursor.execute(sql, values)
@@ -1822,7 +1822,7 @@
         fields = item.keys()
         values = item.values()
         sql_values = {'table' : table,
-         'fields' : ", ".join([("%s = '%s'" % (fields[I], to_unicode(
+         'fields' : ", ".join([("%s = \"%s\"" % (fields[I], to_unicode(
            values[I]))) for I in range(len(fields))]),
          'id' : id}
         sql = ("UPDATE %(table)s "

comment:2 Changed 13 years ago by pipern

Cc: pipern added; anonymous removed

Ah, this was confusing until I realised that the patches are backwards :-)

comment:3 Changed 13 years ago by Radek Bartoň

Resolution: fixed
Status: newclosed

Probably fixed with r9458. Please test it if you can.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Radek Bartoň.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.