| 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()) ){ |
| 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++; |
fNquery++; |
| 267 |
myquery.str(""); |
myquery.str(""); |
| 268 |
myquery << "SET wait_timeout=173000;"; |
myquery << "SET wait_timeout=173000;"; |
| 269 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 270 |
fNquery++; |
fNquery++; |
| 271 |
return true; |
return true; |
| 272 |
}; |
}; |
| 735 |
// |
// |
| 736 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 737 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 738 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 739 |
// |
// |
| 740 |
// retrieve this ID_TRASH |
// retrieve this ID_TRASH |
| 741 |
// |
// |
| 766 |
// |
// |
| 767 |
// printf("2myquery is %s \n",myquery.str().c_str()); |
// printf("2myquery is %s \n",myquery.str().c_str()); |
| 768 |
// |
// |
| 769 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ){ |
| 770 |
|
if (pResult) |
| 771 |
|
delete pResult; |
| 772 |
|
if (Row) |
| 773 |
|
delete Row; |
| 774 |
|
return -57; |
| 775 |
|
} |
| 776 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 777 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 778 |
// |
// |
| 791 |
// |
// |
| 792 |
// printf("3myquery is %s \n",myquery.str().c_str()); |
// printf("3myquery is %s \n",myquery.str().c_str()); |
| 793 |
// |
// |
| 794 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ){ |
| 795 |
|
if (pResult) |
| 796 |
|
delete pResult; |
| 797 |
|
if (Row) |
| 798 |
|
delete Row; |
| 799 |
|
return -57; |
| 800 |
|
} |
| 801 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 802 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 803 |
// |
// |
| 807 |
if( Row != NULL ){ |
if( Row != NULL ){ |
| 808 |
fileL2 = (TString)Row->GetField(0); |
fileL2 = (TString)Row->GetField(0); |
| 809 |
} |
} |
| 810 |
|
delete pResult; |
| 811 |
|
pResult = NULL; |
| 812 |
if (Row){ |
if (Row){ |
| 813 |
delete Row; |
delete Row; |
| 814 |
Row = NULL; // This variable is not used below |
Row = NULL; // This variable is not used below |
| 825 |
// |
// |
| 826 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 827 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 828 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 829 |
// |
// |
| 830 |
myquery.str(""); |
myquery.str(""); |
| 831 |
myquery << " UPDATE GL_RUN_TRASH SET FILENAMEL2='"; |
myquery << " UPDATE GL_RUN_TRASH SET FILENAMEL2='"; |
| 836 |
// |
// |
| 837 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 838 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 839 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 840 |
// |
// |
| 841 |
myquery.str(""); |
myquery.str(""); |
| 842 |
myquery << " UPDATE GL_RUN_TRASH SET BELONGED_TO='"; |
myquery << " UPDATE GL_RUN_TRASH SET BELONGED_TO='"; |
| 848 |
// |
// |
| 849 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 850 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 851 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 852 |
// |
// |
| 853 |
myquery.str(""); |
myquery.str(""); |
| 854 |
myquery << " DELETE FROM "; |
myquery << " DELETE FROM "; |
| 860 |
// |
// |
| 861 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 862 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 863 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 864 |
// |
// |
| 865 |
return 0; |
return 0; |
| 866 |
}; |
}; |
| 876 |
// insert into GL_RUN_FRAGMENTS select * FROM GL_RUN where ID=11; |
// insert into GL_RUN_FRAGMENTS select * FROM GL_RUN where ID=11; |
| 877 |
//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; |
| 878 |
// MySQL variables |
// MySQL variables |
| 879 |
TSQLResult *pResult; |
TSQLResult *pResult = NULL; |
| 880 |
TSQLRow *Row = NULL; |
TSQLRow *Row = NULL; |
| 881 |
stringstream myquery; |
stringstream myquery; |
| 882 |
// |
// |
| 899 |
if( Row != NULL ){ |
if( Row != NULL ){ |
| 900 |
ToTable = (TString)Row->GetField(0); |
ToTable = (TString)Row->GetField(0); |
| 901 |
} else { |
} else { |
| 902 |
|
delete pResult; |
| 903 |
return 1; |
return 1; |
| 904 |
}; |
}; |
| 905 |
}; |
}; |
| 906 |
|
|
| 907 |
|
if (pResult) |
| 908 |
|
delete pResult; |
| 909 |
|
if (Row) |
| 910 |
|
delete Row; |
| 911 |
// ---------------- |
// ---------------- |
| 912 |
myquery.str(""); |
myquery.str(""); |
| 913 |
myquery << " INSERT INTO "; |
myquery << " INSERT INTO "; |
| 988 |
// |
// |
| 989 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 990 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 991 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 992 |
// |
// |
| 993 |
// |
// |
| 994 |
myquery.str(""); |
myquery.str(""); |
| 997 |
// |
// |
| 998 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 999 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1000 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 1001 |
// |
// |
| 1002 |
return 0; |
return 0; |
| 1003 |
}; |
}; |
| 1085 |
// |
// |
| 1086 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 1087 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1088 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 1089 |
// |
// |
| 1090 |
return 0; |
return 0; |
| 1091 |
|
|
| 1167 |
// |
// |
| 1168 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 1169 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1170 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
| 1171 |
// |
// |
| 1172 |
return 0; |
return 0; |
| 1173 |
|
|
| 1231 |
// |
// |
| 1232 |
// printf(" getrowcount %i \n",pResult->GetRowCount()); |
// printf(" getrowcount %i \n",pResult->GetRowCount()); |
| 1233 |
// |
// |
| 1234 |
if( !pResult->GetRowCount() ) return(-50); |
if( !pResult->GetRowCount() ){ |
| 1235 |
|
delete pResult; |
| 1236 |
|
if (Row) |
| 1237 |
|
delete Row; |
| 1238 |
|
return(-50); |
| 1239 |
|
} |
| 1240 |
// |
// |
| 1241 |
for( r=0; r < 1000; r++){ |
for( r=0; r < 1000; r++){ |
| 1242 |
if (Row) |
if (Row) |
| 1342 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 1343 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1344 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 1345 |
if(!pResult->GetRowCount())return(-50); |
if(!pResult->GetRowCount()){ |
| 1346 |
|
delete pResult; |
| 1347 |
|
if (Row) |
| 1348 |
|
delete Row; |
| 1349 |
|
return(-50); |
| 1350 |
|
} |
| 1351 |
for( r=0; r < 1000; r++){ |
for( r=0; r < 1000; r++){ |
| 1352 |
if (Row) |
if (Row) |
| 1353 |
delete Row; |
delete Row; |
| 1421 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 1422 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1423 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 1424 |
if(!pResult->GetRowCount())return (-51); |
if(!pResult->GetRowCount()){ |
| 1425 |
|
delete pResult; |
| 1426 |
|
if (Row) |
| 1427 |
|
delete Row; |
| 1428 |
|
return (-51); |
| 1429 |
|
} |
| 1430 |
for( r=0; r < 1000; r++){ |
for( r=0; r < 1000; r++){ |
| 1431 |
if (Row) |
if (Row) |
| 1432 |
delete Row; |
delete Row; |
| 1436 |
if(t==0) ID = (UInt_t)atoll(Row->GetField(t)); |
if(t==0) ID = (UInt_t)atoll(Row->GetField(t)); |
| 1437 |
if(t==1) ID_RAW = (UInt_t)atoll(Row->GetField(t)); |
if(t==1) ID_RAW = (UInt_t)atoll(Row->GetField(t)); |
| 1438 |
if(t==2) ID_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
if(t==2) ID_TIMESYNC = (UInt_t)atoll(Row->GetField(t)); |
| 1439 |
if(t==3) PATH = (TString)gSystem->ExpandPathName(Row->GetField(t))+'/'; |
if(t==3){ |
| 1440 |
|
PATH = TString(Row->GetField(t)) + '/'; |
| 1441 |
|
gSystem->ExpandPathName(PATH); |
| 1442 |
|
} |
| 1443 |
if(t==4) NAME = Row->GetField(t); |
if(t==4) NAME = Row->GetField(t); |
| 1444 |
} |
} |
| 1445 |
} |
} |
| 1473 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 1474 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1475 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 1476 |
if(!pResult->GetRowCount())return (-53); |
if(!pResult->GetRowCount()){ |
| 1477 |
|
delete pResult; |
| 1478 |
|
return (-53); |
| 1479 |
|
} |
| 1480 |
for( r=0; r < 1000; r++){ |
for( r=0; r < 1000; r++){ |
| 1481 |
if (Row) |
if (Row) |
| 1482 |
delete Row; |
delete Row; |
| 1541 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 1542 |
// printf(" mysquery is %s\n",myquery.str().c_str()); |
// printf(" mysquery is %s\n",myquery.str().c_str()); |
| 1543 |
// |
// |
|
if( !pResult->GetRowCount() ) return(-54); |
|
| 1544 |
if (Row) |
if (Row) |
| 1545 |
delete Row; |
delete Row; |
| 1546 |
|
if( !pResult->GetRowCount() ){ |
| 1547 |
|
delete pResult; |
| 1548 |
|
return(-54); |
| 1549 |
|
} |
| 1550 |
Row = pResult->Next(); |
Row = pResult->Next(); |
| 1551 |
if( Row == NULL ) return (-54); |
if( Row == NULL ){ |
| 1552 |
|
delete pResult; |
| 1553 |
|
return (-54); |
| 1554 |
|
} |
| 1555 |
// |
// |
| 1556 |
uptime = (UInt_t)atoll(Row->GetField(2)); |
uptime = (UInt_t)atoll(Row->GetField(2)); |
| 1557 |
// |
// |
| 1568 |
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; |
| 1569 |
myquery << " and FROM_TIME <= " << time; |
myquery << " and FROM_TIME <= " << time; |
| 1570 |
myquery << " and VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;"; |
myquery << " and VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;"; |
| 1571 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ){ |
| 1572 |
|
if(pResult) |
| 1573 |
|
delete pResult; |
| 1574 |
|
if(Row) |
| 1575 |
|
delete Row; |
| 1576 |
|
return -57; |
| 1577 |
|
} |
| 1578 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1579 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 1580 |
// printf(" mysquery is %s\n",myquery.str().c_str()); |
// printf(" mysquery is %s\n",myquery.str().c_str()); |
| 1581 |
// |
// |
| 1582 |
// if no results yet quit with error |
// if no results yet quit with error |
| 1583 |
// |
// |
| 1584 |
if( !pResult->GetRowCount() ) return (-54); |
if( !pResult->GetRowCount() ){ |
| 1585 |
|
delete pResult; |
| 1586 |
|
if(Row) |
| 1587 |
|
delete Row; |
| 1588 |
|
return (-54); |
| 1589 |
|
} |
| 1590 |
// |
// |
| 1591 |
if (Row) |
if (Row) |
| 1592 |
delete Row; |
delete Row; |
| 1603 |
myquery.str(""); |
myquery.str(""); |
| 1604 |
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; |
| 1605 |
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;"; |
| 1606 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ){ |
| 1607 |
|
if(pResult) |
| 1608 |
|
delete pResult; |
| 1609 |
|
if(Row) |
| 1610 |
|
delete Row; |
| 1611 |
|
return -57; |
| 1612 |
|
} |
| 1613 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1614 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 1615 |
// printf(" mysquery is %s\n",myquery.str().c_str()); |
// printf(" mysquery is %s\n",myquery.str().c_str()); |
| 1616 |
// |
// |
| 1617 |
// if no results yet quit with error |
// if no results yet quit with error |
| 1618 |
// |
// |
| 1619 |
if( !pResult->GetRowCount() ) return (-54); |
if( !pResult->GetRowCount() ){ |
| 1620 |
|
if (Row) |
| 1621 |
|
delete Row; |
| 1622 |
|
delete pResult; |
| 1623 |
|
return (-54); |
| 1624 |
|
} |
| 1625 |
// |
// |
| 1626 |
|
if (Row) |
| 1627 |
|
delete Row; |
| 1628 |
Row = pResult->Next(); |
Row = pResult->Next(); |
| 1629 |
// |
// |
| 1630 |
}; |
}; |
| 1631 |
// |
// |
| 1632 |
// store infos and exit |
// store infos and exit |
| 1633 |
// |
// |
| 1634 |
if( Row == NULL ) return (-54); |
if( Row == NULL ){ |
| 1635 |
|
delete pResult; |
| 1636 |
|
return (-54); |
| 1637 |
|
} |
| 1638 |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
| 1639 |
if (t==0) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
if (t==0) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t)); |
| 1640 |
if (t==1) FROM_TIME = myfromtime; |
if (t==1) FROM_TIME = myfromtime; |
| 1643 |
} |
} |
| 1644 |
if (Row) |
if (Row) |
| 1645 |
delete Row; |
delete Row; |
| 1646 |
pResult->Delete(); |
delete pResult; |
| 1647 |
return 0; |
return 0; |
| 1648 |
}; |
}; |
| 1649 |
|
|
| 1680 |
delete Row; |
delete Row; |
| 1681 |
Row = pResult->Next(); |
Row = pResult->Next(); |
| 1682 |
// |
// |
| 1683 |
if( !Row ) return (-54); |
if( !Row ){ |
| 1684 |
|
delete pResult; |
| 1685 |
|
return (-54); |
| 1686 |
|
} |
| 1687 |
// |
// |
| 1688 |
// store infos and exit |
// store infos and exit |
| 1689 |
// |
// |
| 1723 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 1724 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1725 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 1726 |
if(!pResult->GetRowCount())return (-55);//throw -55; |
if(!pResult->GetRowCount()){ |
| 1727 |
|
delete pResult; |
| 1728 |
|
return (-55);//throw -55; |
| 1729 |
|
} |
| 1730 |
for( r=0; r < 1000; r++){ |
for( r=0; r < 1000; r++){ |
| 1731 |
if (Row) |
if (Row) |
| 1732 |
delete Row; |
delete Row; |
| 1776 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 1777 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1778 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
| 1779 |
if(!pResult->GetRowCount())return (-52); |
if(!pResult->GetRowCount()){ |
| 1780 |
|
delete pResult; |
| 1781 |
|
return (-52); |
| 1782 |
|
} |
| 1783 |
for( r=0; r < 1000; r++){ |
for( r=0; r < 1000; r++){ |
| 1784 |
if (Row) |
if (Row) |
| 1785 |
delete Row; |
delete Row; |
| 1786 |
Row = pResult->Next(); |
Row = pResult->Next(); |
| 1787 |
if( Row == NULL ) break; |
if( Row == NULL ) break; |
| 1788 |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
for( t = 0; t < pResult->GetFieldCount(); t++){ |
| 1789 |
if (t==0) ID = (UInt_t)atoll(Row->GetField(t)); |
if (t==0) ID = (UInt_t)atoll(Row->GetField(t)); |
| 1790 |
if (t==1) PATH = (TString)gSystem->ExpandPathName(Row->GetField(t))+'/';// put in fpath the path to that file |
if (t==1) { |
| 1791 |
if (t==2) NAME = Row->GetField(t); |
PATH = TString(Row->GetField(t)) + "/";// put in fpath the path to that file |
| 1792 |
if (t==3) DESCR = Row->GetField(t); |
gSystem->ExpandPathName(PATH); |
| 1793 |
if (t==4) FROM_TIME = (UInt_t)atoll(Row->GetField(t)); |
} |
| 1794 |
if (t==5) TO_TIME = (UInt_t)atoll(Row->GetField(t)); |
if (t==2) NAME = Row->GetField(t); |
| 1795 |
if (t==6) TYPE = (UInt_t)atoll(Row->GetField(t)); |
if (t==3) DESCR = Row->GetField(t); |
| 1796 |
|
if (t==4) FROM_TIME = (UInt_t)atoll(Row->GetField(t)); |
| 1797 |
|
if (t==5) TO_TIME = (UInt_t)atoll(Row->GetField(t)); |
| 1798 |
|
if (t==6) TYPE = (UInt_t)atoll(Row->GetField(t)); |
| 1799 |
}; |
}; |
| 1800 |
} |
} |
| 1801 |
if (Row) |
if (Row) |
| 1861 |
if( Row ){ |
if( Row ){ |
| 1862 |
stringstream fname; |
stringstream fname; |
| 1863 |
fname.str(""); |
fname.str(""); |
| 1864 |
fname << gSystem->ExpandPathName(Row->GetField(0)) << "/" << Row->GetField(1); |
TString auxStr(Row->GetField(0)); |
| 1865 |
|
gSystem->ExpandPathName(auxStr); |
| 1866 |
|
fname << auxStr << "/" << Row->GetField(1); |
| 1867 |
rname << Row->GetField(1); |
rname << Row->GetField(1); |
| 1868 |
file = new TFile(fname.str().c_str(),"READ"); |
file = new TFile(fname.str().c_str(),"READ"); |
| 1869 |
idtsy = (UInt_t)atoll(Row->GetField(2)); |
idtsy = (UInt_t)atoll(Row->GetField(2)); |
| 1892 |
TString name=rname.str().c_str(); |
TString name=rname.str().c_str(); |
| 1893 |
UInt_t dworbit = 0; |
UInt_t dworbit = 0; |
| 1894 |
// Int_t nlength = name.Length(); |
// Int_t nlength = name.Length(); |
| 1895 |
delete pResult; |
delete pResult; |
| 1896 |
|
if (Row){ |
| 1897 |
|
delete Row; |
| 1898 |
|
Row = NULL; |
| 1899 |
|
} |
| 1900 |
// |
// |
| 1901 |
// 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 |
| 1902 |
// |
// |
| 1920 |
oss.str(""); |
oss.str(""); |
| 1921 |
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=" |
| 1922 |
<< Row->GetField(3) << ";"; |
<< Row->GetField(3) << ";"; |
| 1923 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ){ |
| 1924 |
|
delete pResult; |
| 1925 |
|
delete Row; |
| 1926 |
|
return; |
| 1927 |
|
} |
| 1928 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 1929 |
delete pResult; |
delete pResult; |
| 1930 |
pResult = dbc->Query(oss.str().c_str()); |
pResult = dbc->Query(oss.str().c_str()); |
| 1992 |
if( Row ){ |
if( Row ){ |
| 1993 |
stringstream fname; |
stringstream fname; |
| 1994 |
fname.str(""); |
fname.str(""); |
| 1995 |
fname << gSystem->ExpandPathName(Row->GetField(0)) << "/" << Row->GetField(1); |
TString auxString(Row->GetField(0)); |
| 1996 |
|
gSystem->ExpandPathName(auxString); |
| 1997 |
|
fname << auxString << "/" << Row->GetField(1); |
| 1998 |
rname << Row->GetField(1); |
rname << Row->GetField(1); |
| 1999 |
if ( usel0file ) file = new TFile(fname.str().c_str(),"READ"); |
if ( usel0file ) file = new TFile(fname.str().c_str(),"READ"); |
| 2000 |
idtsy = (UInt_t)atoll(Row->GetField(2)); |
idtsy = (UInt_t)atoll(Row->GetField(2)); |
| 2024 |
TString name=rname.str().c_str(); |
TString name=rname.str().c_str(); |
| 2025 |
UInt_t dworbit = 0; |
UInt_t dworbit = 0; |
| 2026 |
// Int_t nlength = name.Length(); |
// Int_t nlength = name.Length(); |
| 2027 |
delete pResult; |
delete pResult; |
| 2028 |
|
if (Row){ |
| 2029 |
|
delete Row; |
| 2030 |
|
Row = NULL; |
| 2031 |
|
} |
| 2032 |
// |
// |
| 2033 |
// 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 |
| 2034 |
// |
// |
| 2052 |
oss.str(""); |
oss.str(""); |
| 2053 |
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=" |
| 2054 |
<< Row->GetField(3) << ";"; |
<< Row->GetField(3) << ";"; |
| 2055 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ){ |
| 2056 |
|
delete pResult; |
| 2057 |
|
delete Row; |
| 2058 |
|
return; |
| 2059 |
|
} |
| 2060 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 2061 |
delete pResult; |
delete pResult; |
| 2062 |
pResult = dbc->Query(oss.str().c_str()); |
pResult = dbc->Query(oss.str().c_str()); |
| 2363 |
|
|
| 2364 |
// Set the right time_zone (otherwise horrible things will occur! :) |
// Set the right time_zone (otherwise horrible things will occur! :) |
| 2365 |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; |
| 2366 |
dbc->Query("SET time_zone = '+0:00'"); |
delete dbc->Query("SET time_zone = '+0:00'"); |
| 2367 |
|
|
| 2368 |
// Do the query |
// Do the query |
| 2369 |
this->GetGLTABLES()->AddQ(); |
this->GetGLTABLES()->AddQ(); |
| 2370 |
result = dbc->Query(myquery.Data()); |
result = dbc->Query(myquery.Data()); |
| 2371 |
if(! result->GetRowCount() ) { |
if(! result->GetRowCount() ) { |
| 2372 |
cerr << "GL_TLE: query failed: " << myquery.Data() << endl; |
cerr << "GL_TLE: query failed: " << myquery.Data() << endl; |
| 2373 |
|
delete result; |
| 2374 |
return 1; |
return 1; |
| 2375 |
} |
} |
| 2376 |
|
|