Refactored DatabaseFactory.
This commit is contained in:
@@ -22,7 +22,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
|
||||
/**
|
||||
* 18.8.2010 - JIV: Disabling until someone update it
|
||||
@@ -39,7 +39,7 @@ public class CompactionIDFactory extends IdFactory
|
||||
_curOID = FIRST_OID;
|
||||
_freeSize = 0;
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
final Integer[] tmp_obj_ids = extractUsedObjectIDTable();
|
||||
|
||||
|
@@ -28,7 +28,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;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
@@ -181,7 +181,7 @@ public abstract class IdFactory
|
||||
*/
|
||||
private void setAllCharacterOffline()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement())
|
||||
{
|
||||
s.executeUpdate("UPDATE characters SET online = 0");
|
||||
@@ -198,7 +198,7 @@ public abstract class IdFactory
|
||||
*/
|
||||
private void cleanUpDB()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
Statement stmt = con.createStatement())
|
||||
{
|
||||
final long cleanupStart = System.currentTimeMillis();
|
||||
@@ -310,7 +310,7 @@ public abstract class IdFactory
|
||||
|
||||
private void cleanInvalidWeddings()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement())
|
||||
{
|
||||
s.executeUpdate("DELETE FROM mods_wedding WHERE player1Id NOT IN (SELECT charId FROM characters)");
|
||||
@@ -325,7 +325,7 @@ public abstract class IdFactory
|
||||
|
||||
private void cleanUpTimeStamps()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
int cleanCount = 0;
|
||||
for (String line : TIMESTAMPS_CLEAN)
|
||||
@@ -351,7 +351,7 @@ public abstract class IdFactory
|
||||
protected final Integer[] extractUsedObjectIDTable() throws Exception
|
||||
{
|
||||
final List<Integer> temp = new ArrayList<>();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement())
|
||||
{
|
||||
String extractUsedObjectIdsQuery = "";
|
||||
|
@@ -23,7 +23,7 @@ import java.sql.SQLException;
|
||||
import java.util.Stack;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
@@ -42,7 +42,7 @@ public class StackIDFactory extends IdFactory
|
||||
_curOID = FIRST_OID;
|
||||
_tempOID = FIRST_OID;
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
// con.createStatement().execute("drop table if exists tmp_obj_id");
|
||||
|
||||
|
Reference in New Issue
Block a user