mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 18:38:26 +00:00
test speeding up recalc queries
This commit is contained in:
parent
523ce285a1
commit
4f8fd211f3
@ -274,16 +274,30 @@ public void Shavit_OnDatabaseLoaded()
|
||||
"CLOSE cur; " ...
|
||||
"RETURN total; " ...
|
||||
"END;;", gS_MySQLPrefix, gCV_WeightingMultiplier.FloatValue);
|
||||
|
||||
if (gCV_WeightingMultiplier.FloatValue == 1.0)
|
||||
{
|
||||
FormatEx(sQuery, sizeof(sQuery),
|
||||
"CREATE FUNCTION GetWeightedPoints(steamid INT) " ...
|
||||
"RETURNS FLOAT " ...
|
||||
"READS SQL DATA " ...
|
||||
"BEGIN " ...
|
||||
"DECLARE total FLOAT DEFAULT 0.0; " ...
|
||||
"SELECT SUM(points) FROM %splayertimes WHERE auth = steamid INTO total; " ...
|
||||
"RETURN total; " ...
|
||||
"END;;", gS_MySQLPrefix);
|
||||
}
|
||||
|
||||
hTrans.AddQuery(sQuery);
|
||||
|
||||
FormatEx(sQuery, sizeof(sQuery),
|
||||
"CREATE FUNCTION GetRecordPoints(rstyle INT, rtrack INT, rtime FLOAT, rmap VARCHAR(128), pointspertier FLOAT, stylemultiplier FLOAT, pwr FLOAT) " ...
|
||||
"CREATE FUNCTION GetRecordPoints(rstyle INT, rtrack INT, rtime FLOAT, rmap VARCHAR(255), pointspertier FLOAT, stylemultiplier FLOAT, pwr FLOAT, xtier INT) " ...
|
||||
"RETURNS FLOAT " ...
|
||||
"READS SQL DATA " ...
|
||||
"BEGIN " ...
|
||||
"DECLARE ppoints FLOAT DEFAULT 0.0; " ...
|
||||
"DECLARE ptier INT DEFAULT 1; " ...
|
||||
"SELECT tier FROM %smaptiers WHERE map = rmap INTO ptier; " ...
|
||||
"IF rmap > '' THEN SELECT tier FROM %smaptiers WHERE map = rmap INTO ptier; ELSE SET ptier = xtier; END IF; " ...
|
||||
"IF rtrack > 0 THEN SET ptier = 1; END IF; " ...
|
||||
"SET ppoints = ((pointspertier * ptier) * 1.5) + (pwr / 15.0); " ...
|
||||
"IF rtime > pwr THEN SET ppoints = ppoints * (pwr / rtime); END IF; " ...
|
||||
@ -729,7 +743,7 @@ void FormatRecalculate(bool bUseCurrentMap, int track, int style, char[] sQuery,
|
||||
" WHERE style = %d %s %s%s%c %s %s"...
|
||||
" GROUP BY map, track, style "...
|
||||
") as WR "...
|
||||
"SET PT.points = GetRecordPoints(PT.style, PT.track, PT.time, PT.map, %.1f, %.3f, WR.time) "...
|
||||
"SET PT.points = GetRecordPoints(PT.style, PT.track, PT.time, %s, %.1f, %.3f, WR.time, %d) "...
|
||||
"WHERE PT.style = WR.style and PT.track = WR.track and PT.map = WR.map;",
|
||||
gS_MySQLPrefix, gS_MySQLPrefix, style,
|
||||
(bUseCurrentMap || track != -1) ? "AND" : "",
|
||||
@ -738,7 +752,9 @@ void FormatRecalculate(bool bUseCurrentMap, int track, int style, char[] sQuery,
|
||||
(bUseCurrentMap) ? '\'' : ' ',
|
||||
(bUseCurrentMap && track != -1) ? "AND" : "",
|
||||
sTrack,
|
||||
gCV_PointsPerTier.FloatValue, fMultiplier
|
||||
(bUseCurrentMap) ? "''" : "PT.map",
|
||||
gCV_PointsPerTier.FloatValue, fMultiplier,
|
||||
gI_Tier
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user