From 39d62e707565934bd8c7b69b9b4792d5d66c103e Mon Sep 17 00:00:00 2001 From: DoTheEvo Date: Thu, 17 Sep 2015 23:55:57 +0200 Subject: [PATCH] database version check --- angrysearch.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/angrysearch.py b/angrysearch.py index 8349826..0d86b0c 100644 --- a/angrysearch.py +++ b/angrysearch.py @@ -210,6 +210,8 @@ def new_database(self): cur.execute('''CREATE VIRTUAL TABLE angry_table USING fts4(directory, path, size, date)''') + cur.execute('''PRAGMA user_version = 1;''') + self.tstart = datetime.now() for x in self.table: @@ -232,6 +234,8 @@ def new_database_lite(self): cur.execute('''CREATE VIRTUAL TABLE angry_table USING fts4(directory, path)''') + cur.execute('''PRAGMA user_version = 1;''') + self.tstart = datetime.now() for x in self.table: @@ -774,21 +778,24 @@ def readable_filesize(self, nbytes): # CHECKS THE DATABASE AGAINST SETTINGS AND IF ITS NOT EMPTY def show_first_500(self): cur = con.cursor() + + cur.execute('''PRAGMA user_version;''') + if cur.fetchone()[0] != 1: + self.tutorial() + return + cur.execute('''PRAGMA table_info(angry_table);''') d = len(cur.fetchall()) if d == 0: - self.status_bar.showMessage('0') self.tutorial() return if self.set['angrysearch_lite'] is True and d == 4: - self.status_bar.showMessage('0') self.tutorial() return if self.set['angrysearch_lite'] is False and d == 2: - self.status_bar.showMessage('0') self.tutorial() return