--- YodaProfiler/src/GLTables.cpp 2006/09/06 12:47:18 1.6 +++ YodaProfiler/src/GLTables.cpp 2006/09/07 09:17:32 1.7 @@ -772,12 +772,13 @@ * \param run starting time * \return struct of type GL_CALO_CALIB_data, which stores the query result */ -Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB(UInt_t time, UInt_t section, TSQLServer *dbc){ +Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB(UInt_t time, UInt_t &uptime, UInt_t section, TSQLServer *dbc){ // MySQL variables TSQLResult *pResult; TSQLRow *Row; int t; stringstream myquery; + uptime = 0; // // select the correct calibration // @@ -785,14 +786,21 @@ myquery << "select ID_ROOT_L0, FROM_TIME, TO_TIME, EV_ROOT,VALIDATION from GL_CALO_CALIB where SECTION=" << section; myquery << " and FROM_TIME <= " << time; myquery << " and TO_TIME > " << time; - myquery << " and VALIDATION=1;"; + myquery << " ;"; + //myquery << " and VALIDATION=1;"; // pResult = dbc->Query(myquery.str().c_str()); + // printf(" mysquery is %s\n",myquery.str().c_str()); + // + if( !pResult->GetRowCount() ) return(-54); + Row = pResult->Next(); + if( Row == NULL ) return (-54); + // + uptime = (UInt_t)atoll(Row->GetField(2)); // // if it is corrupted validation is 0 and we have no results from the query... // - if( !pResult->GetRowCount() ){ - // pResult->Delete(); + if( atoi(Row->GetField(4)) == 0 ){ // if validation = 0 // // in this case take relax the conditions and take the valid calibration that preceed the correct one // @@ -801,15 +809,18 @@ myquery << " and FROM_TIME <= " << time; myquery << " and VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;"; pResult = dbc->Query(myquery.str().c_str()); + // printf(" mysquery is %s\n",myquery.str().c_str()); // // if no results yet quit with error // if( !pResult->GetRowCount() ) return (-54); + // + Row = pResult->Next(); + // }; // // store infos and exit // - Row = pResult->Next(); if( Row == NULL ) return (-54); for( t = 0; t < pResult->GetFieldCount(); t++){ if (t==0) ID_ROOT_L0 = (UInt_t)atoll(Row->GetField(t));