All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JBMSTours.inserters.InsertFlights

java.lang.Object
   |
   +----JBMSTours.inserters.InsertFlights

public class InsertFlights
extends Object
implements Inserters
Look at the Source.

This class inserts the flights data (the Flights and the Airlines tables).


Constructor Index

 o InsertFlights()

Method Index

 o airlineEntry(String, String, double, double, double, double)
Enters data for a single airline into the database.
 o confirmInsert(Connection)
 o createSQLScript(Connection)
 o estimateArrival(Connection, int, int, Time)
Use this to create new flights if necessary.
 o extractDataForReInsert(Connection)
A home-made method for exporting data.
 o fullFlightEntry(String, int, String, Time, String, Time, String, double, int, String)
Enters a single flight into the database.
 o insert(Connection)
Inserts a large amount of flight data.
 o prepareStatements(Connection)

Constructors

 o InsertFlights
 public InsertFlights()

Methods

 o insert
 public boolean insert(Connection conn) throws SQLException
Inserts a large amount of flight data.

Parameters:
conn - the name of the connection
Throws: SQLException
Thrown if there is a SQL error.
 o prepareStatements
 public boolean prepareStatements(Connection conn) throws SQLException
 o fullFlightEntry
 protected int fullFlightEntry(String flt,
                               int seg,
                               String ap1,
                               Time t1,
                               String ap2,
                               Time t2,
                               String meal,
                               double ft,
                               int m,
                               String ac) throws SQLException
Enters a single flight into the database.

Parameters:
conn - the connection to the database
flt - flight ID
seg - segment number
ap1 - airport from which the flight departs
t1 - departure time
ap2 - destination airport
t2 - arrival time
meal - meal served on the flight
ft - duration of the flight
m - length of the flight in miles
ac - type of aircraft
Returns:
the number of rows inserted
Throws: SQLException
Thrown if there is a SQL error.
 o airlineEntry
 protected int airlineEntry(String airline,
                            String airlineFull,
                            double br,
                            double dd,
                            double blf,
                            double fcl) throws SQLException
Enters data for a single airline into the database.

Parameters:
airline - the abbreviated name of the airline
airlineFull - the full name of the airline
br - the basic rate
dd - the distance discount
blf - the price points for business class
fcl - the price points for first class
Returns:
the number of rows inserted
Throws: SQLException
if there is a SQL error
 o confirmInsert
 public void confirmInsert(Connection conn) throws SQLException
 o extractDataForReInsert
 public void extractDataForReInsert(Connection conn) throws SQLException
A home-made method for exporting data.

Parameters:
conn - the connection to the database
Throws: SQLException
Thrown if there is a SQL error.
 o createSQLScript
 public boolean createSQLScript(Connection conn) throws SQLException
 o estimateArrival
 public static Time estimateArrival(Connection conn,
                                    int cid1,
                                    int cid2,
                                    Time departure) throws SQLException
Use this to create new flights if necessary.

Parameters:
conn - the connection to the database
cid1 - cityid of departure city
cid2 - cityid of destination city
departure - time of departure
Returns:
time of arrival
Throws: SQLException
Thrown if there is a SQL error.

All Packages  Class Hierarchy  This Package  Previous  Next  Index