ソースを参照

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