[Collab-qa-commits] r1535 - udd/udd

Lucas Nussbaum lucas at alioth.debian.org
Fri Jul 24 10:59:46 UTC 2009


Author: lucas
Date: 2009-07-24 10:59:45 +0000 (Fri, 24 Jul 2009)
New Revision: 1535

Modified:
   udd/udd/lintian_gatherer.py
Log:
use executemany()

Modified: udd/udd/lintian_gatherer.py
===================================================================
--- udd/udd/lintian_gatherer.py	2009-07-24 10:33:27 UTC (rev 1534)
+++ udd/udd/lintian_gatherer.py	2009-07-24 10:59:45 UTC (rev 1535)
@@ -46,8 +46,9 @@
       AS INSERT INTO %s (package, package_type, tag, tag_type, information)
       VALUES ($1, $2, $3, $4, $5)""" % (my_config['table']))
 
-    lintian_data = open(my_config['path'])
+    lintian_data = file(my_config['path'])
     line_number = 0
+    entries = []
     for line in lintian_data:
       line_number += 1
 
@@ -64,11 +65,11 @@
         else:
           pkg_type = 'NULL'
 
-        cur.execute("EXECUTE lintian_insert (%s, %s, %s, %s, %s)"\
-          % (quote(pkg), pkg_type, quote(tag), quote(lintian_gatherer.code_to_tag_type_map[code]), quote(extra)));
+        entries.append((pkg, pkg_type, tag, lintian_gatherer.code_to_tag_type_map[code], extra))
       elif not lintian_gatherer.ignore_re.match(line):
         print "Can't parse line %d: %s" % (line_number, line.rstrip())
 
+    cur.executemany("EXECUTE lintian_insert (%s, %s, %s, %s, %s)", entries)
     cur.execute("DEALLOCATE lintian_insert")
     cur.execute("ANALYZE %s" % my_config["table"])
 




More information about the Collab-qa-commits mailing list