审查 Go HTTP 查询接口中的 SQL 拼接、错误处理与资源释放问题。

未标记

Sorry o(╥﹏╥)o,暂无参考答案。带这道题,问问AI吧~

问 AI
本题目录

相关面经

1 篇

公司未注明

Go/React 全栈 AI Agent 开发
社招
查看原面经 →
func GetAccountSpend(w http.ResponseWriter, r *http.Request) { accountID := r.URL.Query().Get("account_id") query := "SELECT SUM(spend) FROM daily_stats WHERE account_id = " + accountID rows, _ := db.Query(query) var total float64 for rows.Next() { rows.Scan(&total) } fmt.Fprintf(w, "total spend: %f", total) }

相关题目

4 题