--- YodaProfiler/src/GLTables.cpp 2007/04/30 09:19:39 1.29 +++ YodaProfiler/src/GLTables.cpp 2007/09/07 21:10:57 1.30 @@ -49,7 +49,7 @@ fNquery = 0; }; -Bool_t GL_TABLES::IsConnected(TSQLServer *dbc){ +Bool_t GL_TABLES::IsConnected(TSQLServer *&dbc){ // // // @@ -59,18 +59,28 @@ // // // - // printf(" host is %s \n",fHost->Data()); + // printf(" host is %s \n",fHost->Data()); // stringstream myquery; myquery.str(""); myquery << "show databases;"; - dbc->Query(myquery.str().c_str()); - fNquery++; - // - if ( dbc->GetErrorCode() != 2013 && dbc->GetErrorCode() != 2006 ){ - // is connected - return true; - } else { + if ( dbc ){ + if ( dbc->IsConnected() ){ + dbc->Query(myquery.str().c_str()); + fNquery++; + if ( !(dbc->GetErrorCode()) ){ + // printf("ok\n"); + // + // if ( (dbc->GetErrorCode() != 2013 && dbc->GetErrorCode() != 2006) ){ + // if ( !(dbc->GetErrorCode()) ){ + // is connected + return true; + // }; + }; + }; + }; + // printf("porca di quella \n"); + if ( true ) { // printf(" WARNING: Lost connection to DB! try to recover... \n"); // @@ -84,8 +94,10 @@ myquery << "show databases;"; dbc->Query(myquery.str().c_str()); fNquery++; + // printf(" e riporca di quella \n"); // - if ( dbc->GetErrorCode() != 2013 && dbc->GetErrorCode() != 2006 ){ + // if ( dbc->GetErrorCode() != 2013 && dbc->GetErrorCode() != 2006 ){ + if ( !(dbc->GetErrorCode()) ){ // printf(" ...connection recovered, I can continue! \n"); // @@ -1808,10 +1820,10 @@ TSQLRow *row; // Set the right time_zone (otherwise horrible things will occur! :) + if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; dbc->Query("SET time_zone = '+0:00'"); // Do the query - if ( !this->GetGLTABLES()->IsConnected(dbc) ) return -57; this->GetGLTABLES()->AddQ(); result = dbc->Query(myquery.Data()); if(! result->GetRowCount() ) {