Improve compatibility of DownloadArchive (#3078)
Other programs can add additional columns to the table without affecting gallery-dl
This commit is contained in:
@@ -790,11 +790,11 @@ class DownloadArchive():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
self.cursor.execute("CREATE TABLE IF NOT EXISTS archive "
|
self.cursor.execute("CREATE TABLE IF NOT EXISTS archive "
|
||||||
"(entry PRIMARY KEY) WITHOUT ROWID")
|
"(entry TEXT PRIMARY KEY) WITHOUT ROWID")
|
||||||
except sqlite3.OperationalError:
|
except sqlite3.OperationalError:
|
||||||
# fallback for missing WITHOUT ROWID support (#553)
|
# fallback for missing WITHOUT ROWID support (#553)
|
||||||
self.cursor.execute("CREATE TABLE IF NOT EXISTS archive "
|
self.cursor.execute("CREATE TABLE IF NOT EXISTS archive "
|
||||||
"(entry PRIMARY KEY)")
|
"(entry TEXT PRIMARY KEY)")
|
||||||
|
|
||||||
def check(self, kwdict):
|
def check(self, kwdict):
|
||||||
"""Return True if the item described by 'kwdict' exists in archive"""
|
"""Return True if the item described by 'kwdict' exists in archive"""
|
||||||
@@ -807,4 +807,4 @@ class DownloadArchive():
|
|||||||
"""Add item described by 'kwdict' to archive"""
|
"""Add item described by 'kwdict' to archive"""
|
||||||
key = kwdict.get(self._cache_key) or self.keygen(kwdict)
|
key = kwdict.get(self._cache_key) or self.keygen(kwdict)
|
||||||
self.cursor.execute(
|
self.cursor.execute(
|
||||||
"INSERT OR IGNORE INTO archive VALUES (?)", (key,))
|
"INSERT OR IGNORE INTO archive (entry) VALUES (?)", (key,))
|
||||||
|
|||||||
Reference in New Issue
Block a user