]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/python | |
2 | ||
3 | import os | |
4 | import sqlite3 | |
5 | import sys | |
6 | ||
7 | keys = {} | |
8 | ||
9 | for db in sys.argv[2:]: | |
10 | with sqlite3.connect(db) as sql: | |
11 | c = sql.cursor() | |
12 | for name, system, value in c.execute('select name, system, value from cache'): | |
13 | key = (name, value) | |
14 | keys[key] = keys.get(key, 0) | system | |
15 | ||
16 | db = sys.argv[1] | |
17 | with sqlite3.connect(db) as sql: | |
18 | many = [] | |
19 | for key, system in keys.items(): | |
20 | name, value = key | |
21 | many.append((name, system, value)) | |
22 | c = sql.cursor() | |
23 | c.executemany("insert into cache (name, system, value) values (?, ?, ?)", many) |