1
0
mirror of https://github.com/moparisthebest/SickRage synced 2025-01-07 11:58:01 -05:00

fix for recent sql errors around connection object

This commit is contained in:
echel0n 2014-06-05 02:13:29 -07:00
parent 7e5cc8c673
commit 8fbd9155d3

View File

@ -126,7 +126,6 @@ class DBConnection:
while attempt < 5: while attempt < 5:
try: try:
with self.connection as trans: with self.connection as trans:
for qu in querylist: for qu in querylist:
if len(qu) == 1: if len(qu) == 1:
@ -142,8 +141,8 @@ class DBConnection:
return sqlResult return sqlResult
except sqlite3.OperationalError, e: except sqlite3.OperationalError, e:
sqlResult = [] sqlResult = []
if trans.connection: if self.connection:
trans.rollback() self.connection.rollback()
if "unable to open database file" in e.args[0] or "database is locked" in e.args[0]: if "unable to open database file" in e.args[0] or "database is locked" in e.args[0]:
logger.log(u"DB error: " + ex(e), logger.WARNING) logger.log(u"DB error: " + ex(e), logger.WARNING)
attempt += 1 attempt += 1
@ -152,8 +151,8 @@ class DBConnection:
raise raise
except sqlite3.DatabaseError, e: except sqlite3.DatabaseError, e:
sqlResult = [] sqlResult = []
if trans.connection: if self.connection:
trans.rollback() self.connection.rollback()
logger.log(u"Fatal error executing query: " + ex(e), logger.ERROR) logger.log(u"Fatal error executing query: " + ex(e), logger.ERROR)
raise raise