update fake_data_control

This commit is contained in:
谈林海 2023-03-31 18:25:28 +08:00
parent 700cc47662
commit 1ad16560d3
2 changed files with 2 additions and 9 deletions

View File

@ -40,12 +40,7 @@ class MysqlDB:
try:
with self.conn.cursor() as cursor:
cursor.execute(sql)
if state == QueryState.ALL:
data = cursor.fetchall()
elif state == QueryState.ONE:
data = cursor.fetchone()
else:
raise ValueError(f"无效的查询状态: {state}")
data = cursor.fetchall() if state == QueryState.ALL else cursor.fetchone() if state == QueryState.ONE else ...
return data
except Exception as err:
logger.error(f"查询失败: {err}")

View File

@ -23,10 +23,8 @@ class Execute:
"""
:return: 返回除内置方法外类中的所有其他方法
"""
func_list = {}
all_method = inspect.getmembers(self, inspect.ismethod)
for name in all_method:
func_list[name[0]] = name[0] if not str(name[0]).startswith('__') else ...
func_list = {name: (name if not str(name).startswith('__') else '...') for name, method in all_methods}
return func_list
def random_int(self):