Modify

Opened 4 years ago

Closed 4 years ago

#7876 closed defect (fixed)

Double quotes do not work with PostgreSQL

Reported by: max Owned by: Blackhex
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 4 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 4 years ago by pipern

  • Cc pipern added

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

comment:3 Changed 4 years ago by Blackhex

  • Resolution set to fixed
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from Blackhex. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.