Ignore:
Timestamp:
09/29/05 19:21:55 (19 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/datacenter
Files:
3 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/macros/buildsequenceentries.C

    r7275 r7370  
    186186
    187187    //getting # of sequence (in sequDB) between from and to
    188     TString query("SELECT fSequenceFirst FROM Sequences WHERE fSequenceFirst ");
    189     query += Form("BETWEEN %d and %d OR fSequenceLast BETWEEN %d and %d",
    190                   from, to, from, to);
     188    TString query("SELECT fSequenceFirst FROM Sequences WHERE (fSequenceFirst ");
     189    query += Form("BETWEEN %d and %d OR fSequenceLast BETWEEN %d and %d) AND "
     190                  "fManuallyChangedKEY=1 ", from, to, from, to);
    191191
    192192    TSQLResult *res = serv.Query(query);
     
    212212    {
    213213    case 0:
     214        //FIXME: like this the check is of no use, but when doing it
     215        //       without the check for manuallychanged, all manually
     216        //       changed sequences would be deleted
    214217        cout << "found no sequence in Sequ-DB -> check other tables" << endl;
    215218        cout << " deleting every sequence found in Calibration, Star or SequenceProcessStatus between "
     
    217220
    218221        //calibration table
    219         query=Form("SELECT fSequenceFirst FROM Calibration WHERE fSequenceFirst BETWEEN %d and %d", from, to);
     222        query=Form("SELECT fSequenceFirst FROM Calibration "
     223                   " LEFT JOIN Sequences ON Calibration.fSequenceFirst=Sequences.fSequenceFirst "
     224                   " WHERE fManuallyChangedKEY=1 AND fSequenceFirst BETWEEN %d and %d",
     225                   from, to);
    220226        res = serv.Query(query);
    221227        if (!res)
     
    231237
    232238        //Star table
    233         query=Form("SELECT fSequenceFirst FROM Star WHERE fSequenceFirst BETWEEN %d and %d", from, to);
     239        query=Form("SELECT fSequenceFirst FROM Star "
     240                   " LEFT JOIN Sequences ON Star.fSequenceFirst=Sequences.fSequenceFirst "
     241                   " WHERE fManuallyChangedKEY=1 AND  fSequenceFirst BETWEEN %d and %d",
     242                   from, to);
    234243        res = serv.Query(query);
    235244        if (!res)
     
    245254
    246255        //SequenceProcessStatus table
    247         query=Form("SELECT fSequenceFirst FROM SequenceProcessStatus WHERE fSequenceFirst BETWEEN %d and %d", from, to);
     256        query=Form("SELECT fSequenceFirst FROM SequenceProcessStatus "
     257                   " LEFT JOIN Sequences ON SequenceProcessStatus.fSequenceFirst=Sequences.fSequenceFirst "
     258                   " WHERE fManuallyChangedKEY=1 AND  fSequenceFirst BETWEEN %d and %d",
     259                   from, to);
    248260        res = serv.Query(query);
    249261        if (!res)
     
    801813
    802814    TList sequlist;
    803     query=Form("SELECT fSequenceFirst FROM Sequences WHERE %s order by fSequenceFirst",
     815    query=Form("SELECT fSequenceFirst FROM Sequences WHERE fManuallyChangedKEY=1 AND %s order by fSequenceFirst",
    804816               cond.Data());
    805817
Note: See TracChangeset for help on using the changeset viewer.