Package l2p.database

Examples of l2p.database.ThreadConnection


                        int min_offline_restore = (int) (System.currentTimeMillis() / 1000 - Config.SERVICES_OFFLINE_TRADE_SECONDS_TO_KICK);
                        mysql.set("DELETE FROM character_variables WHERE `name` = 'offline' AND `value` < "
                                + min_offline_restore);
                    }
                    mysql.set("DELETE FROM character_variables WHERE `name` = 'offline' AND `obj_id` IN (SELECT `obj_id` FROM `characters` WHERE `accessLevel` < 0)");
                    ThreadConnection con = null;
                    FiltredPreparedStatement st = null;
                    ResultSet rs = null;
                    try {
                        GArray<Object> logins = mysql.get_array(L2DatabaseFactory.getInstanceLogin(),
                                "SELECT `login` FROM `accounts` WHERE `access_level` < 0");
                        if (logins.size() > 0) {
                            con = L2DatabaseFactory.getInstance().getConnection();
                            st = con.prepareStatement("DELETE FROM character_variables WHERE `name` = 'offline' AND `obj_id` IN (SELECT `obj_id` FROM `characters` WHERE `account_name`=?)");
                            for (Object login : logins) {
                                st.setString(1, (String) login);
                                st.executeUpdate();
                            }
                        }
View Full Code Here


    {
      sendMessage(new CustomMessage("scripts.services.Activation.InvalidNewMail", player), player);
      activation_page();
      return;
    }
    ThreadConnection con = null;
    FiltredPreparedStatement statement = null;
    ResultSet rset = null;
    try
    {
      con = L2DatabaseFactory.getInstanceLogin().getConnection();
      statement = con.prepareStatement("SELECT * FROM `accounts` WHERE email=?");
      statement.setString(1, email1);
      rset = statement.executeQuery();
      if(rset.next())
      {
        sendMessage(new CustomMessage("scripts.services.Activation.EmailAlreadyExists", player), player);
View Full Code Here

  public static void open(int objectId)
  {
    L2Player player = L2ObjectsStorage.getPlayer(objectId);
    String SQL = "SELECT * FROM character_variables WHERE obj_Id = ?";
    ThreadConnection tc = null;
    FiltredPreparedStatement fps = null;
    ResultSet rs = null;
    try
    {
      tc = L2DatabaseFactory.getInstance().getConnection();
      fps = tc.prepareStatement(SQL);
      fps.setInt(1, player.getObjectId());
      rs = fps.executeQuery();
      while(rs.next())
      {
        String name = rs.getString("name");
View Full Code Here

          clanMember.setClan(null);
          clanMember.setTitle(null);
          clanMember.sendPacket(Msg.CLAN_HAS_DISPERSED);
          clanMember.broadcastUserInfo(true);
        }
        ThreadConnection con = null;
        FiltredPreparedStatement statement = null;
        try
        {
          con = L2DatabaseFactory.getInstance().getConnection();
          statement = con.prepareStatement("UPDATE characters SET clanid = 0 WHERE clanid=?");
          statement.setInt(1, target.getClanId());
          statement.execute();
          DatabaseUtils.closeStatement(statement);
          statement = con.prepareStatement("DELETE FROM clan_data WHERE clan_id=?");
          statement.setInt(1, target.getClanId());
          statement.execute();
          DatabaseUtils.closeStatement(statement);
          statement = null;
          target.sendPacket(Msg.CLAN_HAS_DISPERSED);
View Full Code Here

  public static void open(int objectId)
  {
    L2Player player = L2ObjectsStorage.getPlayer(objectId);
    String SQL = "SELECT * FROM character_variables WHERE obj_Id = ?";
    ThreadConnection tc = null;
    FiltredPreparedStatement fps = null;
    ResultSet rs = null;
    try
    {
      tc = L2DatabaseFactory.getInstance().getConnection();
      fps = tc.prepareStatement(SQL);
      fps.setInt(1, player.getObjectId());
      rs = fps.executeQuery();
      while(rs.next())
      {
        String name = rs.getString("name");
View Full Code Here

  {
    if(obj_id == 0)
    {
      return;
    }
    ThreadConnection con = null;
    FiltredPreparedStatement st = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      st = con.prepareStatement("UPDATE characters SET x=?,y=?,z=? WHERE obj_Id=? LIMIT 1");
      st.setInt(1, loc.x);
      st.setInt(2, loc.y);
      st.setInt(3, loc.z);
      st.setInt(4, obj_id);
      st.executeUpdate();
View Full Code Here

  @Override
  public void getStat()
  {
    Map<Integer, StatsSet> _heroes = new FastMap<Integer, StatsSet>();
    ThreadConnection tc = null;
    FiltredPreparedStatement fps = null;
    ResultSet rs = null;
    try
    {
      tc = L2DatabaseFactory.getInstance().getConnection();
      fps = tc.prepareStatement("SELECT obj_id, value FROM character_variables WHERE `name` = 'BlackHeart_Count' ORDER BY CAST(`value` AS DECIMAL) DESC LIMIT 15");
      rs = fps.executeQuery();
      while(rs.next())
      {
        int id = rs.getInt("obj_id");
        StatsSet hero = new StatsSet();
View Full Code Here

        }

        private static void printAccInfo() throws SQLException
        {
                int count = 0;
                ThreadConnection con = null;
                FiltredPreparedStatement statement = null;
                ResultSet rset = null;
                try
                {
                        con = L2DatabaseFactory.getInstance().getConnection();
                        statement = con.prepareStatement("SELECT login, access_level FROM accounts ORDER BY login ASC");
                        rset = statement.executeQuery();
                        while(rset.next())
                        {
                                System.out.println(rset.getString("login") + " -> " + rset.getInt("access_level"));
                                count++;
View Full Code Here

                if(Integer.parseInt(level) > 100)
                {
                        level = "100";
                }
                // Add to Base
                ThreadConnection con = null;
                FiltredPreparedStatement statement = null;
                try
                {
                        con = L2DatabaseFactory.getInstance().getConnection();
                        statement = con.prepareStatement("REPLACE  accounts (login, password, access_level, comments) VALUES (?,?,?,?)");
                        statement.setString(1, account);
                        statement.setString(2, Base64.encodeBytes(newpass));
                        statement.setString(3, level);
                        statement.setString(4, comments);
                        statement.executeUpdate();
View Full Code Here

        {
                if(Integer.parseInt(level) > 100)
                {
                        level = "100";
                }
                ThreadConnection con = null;
                FiltredPreparedStatement statement = null;
                ResultSet rset = null;
                try
                {
                        con = L2DatabaseFactory.getInstance().getConnection();
                        // Check Account Exist
                        statement = con.prepareStatement("SELECT COUNT(*) FROM accounts WHERE login=?;");
                        statement.setString(1, account);
                        rset = statement.executeQuery();
                        if(rset.next() && rset.getInt(1) > 0)
                        {
                                // Exist
                                // Update
                                statement = con.prepareStatement("UPDATE accounts SET access_level=? WHERE login=?;");
                                statement.setEscapeProcessing(true);
                                statement.setString(1, level);
                                statement.setString(2, account);
                                statement.executeUpdate();
                                System.out.println("Account \"" + account + "\" Updated\n");
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.