From: Mike O'Connor Date: Fri, 30 Oct 2009 14:48:45 +0000 (+0000) Subject: switch execute to executemany for insert_content_paths X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=8ba42ec97d15f469ecb6212c3d5f0664f470e0b7;p=dak.git switch execute to executemany for insert_content_paths --- diff --git a/daklib/.#dbconn.py b/daklib/.#dbconn.py new file mode 120000 index 00000000..a8c5360d --- /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 e651916a..47f4e5f2 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