示例#1
0
    def get_countries():

        ads_curs = dbConnector.get_ads_curs()
        ads_curs.execute("SELECT DISTINCT country FROM ads_airport")

        ress = ads_curs.fetchall()

        for res in ress:

            if res[0] is not None:
                yield res[0]
示例#2
0
    def get_airports_in_city(city):

        ads_curs = dbConnector.get_ads_curs()
        ads_curs.execute("SELECT DISTINCT airport_nm\
                          FROM ads_airport\
                          WHERE city = '" + city + "'")

        ress = ads_curs.fetchall()

        for res in ress:

            if res[0] is not None:
                yield res[0]
示例#3
0
    def get_cities_in_country(cntry):

        ads_curs = dbConnector.get_ads_curs()
        ads_curs.execute("SELECT DISTINCT city\
                          FROM ads_airport\
                          WHERE country = '" + cntry + "'")

        ress = ads_curs.fetchall()
 
        for res in ress:

            if res[0] is not None:
                yield res[0]
示例#4
0
    def get_region(arprt):

        curs = dbConnector.get_ads_curs()

        q = (
            "SELECT region FROM ads_airport\
             WHERE airport_nm = '"
            + arprt
            + "'"
        )
        curs.execute(q)
        res = curs.fetchone()[0]

        return res
示例#5
0
    def get_num_conf_booked(self,cmpt):

        # FIXME: circular and multi-leg flights
        # are problematic here, because select
        # is done based on flight number!

        ads_curs = dbConnector.get_ads_curs()
        ads_curs.execute("SELECT COUNT(DISTINCT bkg_id)\
                          FROM ads_bkg, ads_flight\
                          WHERE ads_bkg.opr_flt_id = ads_flight.flt_id AND\
                                ads_flight.flight_nbr = '" + self.fltnum.lstrip('0') + "' AND\
                                ads_flight.flt_date = DATE('" + self.dptdt.strftime('%Y-%m-%d') + "') AND\
                                ads_bkg.confirm_ind = 'Y' AND\
                                cabin_cd = '" + cmpt + "'")
        res = ads_curs.fetchone()
        if res is None:
            return 0
        else:
            return res[0]
示例#6
0
    def get_num_unconf_surv_checkin_brd_booked(self,cmpt):

        # FIXME: circular and multi-leg flights
        # are problematic here, because select
        # is done based on flight number!

        ads_curs = dbConnector.get_ads_curs()
        ads_curs.execute("SELECT COUNT(DISTINCT ads_checkin.bkg_id)\
                          FROM ads_bkg, ads_flight, ads_checkin\
                          WHERE ads_bkg.opr_flt_id = ads_flight.flt_id AND\
                                ads_bkg.bkg_id = ads_checkin.bkg_id AND\
                                ads_flight.flight_nbr = '" + self.fltnum.lstrip('0') + "' AND\
                                ads_flight.flt_date = DATE('" + self.dptdt.strftime('%Y-%m-%d') + "') AND\
                                ads_bkg.cabin_cd = '" + cmpt + "' AND\
                                ads_bkg.confirm_ind = 'N' AND\
                                ads_bkg.dead_ind = 'N' AND\
                                ads_bkg.bkg_cancel_dt_tm IS NULL AND\
                                ads_checkin.bk_pdi_infantindicator = 'N' AND\
                                ads_checkin.boarding_status = 'BDD'")
        res = ads_curs.fetchone()
        if res is None:
            return 0
        else:
            return res[0]