Package l2p.database

Examples of l2p.database.ThreadConnection.prepareStatement()


                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


                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

                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
View Full Code Here

                        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

                ResultSet rset = null, subRset = 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.getInt(1) == 0)
                        {
                                System.out.println("Account \"" + account + "\" Not Exist\n");
View Full Code Here

                                return;
                        }
                        // Account exist
                        DatabaseUtils.closeDatabaseSR(statement, rset);
                        // Get Accounts ID
                        statement = con.prepareStatement("SELECT obj_Id, char_name, clanid FROM characters WHERE account_name=?;");
                        statement.setEscapeProcessing(true);
                        statement.setString(1, account);
                        rset = statement.executeQuery();
                        while(rset.next())
                        {
View Full Code Here

                        rset = statement.executeQuery();
                        while(rset.next())
                        {
                                System.out.println("Deleting character \"" + rset.getString("char_name") + "\"\n");
                                // Check If clan leader Remove Clan and remove all from it
                                subStatement = con.prepareStatement("SELECT COUNT(*) FROM clan_data WHERE leader_id=?;");
                                subStatement.setString(1, rset.getString("clanid"));
                                subRset = subStatement.executeQuery();
                                boolean isClanLeader = false;
                                if(subRset.next() && subRset.getInt(1) > 0)
                                {
View Full Code Here

                                DatabaseUtils.closeDatabaseSR(subStatement, subRset);
                                if(isClanLeader)
                                {
                                        // Clan Leader
                                        // Get Clan Name
                                        subStatement = con.prepareStatement("SELECT clan_name FROM clan_data WHERE leader_id=?;");
                                        subStatement.setString(1, rset.getString("clanid"));
                                        subRset = subStatement.executeQuery();
                                        String clanName = null;
                                        if(subRset.next())
                                        {
View Full Code Here

                                                clanName = subRset.getString("clan_name");
                                        }
                                        System.out.println("Deleting clan \"" + clanName + "\"\n");
                                        DatabaseUtils.closeDatabaseSR(subStatement, subRset);
                                        // Delete Clan Wars
                                        subStatement = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? OR clan2=?;");
                                        subStatement.setEscapeProcessing(true);
                                        subStatement.setString(1, clanName);
                                        subStatement.setString(2, clanName);
                                        subStatement.executeUpdate();
                                        DatabaseUtils.closeStatement(subStatement);
View Full Code Here

                                        subStatement.setString(1, clanName);
                                        subStatement.setString(2, clanName);
                                        subStatement.executeUpdate();
                                        DatabaseUtils.closeStatement(subStatement);
                                        // Remove All From clan
                                        subStatement = con.prepareStatement("UPDATE characters SET clanid=0 WHERE clanid=?;");
                                        subStatement.setString(1, rset.getString("clanid"));
                                        subStatement.executeUpdate();
                                        DatabaseUtils.closeStatement(subStatement);
                                        // Delete Clan
                                        subStatement = con.prepareStatement("DELETE FROM clan_data WHERE clan_id=?;");
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.