<?php
-require_once( 'xml_functions.php' );
-require_once( 'functions.php' );
+require_once 'xml_functions.php' ;
+require_once 'functions.php' ;
define( 'EXPECTED_NWS_MSG_MAJ_VERSION', '1' ); // Expected message XML message version from NWA
// Delete flight data older than yesterday
- db_auto_exec( "DELETE FROM flight WHERE msg_dtm < 'yesterday';", SI_CONN_STR, FALSE );
+// db_auto_exec( "DELETE FROM flight WHERE msg_dtm < 'yesterday';", SI_CONN_STR, FALSE );
// Get item data
// Don't show flight type 'Z' - these are training data or other unwanted stuff
$this->wpdb->insert();
- if( $flight_type != 'Z' )
- {
-
- if( ($f = db_auto_get_row( "SELECT msg_seq_id FROM flight WHERE flt_orig_date = '$flt_orig_date' AND flt_numb = '$flt_numb';", 0, SI_CONN_STR, FALSE )) == false )
- {
- db_auto_exec( "INSERT INTO flight
- (
- msg_dtm, msg_seq_id, flt_orig_date, flt_airline, flt_numb, flt_leg_orig, flt_leg_dest, flt_leg_vers,
- sch_leg_orig, sch_leg_dest, sch_dep_time, sch_off_time, sch_on_time, sch_in_time, cur_dep_time, cur_dep_time_code,
- cur_off_time , cur_off_time_code, cur_on_time, cur_on_time_code, cur_in_time, cur_in_time_code, delay_code,
- depart_gate, arriv_gate, radio_code, aircraft, reg_numb, remarks, food_code, flight_type, downline_leg,
- overfly, canceled, dep_ontime, arriv_ontime
- )
- VALUES
- (
- '$msg_dtm', '$msg_seq_id', '$flt_orig_date', '$flt_airline', '$flt_numb', '$flt_leg_orig', '$flt_leg_dest', $flt_leg_vers,
- '$sch_leg_orig', '$sch_leg_dest', '$sch_dep_time', '$sch_off_time', '$sch_on_time', '$sch_in_time', '$cur_dep_time', '$cur_dep_time_code',
- '$cur_off_time', '$cur_off_time_code', '$cur_on_time', '$cur_on_time_code', '$cur_in_time', '$cur_in_time_code', '$delay_code',
- '$depart_gate', '$arriv_gate', '$radio_code', '$aircraft', '$reg_numb', '$remarks', '$food_code', '$flight_type', '$downline_leg',
- '$overfly', '$canceled', '$dep_ontime', '$arriv_ontime'
- );", SI_CONN_STR, FALSE );
-
- echo "Flight $flt_numb on $flt_orig_date added<br>";
- }
- else
- {
- if( $msg_seq_id <= $f['msg_seq_id'] )
- echo 'Duplicate message or message out of sequence.<br>';
- else
- {
- db_auto_exec( "UPDATE flight SET
- msg_dtm = '$msg_dtm', msg_seq_id = '$msg_seq_id',
- flt_leg_orig = '$flt_leg_orig', flt_leg_dest = '$flt_leg_dest', flt_leg_vers = $flt_leg_vers, sch_leg_orig = '$sch_leg_orig',
- sch_leg_dest = '$sch_leg_dest', sch_dep_time = '$sch_dep_time', sch_off_time = '$sch_off_time', sch_on_time = '$sch_on_time',
- sch_in_time = '$sch_in_time', cur_dep_time = '$cur_dep_time', cur_dep_time_code = '$cur_dep_time_code', cur_off_time = '$cur_off_time',
- cur_off_time_code = '$cur_off_time_code', cur_on_time = '$cur_on_time', cur_on_time_code = '$cur_on_time_code', cur_in_time = '$cur_in_time',
- cur_in_time_code = '$cur_in_time_code', delay_code = '$delay_code', depart_gate = '$depart_gate', arriv_gate = '$arriv_gate',
- radio_code = '$radio_code', aircraft = '$aircraft', reg_numb = '$reg_numb', remarks = '$remarks', food_code = '$food_code', flight_type = '$flight_type',
- downline_leg = '$downline_leg', overfly = '$overfly', canceled = '$canceled', dep_ontime = '$dep_ontime', arriv_ontime = '$arriv_ontime'
- WHERE flt_orig_date = '$flt_orig_date' AND flt_numb = '$flt_numb';", SI_CONN_STR, FALSE );
- echo "Flight $flt_numb on $flt_orig_date updated<br>";
- }
- }
-
- } // end of if flight_type != 'Z'
+// if( $flight_type != 'Z' )
+// {
+//
+// if( ($f = db_auto_get_row( "SELECT msg_seq_id FROM flight WHERE flt_orig_date = '$flt_orig_date' AND flt_numb = '$flt_numb';", 0, SI_CONN_STR, FALSE )) == false )
+// {
+// db_auto_exec( "INSERT INTO flight
+// (
+// msg_dtm, msg_seq_id, flt_orig_date, flt_airline, flt_numb, flt_leg_orig, flt_leg_dest, flt_leg_vers,
+// sch_leg_orig, sch_leg_dest, sch_dep_time, sch_off_time, sch_on_time, sch_in_time, cur_dep_time, cur_dep_time_code,
+// cur_off_time , cur_off_time_code, cur_on_time, cur_on_time_code, cur_in_time, cur_in_time_code, delay_code,
+// depart_gate, arriv_gate, radio_code, aircraft, reg_numb, remarks, food_code, flight_type, downline_leg,
+// overfly, canceled, dep_ontime, arriv_ontime
+// )
+// VALUES
+// (
+// '$msg_dtm', '$msg_seq_id', '$flt_orig_date', '$flt_airline', '$flt_numb', '$flt_leg_orig', '$flt_leg_dest', $flt_leg_vers,
+// '$sch_leg_orig', '$sch_leg_dest', '$sch_dep_time', '$sch_off_time', '$sch_on_time', '$sch_in_time', '$cur_dep_time', '$cur_dep_time_code',
+// '$cur_off_time', '$cur_off_time_code', '$cur_on_time', '$cur_on_time_code', '$cur_in_time', '$cur_in_time_code', '$delay_code',
+// '$depart_gate', '$arriv_gate', '$radio_code', '$aircraft', '$reg_numb', '$remarks', '$food_code', '$flight_type', '$downline_leg',
+// '$overfly', '$canceled', '$dep_ontime', '$arriv_ontime'
+// );", SI_CONN_STR, FALSE );
+//
+// echo "Flight $flt_numb on $flt_orig_date added<br>";
+// }
+// else
+// {
+// if( $msg_seq_id <= $f['msg_seq_id'] )
+// echo 'Duplicate message or message out of sequence.<br>';
+// else
+// {
+// db_auto_exec( "UPDATE flight SET
+// msg_dtm = '$msg_dtm', msg_seq_id = '$msg_seq_id',
+// flt_leg_orig = '$flt_leg_orig', flt_leg_dest = '$flt_leg_dest', flt_leg_vers = $flt_leg_vers, sch_leg_orig = '$sch_leg_orig',
+// sch_leg_dest = '$sch_leg_dest', sch_dep_time = '$sch_dep_time', sch_off_time = '$sch_off_time', sch_on_time = '$sch_on_time',
+// sch_in_time = '$sch_in_time', cur_dep_time = '$cur_dep_time', cur_dep_time_code = '$cur_dep_time_code', cur_off_time = '$cur_off_time',
+// cur_off_time_code = '$cur_off_time_code', cur_on_time = '$cur_on_time', cur_on_time_code = '$cur_on_time_code', cur_in_time = '$cur_in_time',
+// cur_in_time_code = '$cur_in_time_code', delay_code = '$delay_code', depart_gate = '$depart_gate', arriv_gate = '$arriv_gate',
+// radio_code = '$radio_code', aircraft = '$aircraft', reg_numb = '$reg_numb', remarks = '$remarks', food_code = '$food_code', flight_type = '$flight_type',
+// downline_leg = '$downline_leg', overfly = '$overfly', canceled = '$canceled', dep_ontime = '$dep_ontime', arriv_ontime = '$arriv_ontime'
+// WHERE flt_orig_date = '$flt_orig_date' AND flt_numb = '$flt_numb';", SI_CONN_STR, FALSE );
+// echo "Flight $flt_numb on $flt_orig_date updated<br>";
+// }
+// }
+//
+// } // end of if flight_type != 'Z'
}
// Store for analysis