/[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.22 by mocchiut, Wed Jan 31 16:15:02 2007 UTC revision 1.34 by mocchiut, Thu Oct 25 13:23:36 2007 UTC
# Line 24  ClassImp(GL_ROOT); Line 24  ClassImp(GL_ROOT);
24  ClassImp(GL_PARAM);  ClassImp(GL_PARAM);
25  ClassImp(GL_S4_CALIB);  ClassImp(GL_S4_CALIB);
26  ClassImp(GL_CALO_CALIB);  ClassImp(GL_CALO_CALIB);
27    ClassImp(GL_CALOPULSE_CALIB);
28  ClassImp(GL_TIMESYNC);  ClassImp(GL_TIMESYNC);
29  ClassImp(GL_TLE);  ClassImp(GL_TLE);
30  //  //
# Line 38  GL_TABLES::GL_TABLES(TString host, TStri Line 39  GL_TABLES::GL_TABLES(TString host, TStri
39    fPsw = new TString(psw.Data());    fPsw = new TString(psw.Data());
40    fSet = true;    fSet = true;
41    fNquery = 0;    fNquery = 0;
42      mh = host.Data();
43      mu = user.Data();
44      mp = psw.Data();
45  };  };
46    
47    
# Line 47  void GL_TABLES::Set(TString host, TStrin Line 51  void GL_TABLES::Set(TString host, TStrin
51    fPsw = new TString(psw.Data());    fPsw = new TString(psw.Data());
52    fSet = true;    fSet = true;
53    fNquery = 0;    fNquery = 0;
54      mh = host.Data();
55      mu = user.Data();
56      mp = psw.Data();
57  };  };
58    
59  Bool_t GL_TABLES::IsConnected(TSQLServer *dbc){  Bool_t GL_TABLES::IsConnected(TSQLServer *&dbc){
60    //    //
61    //    //
62    //    //
# Line 57  Bool_t GL_TABLES::IsConnected(TSQLServer Line 64  Bool_t GL_TABLES::IsConnected(TSQLServer
64      return true;      return true;
65    };    };
66    //    //
67    //    //    printf(" host is %s \n",fHost->Data());
   //  
   //  printf(" host is %s \n",fHost->Data());  
