Dropped c3p0 in favor of HikariCP.
This commit is contained in:
@@ -49,6 +49,8 @@ public class SQLAccountManager
|
||||
{
|
||||
Server.serverMode = Server.MODE_LOGINSERVER;
|
||||
Config.load();
|
||||
DatabaseFactory.init();
|
||||
|
||||
while (true)
|
||||
{
|
||||
System.out.println("Please choose an option:");
|
||||
@@ -161,7 +163,7 @@ public class SQLAccountManager
|
||||
{
|
||||
int count = 0;
|
||||
Connection con = null;
|
||||
con = DatabaseFactory.getInstance().getConnection();
|
||||
con = DatabaseFactory.getConnection();
|
||||
String q = "SELECT login, accessLevel FROM accounts ";
|
||||
if (m.equals("1"))
|
||||
{
|
||||
@@ -200,7 +202,7 @@ public class SQLAccountManager
|
||||
|
||||
// Add to Base
|
||||
Connection con = null;
|
||||
con = DatabaseFactory.getInstance().getConnection();
|
||||
con = DatabaseFactory.getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("REPLACE accounts (login, password, accessLevel) VALUES (?,?,?)");
|
||||
statement.setString(1, account);
|
||||
statement.setString(2, Base64.getEncoder().encodeToString(newpass));
|
||||
@@ -213,7 +215,7 @@ public class SQLAccountManager
|
||||
private static void changeAccountLevel(String account, String level) throws SQLException
|
||||
{
|
||||
Connection con = null;
|
||||
con = DatabaseFactory.getInstance().getConnection();
|
||||
con = DatabaseFactory.getConnection();
|
||||
|
||||
// Check Account Exist
|
||||
PreparedStatement statement = con.prepareStatement("SELECT COUNT(*) FROM accounts WHERE login=?;");
|
||||
@@ -248,7 +250,7 @@ public class SQLAccountManager
|
||||
private static void deleteAccount(String account) throws SQLException
|
||||
{
|
||||
Connection con = null;
|
||||
con = DatabaseFactory.getInstance().getConnection();
|
||||
con = DatabaseFactory.getConnection();
|
||||
|
||||
// Check Account Exist
|
||||
PreparedStatement statement = con.prepareStatement("SELECT COUNT(*) FROM accounts WHERE login=?;");
|
||||
|
||||
@@ -69,7 +69,9 @@ public abstract class BaseGameServerRegister
|
||||
Server.serverMode = Server.MODE_LOGINSERVER;
|
||||
|
||||
Config.load();
|
||||
DatabaseFactory.init();
|
||||
GameServerTable.getInstance();
|
||||
|
||||
try
|
||||
{
|
||||
GameServerTable.load();
|
||||
@@ -105,7 +107,7 @@ public abstract class BaseGameServerRegister
|
||||
*/
|
||||
public static void unregisterGameServer(int id) throws SQLException
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM gameservers WHERE server_id = ?"))
|
||||
|
||||
{
|
||||
@@ -121,7 +123,7 @@ public abstract class BaseGameServerRegister
|
||||
*/
|
||||
public static void unregisterAllGameServers() throws SQLException
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
Statement s = con.createStatement())
|
||||
{
|
||||
s.executeUpdate("DELETE FROM gameservers");
|
||||
|
||||
Reference in New Issue
Block a user