Skip to content

Commit 53c6274

Browse files
Merge pull request #52 from Aperture-Development/MRSync
MRSync bugfix and feature addition
2 parents bcd1d52 + 922690a commit 53c6274

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

lua/msync/client_gui/modules/cl_mrsync.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ MSync.modules.MRSync = MSync.modules.MRSync or {}
66
* @package MySQL Rank Sync
77
* @author Aperture Development
88
* @license root_dir/LICENCE
9-
* @version 2.1.3
9+
* @version 2.2.0
1010
]]
1111

1212
--[[
@@ -16,7 +16,7 @@ MSync.modules.MRSync.info = {
1616
Name = "MySQL Rank Sync",
1717
ModuleIdentifier = "MRSync",
1818
Description = "Synchronise your ranks across your servers",
19-
Version = "2.1.3"
19+
Version = "2.2.0"
2020
}
2121

2222
--[[

lua/msync/server/modules/sv_mrsync.lua

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ MSync.modules.MRSync = MSync.modules.MRSync or {}
66
* @package MySQL Rank Sync
77
* @author Aperture Development
88
* @license root_dir/LICENCE
9-
* @version 2.1.3
9+
* @version 2.2.0
1010
]]
1111

1212
--[[
@@ -16,7 +16,7 @@ MSync.modules.MRSync.info = {
1616
Name = "MySQL Rank Sync",
1717
ModuleIdentifier = "MRSync",
1818
Description = "Synchronise your ranks across your servers",
19-
Version = "2.1.3"
19+
Version = "2.2.0"
2020
}
2121

2222
--[[
@@ -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)