Package l2p.database

Examples of l2p.database.FiltredStatement.executeQuery()


    ResultSet rset = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.createStatement();
      rset = statement.executeQuery("SELECT bonus_name,bonus_value from bonus where obj_id='" + _owner.getObjectId() + "' and (bonus_expire_time='-1' or bonus_expire_time > " + System.currentTimeMillis() / 1000 + ")");
      while(rset.next())
      {
        String bonus_name = rset.getString("bonus_name");
        float bonus_value = rset.getFloat("bonus_value");
        Class<?> cls = getClass();
View Full Code Here


      stmt = con.createStatement();
      stmt.executeUpdate("UPDATE mail LEFT JOIN mail_attachments ON mail.messageId = mail_attachments.messageId SET price=0,attachments=0 WHERE mail_attachments.messageId IS NULL");
      DatabaseUtils.closeStatement(stmt);
      // чистим от мусора в mail_attachments, возвращая вещи владельцам
      stmt = con.createStatement();
      rs = stmt.executeQuery("SELECT itemId FROM mail_attachments LEFT JOIN mail ON mail.messageId = mail_attachments.messageId WHERE mail.messageId IS NULL");
      while(rs.next())
      {
        L2ItemInstance item = L2ItemInstance.restoreFromDb(rs.getInt("itemId"), false);
        if(item.getOwnerId() == 0)
        {
View Full Code Here

        ret.body = rs.getString("m.body");
        ret.price = rs.getLong("m.price");
        if(ret.attachments > 0)
        {
          stmt2 = con.createStatement();
          rs2 = stmt2.executeQuery("SELECT itemId FROM mail_attachments WHERE messageId=" + ret.id);
          GArray<TradeItem> items = new GArray<TradeItem>(ret.attachments);
          while(rs2.next())
          {
            TradeItem ti = TradeItem.restoreFromDb(rs2.getInt("itemId"), ItemLocation.LEASE);
            if(ti != null)
View Full Code Here

      String query = "SELECT " + Tasks.objTables[0][1] + ", 0 AS i FROM " + Tasks.objTables[0][0];
      for(int i = 1; i < Tasks.objTables.length; i++)
      {
        query += " UNION SELECT " + Tasks.objTables[i][1] + ", " + i + " FROM " + Tasks.objTables[i][0];
      }
      rs = s.executeQuery("SELECT COUNT(*), COUNT(DISTINCT " + Tasks.objTables[0][1] + ") FROM ( " + query + " ) AS all_ids");
      if(!rs.next())
      {
        throw new Exception("IdFactory: can't extract count ids");
      }
      if(rs.getInt(1) != rs.getInt(2))
View Full Code Here

        throw new Exception("IdFactory: there are duplicates in object ids");
      }
      int[] result = new int[rs.getInt(1)];
      DatabaseUtils.closeResultSet(rs);
      _log.info("IdFactory: Extracting " + result.length + " used id's from data tables...");
      rs = s.executeQuery(query);
      int idx = 0;
      while(rs.next())
      {
        result[idx++] = rs.getInt(1);
      }
View Full Code Here

      ResultSet rs = null;
      try
      {
        con = L2DatabaseFactory.getInstance().getConnection();
        s = con.createStatement();
        rs = s.executeQuery("SELECT COUNT(*) FROM " + _objTable[0]);
        if(!rs.next())
        {
          throw new Exception("IdFactory: can't extract count ids :: " + _objTable[0]);
        }
        _objCountPut[0] = rs.getInt(1);
View Full Code Here

      ResultSet rs = null;
      try
      {
        con = L2DatabaseFactory.getInstance().getConnection();
        s = con.createStatement();
        rs = s.executeQuery("SELECT " + _objTable[1] + " FROM " + _objTable[0]);
        int idx = 0;
        while(rs.next())
        {
          _resultArray[startIdx + idx++] = rs.getInt(1);
        }
View Full Code Here

    int charObjId = L2ObjectsStorage.getStoredObjectId(ownerId);
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.createStatement();
      rs = statement.executeQuery("SELECT * FROM `character_bookmarks` WHERE `char_Id`=" + charObjId + " ORDER BY `idx` LIMIT " + getCapacity());
      synchronized(this)
      {
        elementData.clear();
        while(rs.next())
        {
View Full Code Here

      // Retrieve the L2Player from the characters table of the database
      con = L2DatabaseFactory.getInstance().getConnection();
      statement = con.createStatement();
      statement2 = con.createStatement();
      pl_rset = statement.executeQuery("SELECT * FROM `characters` WHERE `obj_Id`=" + objectId + " LIMIT 1");
      ps_rset = statement2.executeQuery("SELECT `class_id` FROM `character_subclasses` WHERE `char_obj_id`=" + objectId + " AND `isBase`=1 LIMIT 1");
      if(pl_rset.next() && ps_rset.next())
      {
        final int classId = ps_rset.getInt("class_id");
        final boolean female = pl_rset.getInt("sex") == 1;
        final L2PlayerTemplate template = CharTemplateTable.getInstance().getTemplate(classId, female);
View Full Code Here

          FiltredStatement stt = null;
          ResultSet rstkills = null;
          try
          {
            stt = con.createStatement();
            rstkills = stt.executeQuery("SELECT `npc_id`, `count` FROM `killcount` WHERE `char_id`=" + objectId);
            player._StatKills = new HashMap<Integer, Long>(128);
            while(rstkills.next())
            {
              player._StatKills.put(rstkills.getInt("npc_id"), rstkills.getLong("count"));
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.