/[PAMELA software]/chewbacca/PamOffLineSW/PacketUser.cpp
ViewVC logotype

Diff of /chewbacca/PamOffLineSW/PacketUser.cpp

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

revision 1.14 by mocchiut, Fri Jan 15 14:02:29 2010 UTC revision 1.17 by mocchiut, Wed Feb 3 14:11:38 2010 UTC
# Line 1  Line 1 
1  //============================================================================  //============================================================================
2  // $Id: PacketUser.cpp,v 1.13 2010/01/08 13:36:14 mocchiut Exp $  // $Id: PacketUser.cpp,v 1.16 2010/02/02 15:26:09 mocchiut Exp $
3  // Description :  // Description :
4  //============================================================================  //============================================================================
5  #include "PacketUser.h"  #include "PacketUser.h"
# Line 31  extern bool do_cont_check; Line 31  extern bool do_cont_check;
31  //marco_new_31:  //marco_new_31:
32  extern char* db_user;  extern char* db_user;
33  extern char* db_pwd;  extern char* db_pwd;
34  extern char* connection;  extern char* pelosconnection;
35    
36  //per tenere conto reset obt  //per tenere conto reset obt
37  extern unsigned long int max_pkt_obt;  extern unsigned long int max_pkt_obt;
# Line 457  unsigned long int PacketUser::retrieveTi Line 457  unsigned long int PacketUser::retrieveTi
457    //if(!table){table=Table_GL_RESURS_OFFSET}    //if(!table){table=Table_GL_RESURS_OFFSET}
458    
459    if (!single_connection) {    if (!single_connection) {
460      OpenDBConnection(table);//Nota qui ho deciso di lockare solo questa tabella e non tutte      OpenDBConnection(NULL);// no, locak tutto Nota qui ho deciso di lockare solo questa tabella e non tutte
461    }    }
462    
463    UInt_t t0 = 0;//toffset    UInt_t t0 = 0;//toffset
# Line 632  void PacketUser::FinishGroup(char * file Line 632  void PacketUser::FinishGroup(char * file
632            msg = err.str();            msg = err.str();
633            mainLogUtil->logInfo(msg);            mainLogUtil->logInfo(msg);
634                        
635            TString qu = Form("select ID_N from ROOT_TABLE_BAD order by INSERT_TIME desc limit 1;");            //      TString qu = Form("select ID_N from ROOT_TABLE_BAD order by INSERT_TIME desc limit 1;"); //  <=========================
636              TString qu = Form("select ID_N from ROOT_TABLE_BAD where FILE_NAME='%s' and PKT_NUMBER_INIT=%i and INSERTED_BY='%s';",filename,pkt_number_init,tag_value); //  <=========================
637            TSQLResult *result = sqlServer->Query(qu.Data());            TSQLResult *result = sqlServer->Query(qu.Data());
638            TSQLRow    *row = result->Next();            TSQLRow    *row = result->Next();
639            Int_t eid = -1;            Int_t eid = -1;
# Line 647  void PacketUser::FinishGroup(char * file Line 648  void PacketUser::FinishGroup(char * file
648          }          }
649                    
650          CleanDisk();          CleanDisk();
651          if (!single_connection) {          //      if (!single_connection) {
652            CloseDBConnection();          //        CloseDBConnection();
653          }          //      }
654          //      return; // commented here...          //      return; // commented here...
655    
656        };        };
# Line 831  void PacketUser::FinishGroup(char * file Line 832  void PacketUser::FinishGroup(char * file
832    
833    }//pRun    }//pRun
834  }  }
835      
836        
837    void PacketUser::CleanDisk(){    void PacketUser::CleanDisk(){
838      if ( !candelete ) return;      if ( !candelete ) return;
# Line 1387  int PacketUser::LockTables(const char* t Line 1388  int PacketUser::LockTables(const char* t
1388    TSQLResult* res = NULL;    TSQLResult* res = NULL;
1389    stringstream oss;    stringstream oss;
1390    oss.str("");    oss.str("");
1391    if (!tableTobeLocked)    //  if (!tableTobeLocked)
1392      oss << "lock table " << Table_ROOT_Good << " write, " << Table_ROOT_Bad << " write, " << Table_GL_RESURS_OFFSET    oss << "lock table " << Table_ROOT_Good << " write, " << Table_ROOT_Bad << " write, " << Table_GL_RESURS_OFFSET
1393          << " write, " << Table_ROOT_Merging << " write;";        << " write, " << Table_ROOT_Merging << " write;";
1394    else      //  else
1395      oss << "lock table " << tableTobeLocked << " write; ";      //    oss << "lock table " << tableTobeLocked << " write; ";
1396    
1397    string msg = oss.str();    string msg = oss.str();
1398    mainLogUtil->logAll(msg);    mainLogUtil->logAll(msg);
# Line 1461  void PacketUser::OpenDBConnection(const Line 1462  void PacketUser::OpenDBConnection(const
1462    if (do_cont_check) {    if (do_cont_check) {
1463      //controllo che non sia gia' aperta      //controllo che non sia gia' aperta
1464      if (!sqlServer) {      if (!sqlServer) {
1465        sqlServer = TSQLServer::Connect(connection, db_user, db_pwd);        sqlServer = TSQLServer::Connect(pelosconnection, db_user, db_pwd);
1466        if ((!sqlServer) || (!(sqlServer->IsConnected()))) {        if ((!sqlServer) || (!(sqlServer->IsConnected()))) {
1467          cout << "Can not connect with MYSQL sever" << endl;          cout << "Can not connect with MYSQL sever" << endl;
1468        }        }

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.23