fix bug caused by null

This commit is contained in:
2021-05-05 23:32:20 +08:00
parent 5b4b6479cc
commit 25f702c3ff
2 changed files with 4 additions and 5 deletions

View File

@@ -126,7 +126,7 @@ class RSSEntry:
self.url = data[1] self.url = data[1]
self.interval = None self.interval = None
if data is not None and data[2] is not None: if data is not None and data[2] is not None:
self.interval = int(data[2]) self.interval = data[2]
self.lastupdatetime = None self.lastupdatetime = None
if data is not None and data[3] is not None: if data is not None and data[3] is not None:
self.lastupdatetime = data[3] self.lastupdatetime = data[3]

View File

@@ -165,12 +165,11 @@ PRIMARY KEY (hash)
if has_data: if has_data:
self._db.execute( self._db.execute(
f"UPDATE RSSList SET title=?, interval=? WHERE id=?;", f"UPDATE RSSList SET title=?, interval=? WHERE id=?;",
(title, ttl if ttl is not None else 'null', hashd)) (title, ttl, hashd))
else: else:
self._db.execute( self._db.execute(
f"INSERT INTO RSSList VALUES (?, ?, ?, ?, ?, null, false, 0);", f"INSERT INTO RSSList VALUES (?, ?, ?, ?, ?, null, false, 0);",
(title, url, ttl if ttl is not None else 'null', (title, url, ttl, int(time()), hashd))
int(time()), hashd))
cur = self._db.execute( cur = self._db.execute(
f'SELECT * FROM chatList WHERE id=? AND chatId=?;', f'SELECT * FROM chatList WHERE id=? AND chatId=?;',
(hashd, chatId)) (hashd, chatId))
@@ -343,7 +342,7 @@ PRIMARY KEY (hash)
return False return False
self._db.execute( self._db.execute(
f"UPDATE RSSList SET title=?, interval=?, lastupdatetime=?, errorcount=0 WHERE id=?;", f"UPDATE RSSList SET title=?, interval=?, lastupdatetime=?, errorcount=0 WHERE id=?;",
(title, ttl if ttl is not None else 'null', lastupdatetime, hashd)) (title, ttl, lastupdatetime, hashd))
cur = self._db.execute( cur = self._db.execute(
f"SELECT * FROM hashList WHERE id=?;", (hashd,)) f"SELECT * FROM hashList WHERE id=?;", (hashd,))
has_data2 = False has_data2 = False