Commit fc5b1f8e by xuxu

数据库断开重连问题

parent 04c763f4
......@@ -56,11 +56,17 @@ class Database:
res = ''
if (self._conn):
try:
self._conn.ping(reconnect=True)
self._cursor.execute(sql)
res = self._cursor.fetchall()
except Exception as error:
res = False
print("query database exception,%s" % error)
self._conn.ping(reconnect=True)
try:
self._cursor.execute(sql)
res = self._cursor.fetchall()
except Exception as error:
res = False
print("query database exception,%s" % error)
return res
def sqlInsert(self,sql):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment