[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master 09/16] switch execute to executemany for insert_content_paths



---
 daklib/.#dbconn.py |    1 +
 daklib/dbconn.py   |   15 ++++++++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)
 create mode 120000 daklib/.#dbconn.py

diff --git a/daklib/.#dbconn.py b/daklib/.#dbconn.py
new file mode 120000
index 0000000..a8c5360
--- /dev/null
+++ b/daklib/.#dbconn.py
@@ -0,0 +1 @@
+stew@flotow.debconf.org.25417:1240153710
\ No newline at end of file
diff --git a/daklib/dbconn.py b/daklib/dbconn.py
index e651916..47f4e5f 100755
--- a/daklib/dbconn.py
+++ b/daklib/dbconn.py
@@ -611,11 +611,16 @@ def insert_content_paths(binary_id, fullpaths, session=None):
     try:
         # Insert paths
         pathcache = {}
-        for fullpath in fullpaths:
-            if fullpath.startswith( './' ):
-                fullpath = fullpath[2:]
 
-            session.execute( "INSERT INTO bin_contents ( file, binary_id ) VALUES ( :filename, :id )", { 'filename': fullpath, 'id': binary_id}  )
+        def generate_path_dicts():
+            for fullpath in fullpaths:
+                if fullpath.startswith( './' ):
+                    fullpath = fullpath[2:]
+
+                yield {'fulename':fullpath, 'id': binary_id }
+
+        session.execute( "INSERT INTO bin_contents ( file, binary_id ) VALUES ( :filename, :id )",
+                         generate_path_dicts() )
 
         session.commit()
         if privatetrans:
@@ -1244,7 +1249,7 @@ def insert_pending_content_paths(package,
             pca.file = fullpath
             pca.architecture = arch_id
 
-            if isudeb: 
+            if isudeb:
                 pca.type = 8 # gross
             else:
                 pca.type = 7 # also gross
-- 
1.6.5



Reply to: