fix: escape 'key' as reserved word in all MySQL queries with backticks

This commit is contained in:
2026-06-20 23:21:24 +08:00
parent 99fb89c60d
commit 735126ff56
7 changed files with 22 additions and 22 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ type LLMConfig struct {
func GetLLMConfig(db *sql.DB, userID int64) (LLMConfig, error) {
config := LLMConfig{}
rows, err := db.Query(`SELECT key, value FROM user_settings WHERE user_id = ? AND key IN ('llm.endpoint', 'llm.api_key', 'llm.model')`, userID)
rows, err := db.Query("SELECT `key`, value FROM user_settings WHERE user_id = ? AND `key` IN ('llm.endpoint', 'llm.api_key', 'llm.model')", userID)
if err != nil {
return config, fmt.Errorf("read settings: %w", err)
}