Skip to content
Snippets Groups Projects
Commit 7a07d32b authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

prevent wrong spliting of db

parent e86d1fee
No related branches found
No related tags found
No related merge requests found
......@@ -890,9 +890,14 @@ class OptionsParser:
con = sqlite.connect(logger.LOG_DB_FILE)
os.chdir(back)
cur = con.cursor()
cur.execute('''SELECT name FROM sqlite_master WHERE type = 'table';''')
tables = cur.fetchall() # we get [(u'jids',), (u'unread_messages',), ...
tables = [t[0] for t in tables]
cur.execute("ATTACH DATABASE '%s' AS cache" % logger.CACHE_DB_PATH)
for table in ('caps_cache', 'rooms_last_message_time', 'roster_entry',
'roster_group', 'transports_cache'):
if table not in tables:
continue
try:
cur.executescript(
'INSERT INTO cache.%s SELECT * FROM %s;' % (table, table))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment