public async Task <IReadOnlyList <FleetTrueskillRating> > GetTopTanks(uint limit) { DbCommand PrepareQuery(IDatabase database) { var cmd = _db.CreateCommand(); cmd.CommandText = "SELECT Fleets.FleetId, Mean, StdDev, UserId, Name FROM FleetsRanks INNER JOIN Fleets ON Fleets.FleetId=FleetsRanks.FleetId ORDER BY (Mean - 3 * StdDev) DESC"; cmd.Parameters.Add(new SqliteParameter("@Limit", DbType.UInt32) { Value = limit }); return(cmd); } var enumerable = new SqlAsyncResult <FleetTrueskillRating>(_db, PrepareQuery, FleetTrueskillRating.Read); return(await enumerable.ToListAsync()); }
public async Task <IReadOnlyList <Battle> > Queue(uint limit = uint.MaxValue) { DbCommand PrepareQuery(IDatabase database) { var cmd = _db.CreateCommand(); cmd.CommandText = "SELECT * FROM FleetsBattleQueue LIMIT @Limit"; cmd.Parameters.Add(new SqliteParameter("@Limit", DbType.UInt32) { Value = limit }); return(cmd); } var enumerable = new SqlAsyncResult <Battle>(_db, PrepareQuery, Battle.Parse); return(await enumerable.ToListAsync()); }