mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 10:28:26 +00:00
use the wr table view in some more places
This commit is contained in:
parent
96281d2f85
commit
ecc2d8d2c0
@ -1015,21 +1015,9 @@ void DeleteUserData(int client, const int iSteamID)
|
||||
|
||||
if(gB_WR)
|
||||
{
|
||||
if(gB_MySQL)
|
||||
{
|
||||
FormatEx(sQuery, 512,
|
||||
"SELECT p1.id, p1.style, p1.track, p1.map FROM %splayertimes p1 " ...
|
||||
"JOIN (SELECT map, style, track, MIN(time) time FROM %splayertimes GROUP BY map, style, track) p2 " ...
|
||||
"ON p1.style = p2.style AND p1.track = p2.track AND p1.time = p2.time " ...
|
||||
"WHERE p1.auth = %d;",
|
||||
gS_MySQLPrefix, gS_MySQLPrefix, iSteamID);
|
||||
}
|
||||
else
|
||||
{
|
||||
FormatEx(sQuery, 512,
|
||||
"SELECT p.id, p.style, p.track, p.map FROM %splayertimes p JOIN(SELECT style, MIN(time) time, map, track FROM %splayertimes GROUP BY map, style, track) s ON p.style = s.style AND p.time = s.time AND p.map = s.map AND s.track = p.track GROUP BY p.map, p.style, p.track WHERE p.auth = %d;",
|
||||
gS_MySQLPrefix, gS_MySQLPrefix, iSteamID);
|
||||
}
|
||||
FormatEx(sQuery, sizeof(sQuery),
|
||||
"SELECT id, style, track, map FROM %swrs WHERE auth = %d;",
|
||||
gS_MySQLPrefix, iSteamID);
|
||||
|
||||
gH_SQL.Query(SQL_DeleteUserData_GetRecords_Callback, sQuery, hPack, DBPrio_High);
|
||||
}
|
||||
|
||||
@ -333,10 +333,10 @@ Action OpenStatsMenu(int client, int steamid)
|
||||
FormatEx(sQuery, 2048, "SELECT a.clears, b.maps, c.wrs, d.name, d.ip, d.lastlogin, d.points, e.rank FROM " ...
|
||||
"(SELECT COUNT(*) clears FROM (SELECT map FROM %splayertimes WHERE auth = %d AND track = 0 GROUP BY map) s) a " ...
|
||||
"JOIN (SELECT COUNT(*) maps FROM (SELECT map FROM %smapzones WHERE track = 0 AND type = 0 GROUP BY map) s) b " ...
|
||||
"JOIN (SELECT COUNT(*) wrs FROM %splayertimes a JOIN (SELECT MIN(time) time, map FROM %splayertimes WHERE style = 0 AND track = 0 GROUP by map, style, track) b ON a.time = b.time AND a.map = b.map AND track = 0 AND style = 0 WHERE auth = %d) c " ...
|
||||
"JOIN (SELECT COUNT(*) wrs FROM %swrs WHERE auth = %d AND track = 0 AND style = 0) c " ...
|
||||
"JOIN (SELECT name, ip, lastlogin, FORMAT(points, 2) points FROM %susers WHERE auth = %d) d " ...
|
||||
"JOIN (SELECT COUNT(*) as 'rank' FROM %susers as u1 JOIN (SELECT points FROM %susers WHERE auth = %d) u2 WHERE u1.points >= u2.points) e " ...
|
||||
"LIMIT 1;", gS_MySQLPrefix, steamid, gS_MySQLPrefix, gS_MySQLPrefix, gS_MySQLPrefix, steamid, gS_MySQLPrefix, steamid, gS_MySQLPrefix, gS_MySQLPrefix, steamid);
|
||||
"LIMIT 1;", gS_MySQLPrefix, steamid, gS_MySQLPrefix, gS_MySQLPrefix, steamid, gS_MySQLPrefix, steamid, gS_MySQLPrefix, gS_MySQLPrefix, steamid);
|
||||
}
|
||||
|
||||
else
|
||||
@ -344,9 +344,9 @@ Action OpenStatsMenu(int client, int steamid)
|
||||
FormatEx(sQuery, 2048, "SELECT a.clears, b.maps, c.wrs, d.name, d.ip, d.lastlogin FROM " ...
|
||||
"(SELECT COUNT(*) clears FROM (SELECT map FROM %splayertimes WHERE auth = %d AND track = 0 GROUP BY map) s) a " ...
|
||||
"JOIN (SELECT COUNT(*) maps FROM (SELECT map FROM %smapzones WHERE track = 0 AND type = 0 GROUP BY map) s) b " ...
|
||||
"JOIN (SELECT COUNT(*) wrs FROM %splayertimes a JOIN (SELECT MIN(time) time, map FROM %splayertimes WHERE style = 0 AND track = 0 GROUP by map, style, track) b ON a.time = b.time AND a.map = b.map AND track = 0 AND style = 0 WHERE auth = %d) c " ...
|
||||
"JOIN (SELECT COUNT(*) wrs FROM %swrs WHERE auth = %d AND track = 0 AND style = 0) c " ...
|
||||
"JOIN (SELECT name, ip, lastlogin FROM %susers WHERE auth = %d) d " ...
|
||||
"LIMIT 1;", gS_MySQLPrefix, steamid, gS_MySQLPrefix, gS_MySQLPrefix, gS_MySQLPrefix, steamid, gS_MySQLPrefix, steamid);
|
||||
"LIMIT 1;", gS_MySQLPrefix, steamid, gS_MySQLPrefix, gS_MySQLPrefix, steamid, gS_MySQLPrefix, steamid);
|
||||
}
|
||||
|
||||
gB_CanOpenMenu[client] = false;
|
||||
|
||||
@ -506,21 +506,9 @@ void UpdateWRCache(int client = -1)
|
||||
|
||||
char sQuery[512];
|
||||
|
||||
if(gB_MySQL)
|
||||
{
|
||||
FormatEx(sQuery, 512,
|
||||
"SELECT p1.id, p1.auth, p1.style, p1.track, p1.time, u.name FROM %splayertimes p1 " ...
|
||||
"JOIN (SELECT style, track, MIN(time) time FROM %splayertimes WHERE map = '%s' GROUP BY style, track) p2 " ...
|
||||
"JOIN %susers u ON p1.style = p2.style AND p1.track = p2.track AND p1.time = p2.time AND u.auth = p1.auth " ...
|
||||
"WHERE p1.map = '%s';",
|
||||
gS_MySQLPrefix, gS_MySQLPrefix, gS_Map, gS_MySQLPrefix, gS_Map);
|
||||
}
|
||||
else
|
||||
{
|
||||
FormatEx(sQuery, 512,
|
||||
"SELECT p.id, p.auth, p.style, p.track, s.time, u.name FROM %splayertimes p JOIN(SELECT style, MIN(time) time, map, track FROM %splayertimes WHERE map = '%s' GROUP BY style, track) s ON p.style = s.style AND p.time = s.time AND p.map = s.map AND s.track = p.track JOIN %susers u ON p.auth = u.auth GROUP BY p.style, p.track;",
|
||||
gS_MySQLPrefix, gS_MySQLPrefix, gS_Map, gS_MySQLPrefix);
|
||||
}
|
||||
FormatEx(sQuery, sizeof(sQuery),
|
||||
"SELECT p.id, p.auth, p.style, p.track, p.time, u.name FROM %swrs p JOIN %susers u ON p.auth = u.auth WHERE p.map = '%s';",
|
||||
gS_MySQLPrefix, gS_MySQLPrefix, gS_Map);
|
||||
|
||||
gH_SQL.Query(SQL_UpdateWRCache_Callback, sQuery, client);
|
||||
|
||||
@ -529,7 +517,7 @@ void UpdateWRCache(int client = -1)
|
||||
return;
|
||||
}
|
||||
|
||||
FormatEx(sQuery, 512,
|
||||
FormatEx(sQuery, sizeof(sQuery),
|
||||
"SELECT style, track, auth, stage, MIN(time), vel2d FROM `%sstagetimes` WHERE map = '%s' GROUP BY style, track, stage;",
|
||||
gS_MySQLPrefix, gS_Map);
|
||||
|
||||
@ -1821,12 +1809,9 @@ public Action Command_RecentRecords(int client, int args)
|
||||
|
||||
char sQuery[512];
|
||||
|
||||
FormatEx(sQuery, 512,
|
||||
"SELECT a.id, a.map, u.name, a.time, a.style, a.track FROM %splayertimes a " ...
|
||||
"JOIN (SELECT MIN(time) time, map, style, track FROM %splayertimes GROUP by map, style, track) b " ...
|
||||
"JOIN %susers u ON a.time = b.time AND a.auth = u.auth AND a.map = b.map AND a.style = b.style AND a.track = b.track " ...
|
||||
"ORDER BY a.date DESC " ...
|
||||
"LIMIT 100;", gS_MySQLPrefix, gS_MySQLPrefix, gS_MySQLPrefix);
|
||||
FormatEx(sQuery, sizeof(sQuery),
|
||||
"SELECT a.id, a.map, u.name, a.time, a.style, a.track FROM %swrs a JOIN %susers u on a.auth = u.auth ORDER BY a.date DESC LIMIT 100;",
|
||||
gS_MySQLPrefix, gS_MySQLPrefix);
|
||||
|
||||
gH_SQL.Query(SQL_RR_Callback, sQuery, GetClientSerial(client), DBPrio_Low);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user