From 90a4d135e281c371bfd874afc6d4cf929d441f5e Mon Sep 17 00:00:00 2001 From: xaoyaoo Date: Sun, 10 Dec 2023 12:53:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pywxdump/wx_info/merge_db.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pywxdump/wx_info/merge_db.py b/pywxdump/wx_info/merge_db.py index f5b2173..0f80080 100644 --- a/pywxdump/wx_info/merge_db.py +++ b/pywxdump/wx_info/merge_db.py @@ -189,12 +189,16 @@ def execute_sql(connection, sql, params=None): - sql:要执行的SQL语句 - params:SQL语句中的参数 """ - cursor = connection.cursor() - if params: - cursor.execute(sql, params) - else: - cursor.execute(sql) - return cursor.fetchall() + try: + cursor = connection.cursor() + if params: + cursor.execute(sql, params) + else: + cursor.execute(sql) + return cursor.fetchall() + except Exception as e: + print(f"**********\nSQL: {sql}\nparams: {params}\n{e}\n**********") + return None