Skip to content

Commit d588b71

Browse files
Implemented addUserID
- We implemented the same addUserID technique that we have developed for MBSync, now uppon rank change of a non existing user we create the user and then save his rank to the database.
1 parent 7d571bf commit d588b71

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

lua/msync/server/modules/sv_mrsync.lua

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,23 @@ function MSync.modules.MRSync.init( transaction )
6161
addUserRankQ:setString(4, "allservers")
6262
end
6363

64+
addUserRankQ.onError = function( q, err, sql )
65+
if string.match( err, "^Column 'user_id' cannot be null$" ) then
66+
MSync.mysql.addUserID(steamid)
67+
MSync.modules.MRSync.saveRankByID(steamid, group)
68+
else
69+
print("------------------------------------")
70+
print("[MRSync] SQL Error!")
71+
print("------------------------------------")
72+
print("Please include this in a Bug report:\n")
73+
print(err.."\n")
74+
print("------------------------------------")
75+
print("Do not include this, this is for debugging only:\n")
76+
print(sql.."\n")
77+
print("------------------------------------")
78+
end
79+
end
80+
6481
addUserRankQ:start()
6582
end
6683

@@ -100,6 +117,23 @@ function MSync.modules.MRSync.init( transaction )
100117
end
101118
end
102119

120+
removeOldRanksQ.onError = function( q, err, sql )
121+
if string.match( err, "^Column 'user_id' cannot be null$" ) then
122+
MSync.mysql.addUserID(steamid)
123+
MSync.modules.MRSync.saveRankByID(steamid, group)
124+
else
125+
print("------------------------------------")
126+
print("[MRSync] SQL Error!")
127+
print("------------------------------------")
128+
print("Please include this in a Bug report:\n")
129+
print(err.."\n")
130+
print("------------------------------------")
131+
print("Do not include this, this is for debugging only:\n")
132+
print(sql.."\n")
133+
print("------------------------------------")
134+
end
135+
end
136+
103137
removeOldRanksQ:start()
104138
end
105139

0 commit comments

Comments
 (0)