226 |
qu.str(""); |
qu.str(""); |
227 |
// qu << "SELECT BOOT_NUMBER from ROOT_TABLE where BOOT_NUMBER!=0 AND ABS(LAST_TIME_SYNC_INFO-"<< chlastts <<")<10000 AND ABS(REAL_TIME_INIT-"<< row2->GetField(10) <<")<7200 group by BOOT_NUMBER order by BOOT_NUMBER asc;"; |
// qu << "SELECT BOOT_NUMBER from ROOT_TABLE where BOOT_NUMBER!=0 AND ABS(LAST_TIME_SYNC_INFO-"<< chlastts <<")<10000 AND ABS(REAL_TIME_INIT-"<< row2->GetField(10) <<")<7200 group by BOOT_NUMBER order by BOOT_NUMBER asc;"; |
228 |
// qu << "SELECT BOOT_NUMBER from ROOT_TABLE where BOOT_NUMBER!=0 AND ABS(LAST_TIME_SYNC_INFO-"<< chlastts <<")<40000 AND ABS(REAL_TIME_INIT-"<< row2->GetField(10) <<")<40000 group by BOOT_NUMBER order by BOOT_NUMBER asc;"; // relax conditions... 090112 [8RED: error -29] |
// qu << "SELECT BOOT_NUMBER from ROOT_TABLE where BOOT_NUMBER!=0 AND ABS(LAST_TIME_SYNC_INFO-"<< chlastts <<")<40000 AND ABS(REAL_TIME_INIT-"<< row2->GetField(10) <<")<40000 group by BOOT_NUMBER order by BOOT_NUMBER asc;"; // relax conditions... 090112 [8RED: error -29] |
229 |
qu << "SELECT BOOT_NUMBER from ROOT_TABLE where BOOT_NUMBER!=0 AND ABS(LAST_TIME_SYNC_INFO-"<< chlastts <<")<50000 AND ABS(REAL_TIME_INIT-"<< row2->GetField(10) <<")<50000 group by BOOT_NUMBER order by BOOT_NUMBER asc;"; // even more relaxed conditions... 091214 [9REDtest3: error -29] |
qu << "SELECT BOOT_NUMBER from ROOT_TABLE where BOOT_NUMBER!=0 AND ABS(LAST_TIME_SYNC_INFO-"<< (float)chlastts <<")<50000 AND ABS(REAL_TIME_INIT-"<< atof(row2->GetField(10)) <<")<50000 group by BOOT_NUMBER order by BOOT_NUMBER asc;"; // even more relaxed conditions... 091214 [9REDtest3: error -29] // 10RED MYSQL operators BUG: |
230 |
|
/* |
231 |
|
|
232 |
|
mysql> select CAST(1322000646 AS UNSIGNED INTEGER)-1322017203.; |
233 |
|
+--------------------------------------------------+ |
234 |
|
| CAST(1322000646 AS UNSIGNED INTEGER)-1322017203. | |
235 |
|
+--------------------------------------------------+ |
236 |
|
| -16557 | |
237 |
|
+--------------------------------------------------+ |
238 |
|
1 row in set (0.06 sec) |
239 |
|
|
240 |
|
mysql> select CAST(1322000646 AS UNSIGNED INTEGER)-1322017203; |
241 |
|
+-------------------------------------------------+ |
242 |
|
| CAST(1322000646 AS UNSIGNED INTEGER)-1322017203 | |
243 |
|
+-------------------------------------------------+ |
244 |
|
| 18446744073709535059 | |
245 |
|
+-------------------------------------------------+ |
246 |
|
1 row in set (0.02 sec) |
247 |
|
|
248 |
|
*/ |
249 |
if ( debug ) printf(" chewbacca: query is %s \n",qu.str().c_str()); |
if ( debug ) printf(" chewbacca: query is %s \n",qu.str().c_str()); |
250 |
result3 = conn->Query(qu.str().c_str()); |
result3 = conn->Query(qu.str().c_str()); |
251 |
if ( result3 ){ |
if ( result3 ){ |
1366 |
stringstream oss; |
stringstream oss; |
1367 |
// |
// |
1368 |
oss.str(""); |
oss.str(""); |
1369 |
oss << "SET time_zone='+0:00';"; |
oss << "SET time_zone='+0:00'; SET sql_mode = 'NO_UNSIGNED_SUBTRACTION';"; |
1370 |
TSQLResult *result = 0; |
TSQLResult *result = 0; |
1371 |
result = conn->Query(oss.str().c_str()); |
result = conn->Query(oss.str().c_str()); |
1372 |
if ( !result ) throw -10; |
if ( !result ) throw -10; |
1658 |
Int_t PamelaDBOperations::insertPamelaGL_TIMESYNC(){ |
Int_t PamelaDBOperations::insertPamelaGL_TIMESYNC(){ |
1659 |
// |
// |
1660 |
Int_t signal = 0; |
Int_t signal = 0; |
1661 |
UInt_t idresof = 0; |
// UInt_t idresof = 0; |
1662 |
|
idresof = 0; |
1663 |
stringstream oss; |
stringstream oss; |
1664 |
TSQLResult *result = 0; |
TSQLResult *result = 0; |
1665 |
TSQLRow *row = 0; |
TSQLRow *row = 0; |
1973 |
// |
// |
1974 |
if ( chewbacca ){ |
if ( chewbacca ){ |
1975 |
oss.str(""); |
oss.str(""); |
1976 |
oss << " SELECT ID FROM GL_TIMESYNC where TIMESYNC="<<chlastts<<" AND OBT0="<<chobtts*1000<<" limit 1;"; |
oss << " SELECT ID FROM GL_TIMESYNC where TIMESYNC="<<chlastts<<" AND OBT0="<<chobtts*1000<<" and ID_RESURS_OFFSET="<< idresof <<" limit 1;"; // 10RED BUG!!!! without 'and ID_RESURS_OFFSET="<< idresof ' this query is not enough to ensure finding the correct line in GL_TIMSYNC... |
1977 |
if ( debug ) printf(" %s \n",oss.str().c_str()); |
if ( debug ) printf(" %s \n",oss.str().c_str()); |
1978 |
result = conn->Query(oss.str().c_str()); |
result = conn->Query(oss.str().c_str()); |
1979 |
// |
// |
2182 |
UInt_t lowerts = tsync-(obt0/1000)-5; |
UInt_t lowerts = tsync-(obt0/1000)-5; |
2183 |
if ( chewbacca ){ |
if ( chewbacca ){ |
2184 |
oss.str(""); |
oss.str(""); |
2185 |
oss << "select BOOT_NUMBER from ROOT_TABLE where LAST_TIME_SYNC_INFO-(OBT_TIME_SYNC)<" |
oss << "select BOOT_NUMBER from ROOT_TABLE where CAST((LAST_TIME_SYNC_INFO-(OBT_TIME_SYNC)) AS SIGNED INT)<" // 10RED MYSQL OPERATORS BUG |
2186 |
<< upperts |
<< upperts |
2187 |
<< " AND LAST_TIME_SYNC_INFO-(OBT_TIME_SYNC)>" |
<< " AND CAST((LAST_TIME_SYNC_INFO-(OBT_TIME_SYNC)) AS SIGNED INT)>" // 10RED MYSQL OPERATORS BUG |
2188 |
<< lowerts |
<< lowerts |
2189 |
<< " AND BOOT_NUMBER>1;"; |
<< " AND BOOT_NUMBER>1;"; |
2190 |
} else { |
} else { |
2191 |
oss.str(""); |
oss.str(""); |
2192 |
oss << "select GL_RAW.BOOT_NUMBER from GL_TIMESYNC LEFT JOIN GL_RAW ON GL_RAW.ID = GL_TIMESYNC.ID_RAW where TIMESYNC-(OBT0/1000)<" |
oss << "select GL_RAW.BOOT_NUMBER from GL_TIMESYNC LEFT JOIN GL_RAW ON GL_RAW.ID = GL_TIMESYNC.ID_RAW where CAST((TIMESYNC-(OBT0/1000)) AS SIGNED INT)<" // 10RED MYSQL OPERATORS BUG |
2193 |
<< upperts |
<< upperts |
2194 |
<< " AND TIMESYNC-(OBT0/1000)>" |
<< " AND CAST((TIMESYNC-(OBT0/1000)) AS SIGNED INT)>" // 10RED MYSQL OPERATORS BUG |
2195 |
<< lowerts |
<< lowerts |
2196 |
<< " AND GL_RAW.BOOT_NUMBER>0 GROUP BY GL_TIMESYNC.OBT0;"; |
<< " AND GL_RAW.BOOT_NUMBER>0 GROUP BY GL_TIMESYNC.OBT0;"; |
2197 |
}; |
}; |
2977 |
if ( IsDebug() ) printf(" here firstev is %i lastev is %i \n",firstev,lastev); |
if ( IsDebug() ) printf(" here firstev is %i lastev is %i \n",firstev,lastev); |
2978 |
// |
// |
2979 |
glrun->SetEV_FROM(firstev); |
glrun->SetEV_FROM(firstev); |
2980 |
|
glrun->SetEV_TO(lastev); // EM 10 RED ghost run bug |
2981 |
glrun->SetNEVENTS(lastev-firstev+1); |
glrun->SetNEVENTS(lastev-firstev+1); |
2982 |
// |
// |
2983 |
glrun->SetRUNHEADER_TIME(glrun1->GetRUNHEADER_TIME()); |
glrun->SetRUNHEADER_TIME(glrun1->GetRUNHEADER_TIME()); |
3173 |
}; |
}; |
3174 |
if ( IsDebug() ) printf(" Check overlapping events done: %u %u %llu %llu lastev is %i\n",apkt,bpkt,aobt,bobt,lastev); |
if ( IsDebug() ) printf(" Check overlapping events done: %u %u %llu %llu lastev is %i\n",apkt,bpkt,aobt,bobt,lastev); |
3175 |
// |
// |
3176 |
|
glrun->SetEV_FROM(firstev); // EM 10RED ghost run bug |
3177 |
glrun->SetEV_TO(lastev); |
glrun->SetEV_TO(lastev); |
3178 |
glrun->SetNEVENTS(lastev-firstev+1); |
glrun->SetNEVENTS(lastev-firstev+1); |
3179 |
glrun->SetPKT_COUNTER(glrun1->GetPKT_COUNTER()); |
glrun->SetPKT_COUNTER(glrun1->GetPKT_COUNTER()); |
4016 |
glrun1->SetRUNTRAILER_PKT(glrun->GetRUNTRAILER_PKT()); |
glrun1->SetRUNTRAILER_PKT(glrun->GetRUNTRAILER_PKT()); |
4017 |
// |
// |
4018 |
glrun->SetEV_FROM(firstev); |
glrun->SetEV_FROM(firstev); |
4019 |
|
glrun->SetEV_TO(lastev); // 10 RED ghost run bug |
4020 |
glrun->SetNEVENTS(lastev-firstev+1); |
glrun->SetNEVENTS(lastev-firstev+1); |
4021 |
// |
// |
4022 |
glrun->SetRUNHEADER_TIME(glrun1->GetRUNHEADER_TIME()); |
glrun->SetRUNHEADER_TIME(glrun1->GetRUNHEADER_TIME()); |
5746 |
// --------------------------------------------------------------------- |
// --------------------------------------------------------------------- |
5747 |
UInt_t idtimesync = 0; |
UInt_t idtimesync = 0; |
5748 |
oss.str(""); |
oss.str(""); |
5749 |
oss << " SELECT ID FROM GL_TIMESYNC where TIMESYNC="<<chlastts<<" AND OBT0="<<chobtts*1000<<" limit 1;"; |
oss << " SELECT ID FROM GL_TIMESYNC where TIMESYNC="<<chlastts<<" AND OBT0="<<chobtts*1000<<" and ID_RESURS_OFFSET="<< idresof <<" limit 1;"; // 10RED BUG!!!! without 'and ID_RESURS_OFFSET="<< idresof ' this query is not enough to ensure finding the correct line in GL_TIMSYNC... |
5750 |
if ( debug ) printf(" %s \n",oss.str().c_str()); |
if ( debug ) printf(" %s \n",oss.str().c_str()); |
5751 |
result = conn->Query(oss.str().c_str()); |
result = conn->Query(oss.str().c_str()); |
5752 |
if ( !result ) throw -3; |
if ( !result ) throw -3; |
6179 |
while ( anr ){ |
while ( anr ){ |
6180 |
// |
// |
6181 |
oss.str(""); |
oss.str(""); |
6182 |
oss << "SELECT ID,RUNTRAILER_TIME,RUNTRAILER_PKT,BOOT_NUMBER FROM GL_RUN_FRAGMENTS WHERE BOOT_NUMBER=" << mbo << " AND RUNHEADER_PKT=" << mrhp << "+1 AND ABS(RUNHEADER_TIME-"<< mrht <<")<=1 AND INSERT_TIME <= '" << clean_time->AsSQLString() << "' order BY RUNHEADER_TIME asc;"; |
oss << "SELECT ID,RUNTRAILER_TIME,RUNTRAILER_PKT,BOOT_NUMBER FROM GL_RUN_FRAGMENTS WHERE BOOT_NUMBER=" << mbo << " AND RUNHEADER_PKT=" << mrhp << "+1 AND ABS(RUNHEADER_TIME-"<< (float)mrht <<")<=1 AND INSERT_TIME <= '" << clean_time->AsSQLString() << "' order BY RUNHEADER_TIME asc;"; // 10RED MYSQL OPERATOR BUG |
6183 |
if ( IsDebug() ) printf(" In the loop searching for fragmented runs : query is \n %s \n",oss.str().c_str()); |
if ( IsDebug() ) printf(" In the loop searching for fragmented runs : query is \n %s \n",oss.str().c_str()); |
6184 |
// |
// |
6185 |
nresult1 = conn->Query(oss.str().c_str()); |
nresult1 = conn->Query(oss.str().c_str()); |