2017-07-12 11:05:18 +00:00
|
|
|
// +build pgsql
|
|
|
|
|
|
|
|
// This file was generated by Gosora's Query Generator. Please try to avoid modifying this file, as it might change at any time.
|
|
|
|
package main
|
|
|
|
|
|
|
|
import "log"
|
|
|
|
import "database/sql"
|
|
|
|
|
2017-09-03 04:50:31 +00:00
|
|
|
// nolint
|
2017-09-18 17:03:52 +00:00
|
|
|
var addRepliesToTopicStmt *sql.Stmt
|
|
|
|
var removeRepliesFromTopicStmt *sql.Stmt
|
|
|
|
var addTopicsToForumStmt *sql.Stmt
|
|
|
|
var removeTopicsFromForumStmt *sql.Stmt
|
|
|
|
var updateForumCacheStmt *sql.Stmt
|
|
|
|
var addLikesToTopicStmt *sql.Stmt
|
|
|
|
var addLikesToReplyStmt *sql.Stmt
|
|
|
|
var editTopicStmt *sql.Stmt
|
|
|
|
var editReplyStmt *sql.Stmt
|
|
|
|
var stickTopicStmt *sql.Stmt
|
|
|
|
var unstickTopicStmt *sql.Stmt
|
|
|
|
var updateLastIPStmt *sql.Stmt
|
|
|
|
var updateSessionStmt *sql.Stmt
|
|
|
|
var setPasswordStmt *sql.Stmt
|
|
|
|
var setAvatarStmt *sql.Stmt
|
|
|
|
var setUsernameStmt *sql.Stmt
|
|
|
|
var changeGroupStmt *sql.Stmt
|
|
|
|
var activateUserStmt *sql.Stmt
|
|
|
|
var updateUserLevelStmt *sql.Stmt
|
|
|
|
var incrementUserScoreStmt *sql.Stmt
|
|
|
|
var incrementUserPostsStmt *sql.Stmt
|
|
|
|
var incrementUserBigpostsStmt *sql.Stmt
|
|
|
|
var incrementUserMegapostsStmt *sql.Stmt
|
|
|
|
var incrementUserTopicsStmt *sql.Stmt
|
|
|
|
var editProfileReplyStmt *sql.Stmt
|
|
|
|
var updateForumStmt *sql.Stmt
|
|
|
|
var updateSettingStmt *sql.Stmt
|
|
|
|
var updatePluginStmt *sql.Stmt
|
|
|
|
var updatePluginInstallStmt *sql.Stmt
|
|
|
|
var updateThemeStmt *sql.Stmt
|
|
|
|
var updateUserStmt *sql.Stmt
|
|
|
|
var updateGroupPermsStmt *sql.Stmt
|
|
|
|
var updateGroupRankStmt *sql.Stmt
|
|
|
|
var updateGroupStmt *sql.Stmt
|
|
|
|
var updateEmailStmt *sql.Stmt
|
|
|
|
var verifyEmailStmt *sql.Stmt
|
|
|
|
var setTempGroupStmt *sql.Stmt
|
|
|
|
var updateWordFilterStmt *sql.Stmt
|
|
|
|
var bumpSyncStmt *sql.Stmt
|
2017-07-12 11:05:18 +00:00
|
|
|
|
2017-09-03 04:50:31 +00:00
|
|
|
// nolint
|
2017-07-12 11:05:18 +00:00
|
|
|
func _gen_pgsql() (err error) {
|
2017-07-17 10:23:42 +00:00
|
|
|
if dev.DebugMode {
|
2017-07-12 11:05:18 +00:00
|
|
|
log.Print("Building the generated statements")
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing addRepliesToTopic statement.")
|
|
|
|
addRepliesToTopicStmt, err = db.Prepare("UPDATE `topics` SET `postCount` = `postCount` + ?,`lastReplyBy` = ?,`lastReplyAt` = LOCALTIMESTAMP() WHERE `tid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing removeRepliesFromTopic statement.")
|
|
|
|
removeRepliesFromTopicStmt, err = db.Prepare("UPDATE `topics` SET `postCount` = `postCount` - ? WHERE `tid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing addTopicsToForum statement.")
|
|
|
|
addTopicsToForumStmt, err = db.Prepare("UPDATE `forums` SET `topicCount` = `topicCount` + ? WHERE `fid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing removeTopicsFromForum statement.")
|
|
|
|
removeTopicsFromForumStmt, err = db.Prepare("UPDATE `forums` SET `topicCount` = `topicCount` - ? WHERE `fid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing updateForumCache statement.")
|
|
|
|
updateForumCacheStmt, err = db.Prepare("UPDATE `forums` SET `lastTopic` = ?,`lastTopicID` = ?,`lastReplyer` = ?,`lastReplyerID` = ?,`lastTopicTime` = LOCALTIMESTAMP() WHERE `fid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing addLikesToTopic statement.")
|
|
|
|
addLikesToTopicStmt, err = db.Prepare("UPDATE `topics` SET `likeCount` = `likeCount` + ? WHERE `tid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing addLikesToReply statement.")
|
|
|
|
addLikesToReplyStmt, err = db.Prepare("UPDATE `replies` SET `likeCount` = `likeCount` + ? WHERE `rid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing editTopic statement.")
|
|
|
|
editTopicStmt, err = db.Prepare("UPDATE `topics` SET `title` = ?,`content` = ?,`parsed_content` = ?,`is_closed` = ? WHERE `tid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing editReply statement.")
|
|
|
|
editReplyStmt, err = db.Prepare("UPDATE `replies` SET `content` = ?,`parsed_content` = ? WHERE `rid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing stickTopic statement.")
|
|
|
|
stickTopicStmt, err = db.Prepare("UPDATE `topics` SET `sticky` = 1 WHERE `tid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing unstickTopic statement.")
|
|
|
|
unstickTopicStmt, err = db.Prepare("UPDATE `topics` SET `sticky` = 0 WHERE `tid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing updateLastIP statement.")
|
|
|
|
updateLastIPStmt, err = db.Prepare("UPDATE `users` SET `last_ip` = ? WHERE `uid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing updateSession statement.")
|
|
|
|
updateSessionStmt, err = db.Prepare("UPDATE `users` SET `session` = ? WHERE `uid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing setPassword statement.")
|
|
|
|
setPasswordStmt, err = db.Prepare("UPDATE `users` SET `password` = ?,`salt` = ? WHERE `uid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing setAvatar statement.")
|
|
|
|
setAvatarStmt, err = db.Prepare("UPDATE `users` SET `avatar` = ? WHERE `uid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing setUsername statement.")
|
|
|
|
setUsernameStmt, err = db.Prepare("UPDATE `users` SET `name` = ? WHERE `uid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing changeGroup statement.")
|
|
|
|
changeGroupStmt, err = db.Prepare("UPDATE `users` SET `group` = ? WHERE `uid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing activateUser statement.")
|
|
|
|
activateUserStmt, err = db.Prepare("UPDATE `users` SET `active` = 1 WHERE `uid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing updateUserLevel statement.")
|
|
|
|
updateUserLevelStmt, err = db.Prepare("UPDATE `users` SET `level` = ? WHERE `uid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing incrementUserScore statement.")
|
|
|
|
incrementUserScoreStmt, err = db.Prepare("UPDATE `users` SET `score` = `score` + ? WHERE `uid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing incrementUserPosts statement.")
|
|
|
|
incrementUserPostsStmt, err = db.Prepare("UPDATE `users` SET `posts` = `posts` + ? WHERE `uid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing incrementUserBigposts statement.")
|
|
|
|
incrementUserBigpostsStmt, err = db.Prepare("UPDATE `users` SET `posts` = `posts` + ?,`bigposts` = `bigposts` + ? WHERE `uid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing incrementUserMegaposts statement.")
|
|
|
|
incrementUserMegapostsStmt, err = db.Prepare("UPDATE `users` SET `posts` = `posts` + ?,`bigposts` = `bigposts` + ?,`megaposts` = `megaposts` + ? WHERE `uid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing incrementUserTopics statement.")
|
|
|
|
incrementUserTopicsStmt, err = db.Prepare("UPDATE `users` SET `topics` = `topics` + ? WHERE `uid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing editProfileReply statement.")
|
|
|
|
editProfileReplyStmt, err = db.Prepare("UPDATE `users_replies` SET `content` = ?,`parsed_content` = ? WHERE `rid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing updateForum statement.")
|
|
|
|
updateForumStmt, err = db.Prepare("UPDATE `forums` SET `name` = ?,`desc` = ?,`active` = ?,`preset` = ? WHERE `fid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing updateSetting statement.")
|
|
|
|
updateSettingStmt, err = db.Prepare("UPDATE `settings` SET `content` = ? WHERE `name` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing updatePlugin statement.")
|
|
|
|
updatePluginStmt, err = db.Prepare("UPDATE `plugins` SET `active` = ? WHERE `uname` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing updatePluginInstall statement.")
|
|
|
|
updatePluginInstallStmt, err = db.Prepare("UPDATE `plugins` SET `installed` = ? WHERE `uname` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing updateTheme statement.")
|
|
|
|
updateThemeStmt, err = db.Prepare("UPDATE `themes` SET `default` = ? WHERE `uname` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing updateUser statement.")
|
|
|
|
updateUserStmt, err = db.Prepare("UPDATE `users` SET `name` = ?,`email` = ?,`group` = ? WHERE `uid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing updateGroupPerms statement.")
|
|
|
|
updateGroupPermsStmt, err = db.Prepare("UPDATE `users_groups` SET `permissions` = ? WHERE `gid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing updateGroupRank statement.")
|
|
|
|
updateGroupRankStmt, err = db.Prepare("UPDATE `users_groups` SET `is_admin` = ?,`is_mod` = ?,`is_banned` = ? WHERE `gid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing updateGroup statement.")
|
|
|
|
updateGroupStmt, err = db.Prepare("UPDATE `users_groups` SET `name` = ?,`tag` = ? WHERE `gid` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing updateEmail statement.")
|
|
|
|
updateEmailStmt, err = db.Prepare("UPDATE `emails` SET `email` = ?,`uid` = ?,`validated` = ?,`token` = ? WHERE `email` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing verifyEmail statement.")
|
|
|
|
verifyEmailStmt, err = db.Prepare("UPDATE `emails` SET `validated` = 1,`token` = '' WHERE `email` = ?")
|
2017-07-12 11:05:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2017-08-27 09:33:45 +00:00
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing setTempGroup statement.")
|
|
|
|
setTempGroupStmt, err = db.Prepare("UPDATE `users` SET `temp_group` = ? WHERE `uid` = ?")
|
2017-08-27 09:33:45 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing updateWordFilter statement.")
|
|
|
|
updateWordFilterStmt, err = db.Prepare("UPDATE `word_filters` SET `find` = ?,`replacement` = ? WHERE `wfid` = ?")
|
2017-08-27 09:33:45 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2017-09-10 16:57:22 +00:00
|
|
|
|
2017-09-18 17:03:52 +00:00
|
|
|
log.Print("Preparing bumpSync statement.")
|
|
|
|
bumpSyncStmt, err = db.Prepare("UPDATE `sync` SET `last_update` = LOCALTIMESTAMP()")
|
2017-09-10 16:57:22 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2017-07-12 11:05:18 +00:00
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|