}
public void delete (long id) {
super.delete(id);
}
public Airport showInformation(Long id) {
Airport airport = new Airport();
try {
String query = "SELECT Countries.Name, Countries.Id FROM Airports INNER JOIN Countries ON Airports.InCountry=Countries.Id WHERE Airports.Id=?";
PreparedStatement statement = connection.prepareStatement(query);
statement.setLong(1, id);
ResultSet resultSet = statement.executeQuery();
resultSet.next();
Long countryId = resultSet.getLong("Id");
String countryName = resultSet.getString("Name");
query = "SELECT Airports.Id, Airports.Name, Airports.GatesNumber FROM Airports WHERE Id=?";
statement = connection.prepareStatement(query);
statement.setLong(1, id);
resultSet = statement.executeQuery();
while(resultSet.next()) {
airport.setId(id);
airport.setGatesNumber(resultSet.getInt("GatesNumber"));
Country country = new Country();
country.setId(countryId);
country.setName(countryName);
airport.setInCountry(country);
airport.setName(resultSet.getString("Name"));
}
} catch(SQLException e) {
Logs.info("Ошибка выборки " + e);
}
return airport;