403 |
myquery << (UInt_t)BOOT_NUMBER << "','"; |
myquery << (UInt_t)BOOT_NUMBER << "','"; |
404 |
myquery << (UInt_t)VALIDATION << "');"; |
myquery << (UInt_t)VALIDATION << "');"; |
405 |
// |
// |
406 |
//printf("myquery is %s \n",myquery.str().c_str()); |
// printf("myquery is %s \n",myquery.str().c_str()); |
407 |
// |
// |
408 |
dbc->Query(myquery.str().c_str()); |
dbc->Query(myquery.str().c_str()); |
409 |
// |
// |
573 |
if (t==27) CAL_DSP_MASK = (UInt_t)atoll(Row->GetField(t)); |
if (t==27) CAL_DSP_MASK = (UInt_t)atoll(Row->GetField(t)); |
574 |
if (t==28) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); |
if (t==28) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); |
575 |
if (t==29) VALIDATION = (UInt_t)atoll(Row->GetField(t)); |
if (t==29) VALIDATION = (UInt_t)atoll(Row->GetField(t)); |
576 |
|
|
577 |
|
|
578 |
}; |
}; |
579 |
}; |
}; |
580 |
delete pResult; |
delete pResult; |
591 |
* |
* |
592 |
*/ |
*/ |
593 |
Int_t GL_RUN::Query_GL_RUN_FRAGMENTS(TString where, TSQLServer *dbc){ |
Int_t GL_RUN::Query_GL_RUN_FRAGMENTS(TString where, TSQLServer *dbc){ |
|
// Bool_t debug = 1; |
|
594 |
// MySQL variables |
// MySQL variables |
595 |
TSQLResult *pResult; |
TSQLResult *pResult; |
596 |
TSQLRow *Row; |
TSQLRow *Row; |
598 |
int r; |
int r; |
599 |
stringstream myquery; |
stringstream myquery; |
600 |
// ---------------- |
// ---------------- |
|
// NB! unsigned long long integers: when set to a number use ULL to store the correct number |
|
601 |
myquery.str(""); |
myquery.str(""); |
602 |
myquery << " select "; |
myquery << " select "; |
|
// myquery << " * "; |
|
603 |
myquery << "ID"; |
myquery << "ID"; |
604 |
|
myquery << ",ID_RUN_FRAG"; |
605 |
myquery << ",ID_ROOT_L0"; |
myquery << ",ID_ROOT_L0"; |
606 |
|
myquery << ",ID_ROOT_L2"; |
607 |
myquery << ",RUNHEADER_TIME"; |
myquery << ",RUNHEADER_TIME"; |
608 |
myquery << ",RUNTRAILER_TIME"; |
myquery << ",RUNTRAILER_TIME"; |
609 |
myquery << ",RUNHEADER_OBT"; |
myquery << ",RUNHEADER_OBT"; |
629 |
myquery << ",TRK_CALIB_USED"; |
myquery << ",TRK_CALIB_USED"; |
630 |
myquery << ",CAL_DSP_MASK"; |
myquery << ",CAL_DSP_MASK"; |
631 |
myquery << ",BOOT_NUMBER"; |
myquery << ",BOOT_NUMBER"; |
632 |
|
myquery << ",VALIDATION"; |
633 |
myquery << " from GL_RUN_FRAGMENTS where " << where.Data() << ";"; |
myquery << " from GL_RUN_FRAGMENTS where " << where.Data() << ";"; |
634 |
// |
// |
635 |
|
// printf(" query is %s \n",myquery.str().c_str()); |
636 |
|
// |
637 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
638 |
if(!pResult->GetRowCount())return(-50); |
if(!pResult->GetRowCount())return(-50); |
639 |
for( r=0; r < 1000; r++){ |
for( r=0; r < 1000; r++){ |
640 |
Row = pResult->Next(); |
Row = pResult->Next(); |
641 |
if( Row == NULL ) break; |
if( Row == NULL ) break; |
642 |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
643 |
if (t== 0) ID = (UInt_t)atoll(Row->GetField(t)); |
if (t== 0) ID = (UInt_t)atoll(Row->GetField(t)); |
644 |
if (t== 1) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
if (t== 1) ID_RUN_FRAG = (UInt_t)atoll(Row->GetField(t)); |
645 |
if (t== 2) RUNHEADER_TIME = (UInt_t)atoll(Row->GetField(t)); |
if (t== 2) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
646 |
if (t== 3) RUNTRAILER_TIME = (UInt_t)atoll(Row->GetField(t)); |
if (t== 3) ID_ROOT_L2 = (UInt_t)atoll(Row->GetField(t)); |
647 |
if (t== 4) RUNHEADER_OBT = (UInt_t)atoll(Row->GetField(t)); |
if (t== 4) RUNHEADER_TIME = (UInt_t)atoll(Row->GetField(t)); |
648 |
if (t== 5) RUNTRAILER_OBT = (UInt_t)atoll(Row->GetField(t)); |
if (t== 5) RUNTRAILER_TIME = (UInt_t)atoll(Row->GetField(t)); |
649 |
if (t== 6) RUNHEADER_PKT = (UInt_t)atoll(Row->GetField(t)); |
if (t== 6) RUNHEADER_OBT = (UInt_t)atoll(Row->GetField(t)); |
650 |
if (t== 7) RUNTRAILER_PKT = (UInt_t)atoll(Row->GetField(t)); |
if (t== 7) RUNTRAILER_OBT = (UInt_t)atoll(Row->GetField(t)); |
651 |
if (t== 8) EV_FROM = (UInt_t)atoll(Row->GetField(t)); |
if (t== 8) RUNHEADER_PKT = (UInt_t)atoll(Row->GetField(t)); |
652 |
if (t== 9) EV_TO = (UInt_t)atoll(Row->GetField(t)); |
if (t== 9) RUNTRAILER_PKT = (UInt_t)atoll(Row->GetField(t)); |
653 |
if (t==10) NEVENTS = (UInt_t)atoll(Row->GetField(t)); |
if (t==10) EV_FROM = (UInt_t)atoll(Row->GetField(t)); |
654 |
if (t==11) LAST_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
if (t==11) EV_TO = (UInt_t)atoll(Row->GetField(t)); |
655 |
if (t==12) OBT_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
if (t==12) NEVENTS = (UInt_t)atoll(Row->GetField(t)); |
656 |
if (t==13) COMPILATIONTIMESTAMP = (UInt_t)atoll(Row->GetField(t)); |
if (t==13) LAST_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
657 |
if (t==14) FAV_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
if (t==14) OBT_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
658 |
if (t==15) EFF_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
if (t==15) COMPILATIONTIMESTAMP = (UInt_t)atoll(Row->GetField(t)); |
659 |
if (t==16) PRH_VAR_TRG_MODE_A = (UInt_t)atoll(Row->GetField(t)); |
if (t==16) FAV_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
660 |
if (t==17) PRH_VAR_TRG_MODE_B = (UInt_t)atoll(Row->GetField(t)); |
if (t==17) EFF_WRK_SCHEDULE = (UInt_t)atoll(Row->GetField(t)); |
661 |
if (t==18) ACQ_BUILD_INFO = (UInt_t)atoll(Row->GetField(t)); |
if (t==18) PRH_VAR_TRG_MODE_A= (UInt_t)atoll(Row->GetField(t)); |
662 |
if (t==19) ACQ_VAR_INFO = (UInt_t)atoll(Row->GetField(t)); |
if (t==19) PRH_VAR_TRG_MODE_B= (UInt_t)atoll(Row->GetField(t)); |
663 |
if (t==20) RM_ACQ_AFTER_CALIB = (UInt_t)atoll(Row->GetField(t)); |
if (t==20) ACQ_BUILD_INFO = (UInt_t)atoll(Row->GetField(t)); |
664 |
if (t==21) RM_ACQ_SETTING_MODE = (UInt_t)atoll(Row->GetField(t)); |
if (t==21) ACQ_VAR_INFO = (UInt_t)atoll(Row->GetField(t)); |
665 |
if (t==22) PKT_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
if (t==22) RM_ACQ_AFTER_CALIB= (UInt_t)atoll(Row->GetField(t)); |
666 |
if (t==23) PKT_READY_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
if (t==23) RM_ACQ_SETTING_MODE = (UInt_t)atoll(Row->GetField(t)); |
667 |
if (t==24) TRK_CALIB_USED = (UInt_t)atoll(Row->GetField(t)); |
if (t==24) PKT_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
668 |
if (t==25) CAL_DSP_MASK = (UInt_t)atoll(Row->GetField(t)); |
if (t==25) PKT_READY_COUNTER = (UInt_t)atoll(Row->GetField(t)); |
669 |
if (t==26) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); |
if (t==26) TRK_CALIB_USED = (UInt_t)atoll(Row->GetField(t)); |
670 |
}; |
if (t==27) CAL_DSP_MASK = (UInt_t)atoll(Row->GetField(t)); |
671 |
|
if (t==28) BOOT_NUMBER = (UInt_t)atoll(Row->GetField(t)); |
672 |
|
if (t==29) VALIDATION = (UInt_t)atoll(Row->GetField(t)); |
673 |
|
}; |
674 |
}; |
}; |
675 |
delete pResult; |
// delete pResult; |
676 |
|
return(0); |
|
return 0; |
|
|
|
|
677 |
};// **************************************************** |
};// **************************************************** |
678 |
|
|
679 |
/** |
/** |
680 |
* Function to query the GL_ROOT table of the DB. |
* Function to query the GL_ROOT table of the DB. |
681 |
* |
* |
740 |
Row = pResult->Next(); |
Row = pResult->Next(); |
741 |
if( Row == NULL ) break; |
if( Row == NULL ) break; |
742 |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
743 |
|
stringstream row; |
744 |
|
row.str(""); |
745 |
|
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 |
746 |
if (t==0) ID = (UInt_t)atoll(Row->GetField(t)); |
if (t==0) ID = (UInt_t)atoll(Row->GetField(t)); |
747 |
if (t==1) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
if (t==1) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
748 |
if (t==2) EV_ROOT_CALIBTRK1 = (UInt_t)atoll(Row->GetField(t)); |
if (t==2) EV_ROOT_CALIBTRK1 = (UInt_t)atoll(row.str().c_str()); |
749 |
if (t==3) EV_ROOT_CALIBTRK2 = (UInt_t)atoll(Row->GetField(t)); |
if (t==3) EV_ROOT_CALIBTRK2 = (UInt_t)atoll(row.str().c_str()); |
750 |
if (t==4) FROM_TIME = (UInt_t)atoll(Row->GetField(t)); |
if (t==4) FROM_TIME = (UInt_t)atoll(Row->GetField(t)); |
751 |
if (t==5) TO_TIME = (UInt_t)atoll(Row->GetField(t)); |
if (t==5) TO_TIME = (UInt_t)atoll(Row->GetField(t)); |
752 |
// |
// |