Refactored DatabaseFactory.
This commit is contained in:
@@ -26,7 +26,7 @@ import java.util.Scanner;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.Server;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
|
||||
/**
|
||||
* This class SQL Account Manager
|
||||
@@ -166,7 +166,7 @@ public class SQLAccountManager
|
||||
}
|
||||
q = q.concat(" ORDER BY login ASC");
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(q);
|
||||
ResultSet rset = ps.executeQuery())
|
||||
{
|
||||
@@ -187,7 +187,7 @@ public class SQLAccountManager
|
||||
|
||||
private static void addOrUpdateAccount(String account, String password, String level)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("REPLACE accounts(login, password, accessLevel) VALUES (?, ?, ?)"))
|
||||
{
|
||||
final MessageDigest md = MessageDigest.getInstance("SHA");
|
||||
@@ -216,7 +216,7 @@ public class SQLAccountManager
|
||||
|
||||
private static void changeAccountLevel(String account, String level)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET accessLevel = ? WHERE login = ?"))
|
||||
{
|
||||
ps.setString(1, level);
|
||||
@@ -239,7 +239,7 @@ public class SQLAccountManager
|
||||
|
||||
private static void deleteAccount(String account)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM accounts WHERE login = ?"))
|
||||
{
|
||||
ps.setString(1, account);
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.ResourceBundle;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.Server;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.loginserver.GameServerTable;
|
||||
import com.l2jmobius.util.Util;
|
||||
|
||||
@@ -96,7 +96,7 @@ public abstract class BaseGameServerRegister
|
||||
*/
|
||||
public static void unregisterGameServer(int id) throws SQLException
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM gameservers WHERE server_id = ?"))
|
||||
|
||||
{
|
||||
@@ -112,7 +112,7 @@ public abstract class BaseGameServerRegister
|
||||
*/
|
||||
public static void unregisterAllGameServers() throws SQLException
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement())
|
||||
{
|
||||
s.executeUpdate("DELETE FROM gameservers");
|
||||
|
||||
Reference in New Issue
Block a user