11
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import aiomysql
|
||||
|
||||
from astrbot.api import logger
|
||||
|
||||
class AsyncMySQL:
|
||||
def __init__(self, db_config: dict):
|
||||
@@ -71,6 +72,7 @@ class AsyncMySQL:
|
||||
keys = ", ".join(f"`{k}`" for k in data.keys())
|
||||
placeholders = ", ".join(["%s"] * len(data))
|
||||
sql = f"INSERT INTO `{table}` ({keys}) VALUES ({placeholders})"
|
||||
logger.info(f"Executing SQL: {sql}")
|
||||
return await self.execute(sql, tuple(data.values()))
|
||||
|
||||
async def update_record(self, table: str, data: dict, where: dict):
|
||||
|
||||
+1
-1
@@ -2,8 +2,8 @@
|
||||
import json
|
||||
import aiohttp
|
||||
from typing import Optional, Dict, Any, Union, List
|
||||
|
||||
from aiohttp import ClientTimeout, ClientSession
|
||||
|
||||
from astrbot.api import logger
|
||||
|
||||
class APIClient:
|
||||
|
||||
Reference in New Issue
Block a user