Skip to content

Commit

Permalink
database version check
Browse files Browse the repository at this point in the history
  • Loading branch information
DoTheEvo committed Sep 17, 2015
1 parent e06907f commit 39d62e7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions angrysearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 39d62e7

Please sign in to comment.