feat: add MySQL database support with SQL translation

- Add MySQLConnection class with automatic SQL Server to MySQL translation
- Add connection factory to support both SQL Server and MySQL
- Update config schema to support MySQL configuration (host, port, db_type)
- Update default config to use MySQL (localhost:3306)
- Translate table names: [schema].[table] -> schema_table
- Translate placeholders: ? -> %s
- Translate MERGE statements to INSERT ... ON DUPLICATE KEY UPDATE

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Misaka Server
2026-02-09 20:12:32 +08:00
parent 04b99292ad
commit f02858d5dc
7 changed files with 459 additions and 20 deletions

View File

@@ -195,5 +195,9 @@ def get_connection() -> DatabaseConnection:
Returns:
DatabaseConnection: 数据库连接对象
Note:
此函数现在从 connection_factory 导入,以支持 MySQL 和 SQL Server
"""
return DatabaseConnection()
from db.connection_factory import get_connection as factory_get_connection
return factory_get_connection()