135 |
stringstream qu; |
stringstream qu; |
136 |
TSQLResult *result = 0; |
TSQLResult *result = 0; |
137 |
TSQLResult *result2 = 0; |
TSQLResult *result2 = 0; |
138 |
|
TSQLResult *result3 = 0; |
139 |
TSQLRow *row = 0; |
TSQLRow *row = 0; |
140 |
TSQLRow *row2 = 0; |
TSQLRow *row2 = 0; |
141 |
|
TSQLRow *row3 = 0; |
142 |
TString chpath; |
TString chpath; |
143 |
TString chfile; |
TString chfile; |
144 |
UInt_t ridn = 0; |
UInt_t ridn = 0; |
163 |
}; |
}; |
164 |
delete result; |
delete result; |
165 |
qu.str(""); |
qu.str(""); |
166 |
qu << "SELECT FOLDER_NAME,FILE_NAME,OBT_TIME_SYNC,LAST_TIME_SYNC_INFO,TIME_OFFSET,BOOT_NUMBER,PKT_NUMBER_INIT,PKT_NUMBER_FINAL,PKT_OBT_INIT,PKT_OBT_FINAL from ROOT_TABLE where ID_N=" << ridn << ";"; |
qu << "SELECT FOLDER_NAME,FILE_NAME,OBT_TIME_SYNC,LAST_TIME_SYNC_INFO,TIME_OFFSET,BOOT_NUMBER,PKT_NUMBER_INIT,PKT_NUMBER_FINAL,PKT_OBT_INIT,PKT_OBT_FINAL,REAL_TIME_INIT from ROOT_TABLE where ID_N=" << ridn << ";"; |
167 |
if ( debug ) printf(" chewbacca: query is %s \n",qu.str().c_str()); |
if ( debug ) printf(" chewbacca: query is %s \n",qu.str().c_str()); |
168 |
result2 = conn->Query(qu.str().c_str()); |
result2 = conn->Query(qu.str().c_str()); |
169 |
if ( result2 ){ |
if ( result2 ){ |
180 |
chresursts = (UInt_t)atoll(row2->GetField(4)); |
chresursts = (UInt_t)atoll(row2->GetField(4)); |
181 |
chboot = (UInt_t)atoll(row2->GetField(5)); |
chboot = (UInt_t)atoll(row2->GetField(5)); |
182 |
// |
// |
183 |
|
if ( !chboot ){ |
184 |
|
qu.str(""); |
185 |
|
qu << "SELECT BOOT_NUMBER from ROOT_TABLE where BOOT_NUMBER!=0 AND ABS(LAST_TIME_SYNC_INFO-"<< chlastts <<")<10000 AND (REAL_TIME_INIT-"<< row2->GetField(10) <<")<7200 group by BOOT_NUMBER order by BOOT_NUMBER asc;"; |
186 |
|
if ( debug ) printf(" chewbacca: query is %s \n",qu.str().c_str()); |
187 |
|
result3 = conn->Query(qu.str().c_str()); |
188 |
|
if ( result3 ){ |
189 |
|
row3 = result3->Next(); |
190 |
|
if ( row3 && result3->GetRowCount() == 1 ){ |
191 |
|
chboot = (UInt_t)atoll(row3->GetField(0)); |
192 |
|
if ( debug ) printf(" Found boot_number = %u \n",chboot); |
193 |
|
} else { |
194 |
|
if ( debug ) printf(" AGH CANNOT DETERMINE THE BOOT NUMBER... \n"); |
195 |
|
throw -29; |
196 |
|
}; |
197 |
|
}; |
198 |
|
}; |
199 |
|
// |
200 |
chpktinit = (UInt_t)atoll(row2->GetField(6)); |
chpktinit = (UInt_t)atoll(row2->GetField(6)); |
201 |
chpktfinal = (UInt_t)atoll(row2->GetField(7)); |
chpktfinal = (UInt_t)atoll(row2->GetField(7)); |
202 |
chobtinit = (UInt_t)atoll(row2->GetField(8)); |
chobtinit = (UInt_t)atoll(row2->GetField(8)); |