Patch for an Issue #1226đ

This commit is contained in:
Miroslav Stampar 2015-04-22 16:41:20 +02:00
parent bb98894dc1
commit a94dcf94e9

View File

@ -77,10 +77,17 @@ class Database(object):
self.connection.commit() self.connection.commit()
def execute(self, statement, arguments=None): def execute(self, statement, arguments=None):
if arguments: while True:
self.cursor.execute(statement, arguments) try:
else: if arguments:
self.cursor.execute(statement) self.cursor.execute(statement, arguments)
else:
self.cursor.execute(statement)
except sqlite3.OperationalError, ex:
if not "locked" in ex.message:
raise
else:
break
if statement.lstrip().upper().startswith("SELECT"): if statement.lstrip().upper().startswith("SELECT"):
return self.cursor.fetchall() return self.cursor.fetchall()