All pastes #946650 Raw Edit

Mine

public java v1 · immutable
·published 2008-03-17 20:59 UTC
rendered paste body
public boolean isGM(String user)	{		boolean ok = false;		java.sql.Connection con = null;		PreparedStatement statement = null;		try		{			con = L2DatabaseFactory.getInstance().getConnection();			statement = con.prepareStatement("SELECT accessLevel FROM accounts WHERE login=?");			statement.setString(1, user);			ResultSet rset = statement.executeQuery();			if (rset.next())			{				int accessLevel = rset.getInt(1);				if (accessLevel >= Config.GM_MIN)				{					ok = true;				}			}			rset.close();			statement.close();		}		catch (Exception e)		{			_log.warning("could not check gm state:" + e);			ok = false;		}		finally		{			try			{				con.close();			}			catch (Exception e)			{			}			try			{				statement.close();			}			catch (Exception e)			{			}		}		return ok;	}