diff options
author | Helmut Grohne <helmut@subdivi.de> | 2013-03-26 15:59:48 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2013-03-26 15:59:48 +0100 |
commit | 88b0d1ed0809922b56f30e1ee99bc6db67af7f96 (patch) | |
tree | b736dde6602dd0006cbb0efe490d28c42cb2dc3d /update_sharing.py | |
parent | 68cf124ab5fba5f96364925e09226db5c2bbf028 (diff) | |
parent | 4326c4766a6e1fb30bdb6999922ad0620543fff0 (diff) | |
download | debian-dedup-88b0d1ed0809922b56f30e1ee99bc6db67af7f96.tar.gz |
Merge branch schemachange
Diffstat (limited to 'update_sharing.py')
-rwxr-xr-x | update_sharing.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/update_sharing.py b/update_sharing.py index dd12e5b..b45e40b 100755 --- a/update_sharing.py +++ b/update_sharing.py @@ -40,11 +40,12 @@ def process_pkgdict(cursor, pkgdict): def main(): db = sqlite3.connect("test.sqlite3") cur = db.cursor() + cur.execute("PRAGMA foreign_keys = ON;") cur.execute("DELETE FROM sharing;") readcur = db.cursor() - readcur.execute("SELECT hash FROM content GROUP BY hash HAVING count(*) > 1;") + readcur.execute("SELECT hash FROM hash GROUP BY hash HAVING count(*) > 1;") for hashvalue, in fetchiter(readcur): - cur.execute("SELECT package, filename, size, function FROM content WHERE hash = ?;", + cur.execute("SELECT content.package, content.filename, content.size, hash.function FROM hash JOIN content ON hash.cid = content.id WHERE hash = ?;", (hashvalue,)) rows = cur.fetchall() print("processing hash %s with %d entries" % (hashvalue, len(rows))) |