/[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.10 by mocchiut, Thu Dec 24 10:31:12 2009 UTC revision 1.11 by mocchiut, Wed Dec 30 10:46:33 2009 UTC
# Line 1  Line 1 
1  //============================================================================  //============================================================================
2  // $Id: PacketUser.cpp,v 1.9 2009/10/01 08:55:42 mocchiut Exp $  // $Id: PacketUser.cpp,v 1.10 2009/12/24 10:31:12 mocchiut Exp $
3  // Description :  // Description :
4  //============================================================================  //============================================================================
5  #include "PacketUser.h"  #include "PacketUser.h"
# Line 1145  bool PacketUser::updateMergeROOT_DB(cons Line 1145  bool PacketUser::updateMergeROOT_DB(cons
1145    if (type_rel == AFTER) {    if (type_rel == AFTER) {
1146      mainLogUtil->logInfo("Relaz:AFTER = Updating Last values of the DB ROOT file");      mainLogUtil->logInfo("Relaz:AFTER = Updating Last values of the DB ROOT file");
1147      //marco_new:tolti tutti gli apici che qui non devono essere      //marco_new:tolti tutti gli apici che qui non devono essere
1148        
1149        int good = 1;
1150        if ( pkt_number_in >= (pkt_number_init - 1) && abs((int)(pkt_number_in-(pkt_number_init-1)))<10 ) good = 0;
1151        
1152      oss << "UPDATE " << table_name << " SET PKT_NUMBER_FINAL =" << (pkt_number_init - 1) << ", PKT_OBT_FINAL ="      oss << "UPDATE " << table_name << " SET PKT_NUMBER_FINAL =" << (pkt_number_init - 1) << ", PKT_OBT_FINAL ="
1153          << obt_init << ", REAL_TIME_LAST =" << real_time_init << " WHERE ID_N =" << ID_record << ";";          << obt_init << ", REAL_TIME_LAST =" << real_time_init << ", GOOD="<< good << " WHERE ID_N =" << ID_record << ";";
1154    
1155    }    }
1156    else if (type_rel == BEFORE) {    else if (type_rel == BEFORE) {
1157      mainLogUtil->logInfo("Relaz:BEFORE = Updating Init values of the DB ROOT file");      mainLogUtil->logInfo("Relaz:BEFORE = Updating Init values of the DB ROOT file");
1158    
1159        int good = 1;
1160        if ( (pkt_number_last+1) >= pkt_number_fin && abs((int)((pkt_number_last+1)-pkt_number_fin))<10 ) good = 0;
1161        
1162      oss << "UPDATE " << table_name << " SET PKT_NUMBER_INIT =" << (pkt_number_last + 1) << ", PKT_OBT_INIT ="      oss << "UPDATE " << table_name << " SET PKT_NUMBER_INIT =" << (pkt_number_last + 1) << ", PKT_OBT_INIT ="
1163          << obt_last << ", REAL_TIME_INIT =" << real_time_last << " WHERE ID_N =" << ID_record << ";";          << obt_last << ", REAL_TIME_INIT =" << real_time_last << ", GOOD="<< good << " WHERE ID_N =" << ID_record << ";";
1164    }    }
1165    else if (type_rel == SMALLER) {    else if (type_rel == SMALLER) {
1166      //spezzettamentento      //spezzettamentento
1167      mainLogUtil->logInfo("Relaz:SMALLER = (1st part) Updating Last values of the DB ROOT file");      mainLogUtil->logInfo("Relaz:SMALLER = (1st part) Updating Last values of the DB ROOT file");
1168    
1169        int good = 1;
1170        if ( pkt_number_in >= (pkt_number_init - 1) && abs((int)(pkt_number_in-(pkt_number_init-1)))<10 ) good = 0;
1171    
1172      oss << "UPDATE " << table_name << " SET PKT_NUMBER_FINAL=" << (pkt_number_init - 1) << ", PKT_OBT_FINAL ="      oss << "UPDATE " << table_name << " SET PKT_NUMBER_FINAL=" << (pkt_number_init - 1) << ", PKT_OBT_FINAL ="
1173          << obt_init << ", REAL_TIME_LAST =" << real_time_init << " WHERE ID_N =" << ID_record << ";";          << obt_init << ", REAL_TIME_LAST =" << real_time_init << ", GOOD="<< good << " WHERE ID_N =" << ID_record << ";";
1174    
1175      mainLogUtil->logInfo("Relaz:SMALLER = (2nd part) Saving the second part of the DB ROOT file");      mainLogUtil->logInfo("Relaz:SMALLER = (2nd part) Saving the second part of the DB ROOT file");
1176    
# Line 1222  TSQLResult* PacketUser::Select_merging(c Line 1233  TSQLResult* PacketUser::Select_merging(c
1233    else    else
1234      return 0;      return 0;
1235    
1236    query << " order by REAL_TIME_INIT ASC";//marco_new: inutile    query << " order by REAL_TIME_INIT ASC;";//marco_new: inutile
1237    //se volessi mettere un filtro sulla qualita'    //se volessi mettere un filtro sulla qualita'
1238    //    query<<" and NUM_PKT_SAVED - BAD_PKT_CALREAD - BAD_PKT_READ - BAD_PKT >= 2" ;    //    query<<" and NUM_PKT_SAVED - BAD_PKT_CALREAD - BAD_PKT_READ - BAD_PKT >= 2" ;
1239    string msg = query.str();    string msg = query.str();
# Line 1245  bool PacketUser::saveMergeROOT_DB(const Line 1256  bool PacketUser::saveMergeROOT_DB(const
1256      unsigned long int pkt_number_fin, unsigned long int obt_in, unsigned long int obt_fin,      unsigned long int pkt_number_fin, unsigned long int obt_in, unsigned long int obt_fin,
1257      unsigned long int mtime_init, unsigned long int mtime_last, unsigned long int mboot_num, double percentage) {      unsigned long int mtime_init, unsigned long int mtime_last, unsigned long int mboot_num, double percentage) {
1258    
1259      int good = 1;
1260      if ( pkt_number_in >= pkt_number_fin && abs((int)(pkt_number_fin-pkt_number_in))<10 ) good = 0;
1261    
1262    stringstream oss;    stringstream oss;
1263    oss.str("");    oss.str("");
1264    oss << "INSERT INTO " << table_name    oss << "INSERT INTO " << table_name
1265        << " (ID_N, ROOT_ID_N, PKT_NUMBER_INIT, PKT_NUMBER_FINAL, PKT_OBT_INIT, PKT_OBT_FINAL, REAL_TIME_INIT, REAL_TIME_LAST, BOOT_NUMBER, BAD_PKT_PERCENTAGE, INSERT_TIME, INSERTED_BY)"        << " (ID_N, ROOT_ID_N, PKT_NUMBER_INIT, PKT_NUMBER_FINAL, PKT_OBT_INIT, PKT_OBT_FINAL, REAL_TIME_INIT, REAL_TIME_LAST, BOOT_NUMBER, BAD_PKT_PERCENTAGE, INSERT_TIME, INSERTED_BY,GOOD)"
1266        << " VALUES ('" << 0 << "','" << root_id << "','" << pkt_number_in << "','" << pkt_number_fin << "','" << obt_in        << " VALUES ('" << 0 << "','" << root_id << "','" << pkt_number_in << "','" << pkt_number_fin << "','" << obt_in
1267        << "','" << obt_fin << "','" << mtime_init << "','" << mtime_last << "','" << mboot_num << "','" << percentage        << "','" << obt_fin << "','" << mtime_init << "','" << mtime_last << "','" << mboot_num << "','" << percentage
1268        << "'," << "NULL" << ",'" << tag_value << "'" << ");";        << "'," << "NULL" << ",'" << tag_value << "','" << good <<"');";
1269    
1270    string msg = oss.str();    string msg = oss.str();
1271    mainLogUtil->logAll(msg);    mainLogUtil->logAll(msg);

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.23