Exemplo n.º 1
0
     break;
 case 'view':
     $condition = $commandLine->getLine()[0];
     if ($condition == 'all') {
         $query = $database->buildViewQuery($commandLine->getTable(), $condition);
     } else {
         $query = $database->buildViewQuery($commandLine->getTable(), $commandLine->parseWithEquals(0));
     }
     if ($result = $database->thisConnection()->query($query)) {
         $commandLine->printResult($result);
     } else {
         echo "Could not retrieve data.  Make sure your parameters are correct and you have needed foreign keys available.\n";
     }
     break;
 case 'roundtrip':
     $database->findRoundTrip($commandLine->getSource(), $commandLine->getDestination(), $commandLine->getDepartDate(), $commandLine->getReturnDate());
     break;
 case 'flight-res':
     if (isset($argv[2])) {
         switch ($argv[2]) {
             case 'view':
                 $seatNum = $argv[4];
                 $flightNum = $argv[3];
                 $query = "select * from `SeatReservation` `SR` inner join `ScheduledLeg` `SL` on `SR`.`LegNumber` = `SL`.`LegNumber`\n                where `SR`.`SeatNumber` = {$seatNum} and `SL`.`FlightNumber` = '{$flightNum}';";
                 if ($result = $database->thisConnection()->query($query)) {
                     $commandLine->printResult($result);
                 } else {
                     echo "Could not retrieve data.  Make sure your parameters are correct and you have needed foreign keys available.\n";
                 }
                 break;
             case 'cancel':