/[PAMELA software]/YodaProfiler/src/GLTables.cpp
ViewVC logotype

Diff of /YodaProfiler/src/GLTables.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by mocchiut, Wed Sep 6 12:47:18 2006 UTC revision 1.7 by mocchiut, Thu Sep 7 09:17:32 2006 UTC
# Line 772  Int_t GL_TRK_CALIB::Query_GL_TRK_CALIB(U Line 772  Int_t GL_TRK_CALIB::Query_GL_TRK_CALIB(U
772   * \param  run starting time   * \param  run starting time
773   * \return struct of type GL_CALO_CALIB_data, which stores the query result   * \return struct of type GL_CALO_CALIB_data, which stores the query result
774   */   */
775  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){
776    // MySQL variables    // MySQL variables
777    TSQLResult *pResult;    TSQLResult *pResult;
778    TSQLRow *Row;    TSQLRow *Row;
779    int t;    int t;
780    stringstream myquery;    stringstream myquery;
781      uptime = 0;
782    //    //
783    // select the correct calibration    // select the correct calibration
784    //    //
# Line 785  Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB Line 786  Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB
786    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;
787    myquery << " and FROM_TIME <= " << time;    myquery << " and FROM_TIME <= " << time;
788    myquery << " and TO_TIME > " << time;    myquery << " and TO_TIME > " << time;
789    myquery << " and VALIDATION=1;";    myquery << " ;";
790      //myquery << " and VALIDATION=1;";
791    //    //
792    pResult = dbc->Query(myquery.str().c_str());    pResult = dbc->Query(myquery.str().c_str());
793      //  printf(" mysquery is %s\n",myquery.str().c_str());
794      //
795      if( !pResult->GetRowCount() ) return(-54);
796      Row = pResult->Next();
797      if( Row == NULL ) return (-54);
798      //
799      uptime = (UInt_t)atoll(Row->GetField(2));
800    //    //
801    // if it is corrupted validation is 0 and we have no results from the query...    // if it is corrupted validation is 0 and we have no results from the query...
802    //    //
803    if( !pResult->GetRowCount() ){    if( atoi(Row->GetField(4)) == 0 ){ // if validation = 0
     //    pResult->Delete();  
804      //      //
805      // in this case take relax the conditions and take the valid calibration that preceed the correct one      // in this case take relax the conditions and take the valid calibration that preceed the correct one
806      //      //
# Line 801  Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB Line 809  Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB
809      myquery << " and FROM_TIME <= " << time;      myquery << " and FROM_TIME <= " << time;
810      myquery << " and VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;";      myquery << " and VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;";
811      pResult = dbc->Query(myquery.str().c_str());      pResult = dbc->Query(myquery.str().c_str());
812        //    printf(" mysquery is %s\n",myquery.str().c_str());
813      //      //
814      // if no results yet quit with error      // if no results yet quit with error
815      //      //
816      if( !pResult->GetRowCount() ) return (-54);      if( !pResult->GetRowCount() ) return (-54);
817        //
818        Row = pResult->Next();
819        //
820    };    };
821    //    //
822    // store infos and exit    // store infos and exit
823    //    //
   Row = pResult->Next();  
824    if( Row == NULL ) return (-54);    if( Row == NULL ) return (-54);
825    for( t = 0; t < pResult->GetFieldCount(); t++){    for( t = 0; t < pResult->GetFieldCount(); t++){
826      if (t==0) ID_ROOT_L0  = (UInt_t)atoll(Row->GetField(t));      if (t==0) ID_ROOT_L0  = (UInt_t)atoll(Row->GetField(t));

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.23