mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 16:04:38 +01:00
change title db syntax
This commit is contained in:
@@ -329,8 +329,9 @@ func handleMsgMhfEnumerateTitle(s *Session, p mhfpacket.MHFPacket) {
|
|||||||
|
|
||||||
func handleMsgMhfAcquireTitle(s *Session, p mhfpacket.MHFPacket) {
|
func handleMsgMhfAcquireTitle(s *Session, p mhfpacket.MHFPacket) {
|
||||||
pkt := p.(*mhfpacket.MsgMhfAcquireTitle)
|
pkt := p.(*mhfpacket.MsgMhfAcquireTitle)
|
||||||
err := s.server.db.QueryRow("SELECT count(*) FROM titles WHERE id=$1 AND char_id=$2", pkt.TitleID, s.charID)
|
var exists int
|
||||||
if err != nil {
|
err := s.server.db.QueryRow("SELECT count(*) FROM titles WHERE id=$1 AND char_id=$2", pkt.TitleID, s.charID).Scan(&exists)
|
||||||
|
if err != nil || exists == 0 {
|
||||||
s.server.db.Exec("INSERT INTO titles VALUES ($1, $2, now(), now())", pkt.TitleID, s.charID)
|
s.server.db.Exec("INSERT INTO titles VALUES ($1, $2, now(), now())", pkt.TitleID, s.charID)
|
||||||
} else {
|
} else {
|
||||||
s.server.db.Exec("UPDATE titles SET updated_at=now()")
|
s.server.db.Exec("UPDATE titles SET updated_at=now()")
|
||||||
|
|||||||
Reference in New Issue
Block a user