Changeset 7254 for trunk


Ignore:
Timestamp:
08/02/05 18:20:19 (19 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r7252 r7254  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21 2005/07/31 Daniela Dorner
     22
     23   * datacenter/macros/buildsequenceentries.C:
     24     - fixed bug, added some logging output and comments
     25
     26
    2027
    2128 2005/08/02 Thomas Bretz
  • trunk/MagicSoft/Mars/datacenter/macros/buildsequenceentries.C

    r7249 r7254  
    177177Bool_t CheckSequence(MSQLServer &serv, TString datapath, TString sequpath, Int_t from, Int_t to, Bool_t dummy)
    178178{
    179     Int_t rc=0; //rc=0 means sequence is still the same -> insert not neccessary
     179    Int_t rc=0;
     180    //rc=0 means sequence not found -> insert
    180181    //rc=1 means deleting sequence(s) worked -> insert
     182    //rc=2 means sequence is still the same -> insert not neccessary
    181183    //if deleting sequence doesn't work -> return -1
    182184
    183185
    184186    //getting # of sequence (in sequDB) between from and to
    185     TString query(Form("SELECT fSequenceFirst FROM Sequences WHERE fSequenceFirst BETWEEN %d and %d", from, to));
     187    TString query("SELECT fSequenceFirst FROM Sequences WHERE fSequenceFirst ");
     188    query += Form("BETWEEN %d and %d OR fSequenceLast BETWEEN %d and %d",
     189                  from, to, from, to);
    186190
    187191    TSQLResult *res = serv.Query(query);
     
    331335            }
    332336        }
     337        rc=2;
    333338        break;
    334339
     
    351356Bool_t InsertSequence(MSQLServer &serv, Int_t from, Int_t to)
    352357{
     358
     359    cout << "Inserting sequence " << from << " ... " << endl;
    353360
    354361    // ========== Request number of events ==========
     
    423430    TString query1("INSERT Sequences SET");
    424431    query1+=Form(" fSequenceFirst=%d,  fSequenceLast=%d,", from, to);
    425     query1+=Form(" fProjectKEY=%s,", (*row)[0]);
    426     query1+=Form(" fSourceKEY=%s,", (*row)[1]);
     432    query1+=Form(" fSourceKEY=%s,", (*row)[0]);
     433    query1+=Form(" fProjectKEY=%s,", (*row)[1]);
    427434    query1+=Form(" fNumEvents=%s,", nevts.Data());
    428435    query1+=Form(" fRunTime=%s,", secs.Data());
     
    451458    delete res;
    452459
     460
    453461    res = serv.Query(query1);
    454462    if (!res)
    455         return kFALSE;
     463    {
     464        cout << "ERROR - Could not insert Sequence into Sequences." << endl;
     465        return kFALSE;
     466    }
    456467    delete res;
    457468
    458469    res = serv.Query(query2);
    459470    if (!res)
    460         return kFALSE;
     471    {
     472        cout << "ERROR - Could not update RunData." << endl;
     473        return kFALSE;
     474    }
    461475    delete res;
    462476
    463477    res = serv.Query(query3);
    464478    if (!res)
    465         return kFALSE;
     479    {
     480        cout << "ERROR - Could not insert Sequence into SequenceProcessStatus." << endl;
     481        return kFALSE;
     482    }
    466483    delete res;
    467484
     
    497514    {
    498515    case 0:
    499         cout << " inserting sequence not necessary" << endl;
    500         return kTRUE;
     516        cout << " sequence not found -> inserting " << from << flush ;
     517        if (dummy)
     518        {
     519            cout << " <dummy> " << endl;
     520            return kTRUE;
     521        }
     522        cout << endl;
     523        return InsertSequence(serv, from, to);
    501524
    502525    case 1:
     
    508531        }
    509532        cout << endl;
    510         rc = InsertSequence(serv, from, to);
    511         if (!rc)
    512             cout << "InsertSequence failed!" << endl;
    513         break;
     533        return InsertSequence(serv, from, to);
     534
     535    case 2:
     536        cout << " sequence is already existing -> inserting not necessary" << endl;
     537        return kTRUE;
    514538
    515539    case -1:
    516540        cout << " deleting went wrong " << endl;
    517         rc=kFALSE;
     541        return kFALSE;
    518542    }
    519543
Note: See TracChangeset for help on using the changeset viewer.