diff --git a/ext_open/searcher.py b/ext_open/searcher.py index d49a61f..62a5064 100644 --- a/ext_open/searcher.py +++ b/ext_open/searcher.py @@ -53,8 +53,10 @@ class Searcher: self.cur.execute('SELECT * FROM ? WHERE name LIKE ?;',[self.ext,query]) return self.cur.fetchall() def clean(self,backhistory): - pass - # TODO + self.cur.execute('SELECT update_time FROM updates WHERE ext=? ORDER BY update_time DESC LIMIT ?;',[backhistory+1]) + res = self.cur.fetchall() + threshold = res[-1][0] + cur.execute('DELETE FROM {} WHERE update_time < ?;'.format(self.ext),[threshold]) if __name__ == "__main__": init_db() s = Searcher('py')