Skip to content
Snippets Groups Projects
Commit 12ff77e3 authored by ale's avatar ale
Browse files

uhm, fix the file database table schema...

parent 0e247456
Branches
No related tags found
No related merge requests found
...@@ -34,8 +34,8 @@ class FileDatabase(object): ...@@ -34,8 +34,8 @@ class FileDatabase(object):
if is_new: if is_new:
self.conn.execute( self.conn.execute(
'create table seen (sha1 text(40), stamp integer, ' 'create table seen (path text(1024), stamp integer, '
'primary key (sha1))') 'primary key (path))')
self.conn.commit() self.conn.commit()
def close(self): def close(self):
...@@ -44,16 +44,16 @@ class FileDatabase(object): ...@@ -44,16 +44,16 @@ class FileDatabase(object):
def has(self, key): def has(self, key):
c = self.conn.cursor() c = self.conn.cursor()
row = c.execute( row = c.execute(
'select stamp from seen where sha1 = ?', (key,) 'select stamp from seen where path = ?', (key,)
).fetchone() ).fetchone()
if row: if row:
return True return row[0]
else: else:
return False return None
def add(self, key): def add(self, key):
c = self.conn.cursor() c = self.conn.cursor()
c.execute('insert or replace into seen (sha1, stamp) values (?, ?)', c.execute('insert or replace into seen (path, stamp) values (?, ?)',
(key, int(time.time()))) (key, int(time.time())))
self.conn.commit() self.conn.commit()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment