From fb47d36048e94b9a506d5c153e3dd19a01e37df1 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期一, 30 十月 2023 16:30:27 +0800 Subject: [PATCH] bug修复 --- db/mysql_data.py | 14 +++++--------- 1 files changed, 5 insertions(+), 9 deletions(-) diff --git a/db/mysql_data.py b/db/mysql_data.py index ca2521e..670bb3d 100644 --- a/db/mysql_data.py +++ b/db/mysql_data.py @@ -4,16 +4,9 @@ import pymysql # 鎶婅繛鎺ュ弬鏁板畾涔夋垚瀛楀吀 +import constant -config = { - "host": "127.0.0.1", - "port": 3306, - "database": "gp", - "charset": "utf8", - "user": "root", - "passwd": "123456" -} - +config = constant.MYSQL_CONFIG class Mysqldb: # 鍒濆鍖栨柟娉� @@ -23,6 +16,9 @@ # 璋冪敤鑾峰彇娓告爣鐨勬柟娉� self.cursor = self.get_cursor() + def close(self): + self.conn.close() + # 杩炴帴鏁版嵁搴撶殑鏂规硶 def get_conn(self): # **config浠h〃涓嶅畾闀垮弬鏁� -- Gitblit v1.8.0