harryShepherd / Ambry

Software Engineering Methods Group 18
Apache License 2.0
3 stars 0 forks source link

Weird Function #51

Closed harryShepherd closed 4 months ago

harryShepherd commented 4 months ago

What is this function for? (in Country.java line 200)

public static String getCountryCode(String CountryCode){
    String countryName = null;
    try {

        Statement stmt = Database.con.createStatement();
        String str_select =
                "SELECT Name FROM country WHERE country.code = '" + CountryCode + "'";
        ResultSet rset = stmt.executeQuery(str_select);

        while (rset.next()) {
            countryName = (rset.getString("country.Name"));
        }
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }

    return countryName;
}

Need to know if it has to stay or can be deleted, or adjusted to meet other function standards (using CountryStandard instead)

Thank you :)

Alcor2814 commented 4 months ago

The standard for city is that it should have access to the name of the country that it's in but it's only expected to store the CountryCode Murdo made this function to return the country from the city's country code