mirror of
https://github.com/moparisthebest/SickRage
synced 2025-01-08 12:28:05 -05:00
Fix for scene_names table does not exist errors.
This commit is contained in:
parent
37fceb2704
commit
7e91d3a600
@ -125,7 +125,7 @@ class DBConnection:
|
|||||||
|
|
||||||
# Transaction
|
# Transaction
|
||||||
self.connection.isolation_level = None
|
self.connection.isolation_level = None
|
||||||
self.connection.execute('begin')
|
self.connection.execute('BEGIN')
|
||||||
|
|
||||||
while attempt < 5:
|
while attempt < 5:
|
||||||
try:
|
try:
|
||||||
@ -140,7 +140,7 @@ class DBConnection:
|
|||||||
logger.log(qu[0] + " with args " + str(qu[1]), logger.DEBUG)
|
logger.log(qu[0] + " with args " + str(qu[1]), logger.DEBUG)
|
||||||
sqlResult.append(self.connection.execute(qu[0], qu[1]))
|
sqlResult.append(self.connection.execute(qu[0], qu[1]))
|
||||||
|
|
||||||
self.connection.execute('commit')
|
self.connection.execute('COMMIT')
|
||||||
|
|
||||||
logger.log(u"Transaction with " + str(len(querylist)) + u" queries executed", logger.DEBUG)
|
logger.log(u"Transaction with " + str(len(querylist)) + u" queries executed", logger.DEBUG)
|
||||||
return sqlResult
|
return sqlResult
|
||||||
@ -240,6 +240,9 @@ class DBConnection:
|
|||||||
d[col[0]] = row[idx]
|
d[col[0]] = row[idx]
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
def hasTable(self, tableName):
|
||||||
|
return len(self.action("SELECT 1 FROM sqlite_master WHERE name = ?;", (tableName, )).fetchall()) > 0
|
||||||
|
|
||||||
|
|
||||||
def sanityCheckDatabase(connection, sanity_check):
|
def sanityCheckDatabase(connection, sanity_check):
|
||||||
sanity_check(connection).check()
|
sanity_check(connection).check()
|
||||||
|
@ -45,10 +45,13 @@ def retrieveNameFromCache(name):
|
|||||||
Returns: the TVDB and TVRAGE id that resulted from the cache lookup or None if the show wasn't found in the cache
|
Returns: the TVDB and TVRAGE id that resulted from the cache lookup or None if the show wasn't found in the cache
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
cache_results = None
|
||||||
|
|
||||||
# standardize the name we're using to account for small differences in providers
|
# standardize the name we're using to account for small differences in providers
|
||||||
name = sanitizeSceneName(name)
|
name = sanitizeSceneName(name)
|
||||||
|
|
||||||
cacheDB = db.DBConnection('cache.db')
|
cacheDB = db.DBConnection('cache.db')
|
||||||
|
if cacheDB.hasTable('scene_names'):
|
||||||
cache_results = cacheDB.select("SELECT * FROM scene_names WHERE name = ?", [name])
|
cache_results = cacheDB.select("SELECT * FROM scene_names WHERE name = ?", [name])
|
||||||
|
|
||||||
if cache_results:
|
if cache_results:
|
||||||
|
Loading…
Reference in New Issue
Block a user