1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 18:53:21 +01:00

Improve compatibility of DownloadArchive (#3078)

Other programs can add additional columns to the table without affecting
gallery-dl
This commit is contained in:
ClosedPort22 2022-10-21 21:56:40 +08:00 committed by GitHub
parent 300bc03deb
commit 455e34113e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -790,11 +790,11 @@ class DownloadArchive():
try:
self.cursor.execute("CREATE TABLE IF NOT EXISTS archive "
"(entry PRIMARY KEY) WITHOUT ROWID")
"(entry TEXT PRIMARY KEY) WITHOUT ROWID")
except sqlite3.OperationalError:
# fallback for missing WITHOUT ROWID support (#553)
self.cursor.execute("CREATE TABLE IF NOT EXISTS archive "
"(entry PRIMARY KEY)")
"(entry TEXT PRIMARY KEY)")
def check(self, kwdict):
"""Return True if the item described by 'kwdict' exists in archive"""
@ -807,4 +807,4 @@ class DownloadArchive():
"""Add item described by 'kwdict' to archive"""
key = kwdict.get(self._cache_key) or self.keygen(kwdict)
self.cursor.execute(
"INSERT OR IGNORE INTO archive VALUES (?)", (key,))
"INSERT OR IGNORE INTO archive (entry) VALUES (?)", (key,))