浏览代码

Update common database: support dict cursor

StrayWarrior 1 月之前
父节点
当前提交
d32edf8df9
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/common/database.py

+ 2 - 2
src/common/database.py

@@ -10,12 +10,12 @@ class MySQLManager:
     def __init__(self, config):
         self.config = config
 
-    def select(self, sql):
+    def select(self, sql, cursor_type=None):
         """
         sql: SQL to execute, string
         """
         conn = pymysql.connect(**self.config)
-        cursor = conn.cursor()
+        cursor = conn.cursor(cursor_type)
         cursor.execute(sql)
         data = cursor.fetchall()
         # do not handle exception