public ResultSet queryResult(String query) {
		
		final Connection connection = getConnection();
		try {
			
			if (connection == null) {
				Utilities.outputError("Could not connect to database '" + m_databaseName + "'");
				return null;
			}
			
			if (m_statement != null) {
				m_statement.close();
				m_statement = null;
			}
			
			m_statement = connection.createStatement();
			ResultSet result = m_statement.executeQuery(query);
			
			if (result == null) {
				m_statement.close();
				m_statement = null;
				connection.close();
			}

			return result;
			
		} catch (SQLException e) {
			e.printStackTrace();
			try {
				m_statement.close();
				connection.close();
			} catch (SQLException ce) {}
		}
		
		return null;		
	}