68    //    //
69    stringstream myquery;      stringstream myquery;  
70    myquery.str("");    myquery.str("");
71    myquery << "show databases;";    myquery << "show databases;";
72    dbc->Query(myquery.str().c_str());    if ( dbc ){
73    fNquery++;      if ( dbc->IsConnected() ){
74          dbc->Query(myquery.str().c_str());
75          fNquery++;
76          if ( !(dbc->GetErrorCode()) ){
77            //      printf("ok\n");
78            //
79            //  if ( (dbc->GetErrorCode() != 2013 && dbc->GetErrorCode() != 2006) ){
80            //    if ( !(dbc->GetErrorCode()) ){
81            // is connected
82            return true;
83            //    };
84          };
85        };
86      };
87    //    //
88    if ( dbc->GetErrorCode() != 2013 && dbc->GetErrorCode() != 2006 ){    if ( true ) {
     // is connected  
     return true;  
   } else {  
89      //      //
90      printf(" WARNING: Lost connection to DB! try to recover... \n");      printf(" WARNING: Lost connection to DB! try to recover... \n");
91      //      //
# Line 84  Bool_t GL_TABLES::IsConnected(TSQLServer Line 99  Bool_t GL_TABLES::IsConnected(TSQLServer
99      myquery << "show databases;";      myquery << "show databases;";
100      dbc->Query(myquery.str().c_str());      dbc->Query(myquery.str().c_str());
101      fNquery++;      fNquery++;
102      //      //    if ( dbc->GetErrorCode() != 2013 && dbc->GetErrorCode() != 2006 ){
103      if ( dbc->GetErrorCode() != 2013 && dbc->GetErrorCode() != 2006 ){      if ( !(dbc->GetErrorCode()) ){
104        //        //
105        printf(" ...connection recovered, I can continue! \n");        printf(" ...connection recovered, I can continue! \n");
106        //        //
# Line 231  GL_CALO_CALIB::GL_CALO_CALIB(){ Line 246  GL_CALO_CALIB::GL_CALO_CALIB(){
246    FROM_TIME = 0;    FROM_TIME = 0;
247    TO_TIME   = 0;    TO_TIME   = 0;
248    SECTION   = 0;    SECTION   = 0;
249      OBT = 0;
250      PKT = 0;
251      BOOT_NUMBER                = 0;
252      VALIDATION                 = 0;
253    }
254    
255    GL_CALOPULSE_CALIB::GL_CALOPULSE_CALIB(){
256      ID        = 0;
257      ID_ROOT_L0  = 0;
258      EV_ROOT = 0;
259      FROM_TIME = 0;
260      TO_TIME   = 0;
261      SECTION   = 0;
262      PULSED_STRIP = 0;
263      PULSE_AMPLITUDE = 0;
264      OBT = 0;
265      PKT = 0;
266      BOOT_NUMBER                = 0;
267      VALIDATION                 = 0;
268  }  }
269    
270  GL_S4_CALIB::GL_S4_CALIB(){  GL_S4_CALIB::GL_S4_CALIB(){
# Line 239  GL_S4_CALIB::GL_S4_CALIB(){ Line 273  GL_S4_CALIB::GL_S4_CALIB(){
273    EV_ROOT = 0;    EV_ROOT = 0;
274    FROM_TIME = 0;    FROM_TIME = 0;
275    TO_TIME   = 0;    TO_TIME   = 0;
276    PARAM_FIT0 = 0.;    OBT = 0;
277    PARAM_FIT1 = 0.;    PKT = 0;
278      BOOT_NUMBER                = 0;
279  }  }
280    
281  GL_TIMESYNC::GL_TIMESYNC(){  GL_TIMESYNC::GL_TIMESYNC(){
282    obtfirst = 0;    obtfirst = 0;
283    pktfirst = 0;    pktfirst = 0;
284    toffset  = 0;    ID_RESURS_OFFSET  = 0;
285    //  ID       = 0;    ID       = 0;
286    //  ID_RAW   = 0;    ID_RAW   = 0;
287    OBT0     = 0;    OBT0     = 0;
288    TIMESYNC = 0;    TIMESYNC = 0;
289    TYPE     = 0;    TYPE     = 0;
# Line 1145  Int_t GL_ROOT::Query_GL_ROOT(UInt_t id, Line 1180  Int_t GL_ROOT::Query_GL_ROOT(UInt_t id,
1180            if(t==0) ID     = (UInt_t)atoll(Row->GetField(t));            if(t==0) ID     = (UInt_t)atoll(Row->GetField(t));
1181            if(t==1) ID_RAW = (UInt_t)atoll(Row->GetField(t));            if(t==1) ID_RAW = (UInt_t)atoll(Row->GetField(t));
1182            if(t==2) ID_TIMESYNC = (UInt_t)atoll(Row->GetField(t));            if(t==2) ID_TIMESYNC = (UInt_t)atoll(Row->GetField(t));
1183            if(t==3) PATH   = Row->GetField(t);            if(t==3) PATH   = (TString)gSystem->ExpandPathName(Row->GetField(t))+'/';
1184            if(t==4) NAME   = Row->GetField(t);            if(t==4) NAME   = Row->GetField(t);
1185        };        };
1186    };    };
# Line 1170  Int_t GL_TRK_CALIB::Query_GL_TRK_CALIB(U Line 1205  Int_t GL_TRK_CALIB::Query_GL_TRK_CALIB(U
1205    // ----------------    // ----------------
1206    myquery.str("");    myquery.str("");
1207    myquery << "select ID,ID_ROOT_L0,EV_ROOT_CALIBTRK1,EV_ROOT_CALIBTRK2,FROM_TIME,TO_TIME,OBT1,OBT2,PKT1,PKT2,BOOT_NUMBER,VALIDATION from GL_TRK_CALIB where FROM_TIME <= "<< time;    myquery << "select ID,ID_ROOT_L0,EV_ROOT_CALIBTRK1,EV_ROOT_CALIBTRK2,FROM_TIME,TO_TIME,OBT1,OBT2,PKT1,PKT2,BOOT_NUMBER,VALIDATION from GL_TRK_CALIB where FROM_TIME <= "<< time;
1208    myquery << " AND VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;";        //  myquery << " AND VALIDATION=1 ORDER BY FROM_TIME DESC LIMIT 1;";      // RIVEDERE LA VALIDAZIONE!!!
1209      myquery << " and EV_ROOT_CALIBTRK1>=0 and EV_ROOT_CALIBTRK2>=0 "; // EM! SE MANCA UN PACCHETTO DEI DUE IL PROCESSAMENTO CRASHA... DA RIVEDERE LA VALIDAZIONE      
1210      myquery << " ORDER BY FROM_TIME DESC LIMIT 1;";      
1211    //  myquery << " ORDER BY FROM_TIME DESC LIMIT 1;";          //  myquery << " ORDER BY FROM_TIME DESC LIMIT 1;";      
1212    if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57;      if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57;  
1213    this->GetGLTABLES()->AddQ();    this->GetGLTABLES()->AddQ();
# Line 1277  Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB Line 1314  Int_t GL_CALO_CALIB::Query_GL_CALO_CALIB
1314    pResult->Delete();    pResult->Delete();
1315    return 0;    return 0;
1316  };  };
1317    
1318    
1319    // ****************************************************
1320    /**
1321     * Function to query the GL_CALOPULSE_CALIB table of the DB.
1322     *
1323     * \param  run starting time
1324     * \return struct of type GL_CALOPULSE_CALIB_data, which stores the query result
1325     */
1326    Int_t GL_CALOPULSE_CALIB::Query_GL_CALOPULSE_CALIB(UInt_t time, UInt_t section, UInt_t pampli, TSQLServer *dbc){
1327      // MySQL variables
1328      TSQLResult *pResult;
1329      TSQLRow *Row;
1330      int t;
1331      stringstream myquery;
1332      //
1333      // select the correct calibration i.e. the closest to our time
1334      //
1335      myquery.str("");
1336      myquery << "select ID_ROOT_L0, FROM_TIME, TO_TIME, EV_ROOT from GL_CALOPULSE_CALIB where SECTION=" << section;
1337      myquery << " and PULSE_AMPLITUDE=" << pampli;
1338      myquery << " and VALIDATION=1 and (PULSED_STRIP IS NULL OR PULSED_STRIP<100) ORDER BY ABS(" << time << "-FROM_TIME) asc limit 1;";
1339      //  printf(" myq is %s \n",myquery.str().c_str());
1340      //
1341      if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57;  
1342      this->GetGLTABLES()->AddQ();
1343      pResult = dbc->Query(myquery.str().c_str());
1344      //
1345      if( !pResult ) return(-54);
1346      //
1347      Row = pResult->Next();
1348      //
1349      if( !Row ) return (-54);
1350      //
1351      // store infos and exit
1352      //
1353      for( t = 0; t < pResult->GetFieldCount(); t++){
1354        //    printf(" field %i is %s \n",t,Row->GetField(t));
1355        if (t==0) ID_ROOT_L0  = (UInt_t)atoll(Row->GetField(t));
1356        if (t==1) FROM_TIME = (UInt_t)atoll(Row->GetField(t));
1357        if (t==2) TO_TIME   = (UInt_t)atoll(Row->GetField(t));            
1358        if (t==3) EV_ROOT = (UInt_t)atoll(Row->GetField(t));
1359      };
1360      pResult->Delete();
1361      return 0;
1362    };
1363    
1364    
1365  // ****************************************************  // ****************************************************
1366  /**  /**
1367   * Function to query the GL_S4_CALIB table of the DB.   * Function to query the GL_S4_CALIB table of the DB.
# Line 1293  Int_t GL_S4_CALIB::Query_GL_S4_CALIB(UIn Line 1378  Int_t GL_S4_CALIB::Query_GL_S4_CALIB(UIn
1378    stringstream myquery;    stringstream myquery;
1379    // ----------------    // ----------------
1380    myquery.str("");    myquery.str("");
1381    myquery << "select * from GL_S4_CALIB where FROM_TIME <= "<< time;    myquery << "select ID,ID_ROOT_L0,EV_ROOT,FROM_TIME,TO_TIME from GL_S4_CALIB where FROM_TIME <= "<< time;
1382    myquery << " ORDER BY FROM_TIME DESC LIMIT 1;";          myquery << " ORDER BY FROM_TIME DESC LIMIT 1;";      
1383    //  myquery << " ORDER BY FROM_TIME DESC LIMIT 1;";          //  myquery << " ORDER BY FROM_TIME DESC LIMIT 1;";      
1384    if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57;      if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57;  
# Line 1305  Int_t GL_S4_CALIB::Query_GL_S4_CALIB(UIn Line 1390  Int_t GL_S4_CALIB::Query_GL_S4_CALIB(UIn
1390        if( Row == NULL ) break;        if( Row == NULL ) break;
1391        for( t = 0; t < pResult->GetFieldCount(); t++){        for( t = 0; t < pResult->GetFieldCount(); t++){
1392          if (t==0) ID               = (UInt_t)atoll(Row->GetField(t));          if (t==0) ID               = (UInt_t)atoll(Row->GetField(t));
1393            if (t==1) ID_ROOT_L0  = (UInt_t)atoll(Row->GetField(t));          if (t==1) ID_ROOT_L0  = (UInt_t)atoll(Row->GetField(t));
1394            if (t==2) EV_ROOT    = (UInt_t)atoll(Row->GetField(t));          if (t==2) EV_ROOT    = (UInt_t)atoll(Row->GetField(t));
1395            if (t==3) FROM_TIME = (UInt_t)atoll(Row->GetField(t));          if (t==3) FROM_TIME = (UInt_t)atoll(Row->GetField(t));
1396            if (t==4) TO_TIME   = (UInt_t)atoll(Row->GetField(t));          if (t==4) TO_TIME   = (UInt_t)atoll(Row->GetField(t));
           if (t==5) PARAM_FIT0   = atof(Row->GetField(t));  
           if (t==6) PARAM_FIT1   = atof(Row->GetField(t));  
1397        };        };
1398    };    };
1399    delete pResult;        delete pResult;    
# Line 1338  Int_t GL_PARAM::Query_GL_PARAM(UInt_t ti Line 1421  Int_t GL_PARAM::Query_GL_PARAM(UInt_t ti
1421    // ----------------        // ----------------    
1422    myquery.str("");    myquery.str("");
1423    myquery << " select ";    myquery << " select ";
1424    myquery << " ID, PATH, NAME, DESCR, TYPE, FROM_TIME,TO_TIME ";    myquery << " ID, PATH, NAME, DESCR, FROM_TIME,TO_TIME, TYPE ";
1425    myquery << " from GL_PARAM ";    myquery << " from GL_PARAM ";
1426    myquery << " where TYPE = '"<<type<<"' ";    myquery << " where TYPE = '"<<type<<"' ";
1427    myquery << " and FROM_TIME <= " << time;    myquery << " and FROM_TIME <= " << time;
# Line 1353  Int_t GL_PARAM::Query_GL_PARAM(UInt_t ti Line 1436  Int_t GL_PARAM::Query_GL_PARAM(UInt_t ti
1436        if( Row == NULL ) break;        if( Row == NULL ) break;
1437        for( t = 0; t < pResult->GetFieldCount(); t++){        for( t = 0; t < pResult->GetFieldCount(); t++){
1438          if (t==0) ID        = (UInt_t)atoll(Row->GetField(t));          if (t==0) ID        = (UInt_t)atoll(Row->GetField(t));
1439            if (t==1) PATH      = Row->GetField(t);// put in fpath the path to that file          if (t==1) PATH      = (TString)gSystem->ExpandPathName(Row->GetField(t))+'/';// put in fpath the path to that file
1440            if (t==2) NAME      = Row->GetField(t);            if (t==2) NAME      = Row->GetField(t);
1441            if (t==3) DESCR     = Row->GetField(t);            if (t==3) DESCR     = Row->GetField(t);
1442            if (t==4) FROM_TIME = (UInt_t)atoll(Row->GetField(t));            if (t==4) FROM_TIME = (UInt_t)atoll(Row->GetField(t));
# Line 1399  GL_TIMESYNC::GL_TIMESYNC(UInt_t id, TStr Line 1482  GL_TIMESYNC::GL_TIMESYNC(UInt_t id, TStr
1482    TSQLRow *Row;    TSQLRow *Row;
1483    stringstream myquery;    stringstream myquery;
1484    stringstream rname;    stringstream rname;
1485      //  pcksList packetsNames;
1486      //  pcksList::iterator Iter;
1487      //  getPacketsNames(packetsNames);
1488    rname.str("");    rname.str("");
1489    // ----------------    // ----------------
1490    myquery.str("");    myquery.str("");
# Line 1417  GL_TIMESYNC::GL_TIMESYNC(UInt_t id, TStr Line 1503  GL_TIMESYNC::GL_TIMESYNC(UInt_t id, TStr
1503      if( Row ){      if( Row ){
1504        stringstream fname;        stringstream fname;
1505        fname.str("");        fname.str("");
1506        fname << Row->GetField(0) << "/" << Row->GetField(1);        fname << gSystem->ExpandPathName(Row->GetField(0)) << "/" << Row->GetField(1);
1507        rname << Row->GetField(1);        rname << Row->GetField(1);
1508        file = new TFile(fname.str().c_str(),"READ");        file = new TFile(fname.str().c_str(),"READ");
1509        idraw = (UInt_t)atoll(Row->GetField(2));        idraw = (UInt_t)atoll(Row->GetField(2));
# Line 1434  GL_TIMESYNC::GL_TIMESYNC(UInt_t id, TStr Line 1520  GL_TIMESYNC::GL_TIMESYNC(UInt_t id, TStr
1520      ph = eh->GetPscuHeader();      ph = eh->GetPscuHeader();
1521      pktfirst = ph->GetCounter();      pktfirst = ph->GetCounter();
1522      obtfirst = ph->GetOrbitalTime();        obtfirst = ph->GetOrbitalTime();  
1523        //
1524    //     code = eh->GetCounter();
1525    //     UInt_t en = 0;
1526    //     for(Iter = packetsNames.begin(); Iter != packetsNames.end(); Iter++){
1527    //       en = code->Get(GetPacketType(*Iter));
1528    //       if ( !strcmp("CalibCalPed",*Iter) || !strcmp("CalibTrk1",*Iter) || !strcmp("CalibTrk2",*Iter) || !strcmp("CalibS4",*Iter) ){
1529    //      //
1530    //      TTree *TC = 0;
1531    //      TC = (TTree*)file->Get("CalibCalPed");
1532    //      if ( !TC || TC->IsZombie() ) return;
1533    //      EventHeader *ehc = 0;
1534    //      PscuHeader *phc = 0;
1535    //      TC->SetBranchAddress("Header", &ehc);
1536    //      TC->GetEntry(0);
1537    //      phc = ehc->GetPscuHeader();
1538    //      pktfirst = phc->GetCounter();
1539    //      obtfirst = phc->GetOrbitalTime();  
1540    //       //
1541    //       };
1542    //     };  
1543        //
1544    };    };
1545    //    //
1546    // look for Resurs offset    // look for Resurs offset
# Line 1442  GL_TIMESYNC::GL_TIMESYNC(UInt_t id, TStr Line 1549  GL_TIMESYNC::GL_TIMESYNC(UInt_t id, TStr
1549    //    //
1550    //    //
1551    stringstream oss;    stringstream oss;
1552      TString frn = rname.str().c_str();
1553      frn = frn.ReplaceAll(".root",5,".pam",4);
1554    oss.str("");    oss.str("");
1555    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 SPECIAL_FILE='"    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 SPECIAL_FILE='"
1556        << rname.str().c_str() << "';";        << frn.Data() << "';";
1557    if ( !this->GetGLTABLES()->IsConnected(dbc) ) return;      if ( !this->GetGLTABLES()->IsConnected(dbc) ) return;  
1558    this->GetGLTABLES()->AddQ();    this->GetGLTABLES()->AddQ();
1559    pResult = dbc->Query(oss.str().c_str());    pResult = dbc->Query(oss.str().c_str());
# Line 1453  GL_TIMESYNC::GL_TIMESYNC(UInt_t id, TStr Line 1562  GL_TIMESYNC::GL_TIMESYNC(UInt_t id, TStr
1562    TString name=rname.str().c_str();    TString name=rname.str().c_str();
1563    UInt_t dworbit = 0;    UInt_t dworbit = 0;
1564    Int_t nlength = name.Length();    Int_t nlength = name.Length();
1565    if ( nlength < 5 ) return;    //
1566    TString dwo = 0;    // Is not a special file
   for (Int_t i = 0; i<5; i++){  
     dwo.Append(name[i],1);  
   };  
   if ( dwo.IsDigit() ){  
     dworbit = (UInt_t)dwo.Atoi();  
   } else {  
     dwo="";  
     for (Int_t i = 8; i<13; i++){  
       dwo.Append(name[i],1);  
     };      
     if ( dwo.IsDigit() ) dworbit = (UInt_t)dwo.Atoi();  
   };  
1567    //    //
1568    if ( !Row ){    if ( !Row ){
1569        delete pResult;      
1570        //
1571        // New code, we have one more column on GL_TIMESYNC so we can trust that one for the Resurs offset
1572        //
1573      oss.str("");      oss.str("");
1574      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 FROM_ORBIT< "      oss << "SELECT ID_RESURS_OFFSET from GL_TIMESYNC where ID_RAW=" << idraw <<";";
         << dworbit << " order by FROM_ORBIT desc limit 1;";  
1575      if ( !this->GetGLTABLES()->IsConnected(dbc) ) return;        if ( !this->GetGLTABLES()->IsConnected(dbc) ) return;  
1576      this->GetGLTABLES()->AddQ();      this->GetGLTABLES()->AddQ();
1577      pResult = dbc->Query(oss.str().c_str());      pResult = dbc->Query(oss.str().c_str());
1578      Row = pResult->Next();      Bool_t fndit = false;
1579      if ( !Row ){      if ( pResult ){
1580        printf(" ERROR FROM GLTables! cannot determine Resurs offset \n");        Row = pResult->Next();
1581        return;        if ( Row ){
1582            oss.str("");
1583            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="
1584                << Row->GetField(0) << ";";
1585            if ( !this->GetGLTABLES()->IsConnected(dbc) ) return;  
1586            this->GetGLTABLES()->AddQ();
1587            pResult = dbc->Query(oss.str().c_str());
1588            if ( pResult ){
1589              Row = pResult->Next();
1590              if ( Row ){
1591                //      printf(" GREAT! the DB structure is the new one! \n");
1592                fndit = true;
1593                dworbit = 1;
1594              };
1595            };
1596          };
1597        };
1598        if ( !fndit ){
1599          delete pResult;      
1600          //
1601          printf(" OK, you got an error because this is the old database\n Using backward compability code, hence you can continue safetly \n");
1602          //
1603          // Old code, we must trust the filename
1604          //
1605          if ( nlength < 5 ) return;
1606          TString dwo = 0;
1607          for (Int_t i = 0; i<5; i++){
1608            dwo.Append(name[i],1);
1609          };
1610          if ( dwo.IsDigit() ){
1611            dworbit = (UInt_t)dwo.Atoi();
1612          } else {
1613            dwo="";
1614            for (Int_t i = 8; i<13; i++){
1615              dwo.Append(name[i],1);
1616            };    
1617            if ( dwo.IsDigit() ){
1618              dworbit = (UInt_t)dwo.Atoi();
1619            } else {
1620              dworbit = 1;
1621            };
1622          };    
1623          //
1624          oss.str("");
1625          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 FROM_ORBIT< "
1626              << dworbit << " order by FROM_ORBIT desc limit 1;";
1627          if ( !this->GetGLTABLES()->IsConnected(dbc) ) return;  
1628          this->GetGLTABLES()->AddQ();
1629          pResult = dbc->Query(oss.str().c_str());
1630          Row = pResult->Next();
1631          if ( !Row ){
1632            printf(" ERROR FROM GLTables! cannot determine Resurs offset \n");
1633            return;
1634          };
1635      };      };
1636    };    };
1637    //    //
# Line 1775  Int_t GL_TLE::DoQuery(TString myquery, T Line 1928  Int_t GL_TLE::DoQuery(TString myquery, T
1928    TSQLRow *row;    TSQLRow *row;
1929    
1930    // Set the right time_zone (otherwise horrible things will occur! :)    // Set the right time_zone (otherwise horrible things will occur! :)
1931      if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57;  
1932    dbc->Query("SET time_zone = '+0:00'");    dbc->Query("SET time_zone = '+0:00'");
1933    
1934    // Do the query    // Do the query
   if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57;    
1935    this->GetGLTABLES()->AddQ();    this->GetGLTABLES()->AddQ();
1936    result = dbc->Query(myquery.Data());    result = dbc->Query(myquery.Data());
1937    if(! result->GetRowCount() ) {    if(! result->GetRowCount() ) {

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.34

  ViewVC Help
Powered by ViewVC 1.1.23