|
|
@ -249,4 +249,47 @@ public class Games { |
|
|
|
|
|
|
|
return result.substring(0, result.length() - 2); |
|
|
|
} |
|
|
|
|
|
|
|
public String checkGameGenres() { |
|
|
|
String result = ""; |
|
|
|
String query = "SELECT Game_Genre FROM Games"; |
|
|
|
boolean actAd = false; |
|
|
|
boolean rpg = false; |
|
|
|
|
|
|
|
try { |
|
|
|
Connection connection = DriverManager.getConnection(databaseURL); |
|
|
|
|
|
|
|
Statement statement = connection.createStatement(); |
|
|
|
ResultSet resultSet = statement.executeQuery(query); |
|
|
|
|
|
|
|
while (resultSet.next()) { |
|
|
|
String gameGenre = resultSet.getString("Game_Genre"); |
|
|
|
|
|
|
|
if (actAd && gameGenre.equals("Action-Adventure")) { |
|
|
|
continue; |
|
|
|
} else if (rpg && gameGenre.equals("RPG")) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
switch (gameGenre) { |
|
|
|
case "Action-Adventure": |
|
|
|
actAd = true; |
|
|
|
break; |
|
|
|
case "RPG": |
|
|
|
rpg = true; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
result += gameGenre + ", "; |
|
|
|
|
|
|
|
} |
|
|
|
statement.close(); |
|
|
|
connection.close(); |
|
|
|
|
|
|
|
} catch (SQLException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
|
|
|
|
return result.substring(0, result.length() - 2); |
|
|
|
} |
|
|
|
} |