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):
if is_new:
self.conn.execute(
'create table seen (sha1 text(40), stamp integer, '
'primary key (sha1))')
'create table seen (path text(1024), stamp integer, '
'primary key (path))')
self.conn.commit()
def close(self):
......@@ -44,16 +44,16 @@ class FileDatabase(object):
def has(self, key):
c = self.conn.cursor()
row = c.execute(
'select stamp from seen where sha1 = ?', (key,)
'select stamp from seen where path = ?', (key,)
).fetchone()
if row:
return True
return row[0]
else:
return False
return None
def add(self, key):
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())))
self.conn.commit()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment