From 12ff77e3ccda8364e0967bf5072adf3e29dd3bcc Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Wed, 28 Sep 2011 10:23:07 +0100 Subject: [PATCH] uhm, fix the file database table schema... --- client/djrandom_client/upload.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/djrandom_client/upload.py b/client/djrandom_client/upload.py index 3244797..38c6628 100644 --- a/client/djrandom_client/upload.py +++ b/client/djrandom_client/upload.py @@ -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() -- GitLab