From 7997703c0ad22cbdf0969704953b639cfcb60819 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 20 Apr 2019 21:54:43 +0200 Subject: [PATCH] get all schems of certain type --- src/de/warking/hunjy/MySQL/Schematic.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/de/warking/hunjy/MySQL/Schematic.java b/src/de/warking/hunjy/MySQL/Schematic.java index 34abe72..c58073c 100644 --- a/src/de/warking/hunjy/MySQL/Schematic.java +++ b/src/de/warking/hunjy/MySQL/Schematic.java @@ -109,6 +109,23 @@ public class Schematic { return null; } + public static List getAllSchemsOfType(SchematicType schemType){ + try{ + ResultSet schematic = sql.select("SELECT * FROM Schematic WHERE SchemType = '" + schemType.name() + "'"); + List schematics = new ArrayList<>(); + while(schematic.next()){ + int schemOwner = schematic.getInt("SchemOwner"); + String schemName = schematic.getString("SchemName"); + String item = schematic.getString("Item"); + schematics.add(new Schematic(schemName, schemOwner, item, schemType, false)); + } + return schematics; + }catch(SQLException e){ + e.printStackTrace(); + } + return null; + } + public String getSchemName() { return SchemName; }