Package l2p.database

Examples of l2p.database.ThreadConnection.createStatement()


    ResultSet rs2 = null;
    sendLock.lock();
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      stmt = con.createStatement();
      rs = stmt.executeQuery("SELECT m.messageId, m.topic, UNIX_TIMESTAMP(m.expire) AS lifetime, m.body, m.price, m.attachments, m.unread, m.system, m.sender, m.receiver, cs.char_name, cr.char_name FROM mail m LEFT JOIN characters cs ON ( m.sender = cs.obj_Id ) LEFT JOIN characters cr ON ( m.receiver = cr.obj_Id )");
      while(rs.next())
      {
        Letter ret = new Letter();
        ret.id = rs.getInt("m.messageId");
View Full Code Here


        ret.topic = rs.getString("m.topic");
        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);
View Full Code Here

    ThreadConnection conn = null;
    FiltredStatement stmt = null;
    try
    {
      conn = L2DatabaseFactory.getInstance().getConnection();
      stmt = conn.createStatement();
      stmt.executeUpdate("UPDATE characters SET online = 0");
      stmt.executeUpdate("UPDATE characters SET accesslevel = 0 WHERE accesslevel = -1");
      _log.info("Clear characters online status and accesslevel.");
    }
    catch(SQLException e)
View Full Code Here

    FiltredStatement s = null;
    ResultSet rs = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      s = con.createStatement();
      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];
      }
View Full Code Here

      FiltredStatement s = null;
      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]);
        }
View Full Code Here

      FiltredStatement s = null;
      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

    ResultSet rs = null;
    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

    ResultSet ps_rset = null;
    try
    {
      // 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())
      {
View Full Code Here

    try
    {
      // 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");
View Full Code Here

          // Restore kills stat
          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.