--- YodaProfiler/src/GLTables.cpp 2006/08/30 11:18:13 1.1 +++ YodaProfiler/src/GLTables.cpp 2006/09/05 10:48:58 1.3 @@ -403,7 +403,7 @@ myquery << (UInt_t)BOOT_NUMBER << "','"; myquery << (UInt_t)VALIDATION << "');"; // - //printf("myquery is %s \n",myquery.str().c_str()); + // printf("myquery is %s \n",myquery.str().c_str()); // dbc->Query(myquery.str().c_str()); // @@ -573,6 +573,8 @@ if (t==27) CAL_DSP_MASK = (UInt_t)atoll(Row->GetField(t)); if (t==28) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); if (t==29) VALIDATION = (UInt_t)atoll(Row->GetField(t)); + + }; }; delete pResult; @@ -589,7 +591,6 @@ * */ Int_t GL_RUN::Query_GL_RUN_FRAGMENTS(TString where, TSQLServer *dbc){ - // Bool_t debug = 1; // MySQL variables TSQLResult *pResult; TSQLRow *Row; @@ -597,12 +598,12 @@ int r; stringstream myquery; // ---------------- - // NB! unsigned long long integers: when set to a number use ULL to store the correct number myquery.str(""); myquery << " select "; - // myquery << " * "; myquery << "ID"; + myquery << ",ID_RUN_FRAG"; myquery << ",ID_ROOT_L0"; + myquery << ",ID_ROOT_L2"; myquery << ",RUNHEADER_TIME"; myquery << ",RUNTRAILER_TIME"; myquery << ",RUNHEADER_OBT"; @@ -628,48 +629,53 @@ myquery << ",TRK_CALIB_USED"; myquery << ",CAL_DSP_MASK"; myquery << ",BOOT_NUMBER"; + myquery << ",VALIDATION"; myquery << " from GL_RUN_FRAGMENTS where " << where.Data() << ";"; // + // printf(" query is %s \n",myquery.str().c_str()); + // pResult = dbc->Query(myquery.str().c_str()); if(!pResult->GetRowCount())return(-50); for( r=0; r < 1000; r++){ - Row = pResult->Next(); - if( Row == NULL ) break; - for( t = 0; t < pResult->GetFieldCount(); t++){ - if (t== 0) ID = (UInt_t)atoll(Row->GetField(t)); - if (t== 1) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); - if (t== 2) RUNHEADER_TIME = (UInt_t)atoll(Row->GetField(t)); - if (t== 3) RUNTRAILER_TIME = (UInt_t)atoll(Row->GetField(t)); - if (t== 4) RUNHEADER_OBT = (UInt_t)atoll(Row->GetField(t)); - if (t== 5) RUNTRAILER_OBT = (UInt_t)atoll(Row->GetField(t)); - if (t== 6) RUNHEADER_PKT = (UInt_t)atoll(Row->GetField(t)); - if (t== 7) RUNTRAILER_PKT = (UInt_t)atoll(Row->GetField(t)); - if (t== 8) EV_FROM = (UInt_t)atoll(Row->GetField(t)); - if (t== 9) EV_TO = (UInt_t)atoll(Row->GetField(t)); - if (t==10) NEVENTS = (UInt_t)atoll(Row->GetField(t)); - if (t==11) LAST_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); - if (t==12) OBT_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); - if (t==13) COMPILATIONTIMESTAMP = (UInt_t)atoll(Row->GetField(t)); - if (t==14) FAV_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); - if (t==15) EFF_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); - if (t==16) PRH_VAR_TRG_MODE_A = (UInt_t)atoll(Row->GetField(t)); - if (t==17) PRH_VAR_TRG_MODE_B = (UInt_t)atoll(Row->GetField(t)); - if (t==18) ACQ_BUILD_INFO = (UInt_t)atoll(Row->GetField(t)); - if (t==19) ACQ_VAR_INFO = (UInt_t)atoll(Row->GetField(t)); - if (t==20) RM_ACQ_AFTER_CALIB = (UInt_t)atoll(Row->GetField(t)); - if (t==21) RM_ACQ_SETTING_MODE = (UInt_t)atoll(Row->GetField(t)); - if (t==22) PKT_COUNTER = (UInt_t)atoll(Row->GetField(t)); - if (t==23) PKT_READY_COUNTER = (UInt_t)atoll(Row->GetField(t)); - if (t==24) TRK_CALIB_USED = (UInt_t)atoll(Row->GetField(t)); - if (t==25) CAL_DSP_MASK = (UInt_t)atoll(Row->GetField(t)); - if (t==26) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); - }; + Row = pResult->Next(); + if( Row == NULL ) break; + for( t = 0; t < pResult->GetFieldCount(); t++){ + if (t== 0) ID = (UInt_t)atoll(Row->GetField(t)); + if (t== 1) ID_RUN_FRAG = (UInt_t)atoll(Row->GetField(t)); + if (t== 2) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); + if (t== 3) ID_ROOT_L2 = (UInt_t)atoll(Row->GetField(t)); + if (t== 4) RUNHEADER_TIME = (UInt_t)atoll(Row->GetField(t)); + if (t== 5) RUNTRAILER_TIME = (UInt_t)atoll(Row->GetField(t)); + if (t== 6) RUNHEADER_OBT = (UInt_t)atoll(Row->GetField(t)); + if (t== 7) RUNTRAILER_OBT = (UInt_t)atoll(Row->GetField(t)); + if (t== 8) RUNHEADER_PKT = (UInt_t)atoll(Row->GetField(t)); + if (t== 9) RUNTRAILER_PKT = (UInt_t)atoll(Row->GetField(t)); + if (t==10) EV_FROM = (UInt_t)atoll(Row->GetField(t)); + if (t==11) EV_TO = (UInt_t)atoll(Row->GetField(t)); + if (t==12) NEVENTS = (UInt_t)atoll(Row->GetField(t)); + if (t==13) LAST_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); + if (t==14) OBT_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); + if (t==15) COMPILATIONTIMESTAMP = (UInt_t)atoll(Row->GetField(t)); + if (t==16) FAV_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); + if (t==17) EFF_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); + if (t==18) PRH_VAR_TRG_MODE_A= (UInt_t)atoll(Row->GetField(t)); + if (t==19) PRH_VAR_TRG_MODE_B= (UInt_t)atoll(Row->GetField(t)); + if (t==20) ACQ_BUILD_INFO = (UInt_t)atoll(Row->GetField(t)); + if (t==21) ACQ_VAR_INFO = (UInt_t)atoll(Row->GetField(t)); + if (t==22) RM_ACQ_AFTER_CALIB= (UInt_t)atoll(Row->GetField(t)); + if (t==23) RM_ACQ_SETTING_MODE = (UInt_t)atoll(Row->GetField(t)); + if (t==24) PKT_COUNTER = (UInt_t)atoll(Row->GetField(t)); + if (t==25) PKT_READY_COUNTER = (UInt_t)atoll(Row->GetField(t)); + if (t==26) TRK_CALIB_USED = (UInt_t)atoll(Row->GetField(t)); + if (t==27) CAL_DSP_MASK = (UInt_t)atoll(Row->GetField(t)); + if (t==28) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); + if (t==29) VALIDATION = (UInt_t)atoll(Row->GetField(t)); + }; }; - delete pResult; - - return 0; - + // delete pResult; + return(0); };// **************************************************** + /** * Function to query the GL_ROOT table of the DB. * @@ -734,10 +740,13 @@ Row = pResult->Next(); if( Row == NULL ) break; for( t = 0; t < pResult->GetFieldCount(); t++){ + stringstream row; + row.str(""); + row << "0" << Row->GetField(t); // add leading 0 since we have two fields that could be "null" and we want to avoid crashes due to atoll if (t==0) ID = (UInt_t)atoll(Row->GetField(t)); if (t==1) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); - if (t==2) EV_ROOT_CALIBTRK1 = (UInt_t)atoll(Row->GetField(t)); - if (t==3) EV_ROOT_CALIBTRK2 = (UInt_t)atoll(Row->GetField(t)); + if (t==2) EV_ROOT_CALIBTRK1 = (UInt_t)atoll(row.str().c_str()); + if (t==3) EV_ROOT_CALIBTRK2 = (UInt_t)atoll(row.str().c_str()); if (t==4) FROM_TIME = (UInt_t)atoll(Row->GetField(t)); if (t==5) TO_TIME = (UInt_t)atoll(Row->GetField(t)); // @@ -992,6 +1001,8 @@ toffset = (UInt_t)atoll(Row->GetField(1)) - (UInt_t)(this->DBobt((UInt_t)atoll(Row->GetField(0)))/1000) + t0; }; }; + // + file->Close(); delete pResult; };