Code

Fuse multiple DELETE calls into one for multilinks.
authorstefan <stefan@57a73879-2fb5-44c3-a270-3262357dd7e2>
Mon, 16 Feb 2009 20:53:40 +0000 (20:53 +0000)
committerstefan <stefan@57a73879-2fb5-44c3-a270-3262357dd7e2>
Mon, 16 Feb 2009 20:53:40 +0000 (20:53 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4131 57a73879-2fb5-44c3-a270-3262357dd7e2

roundup/backends/rdbms_common.py

index f88d8ca77d98437edeec6791e53affe4f02c0156..4b3b480ec2e43f46007a41c1bfb4b32e32dcbde6 100644 (file)
@@ -944,11 +944,11 @@ class Database(FileStorage, hyperdb.Database, roundupdb.Database):
                     # XXX numeric ids
                     self.sql(sql, (int(nodeid), int(addid)))
             if remove:
-                sql = 'delete from %s where nodeid=%s and linkid=%s'%(tn,
-                    self.arg, self.arg)
-                for removeid in remove:
-                    # XXX numeric ids
-                    self.sql(sql, (int(nodeid), int(removeid)))
+                s = ','.join([self.arg]*len(remove))
+                sql = 'delete from %s where nodeid=%s and linkid in (%s)'%(tn,
+                    self.arg, s)
+                # XXX numeric ids
+                self.sql(sql, [int(nodeid)] + remove)
 
     sql_to_hyperdb_value = {
         hyperdb.String : str,