Package l2p.database

Examples of l2p.database.ThreadConnection


  }

  public static String getPlayerNameByObjId(int oid)
  {
    String pName = null;
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    ResultSet rset = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("SELECT `char_name` FROM `characters` WHERE `obj_Id`=\"" + oid + "\" LIMIT 1");
      rset = statement.executeQuery();
      if(rset.next())
      {
        pName = rset.getString(1);
      }
View Full Code Here


      }
      _logChat.log(record);
    }
    if(Config.LOG_CHAT_DB != null && !Config.LOG_CHAT_DB.isEmpty())
    {
      ThreadConnection con = null;
      FiltredPreparedStatement statement = null;
      try
      {
        con = L2DatabaseFactory.getInstance().getConnection();
        statement = con.prepareStatement("INSERT DELAYED INTO " + Config.LOG_CHAT_DB + " (`type`,`text`,`from`,`to`) VALUES(?,?,?,?);");
        statement.setString(1, type.trim());
        statement.setString(2, text);
        statement.setString(3, from);
        statement.setString(4, to != null ? to : "");
        statement.execute();
View Full Code Here

  public static void SqlLog(L2Character activeObject, L2Character target, Integer log_id, L2ItemInstance Item, String etc_str1, String etc_str2, String etc_str3, Integer etc_num1, Integer etc_num2, Integer etc_num3, Integer etc_num4, Integer etc_num5, Integer etc_num6, Integer etc_num7, Integer etc_num8, Long etc_num9, Long etc_num10)
  {
    if(Config.SQL_LOG)
    {
      ThreadConnection con = null;
      FiltredPreparedStatement statement = null;
      try
      {
        con = L2DatabaseFactory.getInstance().getConnection();
        statement = con.prepareStatement("INSERT INTO game_log (serv_id, act_time, log_id, actor, actor_type, target, target_type, location_x, location_y, location_z, etc_str1, etc_str2, etc_str3, etc_num1, etc_num2, etc_num3, etc_num4, etc_num5, etc_num6, etc_num7, etc_num8, etc_num9, etc_num10, STR_actor, STR_actor_account, STR_target, STR_target_account, item_id) " + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);");
        statement.setInt(1, 0); //serv_id
        statement.setLong(2, System.currentTimeMillis() / 1000); //act_time
        statement.setInt(3, log_id); //log_id
        if(activeObject != null)
        {
View Full Code Here

  public static void LogPetition(L2Player fromChar, Integer Petition_type, String Petition_text)
  {
    if(Config.SQL_LOG)
    {
      ThreadConnection con = null;
      FiltredPreparedStatement statement = null;
      try
      {
        con = L2DatabaseFactory.getInstance().getConnection();
        statement = con.prepareStatement("INSERT INTO petitions (serv_id, act_time, petition_type, actor, location_x, location_y, location_z, petition_text, STR_actor, STR_actor_account) VALUES (?,?,?,?,?,?,?,?,?,?);");
        statement.setInt(1, 0); //serv_id
        statement.setLong(2, System.currentTimeMillis() / 1000); //act_time
        statement.setInt(3, Petition_type); //log_id
        statement.setInt(4, fromChar.getObjectId());
        statement.setInt(5, fromChar.getX()); //location_x,
View Full Code Here

  {
    if(!Config.SQL_LOG)
    {
      return;
    }
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("INSERT INTO loginserv_log (act_time, log_id, etc_str1, etc_str2, etc_str3, etc_num1, etc_num2) " + "VALUES (?,?,?,?,?,?,?);");
      statement.setLong(1, System.currentTimeMillis() / 1000); //act_time
      statement.setInt(2, log_id); //log_id
      statement.setString(3, etc_str1); //etc_str1,
      statement.setString(4, etc_str2); //etc_str2
      statement.setString(5, etc_str3); //etc_str3,
View Full Code Here

    }
  }

  public void load()
  {
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    ResultSet rset = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("SELECT * FROM epic_boss_spawn WHERE bossId = ? LIMIT 1");
      statement.setInt(1, _bossId);
      rset = statement.executeQuery();
      if(rset.next())
      {
        _respawnDate = rset.getLong("respawnDate") * 1000L;
 
View Full Code Here

    }
  }

  public void save()
  {
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("REPLACE INTO epic_boss_spawn (bossId,respawnDate,state) VALUES(?,?,?)");
      statement.setInt(1, _bossId);
      statement.setInt(2, (int) (_respawnDate / 1000));
      statement.setInt(3, _state.ordinal());
      statement.execute();
      statement.close();
View Full Code Here

    }
  }

  public void update()
  {
    ThreadConnection con = null;
    FiltredStatement statement = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.createStatement();
      statement.executeUpdate("UPDATE epic_boss_spawn SET respawnDate=" + _respawnDate / 1000 + ", state=" + _state.ordinal() + " WHERE bossId=" + _bossId);
      _log.info("update EpicBossState: ID:" + _bossId + ", RespawnDate:" + _respawnDate / 1000 + ", State:" + _state.toString());
    }
    catch(Exception e)
    {
View Full Code Here

{
  private boolean HaveBonus(String type)
  {
    L2Player player = (L2Player) getSelf();
    ResultSet rs = null;
    ThreadConnection con = null;
    FiltredPreparedStatement offline = null;
    Calendar end_;
    end_ = Calendar.getInstance();
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      offline = con.prepareStatement("SELECT bonus_expire_time FROM bonus WHERE obj_id LIKE ? AND bonus_name = ?");
      offline.setInt(1, player.getObjectId());
      offline.setString(2, type);
      rs = offline.executeQuery();
      if(rs.next())
      {
View Full Code Here

    }
    if(HaveBonus(bonus_class))
    {
      return;
    }
    ThreadConnection con = null;
    FiltredPreparedStatement offline = null;
    Calendar bonus_expire = Calendar.getInstance();
    if(getItemCount(player, Config.SERVICES_RATE_SPECIAL_ITEM_ID) < Config.SERVICES_RATE_SPECIAL_ITEM_COUNT)
    {
      if(Config.SERVICES_RATE_SPECIAL_ITEM_ID == 57)
      {
        player.sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
      }
      else
      {
        player.sendPacket(Msg.INCORRECT_ITEM_COUNT);
      }
      return;
    }
    bonus_expire.add(Calendar.DAY_OF_MONTH, Config.SERVICES_RATE_SPECIAL_DAYS);
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      offline = con.prepareStatement("INSERT INTO bonus(obj_id, bonus_name, bonus_value, bonus_expire_time) VALUES (?,?,?,?)");
      offline.setInt(1, player.getObjectId());
      offline.setString(2, bonus_class);
      offline.setInt(3, Config.SERVICES_RATE_SPECIAL_RATE);
      offline.setLong(4, bonus_expire.getTimeInMillis() / 1000);
      offline.executeUpdate();
View Full Code Here

TOP

Related Classes of l2p.database.ThreadConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.