/**
   * gets the characters who have taken part in the specified fametype
   *
   * @param transaction a DBTransaction
   * @param fametype type of fame
   * @param max maximum number of returned characters
   * @param ascending sort ascending or descending
   * @return list of character names
   * @throws SQLException in case of an database error
   */
  public List<String> getCharactersByFametype(
      DBTransaction transaction, String fametype, int max, boolean ascending) throws SQLException {
    List<String> res = new LinkedList<String>();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("fametype", fametype);

    // generate SQL statement
    StringBuilder sql = new StringBuilder();
    sql.append("SELECT charname FROM halloffame");
    sql.append(" WHERE fametype = '[fametype]'");
    sql.append(" ORDER BY points");
    if (!ascending) {
      sql.append(" DESC");
    }
    if (max > 0) {
      sql.append(" LIMIT " + max);
    }

    // read result
    ResultSet resultSet = transaction.query(sql.toString(), params);
    while (resultSet.next()) {
      res.add(resultSet.getString(1));
    }
    return res;
  }
  /**
   * Returns the points in the specified hall of fame.
   *
   * @param transaction Transaction
   * @param charname name of the player
   * @param fametype type of the hall of fame
   * @return points or 0 in case there is no entry
   */
  public int getHallOfFamePoints(
      final DBTransaction transaction, final String charname, final String fametype) {
    int res = 0;
    try {
      final String query =
          "SELECT points FROM halloffame WHERE charname="
              + "'[charname]' AND fametype='[fametype]'";
      Map<String, Object> params = new HashMap<String, Object>();
      params.put("charname", charname);
      params.put("fametype", fametype);

      final ResultSet result = transaction.query(query, params);
      if (result.next()) {
        res = result.getInt("points");
      }
      result.close();
    } catch (final Exception sqle) {
      logger.warn("Error reading hall of fame", sqle);
    }

    return res;
  }