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

Diff of /YodaProfiler/src/PamelaDBOperations.cpp

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

revision 1.50 by mocchiut, Wed Sep 5 15:34:49 2007 UTC revision 1.51 by mocchiut, Fri Oct 19 07:47:52 2007 UTC
# Line 1108  Int_t PamelaDBOperations::insertPamelaGL Line 1108  Int_t PamelaDBOperations::insertPamelaGL
1108    TSQLRow *row = 0;    TSQLRow *row = 0;
1109    UInt_t t0 = 0;    UInt_t t0 = 0;
1110    Int_t signal = 0;    Int_t signal = 0;
1111      UInt_t idresof = 0;
1112    //    //
1113    signal = this->SetUpperLimits();    signal = this->SetUpperLimits();
1114    //    //
# Line 1116  Int_t PamelaDBOperations::insertPamelaGL Line 1117  Int_t PamelaDBOperations::insertPamelaGL
1117    if ( this->GetID_RAW() == 0 )  throw -11;    if ( this->GetID_RAW() == 0 )  throw -11;
1118    //    //
1119    oss.str("");    oss.str("");
1120    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),ID FROM GL_RESURS_OFFSET WHERE SPECIAL_FILE='"
1121        << this->GetRawFile().Data() << "';";        << this->GetRawFile().Data() << "';";
1122    if ( IsDebug() ) printf(" %s \n",oss.str().c_str());    if ( IsDebug() ) printf(" %s \n",oss.str().c_str());
1123    result = conn->Query(oss.str().c_str());    result = conn->Query(oss.str().c_str());
# Line 1125  Int_t PamelaDBOperations::insertPamelaGL Line 1126  Int_t PamelaDBOperations::insertPamelaGL
1126    //    //
1127    if ( !row ){    if ( !row ){
1128      oss.str("");      oss.str("");
1129      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 YEAR(OFFSET_DATE),MONTH(OFFSET_DATE),DAY(OFFSET_DATE),HOUR(OFFSET_DATE),MINUTE(OFFSET_DATE),SECOND(OFFSET_DATE),ID FROM GL_RESURS_OFFSET WHERE FROM_ORBIT< "
1130          << dworbit << " order by FROM_ORBIT desc limit 1;";          << dworbit << " order by FROM_ORBIT desc limit 1;";
1131      if ( IsDebug() ) printf(" %s \n",oss.str().c_str());      if ( IsDebug() ) printf(" %s \n",oss.str().c_str());
1132      result = conn->Query(oss.str().c_str());      result = conn->Query(oss.str().c_str());
# Line 1134  Int_t PamelaDBOperations::insertPamelaGL Line 1135  Int_t PamelaDBOperations::insertPamelaGL
1135      if ( !row ) throw -10;      if ( !row ) throw -10;
1136    };    };
1137    //    //
1138      idresof = (UInt_t)atoll(row->GetField(6));
1139      //
1140    TTimeStamp tu = TTimeStamp((UInt_t)atoi(row->GetField(0)),(UInt_t)atoi(row->GetField(1)),(UInt_t)atoi(row->GetField(2)),(UInt_t)atoi(row->GetField(3)),(UInt_t)atoi(row->GetField(4)),(UInt_t)atoi(row->GetField(5)),0,true,0);    TTimeStamp tu = TTimeStamp((UInt_t)atoi(row->GetField(0)),(UInt_t)atoi(row->GetField(1)),(UInt_t)atoi(row->GetField(2)),(UInt_t)atoi(row->GetField(3)),(UInt_t)atoi(row->GetField(4)),(UInt_t)atoi(row->GetField(5)),0,true,0);
1141    t0 = (UInt_t)tu.GetSec();    t0 = (UInt_t)tu.GetSec();
1142    if ( IsDebug() ) printf(" t0 is %u ti is %s %s %s %s %s %s\n",t0,row->GetField(0),row->GetField(1),row->GetField(2),row->GetField(3),row->GetField(4),row->GetField(5));    if ( IsDebug() ) printf(" t0 is %u ti is %s %s %s %s %s %s %s\n",t0,row->GetField(0),row->GetField(1),row->GetField(2),row->GetField(3),row->GetField(4),row->GetField(5),row->GetField(6));
1143    //    //
1144    /*    /*
1145     * Verify that the TIMESYNC have been not already processed     * Verify that the TIMESYNC have been not already processed
# Line 1342  Int_t PamelaDBOperations::insertPamelaGL Line 1345  Int_t PamelaDBOperations::insertPamelaGL
1345    if ( !existsts ) throw -3;    if ( !existsts ) throw -3;
1346    //    //
1347    oss.str("");    oss.str("");
1348    oss << "INSERT INTO GL_TIMESYNC (ID_RAW,TYPE,OBT0,TIMESYNC) VALUES ('"    oss << "INSERT INTO GL_TIMESYNC (ID_RAW,TYPE,OBT0,TIMESYNC,ID_RESURS_OFFSET) VALUES ('"
1349        << this->GetID_RAW() << "','"//224'"        << this->GetID_RAW() << "','"//224'"
1350        << dec << (UInt_t)TYPE << "','"        << dec << (UInt_t)TYPE << "','"
1351        << dec << (UInt_t)OBT << "','"        << dec << (UInt_t)OBT << "','"
1352        << dec << (UInt_t)TSYNC << "');";        << dec << (UInt_t)TSYNC << "','"
1353          << dec << (UInt_t)idresof << "');";
1354    conn->Query(oss.str().c_str());    conn->Query(oss.str().c_str());
1355    if ( IsDebug() ) printf(" Query the GL_TIMESYNC table to fill it:\n %s \n",oss.str().c_str());    if ( IsDebug() ) printf(" Query the GL_TIMESYNC table to fill it:\n %s \n",oss.str().c_str());
1356      if ( conn->GetErrorCode() ){
1357        printf(" OK, you got an error because the database structure you are using is not up to date\n Using backward compability code, hence you can continue safetly \n");
1358        oss.str("");
1359        oss << "INSERT INTO GL_TIMESYNC (ID_RAW,TYPE,OBT0,TIMESYNC) VALUES ('"
1360            << this->GetID_RAW() << "','"//224'"
1361            << dec << (UInt_t)TYPE << "','"
1362            << dec << (UInt_t)OBT << "','"
1363            << dec << (UInt_t)TSYNC << "');";
1364        conn->Query(oss.str().c_str());
1365        if ( IsDebug() ) printf(" Query the GL_TIMESYNC table to fill it:\n %s \n",oss.str().c_str());
1366      };
1367    //    //
1368    if ( IsDebug() ) printf(" found a timesync t0 is %u \n",t0);    if ( IsDebug() ) printf(" found a timesync t0 is %u \n",t0);
1369      //
1370    toffset = (UInt_t)TSYNC - (UInt_t)(this->OBT(OBT)/1000) + t0;    toffset = (UInt_t)TSYNC - (UInt_t)(this->OBT(OBT)/1000) + t0;
1371    //    //
1372    tsync = TSYNC;    tsync = TSYNC;

Legend:
Removed from v.1.50  
changed lines
  Added in v.1.51

  ViewVC Help
Powered by ViewVC 1.1.23