diff options
Diffstat (limited to 'module/database')
-rw-r--r-- | module/database/DatabaseBackend.py | 21 | ||||
-rw-r--r-- | module/database/FileDatabase.py | 4 |
2 files changed, 22 insertions, 3 deletions
diff --git a/module/database/DatabaseBackend.py b/module/database/DatabaseBackend.py index 95bb6a198..c147aa018 100644 --- a/module/database/DatabaseBackend.py +++ b/module/database/DatabaseBackend.py @@ -233,8 +233,27 @@ class DatabaseBackend(Thread): self.c.executemany("INSERT INTO users(name, password, email) VALUES (?, ?, ?)", users) move("pyload.db", "pyload.old.db") - + + #try to lower ids + self.c.execute('SELECT max(id) FROM LINKS') + fid = self.c.fetchone()[0] + if fid: + fid = int(fid) + else: + fid = 0 + self.c.execute('UPDATE SQLITE_SEQUENCE SET seq=? WHERE name=?', (fid, "links")) + + + self.c.execute('SELECT max(id) FROM packages') + pid = self.c.fetchone()[0] + if pid: + pid = int(fid) + else: + pid = 0 + self.c.execute('UPDATE SQLITE_SEQUENCE SET seq=? WHERE name=?', (pid, "packages")) + self.c.execute('VACUUM') + def createCursor(self): return self.conn.cursor() diff --git a/module/database/FileDatabase.py b/module/database/FileDatabase.py index 3ba43f881..7ecf81576 100644 --- a/module/database/FileDatabase.py +++ b/module/database/FileDatabase.py @@ -96,7 +96,7 @@ class FileHandler: self.db.syncSave() - #---------------------------------------------------------------------- + @lock def getCompleteData(self, queue=1): """gets a complete data representation""" @@ -112,7 +112,7 @@ class FileHandler: return packs - #---------------------------------------------------------------------- + @lock def getInfoData(self, queue=1): """gets a data representation without links""" |