SteamWar/SpigotCore
Archiviert
13
0

Minimize SQL queries #74

Manuell gemergt
Lixfel hat 1 Commits von speedupSchemListing nach master 2020-12-19 09:17:26 +01:00 zusammengeführt
Nur Änderungen aus Commit 26c67801d0 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -102,15 +102,10 @@ public class Schematic {
public static List<Schematic> getSchemsAccessibleByUser(int schemOwner){
try{
ResultSet schematic = SQL.select("SELECT SchemID, SchemName, SchemOwner, Item, SchemType, Rank, SchemFormat FROM Schematic WHERE SchemOwner = ? ORDER BY SchemName", schemOwner);
ResultSet schematic = SQL.select("SELECT s.SchemID, s.SchemName, s.SchemOwner, s.Item, s.SchemType, s.Rank, s.SchemFormat FROM Schematic s LEFT JOIN SchemMember sm ON sm.SchemName = s.SchemName AND sm.SchemOwner = s.SchemOwner WHERE s.SchemOwner = ? OR sm.Member = ? ORDER BY s.SchemName", schemOwner, schemOwner);
List<Schematic> schematics = new ArrayList<>();
while(schematic.next()){
while(schematic.next())
schematics.add(new Schematic(schematic));
}
List<SchematicMember> addedSchems = SchematicMember.getAccessibleSchems(schemOwner);
for(SchematicMember schem : addedSchems){
schematics.add(getSchemFromDB(schem.getSchemName(), schem.getSchemOwner()));
}
return schematics;
}catch(SQLException e){
throw new SecurityException("Failed listing schematics", e);