Refactored DatabaseFactory.

This commit is contained in:
MobiusDev
2016-01-11 21:31:45 +00:00
parent d288d505a9
commit 2684901232
140 changed files with 668 additions and 955 deletions

View File

@@ -40,7 +40,7 @@ import java.util.logging.Logger;
import javax.crypto.Cipher;
import com.l2jmobius.Config;
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.loginserver.GameServerTable.GameServerInfo;
import com.l2jmobius.loginserver.model.data.AccountInfo;
import com.l2jmobius.loginserver.network.L2LoginClient;
@@ -216,7 +216,7 @@ public class LoginController
final byte[] raw = password.getBytes(StandardCharsets.UTF_8);
final String hashBase64 = Base64.getEncoder().encodeToString(md.digest(raw));
try (Connection con = ConnectionFactory.getInstance().getConnection();
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(USER_INFO_SELECT))
{
ps.setString(1, Long.toString(System.currentTimeMillis()));
@@ -251,7 +251,7 @@ public class LoginController
return null;
}
try (Connection con = ConnectionFactory.getInstance().getConnection();
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(AUTOCREATE_ACCOUNTS_INSERT))
{
ps.setString(1, login);
@@ -451,7 +451,7 @@ public class LoginController
if (loginOk && (client.getLastServer() != serverId))
{
try (Connection con = ConnectionFactory.getInstance().getConnection();
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_LAST_SERVER_UPDATE))
{
ps.setInt(1, serverId);
@@ -470,7 +470,7 @@ public class LoginController
public void setAccountAccessLevel(String account, int banLevel)
{
try (Connection con = ConnectionFactory.getInstance().getConnection();
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_ACCESS_LEVEL_UPDATE))
{
ps.setInt(1, banLevel);
@@ -485,7 +485,7 @@ public class LoginController
public void setAccountLastTracert(String account, String pcIp, String hop1, String hop2, String hop3, String hop4)
{
try (Connection con = ConnectionFactory.getInstance().getConnection();
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPS_UPDATE))
{
ps.setString(1, pcIp);
@@ -545,7 +545,7 @@ public class LoginController
{
final List<InetAddress> ipWhiteList = new ArrayList<>();
final List<InetAddress> ipBlackList = new ArrayList<>();
try (Connection con = ConnectionFactory.getInstance().getConnection();
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPAUTH_SELECT))
{
ps.setString(1, info.getLogin());
@@ -591,7 +591,7 @@ public class LoginController
client.setAccessLevel(info.getAccessLevel());
client.setLastServer(info.getLastServer());
try (Connection con = ConnectionFactory.getInstance().getConnection();
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_INFO_UPDATE))
{
ps.setLong(1, System.currentTimeMillis());