For http://trac-hacks.org/ticket/11287 I'm working to revise how long
lists of arguments are handled in my Trac-jsgantt plugin.  I had no
problem with:

         def ownersOf(ids):
             db = self.env.get_db_cnx()
-            inClause = "IN (%s)" % ','.join(('%s',) * len(ids))
             cursor = db.cursor()
-            cursor.execute(("SELECT DISTINCT owner FROM ticket "
-                            "WHERE id " +
-                           inClause),
-                           list(ids))
+            query = "SELECT DISTINCT owner FROM ticket WHERE id IN (%s)"
+            values = []
+            for tid in ids:
+                values.append([ tid ])
+            cursor.executemany(query, values)
             owners = [row[0] for row in cursor]
             return set(owners)

but when faced with a more complex query like:

    inClause = "IN (%s)" % ','.join(('%s',) * len(owners))
    cursor.execute(("SELECT id FROM ticket "
                    "WHERE status!=%s AND owner " +
                    inClause),
                    ['closed'] + list(owners))

I don't know what to do with 'closed'.  Do I build up a list like

 [ ['closed', 'owner1'], ['closed', 'owner2'], ...]

?  That seems odd.  Alas, the source (e.g., trac/dp/util.py) provided
no insight.

                                                             Chris

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to