Refactored DatabaseFactory.
This commit is contained in:
@ -33,7 +33,7 @@ import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.commons.mmocore.MMOClient;
|
||||
import com.l2jmobius.commons.mmocore.MMOConnection;
|
||||
import com.l2jmobius.commons.mmocore.ReceivablePacket;
|
||||
@ -308,7 +308,7 @@ public final class L2GameClient extends MMOClient<MMOConnection<L2GameClient>> i
|
||||
return -1;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("SELECT clanId FROM characters WHERE charId=?"))
|
||||
{
|
||||
statement.setInt(1, objid);
|
||||
@ -401,7 +401,7 @@ public final class L2GameClient extends MMOClient<MMOConnection<L2GameClient>> i
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("UPDATE characters SET deletetime=0 WHERE charId=?"))
|
||||
{
|
||||
statement.setInt(1, objid);
|
||||
@ -430,7 +430,7 @@ public final class L2GameClient extends MMOClient<MMOConnection<L2GameClient>> i
|
||||
|
||||
CharNameTable.getInstance().removeName(objid);
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
try (PreparedStatement ps = con.prepareStatement("DELETE FROM character_contacts WHERE charId=? OR contactId=?"))
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ import java.sql.PreparedStatement;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
|
||||
import com.l2jmobius.gameserver.model.PcCondOverride;
|
||||
@ -153,7 +153,7 @@ public final class RequestDestroyItem extends L2GameClientPacket
|
||||
pet.unSummon(activeChar);
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
|
||||
{
|
||||
statement.setInt(1, _objectId);
|
||||
|
@ -21,7 +21,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
@ -62,7 +62,7 @@ public class RequestPetitionFeedback extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(INSERT_FEEDBACK))
|
||||
{
|
||||
statement.setString(1, player.getName());
|
||||
|
@ -20,7 +20,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.L2GameClientPacket;
|
||||
@ -64,7 +64,7 @@ public final class RequestAnswerFriendInvite extends L2GameClientPacket
|
||||
|
||||
if (_response == 1)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("INSERT INTO character_friends (charId, friendId) VALUES (?, ?), (?, ?)"))
|
||||
{
|
||||
statement.setInt(1, requestor.getObjectId());
|
||||
|
@ -20,7 +20,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
@ -75,7 +75,7 @@ public final class RequestFriendDel extends L2GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("DELETE FROM character_friends WHERE (charId=? AND friendId=?) OR (charId=? AND friendId=?)"))
|
||||
{
|
||||
statement.setInt(1, activeChar.getObjectId());
|
||||
|
@ -20,7 +20,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.enums.CategoryType;
|
||||
import com.l2jmobius.gameserver.instancemanager.MentorManager;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
@ -73,7 +73,7 @@ public class ConfirmMenteeAdd extends L2GameClientPacket
|
||||
{
|
||||
if (validate(mentor, mentee))
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("INSERT INTO character_mentees (charId, mentorId) VALUES (?, ?)"))
|
||||
{
|
||||
statement.setInt(1, mentee.getObjectId());
|
||||
|
@ -25,7 +25,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import com.l2jmobius.gameserver.model.CharSelectInfoPackage;
|
||||
@ -176,7 +176,7 @@ public class CharSelectionInfo extends L2GameServerPacket
|
||||
private static List<CharSelectInfoPackage> loadCharacterSelectInfo(String loginName)
|
||||
{
|
||||
final List<CharSelectInfoPackage> characterList = new ArrayList<>();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("SELECT * FROM characters WHERE account_name=? ORDER BY createDate"))
|
||||
{
|
||||
statement.setString(1, loginName);
|
||||
@ -201,7 +201,7 @@ public class CharSelectionInfo extends L2GameServerPacket
|
||||
|
||||
private static void loadCharacterSubclassInfo(CharSelectInfoPackage charInfopackage, int ObjectId, int activeClassId)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("SELECT exp, sp, level, vitality_points FROM character_subclasses WHERE charId=? && class_id=? ORDER BY charId"))
|
||||
{
|
||||
statement.setInt(1, ObjectId);
|
||||
@ -311,7 +311,7 @@ public class CharSelectionInfo extends L2GameServerPacket
|
||||
|
||||
if (weaponObjId > 0)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("SELECT augAttributes FROM item_attributes WHERE itemId=?"))
|
||||
{
|
||||
statement.setInt(1, weaponObjId);
|
||||
|
Reference in New Issue
Block a user