|
|
@ -8,7 +8,11 @@ import java.sql.Statement; |
|
|
|
|
|
|
|
public class Games { |
|
|
|
private String databaseURL = "jdbc:ucanaccess://GamesDB.accdb"; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Checks if the connection to the database can be established |
|
|
|
* @return Returns true if it connects successfully and false if the connection fails. |
|
|
|
*/ |
|
|
|
public boolean checkConnection() { |
|
|
|
try { |
|
|
|
Connection connection = DriverManager.getConnection(databaseURL); |
|
|
@ -20,7 +24,11 @@ public class Games { |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Prints the whole table for those, who cannot access the Database for some reason. |
|
|
|
* @return Returns a String of the whole table. |
|
|
|
*/ |
|
|
|
public String printTable() { |
|
|
|
String result = ""; |
|
|
|
String query = "SELECT * FROM Games"; |
|
|
@ -93,7 +101,7 @@ public class Games { |
|
|
|
// The substring removes the last New line in the String. |
|
|
|
return result.substring(0, result.length() - 1); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String checkGames() { |
|
|
|
String result = ""; |
|
|
|
String query = "SELECT Game_Name FROM Games"; |
|
|
@ -1643,7 +1651,7 @@ public class Games { |
|
|
|
|
|
|
|
return result.substring(0, result.length() - 2); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String checkEsrbE() { |
|
|
|
String result = ""; |
|
|
|
String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games"; |
|
|
@ -1672,7 +1680,7 @@ public class Games { |
|
|
|
|
|
|
|
return result.substring(0, result.length() - 2); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String checkEsrbEten() { |
|
|
|
String result = ""; |
|
|
|
String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games"; |
|
|
@ -1701,7 +1709,7 @@ public class Games { |
|
|
|
|
|
|
|
return result.substring(0, result.length() - 2); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String checkEsrbT() { |
|
|
|
String result = ""; |
|
|
|
String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games"; |
|
|
@ -1730,7 +1738,7 @@ public class Games { |
|
|
|
|
|
|
|
return result.substring(0, result.length() - 2); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String checkEsrbM() { |
|
|
|
String result = ""; |
|
|
|
String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games"; |
|
|
@ -1759,7 +1767,7 @@ public class Games { |
|
|
|
|
|
|
|
return result.substring(0, result.length() - 2); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String checkCeroA() { |
|
|
|
String result = ""; |
|
|
|
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games"; |
|
|
@ -1788,7 +1796,7 @@ public class Games { |
|
|
|
|
|
|
|
return result.substring(0, result.length() - 2); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String checkCeroB() { |
|
|
|
String result = ""; |
|
|
|
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games"; |
|
|
@ -1817,7 +1825,7 @@ public class Games { |
|
|
|
|
|
|
|
return result.substring(0, result.length() - 2); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String checkCeroC() { |
|
|
|
String result = ""; |
|
|
|
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games"; |
|
|
@ -1846,7 +1854,7 @@ public class Games { |
|
|
|
|
|
|
|
return result.substring(0, result.length() - 2); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String checkCeroD() { |
|
|
|
String result = ""; |
|
|
|
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games"; |
|
|
@ -1875,7 +1883,7 @@ public class Games { |
|
|
|
|
|
|
|
return result.substring(0, result.length() - 2); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String checkCeroZ() { |
|
|
|
String result = ""; |
|
|
|
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games"; |
|
|
@ -1904,7 +1912,7 @@ public class Games { |
|
|
|
|
|
|
|
return result.substring(0, result.length() - 2); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String checkAcbG() { |
|
|
|
String result = ""; |
|
|
|
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games"; |
|
|
@ -1933,7 +1941,7 @@ public class Games { |
|
|
|
|
|
|
|
return result.substring(0, result.length() - 2); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String checkAcbPg() { |
|
|
|
String result = ""; |
|
|
|
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games"; |
|
|
@ -1962,7 +1970,7 @@ public class Games { |
|
|
|
|
|
|
|
return result.substring(0, result.length() - 2); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String checkAcbM() { |
|
|
|
String result = ""; |
|
|
|
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games"; |
|
|
@ -1991,7 +1999,7 @@ public class Games { |
|
|
|
|
|
|
|
return result.substring(0, result.length() - 2); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String checkAcbMaFifteen() { |
|
|
|
String result = ""; |
|
|
|
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games"; |
|
|
@ -2020,7 +2028,7 @@ public class Games { |
|
|
|
|
|
|
|
return result.substring(0, result.length() - 2); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String checkAcbReighteen() { |
|
|
|
String result = ""; |
|
|
|
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games"; |
|
|
|