76 conn = sqlite3.connect(main_db)
80 c.execute(
'''SELECT * FROM Directory limit 1;''')
81 directory_row = c.fetchall()
84 rel_cmp_offset, file_cmp_offset, directory_offset, hist_cmp_offset = 0, 0, 0, 0
86 c.execute(
'''SELECT count(*) FROM ReleaseComparison;''')
87 rel_cmp_offset = c.fetchone()[0]
88 c.execute(
'''SELECT count(*) FROM RootFileComparison;''')
89 file_cmp_offset = c.fetchone()[0]
90 c.execute(
'''SELECT max(id) FROM Directory;''')
91 directory_offset = c.fetchone()[0]
92 c.execute(
'''SELECT max(id) FROM HistogramComparison;''')
93 hist_cmp_offset = c.fetchone()[0]
97 ATTACH '{0}' AS partial;
100 INSERT INTO ReleaseComparison (title, release1, release2, statistical_test)
101 SELECT title, release1, release2, statistical_test FROM partial.ReleaseComparison;
103 INSERT INTO RootFileComparison (filename1, filename2, release_comparison_id, directory_id)
104 SELECT filename1, filename2, release_comparison_id+{1}, directory_id+{3} FROM partial.RootFileComparison;
106 INSERT INTO Directory (id, name, parent_id, from_histogram_id, till_histogram_id)
107 SELECT id+{3}, name, parent_id+{3}, from_histogram_id+{4}, till_histogram_id+{4} FROM partial.Directory;
109 INSERT INTO HistogramComparison (name, p_value, directory_id)
110 SELECT name, p_value, directory_id+{3} FROM partial.HistogramComparison;
112 COMMIT;""".
format(partial_db, rel_cmp_offset, file_cmp_offset, directory_offset, hist_cmp_offset))
115 c.execute(
'''SELECT max(id) FROM RootFileComparison;''')
116 max_file_cmp_id = c.fetchone()[0]
118 return max_file_cmp_id