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

@ -32,7 +32,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.gameserver.GeoData;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.data.xml.impl.AppearanceItemData;
@ -924,7 +924,7 @@ public final class L2ItemInstance extends L2Object
}
_augmentation = augmentation;
try (Connection con = ConnectionFactory.getInstance().getConnection())
try (Connection con = DatabaseFactory.getInstance().getConnection())
{
updateItemAttributes(con);
}
@ -950,7 +950,7 @@ public final class L2ItemInstance extends L2Object
final L2Augmentation augment = _augmentation;
_augmentation = null;
try (Connection con = ConnectionFactory.getInstance().getConnection();
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_attributes WHERE itemId = ?"))
{
ps.setInt(1, getObjectId());
@ -967,7 +967,7 @@ public final class L2ItemInstance extends L2Object
public void restoreAttributes()
{
try (Connection con = ConnectionFactory.getInstance().getConnection();
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT augAttributes FROM item_attributes WHERE itemId=?");
PreparedStatement ps2 = con.prepareStatement("SELECT elemType,elemValue FROM item_elementals WHERE itemId=?"))
{
@ -1177,7 +1177,7 @@ public final class L2ItemInstance extends L2Object
_elementals[0] = new Elementals(element, value);
}
}
try (Connection con = ConnectionFactory.getInstance().getConnection())
try (Connection con = DatabaseFactory.getInstance().getConnection())
{
updateItemElements(con);
}
@ -1195,7 +1195,7 @@ public final class L2ItemInstance extends L2Object
public void setElementAttr(byte element, int value)
{
applyAttribute(element, value);
try (Connection con = ConnectionFactory.getInstance().getConnection())
try (Connection con = DatabaseFactory.getInstance().getConnection())
{
updateItemElements(con);
}
@ -1232,7 +1232,7 @@ public final class L2ItemInstance extends L2Object
_elementals = array;
final String query = (element != -1) ? "DELETE FROM item_elementals WHERE itemId = ? AND elemType = ?" : "DELETE FROM item_elementals WHERE itemId = ?";
try (Connection con = ConnectionFactory.getInstance().getConnection();
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
if (element != -1)
@ -1669,7 +1669,7 @@ public final class L2ItemInstance extends L2Object
return;
}
try (Connection con = ConnectionFactory.getInstance().getConnection();
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE items SET owner_id=?,count=?,loc=?,loc_data=?,enchant_level=?,custom_type1=?,custom_type2=?,mana_left=?,time=? " + "WHERE object_id = ?"))
{
ps.setInt(1, _ownerId);
@ -1704,7 +1704,7 @@ public final class L2ItemInstance extends L2Object
return;
}
try (Connection con = ConnectionFactory.getInstance().getConnection();
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO items (owner_id,item_id,count,loc,loc_data,enchant_level,object_id,custom_type1,custom_type2,mana_left,time) " + "VALUES (?,?,?,?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _ownerId);
@ -1750,7 +1750,7 @@ public final class L2ItemInstance extends L2Object
return;
}
try (Connection con = ConnectionFactory.getInstance().getConnection())
try (Connection con = DatabaseFactory.getInstance().getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE object_id = ?"))
{