Skip to content

Commit

Permalink
Merge pull request #1 from Johnanater/patch-1
Browse files Browse the repository at this point in the history
Fix MySQL statement on QueryById
  • Loading branch information
fr34kyn01535 authored May 13, 2019
2 parents e02d0bd + aa66022 commit 6ca26c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DatabaseManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ public PlayerData QueryById(CSteamID steamId, bool cached = true)
MySqlCommand command = Connection.CreateCommand();
command.Parameters.AddWithValue("@steamid", steamId);
command.Parameters.AddWithValue("@instance", InstanceID);
command.CommandText = "SELECT * FROM (SELECT a.SteamID, a.SteamName, a.CharName, a.IP, a.LastLoginGlobal, a.TotalPlayTime, a.LastServerID, b.ServerID, b.LastLoginLocal, b.CleanedBuildables, b.CleanedPlayerData, c.ServerName AS LastServerName FROM `" + Table + "` AS a LEFT JOIN `" + TableServer + "` AS b ON a.SteamID = b.SteamID LEFT JOIN `" + TableInstance + "` AS c ON a.LastServerID = c.ServerID WHERE (b.ServerID = @instance OR b.ServerID = a.LastServerID OR b.ServerID IS NULL) AND a.SteamID = @steamid ORDER BY b.LastLoginLocal ASC) AS g GROUP BY g.SteamID";
command.CommandText = "SELECT * FROM (SELECT a.SteamID, a.SteamName, a.CharName, a.IP, a.LastLoginGlobal, a.TotalPlayTime, a.LastServerID, b.ServerID, b.LastLoginLocal, b.CleanedBuildables, b.CleanedPlayerData, c.ServerName AS LastServerName FROM `" + Table + "` AS a LEFT JOIN `" + TableServer + "` AS b ON a.SteamID = b.SteamID LEFT JOIN `" + TableInstance + "` AS c ON a.LastServerID = c.ServerID WHERE (b.ServerID = @instance OR b.ServerID = a.LastServerID OR b.ServerID IS NULL) AND a.SteamID = @steamid ORDER BY b.LastLoginLocal ASC) AS g";
reader = command.ExecuteReader();
if (reader.Read())
{
Expand Down Expand Up @@ -803,4 +803,4 @@ public enum OptionType
Buildables,
PlayerFiles,
}
}
}

0 comments on commit 6ca26c3

Please sign in to comment.