Package l2p.database

Examples of l2p.database.FiltredPreparedStatement


   */
  public static synchronized void cleanupNobles()
  {
    Olympiad._log.info("Olympiad: Calculating last period...");
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement(Olympiad.OLYMPIAD_CALCULATE_LAST_PERIOD);
      statement.execute();
    }
    catch(Exception e)
    {
      Olympiad._log.warning("Olympiad System: Couldn't calculate last period!");
      e.printStackTrace();
    }
    finally
    {
      DatabaseUtils.closeDatabaseCS(con, statement);
    }
    Olympiad._log.info("Olympiad: Clearing nobles table...");
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement(Olympiad.OLYMPIAD_CLEANUP_NOBLES);
      statement.execute();
    }
    catch(Exception e)
    {
      Olympiad._log.warning("Olympiad System: Couldn't cleanup nobles table!");
      e.printStackTrace();
View Full Code Here


  public static int[][] restoreVisibleInventory(int objectId)
  {
    int[][] paperdoll = new int[Inventory.PAPERDOLL_MAX][3];
    ThreadConnection con = null;
    FiltredPreparedStatement statement2 = null;
    ResultSet invdata = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement2 = con.prepareStatement("SELECT object_id,item_id,loc_data,enchant_level FROM items WHERE owner_id=? AND loc='PAPERDOLL'");
      statement2.setInt(1, objectId);
      invdata = statement2.executeQuery();
      while(invdata.next())
      {
        int slot = invdata.getInt("loc_data");
        paperdoll[slot][0] = invdata.getInt("object_id");
        paperdoll[slot][1] = invdata.getInt("item_id");
View Full Code Here

  public static GArray<String> getClassLeaderBoard(int classId)
  {
    GArray<String> names = new GArray<String>();
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    ResultSet rset = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement(classId == 132 ? Olympiad.GET_EACH_CLASS_LEADER_SOULHOUND : Olympiad.GET_EACH_CLASS_LEADER);
      statement.setInt(1, classId);
      rset = statement.executeQuery();
      while(rset.next())
      {
        names.add(rset.getString(Olympiad.CHAR_NAME));
      }
      return names;
View Full Code Here

    {
      return;
    }
    Olympiad._heroesToBe = new GArray<StatsSet>();
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    ResultSet rset = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      StatsSet hero;
      for(ClassId id : ClassId.values())
      {
        if(id.getId() == 133)
        {
          continue;
        }
        if(id.level() == 3)
        {
          statement = con.prepareStatement(id.getId() == 132 ? Olympiad.OLYMPIAD_GET_HEROS_SOULHOUND : Olympiad.OLYMPIAD_GET_HEROS);
          statement.setInt(1, id.getId());
          rset = statement.executeQuery();
          if(rset.next())
          {
            hero = new StatsSet();
            hero.set(Olympiad.CLASS_ID, id.getId());
            hero.set(Olympiad.CHAR_ID, rset.getInt(Olympiad.CHAR_ID));
View Full Code Here

  public static synchronized void saveNobleData(int nobleId)
  {
    L2Player player = L2ObjectsStorage.getPlayer(nobleId);
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      StatsSet nobleInfo = Olympiad._nobles.get(nobleId);
      int classId = nobleInfo.getInteger(Olympiad.CLASS_ID);
      String charName = player != null ? player.getName() : nobleInfo.getString(Olympiad.CHAR_NAME);
      int points = nobleInfo.getInteger(Olympiad.POINTS);
      int points_past = nobleInfo.getInteger(Olympiad.POINTS_PAST);
      int points_past_static = nobleInfo.getInteger(Olympiad.POINTS_PAST_STATIC);
      int compDone = nobleInfo.getInteger(Olympiad.COMP_DONE);
      int compWin = nobleInfo.getInteger(Olympiad.COMP_WIN);
      int compLoose = nobleInfo.getInteger(Olympiad.COMP_LOOSE);
      statement = con.prepareStatement(Olympiad.OLYMPIAD_SAVE_NOBLES);
      statement.setInt(1, nobleId);
      statement.setInt(2, classId);
      statement.setString(3, charName);
      statement.setInt(4, points);
      statement.setInt(5, points_past);
      statement.setInt(6, points_past_static);
      statement.setInt(7, compDone);
      statement.setInt(8, compWin);
      statement.setInt(9, compLoose);
      statement.execute();
    }
    catch(Exception e)
    {
      Olympiad._log.warning("Olympiad System: Couldnt save noble info in db for player " + (player != null ? player.getName() : "null"));
      e.printStackTrace();
View Full Code Here

    _procureNext = new GArray<CropProcure>();
    _productionNext = new GArray<SeedProduction>();
    _isNextPeriodApproved = false;
    _type = ResidenceType.Castle;
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    ResultSet rset = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("SELECT clan_id FROM clan_data WHERE hasCastle = ? LIMIT 1");
      statement.setInt(1, getId());
      rset = statement.executeQuery();
      if(rset.next())
      {
        _ownerId = rset.getInt("clan_id");
      }
      statement = con.prepareStatement("SELECT * FROM castle WHERE id=? LIMIT 1");
      statement.setInt(1, getId());
      rset = statement.executeQuery();
      while(rset.next())
      {
        _name = rset.getString("name");
        _SiegeDayOfWeek = rset.getInt("siegeDayOfWeek");
        if(_SiegeDayOfWeek < 1 || _SiegeDayOfWeek > 7)
View Full Code Here

  private void updateOwnerInDB(L2Clan clan)
  {
    _ownerId = clan == null ? 0 : clan.getClanId(); // Update owner id property
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("UPDATE clan_data SET hasCastle=0 WHERE hasCastle=? LIMIT 1");
      statement.setInt(1, getId());
      statement.execute();
      DatabaseUtils.closeStatement(statement);
      statement = null;
      if(clan != null)
      {
        statement = con.prepareStatement("UPDATE clan_data SET hasCastle=? WHERE clan_id=? LIMIT 1");
        statement.setInt(1, getId());
        statement.setInt(2, getOwnerId());
        statement.execute();
        clan.broadcastClanStatus(false, true, true);
        clan.broadcastToOnlineMembers(new PlaySound("Siege_Victory"));
      }
    }
    catch(Exception e)
View Full Code Here

    if(seed)
    {
      _collectedSeed += amount;
    }
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("Update castle set treasury = ? where id = ?");
      statement.setLong(1, getTreasury());
      statement.setInt(2, getId());
      statement.execute();
      statement.close();
      DatabaseUtils.closeDatabaseCS(con, statement);
    }
    catch(Exception e)
    {
      _log.warning("Exception: addToTreasuryNoTax(): " + e.getMessage());
View Full Code Here

  public void setTaxPercent(L2Player activeChar, int taxPercent)
  {
    _TaxPercent = taxPercent;
    _TaxRate = _TaxPercent / 100.0;
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement("UPDATE castle SET taxPercent = ? WHERE id = ? LIMIT 1");
      statement.setInt(1, taxPercent);
      statement.setInt(2, getId());
      statement.execute();
    }
    catch(Exception e)
    {
    }
    finally
View Full Code Here

  public L2ItemInstance[] listItems(ItemClass clss)
  {
    final GArray<L2ItemInstance> items = new GArray<L2ItemInstance>();
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    ResultSet rset = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement(clss == ItemClass.ALL ? query : query_class);
      statement.setInt(1, getOwnerId());
      statement.setString(2, getLocationType().name());
      if(clss != ItemClass.ALL)
      {
        statement.setString(3, clss.name());
      }
      rset = statement.executeQuery();
      L2ItemInstance item;
      while(rset.next())
      {
        if((item = L2ItemInstance.restoreFromDb(rset, con, false)) != null)
        {
View Full Code Here

TOP

Related Classes of l2p.database.FiltredPreparedStatement

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.