edit_topic_stmt,err=db.Prepare("UPDATE topics SET title = ?, content = ?, parsed_content = ?, is_closed = ? WHERE tid = ?")
iferr!=nil{
log.Fatal(err)
}
log.Print("Preparing edit_reply statement.")
edit_reply_stmt,err=db.Prepare("UPDATE replies SET content = ?, parsed_content = ? WHERE rid = ?")
iferr!=nil{
log.Fatal(err)
}
log.Print("Preparing delete_reply statement.")
delete_reply_stmt,err=db.Prepare("DELETE FROM replies WHERE rid = ?")
iferr!=nil{
log.Fatal(err)
}
log.Print("Preparing delete_topic statement.")
delete_topic_stmt,err=db.Prepare("DELETE FROM topics WHERE tid = ?")
iferr!=nil{
log.Fatal(err)
}
log.Print("Preparing stick_topic statement.")
stick_topic_stmt,err=db.Prepare("UPDATE topics SET sticky = 1 WHERE tid = ?")
iferr!=nil{
log.Fatal(err)
}
log.Print("Preparing unstick_topic statement.")
unstick_topic_stmt,err=db.Prepare("UPDATE topics SET sticky = 0 WHERE tid = ?")
iferr!=nil{
log.Fatal(err)
}
log.Print("Preparing login statement.")
login_stmt,err=db.Prepare("SELECT `uid`, `name`, `password`, `salt` FROM `users` WHERE `name` = ?")
iferr!=nil{
log.Fatal(err)
}
log.Print("Preparing update_session statement.")
update_session_stmt,err=db.Prepare("UPDATE users SET session = ? WHERE uid = ?")
iferr!=nil{
log.Fatal(err)
}
log.Print("Preparing logout statement.")
logout_stmt,err=db.Prepare("UPDATE users SET session = '' WHERE uid = ?")
iferr!=nil{
log.Fatal(err)
}
log.Print("Preparing set_password statement.")
set_password_stmt,err=db.Prepare("UPDATE users SET password = ?, salt = ? WHERE uid = ?")
iferr!=nil{
log.Fatal(err)
}
log.Print("Preparing get_password statement.")
get_password_stmt,err=db.Prepare("SELECT `password`, `salt` FROM `users` WHERE `uid` = ?")
iferr!=nil{
log.Fatal(err)
}
log.Print("Preparing set_avatar statement.")
set_avatar_stmt,err=db.Prepare("UPDATE users SET avatar = ? WHERE uid = ?")
iferr!=nil{
log.Fatal(err)
}
log.Print("Preparing set_username statement.")
set_username_stmt,err=db.Prepare("UPDATE users SET name = ? WHERE uid = ?")
iferr!=nil{
log.Fatal(err)
}
// Add an admin version of register_stmt with more flexibility
// create_account_stmt, err = db.Prepare("INSERT INTO
log.Print("Preparing register statement.")
register_stmt,err=db.Prepare("INSERT INTO users(`name`,`password`,`salt`,`group`,`is_super_admin`,`session`,`message`) VALUES(?,?,?,"+strconv.Itoa(default_group)+",0,?,'')")
iferr!=nil{
log.Fatal(err)
}
log.Print("Preparing username_exists statement.")
username_exists_stmt,err=db.Prepare("SELECT `name` FROM `users` WHERE `name` = ?")
iferr!=nil{
log.Fatal(err)
}
log.Print("Preparing change_group statement.")
change_group_stmt,err=db.Prepare("UPDATE `users` SET `group` = ? WHERE `uid` = ?")