diff --git a/sickbeard/db.py b/sickbeard/db.py index a56d9702..4ff56ee7 100644 --- a/sickbeard/db.py +++ b/sickbeard/db.py @@ -126,7 +126,6 @@ class DBConnection: while attempt < 5: try: - with self.connection as trans: for qu in querylist: if len(qu) == 1: @@ -142,8 +141,8 @@ class DBConnection: return sqlResult except sqlite3.OperationalError, e: sqlResult = [] - if trans.connection: - trans.rollback() + if self.connection: + self.connection.rollback() 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) attempt += 1 @@ -152,8 +151,8 @@ class DBConnection: raise except sqlite3.DatabaseError, e: sqlResult = [] - if trans.connection: - trans.rollback() + if self.connection: + self.connection.rollback() logger.log(u"Fatal error executing query: " + ex(e), logger.ERROR) raise