/[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.29 by mocchiut, Mon Apr 30 09:19:39 2007 UTC revision 1.30 by mocchiut, Fri Sep 7 21:10:57 2007 UTC
# Line 49  void GL_TABLES::Set(TString host, TStrin Line 49  void GL_TABLES::Set(TString host, TStrin
49    fNquery = 0;    fNquery = 0;
50  };  };
51    
52  Bool_t GL_TABLES::IsConnected(TSQLServer *dbc){  Bool_t GL_TABLES::IsConnected(TSQLServer *&dbc){
53    //    //
54    //    //
55    //    //
# Line 59  Bool_t GL_TABLES::IsConnected(TSQLServer Line 59  Bool_t GL_TABLES::IsConnected(TSQLServer
59    //    //
60    //    //
61    //    //
62    //  printf(" host is %s \n",fHost->Data());    //    printf(" host is %s \n",fHost->Data());
63    //    //
64    stringstream myquery;      stringstream myquery;  
65    myquery.str("");    myquery.str("");
66    myquery << "show databases;";    myquery << "show databases;";
67    dbc->Query(myquery.str().c_str());    if ( dbc ){
68    fNquery++;      if ( dbc->IsConnected() ){
69    //        dbc->Query(myquery.str().c_str());
70    if ( dbc->GetErrorCode() != 2013 && dbc->GetErrorCode() != 2006 ){        fNquery++;
71      // is connected        if ( !(dbc->GetErrorCode()) ){
72      return true;          //      printf("ok\n");
73    } else {          //
74            //  if ( (dbc->GetErrorCode() != 2013 && dbc->GetErrorCode() != 2006) ){
75            //    if ( !(dbc->GetErrorCode()) ){
76            // is connected
77            return true;
78            //    };
79          };
80        };
81      };
82      //  printf("porca di quella \n");
83      if ( true ) {
84      //      //
85      printf(" WARNING: Lost connection to DB! try to recover... \n");      printf(" WARNING: Lost connection to DB! try to recover... \n");
86      //      //
# Line 84  Bool_t GL_TABLES::IsConnected(TSQLServer Line 94  Bool_t GL_TABLES::IsConnected(TSQLServer
94      myquery << "show databases;";      myquery << "show databases;";
95      dbc->Query(myquery.str().c_str());      dbc->Query(myquery.str().c_str());
96      fNquery++;      fNquery++;
97        //    printf(" e riporca di quella \n");
98      //      //
99      if ( dbc->GetErrorCode() != 2013 && dbc->GetErrorCode() != 2006 ){      //    if ( dbc->GetErrorCode() != 2013 && dbc->GetErrorCode() != 2006 ){
100        if ( !(dbc->GetErrorCode()) ){
101        //        //
102        printf(" ...connection recovered, I can continue! \n");        printf(" ...connection recovered, I can continue! \n");
103        //        //
# Line 1808  Int_t GL_TLE::DoQuery(TString myquery, T Line 1820  Int_t GL_TLE::DoQuery(TString myquery, T
1820    TSQLRow *row;    TSQLRow *row;
1821    
1822    // Set the right time_zone (otherwise horrible things will occur! :)    // Set the right time_zone (otherwise horrible things will occur! :)
1823      if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57;  
1824    dbc->Query("SET time_zone = '+0:00'");    dbc->Query("SET time_zone = '+0:00'");
1825    
1826    // Do the query    // Do the query
   if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57;    
1827    this->GetGLTABLES()->AddQ();    this->GetGLTABLES()->AddQ();
1828    result = dbc->Query(myquery.Data());    result = dbc->Query(myquery.Data());
1829    if(! result->GetRowCount() ) {    if(! result->GetRowCount() ) {

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30

  ViewVC Help
Powered by ViewVC 1.1.23