All pastes #2082515 Raw Edit

Someone

public text v1 · immutable
#2082515 ·published 2011-09-24 16:31 UTC
rendered paste body
protected void getVotes(L2PcInstance activeChar)
	{

		int votes = 0;
		Connection con = null;

		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			final PreparedStatement statement = con.prepareStatement("SELECT vote_points FROM accounts WHERE login=?");
			statement.setString(1, activeChar.getAccountName());
			final ResultSet rset = statement.executeQuery();
			if (rset.next())
				votes = rset.getInt("vote_points");
			rset.close();
			
			statement.close();
			activeChar.sendMessage("You have actually "+ votes +" vote points.");
		}
		catch (final Exception e)
		{
			e.printStackTrace();
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}