| 68 |
return NULL; |
return NULL; |
| 69 |
}; |
}; |
| 70 |
// |
// |
| 71 |
|
if (Row) |
| 72 |
|
delete Row; |
| 73 |
pResult = dbc->Query(query.Data()); |
pResult = dbc->Query(query.Data()); |
| 74 |
// |
// |
| 75 |
Row = pResult->Next(); |
Row = pResult->Next(); |
| 99 |
if ( f2 < minf2 ) minf2 = f2; |
if ( f2 < minf2 ) minf2 = f2; |
| 100 |
|
|
| 101 |
}; |
}; |
| 102 |
|
if (Row) |
| 103 |
|
delete Row; |
| 104 |
Row = pResult->Next(); |
Row = pResult->Next(); |
| 105 |
}; |
}; |
| 106 |
pResult->Delete(); |
pResult->Delete(); |
| 140 |
// |
// |
| 141 |
pResult = dbc->Query(query.Data()); |
pResult = dbc->Query(query.Data()); |
| 142 |
// |
// |
| 143 |
|
if (Row) |
| 144 |
|
delete Row; |
| 145 |
Row = pResult->Next(); |
Row = pResult->Next(); |
| 146 |
// |
// |
| 147 |
Int_t r = 0; |
Int_t r = 0; |
| 157 |
h2->Fill(f1,f2); |
h2->Fill(f1,f2); |
| 158 |
}; |
}; |
| 159 |
r++; |
r++; |
| 160 |
|
if (Row) |
| 161 |
|
delete Row; |
| 162 |
Row = pResult->Next(); |
Row = pResult->Next(); |
| 163 |
}; |
}; |
| 164 |
// |
// |
| 172 |
if ( dim == 1 ) h1->Draw(); |
if ( dim == 1 ) h1->Draw(); |
| 173 |
if ( dim == 2 ) h2->Draw(); |
if ( dim == 2 ) h2->Draw(); |
| 174 |
// |
// |
| 175 |
|
if (Row) |
| 176 |
|
delete Row; |
| 177 |
pResult->Delete(); |
pResult->Delete(); |
| 178 |
if ( dim == 1 ) return h1; |
if ( dim == 1 ) return h1; |
| 179 |
if ( dim == 2 ) return h2; |
if ( dim == 2 ) return h2; |
| 223 |
myquery << "show databases;"; |
myquery << "show databases;"; |
| 224 |
if ( dbc ){ |
if ( dbc ){ |
| 225 |
if ( dbc->IsConnected() ){ |
if ( dbc->IsConnected() ){ |
| 226 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 227 |
fNquery++; |
fNquery++; |
| 228 |
if ( !(dbc->GetErrorCode()) ){ |
if ( !(dbc->GetErrorCode()) ){ |
| 229 |
// printf("ok\n"); |
// printf("ok\n"); |
| 247 |
if ( dbc ){ |
if ( dbc ){ |
| 248 |
dbc->Close(); |
dbc->Close(); |
| 249 |
delete dbc; |
delete dbc; |
| 250 |
|
dbc = 0; |
| 251 |
}; |
}; |
| 252 |
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
| 253 |
// |
// |
| 254 |
myquery.str(""); |
myquery.str(""); |
| 255 |
myquery << "show databases;"; |
myquery << "show databases;"; |
| 256 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 257 |
fNquery++; |
fNquery++; |
| 258 |
// if ( dbc->GetErrorCode() != 2013 && dbc->GetErrorCode() != 2006 ){ |
// if ( dbc->GetErrorCode() != 2013 && dbc->GetErrorCode() != 2006 ){ |
| 259 |
if ( !(dbc->GetErrorCode()) ){ |
if ( !(dbc->GetErrorCode()) ){ |
| 261 |
printf(" ...connection recovered, I can continue! \n"); |
printf(" ...connection recovered, I can continue! \n"); |
| 262 |
// |
// |
| 263 |
myquery.str(""); |
myquery.str(""); |
| 264 |
myquery << "SET time_zone='+0:00'"; |
myquery << "SET time_zone='+0:00';"; |
| 265 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 266 |
|
fNquery++; |
| 267 |
|
myquery.str(""); |
| 268 |
|
myquery << "SET sql_mode = 'NO_UNSIGNED_SUBTRACTION';"; |
| 269 |
|
delete dbc->Query(myquery.str().c_str()); |
| 270 |
fNquery++; |
fNquery++; |
| 271 |
myquery.str(""); |
myquery.str(""); |
| 272 |
myquery << "SET wait_timeout=173000;"; |
myquery << "SET wait_timeout=173000;"; |
| 273 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 274 |
fNquery++; |
fNquery++; |
| 275 |
return true; |
return true; |
| 276 |
}; |
}; |
| 739 |
// |
// |
| 740 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 741 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 742 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 743 |
// |
// |
| 744 |
// retrieve this ID_TRASH |
// retrieve this ID_TRASH |
| 745 |
// |
// |
| 770 |
// |
// |
| 771 |
// printf("2myquery is %s \n",myquery.str().c_str()); |
// printf("2myquery is %s \n",myquery.str().c_str()); |
| 772 |
// |
// |
| 773 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ){ |
| 774 |
|
if (pResult) |
| 775 |
|
delete pResult; |
| 776 |
|
if (Row) |
| 777 |
|
delete Row; |
| 778 |
|
return -57; |
| 779 |
|
} |
| 780 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 781 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 782 |
// |
// |
| 795 |
// |
// |
| 796 |
// printf("3myquery is %s \n",myquery.str().c_str()); |
// printf("3myquery is %s \n",myquery.str().c_str()); |
| 797 |
// |
// |
| 798 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ){ |
| 799 |
|
if (pResult) |
| 800 |
|
delete pResult; |
| 801 |
|
if (Row) |
| 802 |
|
delete Row; |
| 803 |
|
return -57; |
| 804 |
|
} |
| 805 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 806 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 807 |
// |
// |
| 811 |
if( Row != NULL ){ |
if( Row != NULL ){ |
| 812 |
fileL2 = (TString)Row->GetField(0); |
fileL2 = (TString)Row->GetField(0); |
| 813 |
} |
} |
| 814 |
|
delete pResult; |
| 815 |
|
pResult = NULL; |
| 816 |
if (Row){ |
if (Row){ |
| 817 |
delete Row; |
delete Row; |
| 818 |
Row = NULL; // This variable is not used below |
Row = NULL; // This variable is not used below |
| 829 |
// |
// |
| 830 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 831 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 832 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 833 |
// |
// |
| 834 |
myquery.str(""); |
myquery.str(""); |
| 835 |
myquery << " UPDATE GL_RUN_TRASH SET FILENAMEL2='"; |
myquery << " UPDATE GL_RUN_TRASH SET FILENAMEL2='"; |
| 840 |
// |
// |
| 841 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 842 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 843 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 844 |
// |
// |
| 845 |
myquery.str(""); |
myquery.str(""); |
| 846 |
myquery << " UPDATE GL_RUN_TRASH SET BELONGED_TO='"; |
myquery << " UPDATE GL_RUN_TRASH SET BELONGED_TO='"; |
| 852 |
// |
// |
| 853 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 854 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 855 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 856 |
// |
// |
| 857 |
myquery.str(""); |
myquery.str(""); |
| 858 |
myquery << " DELETE FROM "; |
myquery << " DELETE FROM "; |
| 864 |
// |
// |
| 865 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 866 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 867 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 868 |
// |
// |
| 869 |
return 0; |
return 0; |
| 870 |
}; |
}; |
| 880 |
// insert into GL_RUN_FRAGMENTS select * FROM GL_RUN where ID=11; |
// insert into GL_RUN_FRAGMENTS select * FROM GL_RUN where ID=11; |
| 881 |
//insert into GL_RUN_TRASH VALUES (ID , ID_RUN_FRAG , ID_ROOT_L0 , ID_ROOT_L2 , RUNHEADER_TIME , RUNTRAILER_TIME , RUNHEADER_OBT , RUNTRAILER_OBT , RUNHEADER_PKT , RUNTRAILER_PKT , BOOT_NUMBER , EV_FROM , EV_TO , NEVENTS , PKT_COUNTER , PKT_READY_COUNTER , COMPILATIONTIMESTAMP , FAV_WRK_SCHEDULE , EFF_WRK_SCHEDULE , PRH_VAR_TRG_MODE_A , PRH_VAR_TRG_MODE_B , ACQ_BUILD_INFO , ACQ_VAR_INFO , RM_ACQ_AFTER_CALIB , RM_ACQ_SETTING_MODE, TRK_CALIB_USED,CAL_DSP_MASK, LAST_TIMESYNC, OBT_TIMESYNC, VALIDATION, INSERT_TIME) select * FROM GL_RUN where ID=11; |
//insert into GL_RUN_TRASH VALUES (ID , ID_RUN_FRAG , ID_ROOT_L0 , ID_ROOT_L2 , RUNHEADER_TIME , RUNTRAILER_TIME , RUNHEADER_OBT , RUNTRAILER_OBT , RUNHEADER_PKT , RUNTRAILER_PKT , BOOT_NUMBER , EV_FROM , EV_TO , NEVENTS , PKT_COUNTER , PKT_READY_COUNTER , COMPILATIONTIMESTAMP , FAV_WRK_SCHEDULE , EFF_WRK_SCHEDULE , PRH_VAR_TRG_MODE_A , PRH_VAR_TRG_MODE_B , ACQ_BUILD_INFO , ACQ_VAR_INFO , RM_ACQ_AFTER_CALIB , RM_ACQ_SETTING_MODE, TRK_CALIB_USED,CAL_DSP_MASK, LAST_TIMESYNC, OBT_TIMESYNC, VALIDATION, INSERT_TIME) select * FROM GL_RUN where ID=11; |
| 882 |
// MySQL variables |
// MySQL variables |
| 883 |
TSQLResult *pResult; |
TSQLResult *pResult = NULL; |
| 884 |
TSQLRow *Row = NULL; |
TSQLRow *Row = NULL; |
| 885 |
stringstream myquery; |
stringstream myquery; |
| 886 |
// |
// |
| 903 |
if( Row != NULL ){ |
if( Row != NULL ){ |
| 904 |
ToTable = (TString)Row->GetField(0); |
ToTable = (TString)Row->GetField(0); |
| 905 |
} else { |
} else { |
| 906 |
|
delete pResult; |
| 907 |
return 1; |
return 1; |
| 908 |
}; |
}; |
| 909 |
}; |
}; |
| 910 |
|
|
| 911 |
|
if (pResult) |
| 912 |
|
delete pResult; |
| 913 |
|
if (Row) |
| 914 |
|
delete Row; |
| 915 |
// ---------------- |
// ---------------- |
| 916 |
myquery.str(""); |
myquery.str(""); |
| 917 |
myquery << " INSERT INTO "; |
myquery << " INSERT INTO "; |
| 992 |
// |
// |
| 993 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 994 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 995 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 996 |
// |
// |
| 997 |
// |
// |
| 998 |
myquery.str(""); |
myquery.str(""); |
| 1001 |
// |
// |
| 1002 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 1003 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1004 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 1005 |
// |
// |
| 1006 |
return 0; |
return 0; |
| 1007 |
}; |
}; |
| 1089 |
// |
// |
| 1090 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 1091 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1092 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 1093 |
// |
// |
| 1094 |
return 0; |
return 0; |
| 1095 |
|
|
| 1171 |
// |
// |
| 1172 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 1173 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1174 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 1175 |
// |
// |
| 1176 |
return 0; |
return 0; |
| 1177 |
|
|
| 1235 |
// |
// |
| 1236 |
// printf(" getrowcount %i \n",pResult->GetRowCount()); |
// printf(" getrowcount %i \n",pResult->GetRowCount()); |
| 1237 |
// |
// |
| 1238 |
if( !pResult->GetRowCount() ) return(-50); |
if( !pResult->GetRowCount() ){ |
| 1239 |
|
delete pResult; |
| 1240 |
|
if (Row) |
| 1241 |
|
delete Row; |
| 1242 |
|
return(-50); |
| 1243 |
|
} |
| 1244 |
// |
// |
| 1245 |
for( r=0; r < 1000; r++){ |
for( r=0; r < 1000; r++){ |
| 1246 |
if (Row) |
if (Row) |
| 1346 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 1347 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1348 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 1349 |
if(!pResult->GetRowCount())return(-50); |
if(!pResult->GetRowCount()){ |
| 1350 |
|
delete pResult; |
| 1351 |
|
if (Row) |
| 1352 |
|
delete Row; |
| 1353 |
|
return(-50); |
| 1354 |
|
} |
| 1355 |
for( r=0; r < 1000; r++){ |
for( r=0; r < 1000; r++){ |
| 1356 |
if (Row) |
if (Row) |
| 1357 |
delete Row; |
delete Row; |
| 1425 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 1426 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1427 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 1428 |
if(!pResult->GetRowCount())return (-51); |
if(!pResult->GetRowCount()){ |
| 1429 |
|
delete pResult; |
| 1430 |
|
if (Row) |
| 1431 |
|
delete Row; |
| 1432 |
|
return (-51); |
| 1433 |
|
} |
| 1434 |
for( r=0; r < 1000; r++){ |
for( r=0; r < 1000; r++){ |
| 1435 |
if (Row) |
if (Row) |
| 1436 |
delete Row; |
delete Row; |
| 1440 |
if(t==0) ID = (UInt_t)atoll(Row->GetField(t)); |
if(t==0) ID = (UInt_t)atoll(Row->GetField(t)); |
| 1441 |
if(t==1) ID_RAW = (UInt_t)atoll(Row->GetField(t)); |
if(t==1) ID_RAW = (UInt_t)atoll(Row->GetField(t)); |
| 1442 |
if(t==2) ID_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
if(t==2) ID_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
| 1443 |
if(t==3) PATH = (TString)gSystem->ExpandPathName(Row->GetField(t))+'/'; |
if(t==3){ |
| 1444 |
|
PATH = TString(Row->GetField(t)) + '/'; |
| 1445 |
|
gSystem->ExpandPathName(PATH); |
| 1446 |
|
} |
| 1447 |
if(t==4) NAME = Row->GetField(t); |
if(t==4) NAME = Row->GetField(t); |
| 1448 |
} |
} |
| 1449 |
} |
} |
| 1477 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 1478 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1479 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 1480 |
if(!pResult->GetRowCount())return (-53); |
if(!pResult->GetRowCount()){ |
| 1481 |
|
delete pResult; |
| 1482 |
|
return (-53); |
| 1483 |
|
} |
| 1484 |
for( r=0; r < 1000; r++){ |
for( r=0; r < 1000; r++){ |
| 1485 |
if (Row) |
if (Row) |
| 1486 |
delete Row; |
delete Row; |
| 1545 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 1546 |
// printf(" mysquery is %s\n",myquery.str().c_str()); |
// printf(" mysquery is %s\n",myquery.str().c_str()); |
| 1547 |
// |
// |
|
if( !pResult->GetRowCount() ) return(-54); |
|
| 1548 |
if (Row) |
if (Row) |
| 1549 |
delete Row; |
delete Row; |
| 1550 |
|
if( !pResult->GetRowCount() ){ |
| 1551 |
|
delete pResult; |
| 1552 |
|
return(-54); |
| 1553 |
|
} |
| 1554 |
Row = pResult->Next(); |
Row = pResult->Next(); |
| 1555 |
if( Row == NULL ) return (-54); |
if( Row == NULL ){ |
| 1556 |
|
delete pResult; |
| 1557 |
|
return (-54); |
| 1558 |
|
} |
| 1559 |
// |
// |
| 1560 |
uptime = (UInt_t)atoll(Row->GetField(2)); |
uptime = (UInt_t)atoll(Row->GetField(2)); |
| 1561 |
// |
// |
| 1572 |
myquery << "select ID_ROOT_L0, FROM_TIME, TO_TIME, EV_ROOT,VALIDATION from GL_CALO_CALIB where SECTION=" << section; |
myquery << "select ID_ROOT_L0, FROM_TIME, TO_TIME, EV_ROOT,VALIDATION from GL_CALO_CALIB where SECTION=" << section; |
| 1573 |
myquery << " and FROM_TIME <= " << time; |
myquery << " and FROM_TIME <= " << time; |
| 1574 |
myquery << " and VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;"; |
myquery << " and VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;"; |
| 1575 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ){ |
| 1576 |
|
if(pResult) |
| 1577 |
|
delete pResult; |
| 1578 |
|
if(Row) |
| 1579 |
|
delete Row; |
| 1580 |
|
return -57; |
| 1581 |
|
} |
| 1582 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1583 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 1584 |
// printf(" mysquery is %s\n",myquery.str().c_str()); |
// printf(" mysquery is %s\n",myquery.str().c_str()); |
| 1585 |
// |
// |
| 1586 |
// if no results yet quit with error |
// if no results yet quit with error |
| 1587 |
// |
// |
| 1588 |
if( !pResult->GetRowCount() ) return (-54); |
if( !pResult->GetRowCount() ){ |
| 1589 |
|
delete pResult; |
| 1590 |
|
if(Row) |
| 1591 |
|
delete Row; |
| 1592 |
|
return (-54); |
| 1593 |
|
} |
| 1594 |
// |
// |
| 1595 |
if (Row) |
if (Row) |
| 1596 |
delete Row; |
delete Row; |
| 1607 |
myquery.str(""); |
myquery.str(""); |
| 1608 |
myquery << "select ID_ROOT_L0, FROM_TIME, TO_TIME, EV_ROOT from GL_CALO_CALIB where SECTION=" << section; |
myquery << "select ID_ROOT_L0, FROM_TIME, TO_TIME, EV_ROOT from GL_CALO_CALIB where SECTION=" << section; |
| 1609 |
myquery << " and VALIDATION=1 ORDER BY ABS(" << time << "-FROM_TIME) asc limit 1;"; |
myquery << " and VALIDATION=1 ORDER BY ABS(" << time << "-FROM_TIME) asc limit 1;"; |
| 1610 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ){ |
| 1611 |
|
if(pResult) |
| 1612 |
|
delete pResult; |
| 1613 |
|
if(Row) |
| 1614 |
|
delete Row; |
| 1615 |
|
return -57; |
| 1616 |
|
} |
| 1617 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1618 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 1619 |
// printf(" mysquery is %s\n",myquery.str().c_str()); |
// printf(" mysquery is %s\n",myquery.str().c_str()); |
| 1620 |
// |
// |
| 1621 |
// if no results yet quit with error |
// if no results yet quit with error |
| 1622 |
// |
// |
| 1623 |
if( !pResult->GetRowCount() ) return (-54); |
if( !pResult->GetRowCount() ){ |
| 1624 |
|
if (Row) |
| 1625 |
|
delete Row; |
| 1626 |
|
delete pResult; |
| 1627 |
|
return (-54); |
| 1628 |
|
} |
| 1629 |
// |
// |
| 1630 |
|
if (Row) |
| 1631 |
|
delete Row; |
| 1632 |
Row = pResult->Next(); |
Row = pResult->Next(); |
| 1633 |
// |
// |
| 1634 |
}; |
}; |
| 1635 |
// |
// |
| 1636 |
// store infos and exit |
// store infos and exit |
| 1637 |
// |
// |
| 1638 |
if( Row == NULL ) return (-54); |
if( Row == NULL ){ |
| 1639 |
|
delete pResult; |
| 1640 |
|
return (-54); |
| 1641 |
|
} |
| 1642 |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
| 1643 |
if (t==0) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
if (t==0) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
| 1644 |
if (t==1) FROM_TIME = myfromtime; |
if (t==1) FROM_TIME = myfromtime; |
| 1647 |
} |
} |
| 1648 |
if (Row) |
if (Row) |
| 1649 |
delete Row; |
delete Row; |
| 1650 |
pResult->Delete(); |
delete pResult; |
| 1651 |
return 0; |
return 0; |
| 1652 |
}; |
}; |
| 1653 |
|
|
| 1684 |
delete Row; |
delete Row; |
| 1685 |
Row = pResult->Next(); |
Row = pResult->Next(); |
| 1686 |
// |
// |
| 1687 |
if( !Row ) return (-54); |
if( !Row ){ |
| 1688 |
|
delete pResult; |
| 1689 |
|
return (-54); |
| 1690 |
|
} |
| 1691 |
// |
// |
| 1692 |
// store infos and exit |
// store infos and exit |
| 1693 |
// |
// |
| 1727 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 1728 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1729 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 1730 |
if(!pResult->GetRowCount())return (-55);//throw -55; |
if(!pResult->GetRowCount()){ |
| 1731 |
|
delete pResult; |
| 1732 |
|
return (-55);//throw -55; |
| 1733 |
|
} |
| 1734 |
for( r=0; r < 1000; r++){ |
for( r=0; r < 1000; r++){ |
| 1735 |
if (Row) |
if (Row) |
| 1736 |
delete Row; |
delete Row; |
| 1780 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 1781 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1782 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 1783 |
if(!pResult->GetRowCount())return (-52); |
if(!pResult->GetRowCount()){ |
| 1784 |
|
delete pResult; |
| 1785 |
|
return (-52); |
| 1786 |
|
} |
| 1787 |
for( r=0; r < 1000; r++){ |
for( r=0; r < 1000; r++){ |
| 1788 |
if (Row) |
if (Row) |
| 1789 |
delete Row; |
delete Row; |
| 1790 |
Row = pResult->Next(); |
Row = pResult->Next(); |
| 1791 |
if( Row == NULL ) break; |
if( Row == NULL ) break; |
| 1792 |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
| 1793 |
if (t==0) ID = (UInt_t)atoll(Row->GetField(t)); |
if (t==0) ID = (UInt_t)atoll(Row->GetField(t)); |
| 1794 |
if (t==1) PATH = (TString)gSystem->ExpandPathName(Row->GetField(t))+'/';// put in fpath the path to that file |
if (t==1) { |
| 1795 |
if (t==2) NAME = Row->GetField(t); |
PATH = TString(Row->GetField(t)) + "/";// put in fpath the path to that file |
| 1796 |
if (t==3) DESCR = Row->GetField(t); |
gSystem->ExpandPathName(PATH); |
| 1797 |
if (t==4) FROM_TIME = (UInt_t)atoll(Row->GetField(t)); |
} |
| 1798 |
if (t==5) TO_TIME = (UInt_t)atoll(Row->GetField(t)); |
if (t==2) NAME = Row->GetField(t); |
| 1799 |
if (t==6) TYPE = (UInt_t)atoll(Row->GetField(t)); |
if (t==3) DESCR = Row->GetField(t); |
| 1800 |
|
if (t==4) FROM_TIME = (UInt_t)atoll(Row->GetField(t)); |
| 1801 |
|
if (t==5) TO_TIME = (UInt_t)atoll(Row->GetField(t)); |
| 1802 |
|
if (t==6) TYPE = (UInt_t)atoll(Row->GetField(t)); |
| 1803 |
}; |
}; |
| 1804 |
} |
} |
| 1805 |
if (Row) |
if (Row) |
| 1865 |
if( Row ){ |
if( Row ){ |
| 1866 |
stringstream fname; |
stringstream fname; |
| 1867 |
fname.str(""); |
fname.str(""); |
| 1868 |
fname << gSystem->ExpandPathName(Row->GetField(0)) << "/" << Row->GetField(1); |
TString auxStr(Row->GetField(0)); |
| 1869 |
|
gSystem->ExpandPathName(auxStr); |
| 1870 |
|
fname << auxStr << "/" << Row->GetField(1); |
| 1871 |
rname << Row->GetField(1); |
rname << Row->GetField(1); |
| 1872 |
file = new TFile(fname.str().c_str(),"READ"); |
file = new TFile(fname.str().c_str(),"READ"); |
| 1873 |
idtsy = (UInt_t)atoll(Row->GetField(2)); |
idtsy = (UInt_t)atoll(Row->GetField(2)); |
| 1883 |
T->GetEntry(0); |
T->GetEntry(0); |
| 1884 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
| 1885 |
pktfirst = ph->GetCounter(); |
pktfirst = ph->GetCounter(); |
| 1886 |
|
if ( eh ){ |
| 1887 |
|
delete eh; |
| 1888 |
|
eh = 0; |
| 1889 |
|
} |
| 1890 |
// obtfirst = ph->GetOrbitalTime(); |
// obtfirst = ph->GetOrbitalTime(); |
| 1891 |
// |
// |
| 1892 |
}; |
}; |
| 1898 |
stringstream oss; |
stringstream oss; |
| 1899 |
// |
// |
| 1900 |
TString name=rname.str().c_str(); |
TString name=rname.str().c_str(); |
| 1901 |
UInt_t dworbit = 0; |
// UInt_t dworbit = 0; |
| 1902 |
// Int_t nlength = name.Length(); |
// Int_t nlength = name.Length(); |
| 1903 |
delete pResult; |
delete pResult; |
| 1904 |
|
if (Row){ |
| 1905 |
|
delete Row; |
| 1906 |
|
Row = NULL; |
| 1907 |
|
} |
| 1908 |
// |
// |
| 1909 |
// New code, we have one more column on GL_TIMESYNC so we can trust that one for the Resurs offset |
// New code, we have one more column on GL_TIMESYNC so we can trust that one for the Resurs offset |
| 1910 |
// |
// |
| 1928 |
oss.str(""); |
oss.str(""); |
| 1929 |
oss << "SELECT YEAR(OFFSET_DATE),MONTH(OFFSET_DATE),DAY(OFFSET_DATE),HOUR(OFFSET_DATE),MINUTE(OFFSET_DATE),SECOND(OFFSET_DATE) FROM GL_RESURS_OFFSET WHERE ID=" |
oss << "SELECT YEAR(OFFSET_DATE),MONTH(OFFSET_DATE),DAY(OFFSET_DATE),HOUR(OFFSET_DATE),MINUTE(OFFSET_DATE),SECOND(OFFSET_DATE) FROM GL_RESURS_OFFSET WHERE ID=" |
| 1930 |
<< Row->GetField(3) << ";"; |
<< Row->GetField(3) << ";"; |
| 1931 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ){ |
| 1932 |
|
delete pResult; |
| 1933 |
|
delete Row; |
| 1934 |
|
return; |
| 1935 |
|
} |
| 1936 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1937 |
delete pResult; |
delete pResult; |
| 1938 |
pResult = dbc->Query(oss.str().c_str()); |
pResult = dbc->Query(oss.str().c_str()); |
| 1943 |
if ( Row ){ |
if ( Row ){ |
| 1944 |
// printf(" GREAT! the DB structure is the new one! \n"); |
// printf(" GREAT! the DB structure is the new one! \n"); |
| 1945 |
fndit = true; |
fndit = true; |
| 1946 |
dworbit = 1; |
// dworbit = 1; |
| 1947 |
}; |
}; |
| 1948 |
}; |
}; |
| 1949 |
}; |
}; |
| 2000 |
if( Row ){ |
if( Row ){ |
| 2001 |
stringstream fname; |
stringstream fname; |
| 2002 |
fname.str(""); |
fname.str(""); |
| 2003 |
fname << gSystem->ExpandPathName(Row->GetField(0)) << "/" << Row->GetField(1); |
TString auxString(Row->GetField(0)); |
| 2004 |
|
gSystem->ExpandPathName(auxString); |
| 2005 |
|
fname << auxString << "/" << Row->GetField(1); |
| 2006 |
rname << Row->GetField(1); |
rname << Row->GetField(1); |
| 2007 |
if ( usel0file ) file = new TFile(fname.str().c_str(),"READ"); |
if ( usel0file ) file = new TFile(fname.str().c_str(),"READ"); |
| 2008 |
idtsy = (UInt_t)atoll(Row->GetField(2)); |
idtsy = (UInt_t)atoll(Row->GetField(2)); |
| 2018 |
T->GetEntry(0); |
T->GetEntry(0); |
| 2019 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
| 2020 |
pktfirst = ph->GetCounter(); |
pktfirst = ph->GetCounter(); |
| 2021 |
|
if ( eh ){ |
| 2022 |
|
delete eh; |
| 2023 |
|
eh = 0; |
| 2024 |
|
} |
| 2025 |
// obtfirst = ph->GetOrbitalTime(); |
// obtfirst = ph->GetOrbitalTime(); |
| 2026 |
// |
// |
| 2027 |
}; |
}; |
| 2034 |
stringstream oss; |
stringstream oss; |
| 2035 |
// |
// |
| 2036 |
TString name=rname.str().c_str(); |
TString name=rname.str().c_str(); |
| 2037 |
UInt_t dworbit = 0; |
// UInt_t dworbit = 0; |
| 2038 |
// Int_t nlength = name.Length(); |
// Int_t nlength = name.Length(); |
| 2039 |
delete pResult; |
delete pResult; |
| 2040 |
|
if (Row){ |
| 2041 |
|
delete Row; |
| 2042 |
|
Row = NULL; |
| 2043 |
|
} |
| 2044 |
// |
// |
| 2045 |
// New code, we have one more column on GL_TIMESYNC so we can trust that one for the Resurs offset |
// New code, we have one more column on GL_TIMESYNC so we can trust that one for the Resurs offset |
| 2046 |
// |
// |
| 2064 |
oss.str(""); |
oss.str(""); |
| 2065 |
oss << "SELECT YEAR(OFFSET_DATE),MONTH(OFFSET_DATE),DAY(OFFSET_DATE),HOUR(OFFSET_DATE),MINUTE(OFFSET_DATE),SECOND(OFFSET_DATE) FROM GL_RESURS_OFFSET WHERE ID=" |
oss << "SELECT YEAR(OFFSET_DATE),MONTH(OFFSET_DATE),DAY(OFFSET_DATE),HOUR(OFFSET_DATE),MINUTE(OFFSET_DATE),SECOND(OFFSET_DATE) FROM GL_RESURS_OFFSET WHERE ID=" |
| 2066 |
<< Row->GetField(3) << ";"; |
<< Row->GetField(3) << ";"; |
| 2067 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ){ |
| 2068 |
|
delete pResult; |
| 2069 |
|
delete Row; |
| 2070 |
|
return; |
| 2071 |
|
} |
| 2072 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 2073 |
delete pResult; |
delete pResult; |
| 2074 |
pResult = dbc->Query(oss.str().c_str()); |
pResult = dbc->Query(oss.str().c_str()); |
| 2079 |
if (Row){ |
if (Row){ |
| 2080 |
// printf(" GREAT! the DB structure is the new one! \n"); |
// printf(" GREAT! the DB structure is the new one! \n"); |
| 2081 |
fndit = true; |
fndit = true; |
| 2082 |
dworbit = 1; |
// dworbit = 1; |
| 2083 |
}; |
}; |
| 2084 |
}; |
}; |
| 2085 |
}; |
}; |
| 2375 |
|
|
| 2376 |
// Set the right time_zone (otherwise horrible things will occur! :) |
// Set the right time_zone (otherwise horrible things will occur! :) |
| 2377 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 2378 |
dbc->Query("SET time_zone = '+0:00'"); |
delete dbc->Query("SET time_zone = '+0:00';"); |
| 2379 |
|
delete dbc->Query("SET sql_mode = 'NO_UNSIGNED_SUBTRACTION';"); |
| 2380 |
|
|
| 2381 |
// Do the query |
// Do the query |
| 2382 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 2383 |
result = dbc->Query(myquery.Data()); |
result = dbc->Query(myquery.Data()); |
| 2384 |
if(! result->GetRowCount() ) { |
if(! result->GetRowCount() ) { |
| 2385 |
cerr << "GL_TLE: query failed: " << myquery.Data() << endl; |
cerr << "GL_TLE: query failed: " << myquery.Data() << endl; |
| 2386 |
|
delete result; |
| 2387 |
return 1; |
return 1; |
| 2388 |
} |
} |
| 2389 |
|
|