List<ExtendedPlayer> LoadSummonerGames(Summoner summoner, DbConnection connection) { List<ExtendedPlayer> output = new List<ExtendedPlayer>(); using (var select = Command("select {0} from game, player where game.id = player.game_id and player.summoner_id = :summoner_id order by game.time desc", connection, ExtendedPlayer.GetFields())) { select.Set("summoner_id", summoner.Id); using (var reader = select.ExecuteReader()) { while (reader.Read()) { ExtendedPlayer player = new ExtendedPlayer(reader); output.Add(player); } } } return output; }
List <ExtendedPlayer> GetSummonerGames(Summoner summoner, DbConnection connection) { bool useItemArray = !connection.IsMySQL(); List <ExtendedPlayer> output = new List <ExtendedPlayer>(); using (var select = Command("select {0} from game, player where game.id = player.game_id and player.summoner_id = :summoner_id order by game.time desc", connection, ExtendedPlayer.GetFields(useItemArray))) { select.Set("summoner_id", summoner.Id); using (var reader = select.ExecuteReader()) { while (reader.Read()) { ExtendedPlayer player = new ExtendedPlayer(reader, useItemArray); output.Add(player); } } return(output); } }
List<ExtendedPlayer> GetSummonerGames(Summoner summoner, DbConnection connection) { bool useItemArray = (connection.IsMySQL() || connection.IsMsSQL()) == false; List<ExtendedPlayer> output = new List<ExtendedPlayer>(); using (var select = Command("select {0} from game, player where game.id = player.game_id and player.summoner_id = :summoner_id order by game.time desc", connection, ExtendedPlayer.GetFields(useItemArray))) { select.Set("summoner_id", summoner.Id); using (var reader = select.ExecuteReader()) { while (reader.Read()) { ExtendedPlayer player = new ExtendedPlayer(reader, useItemArray); output.Add(player); } } } foreach(var player in output) { using (var select = Command("select champion_id, team_id from player where game_id = ( select TOP 1 id from game where game_id = :game_id )", connection)) { select.Set("game_id", player.InternalGameId); using (var reader = select.ExecuteReader()) { int cnt = 0; while (reader.Read()) { long teamChampions = ((long)reader.Integer() << 32) | (reader.Integer()); player.TeamChampions[cnt++] = teamChampions; } } } } return output; }