summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xupdate_sharing.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/update_sharing.py b/update_sharing.py
index e78e13f..0995114 100755
--- a/update_sharing.py
+++ b/update_sharing.py
@@ -49,8 +49,13 @@ def main():
(hashvalue,)).fetchall()
print("processing hash %s with %d entries" % (hashvalue, len(rows)))
pkgdict = compute_pkgdict(rows)
- conn.execute("INSERT OR IGNORE INTO duplicate (cid) VALUES (?);",
- *[(row[1],) for row in rows])
+ for row in rows:
+ cid = row[1]
+ already = conn.scalar("SELECT cid FROM duplicate WHERE cid = ?;",
+ (cid,))
+ if not already:
+ conn.execute("INSERT INTO duplicate (cid) VALUES (?);",
+ (cid,))
process_pkgdict(conn, pkgdict)
if __name__ == "__main__":