Sync with L2jServer HighFive Jul 25th 2015.
This commit is contained in:
@ -26,7 +26,7 @@ import java.sql.Statement;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
@ -110,14 +110,14 @@ public class Announcement implements IAnnouncement
|
||||
@Override
|
||||
public boolean storeMe()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement st = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
|
||||
{
|
||||
st.setInt(1, _type.ordinal());
|
||||
st.setString(2, _content);
|
||||
st.setString(3, _author);
|
||||
st.execute();
|
||||
try (ResultSet rset = st.getGeneratedKeys())
|
||||
ps.setInt(1, _type.ordinal());
|
||||
ps.setString(2, _content);
|
||||
ps.setString(3, _author);
|
||||
ps.execute();
|
||||
try (ResultSet rset = ps.getGeneratedKeys())
|
||||
{
|
||||
if (rset.next())
|
||||
{
|
||||
@ -136,14 +136,14 @@ public class Announcement implements IAnnouncement
|
||||
@Override
|
||||
public boolean updateMe()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement st = con.prepareStatement(UPDATE_QUERY))
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(UPDATE_QUERY))
|
||||
{
|
||||
st.setInt(1, _type.ordinal());
|
||||
st.setString(2, _content);
|
||||
st.setString(3, _author);
|
||||
st.setInt(4, _id);
|
||||
st.execute();
|
||||
ps.setInt(1, _type.ordinal());
|
||||
ps.setString(2, _content);
|
||||
ps.setString(3, _author);
|
||||
ps.setInt(4, _id);
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -156,11 +156,11 @@ public class Announcement implements IAnnouncement
|
||||
@Override
|
||||
public boolean deleteMe()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement st = con.prepareStatement(DELETE_QUERY))
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(DELETE_QUERY))
|
||||
{
|
||||
st.setInt(1, _id);
|
||||
st.execute();
|
||||
ps.setInt(1, _id);
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.util.Broadcast;
|
||||
|
||||
@ -96,17 +96,17 @@ public final class AutoAnnouncement extends Announcement implements Runnable
|
||||
@Override
|
||||
public boolean storeMe()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement st = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
|
||||
{
|
||||
st.setInt(1, getType().ordinal());
|
||||
st.setString(2, getContent());
|
||||
st.setString(3, getAuthor());
|
||||
st.setLong(4, getInitial());
|
||||
st.setLong(5, getDelay());
|
||||
st.setInt(6, getRepeat());
|
||||
st.execute();
|
||||
try (ResultSet rset = st.getGeneratedKeys())
|
||||
ps.setInt(1, getType().ordinal());
|
||||
ps.setString(2, getContent());
|
||||
ps.setString(3, getAuthor());
|
||||
ps.setLong(4, getInitial());
|
||||
ps.setLong(5, getDelay());
|
||||
ps.setInt(6, getRepeat());
|
||||
ps.execute();
|
||||
try (ResultSet rset = ps.getGeneratedKeys())
|
||||
{
|
||||
if (rset.next())
|
||||
{
|
||||
@ -125,17 +125,17 @@ public final class AutoAnnouncement extends Announcement implements Runnable
|
||||
@Override
|
||||
public boolean updateMe()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement st = con.prepareStatement(UPDATE_QUERY))
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(UPDATE_QUERY))
|
||||
{
|
||||
st.setInt(1, getType().ordinal());
|
||||
st.setString(2, getContent());
|
||||
st.setString(3, getAuthor());
|
||||
st.setLong(4, getInitial());
|
||||
st.setLong(5, getDelay());
|
||||
st.setLong(6, getRepeat());
|
||||
st.setLong(7, getId());
|
||||
st.execute();
|
||||
ps.setInt(1, getType().ordinal());
|
||||
ps.setString(2, getContent());
|
||||
ps.setString(3, getAuthor());
|
||||
ps.setLong(4, getInitial());
|
||||
ps.setLong(5, getDelay());
|
||||
ps.setLong(6, getRepeat());
|
||||
ps.setLong(7, getId());
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
Reference in New Issue
Block a user