|
@ -21,6 +21,72 @@ public class Games { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String printTable() { |
|
|
|
|
|
String result = ""; |
|
|
|
|
|
String query = "SELECT * FROM Games"; |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
Connection connection = DriverManager.getConnection(databaseURL); |
|
|
|
|
|
|
|
|
|
|
|
Statement statement = connection.createStatement(); |
|
|
|
|
|
ResultSet resultSet = statement.executeQuery(query); |
|
|
|
|
|
|
|
|
|
|
|
while (resultSet.next()) { |
|
|
|
|
|
int id = resultSet.getInt("Game_ID"); |
|
|
|
|
|
String gameName = resultSet.getString("Game_Name"); |
|
|
|
|
|
String gameConsole = resultSet.getString("Game_Console"); |
|
|
|
|
|
String gameDeveloper = resultSet.getString("Game_Developer"); |
|
|
|
|
|
String gamePublisherEu = resultSet.getString("Game_Developer"); |
|
|
|
|
|
String gamePublisherJp = resultSet.getString("Game_Console"); |
|
|
|
|
|
String gamePublisherNa = resultSet.getString("Game_Console"); |
|
|
|
|
|
String gameGenre = resultSet.getString("Game_Genre"); |
|
|
|
|
|
|
|
|
|
|
|
String gameReleaseEu = resultSet.getString("Game_Release_EU"); |
|
|
|
|
|
String gameReleaseEuDots = gameReleaseEu.substring(8, 10) + "." + gameReleaseEu.substring(5, 7) |
|
|
|
|
|
+ "." + gameReleaseEu.substring(0, 4); |
|
|
|
|
|
|
|
|
|
|
|
String gameReleaseJp = resultSet.getString("Game_Release_JP"); |
|
|
|
|
|
String gameReleaseJpDots = gameReleaseJp.substring(8, 10) + "." + gameReleaseJp.substring(5, 7) |
|
|
|
|
|
+ "." + gameReleaseJp.substring(0, 4); |
|
|
|
|
|
|
|
|
|
|
|
String gameReleaseNa = resultSet.getString("Game_Release_NA"); |
|
|
|
|
|
String gameReleaseNaDots = gameReleaseNa.substring(8, 10) + "." + gameReleaseNa.substring(5, 7) |
|
|
|
|
|
+ "." + gameReleaseNa.substring(0, 4); |
|
|
|
|
|
String gameReleaseAu = resultSet.getString("Game_Release_AU"); |
|
|
|
|
|
String gameReleaseAuDots; |
|
|
|
|
|
if (gameReleaseAu != null) { |
|
|
|
|
|
gameReleaseAuDots = gameReleaseAu.substring(8, 10) + "." + gameReleaseAu.substring(5, 7) |
|
|
|
|
|
+ "." + gameReleaseAu.substring(0, 4); |
|
|
|
|
|
} else { |
|
|
|
|
|
gameReleaseAuDots = "Unknown"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int gameUsk = resultSet.getInt("Game_USK_Rating"); |
|
|
|
|
|
int gamePegi = resultSet.getInt("Game_PEGI_Rating"); |
|
|
|
|
|
String gameEsrb = resultSet.getString("Game_ESRB_Rating"); |
|
|
|
|
|
String gameCero = resultSet.getString("Game_CERO_Rating"); |
|
|
|
|
|
String gameAcb = resultSet.getString("Game_ACB_Rating"); |
|
|
|
|
|
String gamePlayers = resultSet.getString("Game_Players"); |
|
|
|
|
|
|
|
|
|
|
|
if (gamePegi != 0) { |
|
|
|
|
|
result += id + ": " + gameName + ", " + gameConsole + ", " + gameDeveloper + ", " + gamePublisherEu + ", " + gamePublisherJp + ", " + gamePublisherNa + ", " + gameGenre + ", " + gameReleaseEuDots + ", " + gameReleaseJpDots + ", " + gameReleaseNaDots + ", " + gameReleaseAuDots + ", " + gameUsk + ", " + gamePegi + ", " + gameEsrb + ", " + gameCero + ", " + gameAcb + ", " + gamePlayers + "\n"; |
|
|
|
|
|
} else { |
|
|
|
|
|
result += id + ": " + gameName + ", " + gameConsole + ", " + gameDeveloper + ", " + gamePublisherEu + ", " + gamePublisherJp + ", " + gamePublisherNa + ", " + gameGenre + ", " + gameReleaseEuDots + ", " + gameReleaseJpDots + ", " + gameReleaseNaDots + ", " + gameReleaseAuDots + ", " + gameUsk + ", Unknown, " + gameEsrb + ", " + gameCero + ", " + gameAcb + ", " + gamePlayers + "\n"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
statement.close(); |
|
|
|
|
|
|
|
|
|
|
|
connection.close(); |
|
|
|
|
|
|
|
|
|
|
|
} catch (SQLException e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
// The substring removes the last New line in the String. |
|
|
|
|
|
return result.substring(0, result.length() - 1); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public String checkGames() { |
|
|
public String checkGames() { |
|
|
String result = ""; |
|
|
String result = ""; |
|
|
String query = "SELECT Game_Name FROM Games"; |
|
|
String query = "SELECT Game_Name FROM Games"; |
|
|