package RDG;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Marcel
 */
public class PassengerTypeFinder {

    /**
     * selectAll all passenger types
     * @throws SQLException
     * @return List PassengerType
     */
    public static List<PassengerType> selectAll() throws SQLException {
        PreparedStatement s = DbContext.getConnection().prepareStatement("SELECT * from passenger_types");
        ResultSet rs = s.executeQuery();
        List<PassengerType> res = new ArrayList<>();
        while (rs.next()) {
            PassengerType tmp = new PassengerType();
            tmp.setPassenger_type_id(rs.getInt("passenger_type_id"));
            tmp.setPassenger_type_name(rs.getString("passenger_type_name"));
            res.add(tmp);
        }
        return res;
    }
    
}
