为什么我defer stmnt.Close()似乎阻止我http.Redirect重定向它只是挂在网站上无限尝试加载。
但是如果我删除defer stmnt.Close()它重定向就好了?
err = db.QueryRow("SELECT steamid FROM accounts WHERE steamid = ?", ids).Scan(&steamid)
if err != nil {
common.WriteLog(err.Error(), r)
http.Error(w, "Failed to connect to database. Try again in a bit.", 500)
}
switch {
case len(profile.Response.Players) == 0:
common.WriteLog("Failed to look you up in the steam database. Try again in a bit.", r)
http.Error(w, "Failed to look you up in the steam database. Try again in a bit.", 500)
case err == sql.ErrNoRows:
stmnt, err := db.Query("INSERT INTO accounts SET steamid=?", ids)
if err != nil {
common.WriteLog(err.Error(), r)
http.Error(w, "Failed to insert your account to the database. Try again in a bit.", 500)
}
defer stmnt.Close() // <<<<< The suspect
// Insert Account
http.Redirect(w, r, "/", 303)
case err != nil:
common.WriteLog(err.Error(), r)
http.Error(w, "Failed to insert your account to the database. Try again in a bit.", 500)
default:
// Login User
http.Redirect(w, r, "/", 303)
}
海绵宝宝撒
为什么要阻止鼠标的默认事件??
被阻止了为什么还会显示
为什么给div阻止事件冒泡是没有的呢?
为什么我加了滤镜没用在网站看代码是被划掉的了似乎被覆盖了的样子
相关分类