|
@@ -73,7 +73,7 @@ class MysqlHelper(object):
|
|
|
task_id = self.connection.insert_id()
|
|
|
self.connection.commit()
|
|
|
# 关闭数据库连接
|
|
|
- self.connection.close()
|
|
|
+ # self.connection.close()
|
|
|
# 返回查询结果,元组
|
|
|
return task_id
|
|
|
except Exception as e:
|
|
@@ -85,13 +85,13 @@ class MysqlHelper(object):
|
|
|
self.cursor.execute(sql)
|
|
|
# 注意 一定要commit,否则添加数据不生效
|
|
|
self.connection.commit()
|
|
|
- self.connection.close()
|
|
|
+ # self.connection.close()
|
|
|
return True
|
|
|
except Exception as e:
|
|
|
logging.error(f"update_values异常,进行回滚操作:{e}\n")
|
|
|
# 发生错误时回滚
|
|
|
self.connection.rollback()
|
|
|
- self.connection.close()
|
|
|
+ # self.connection.close()
|
|
|
return False
|
|
|
# 关闭数据库连接
|
|
|
|