This commit is contained in:
2025-12-04 09:35:40 +08:00
parent 5a4f87eacb
commit ecd17c7721
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -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
View File
@@ -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: