瀏覽代碼

update 二期开发

lierqiang 2 年之前
父節點
當前提交
6812521ac7
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      common/db/mysql_help_new.py

+ 3 - 3
common/db/mysql_help_new.py

@@ -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
         # 关闭数据库连接