| 1 |
|
|
| 2 |
//============================================================================ |
//============================================================================ |
| 3 |
// $Id: PacketUser.cpp,v 1.67 2008-09-05 14:33:48 messineo Exp $ |
// $Id: PacketUser.cpp,v 1.69 2008-10-27 10:41:27 messineo Exp $ |
| 4 |
// Description : |
// Description : |
| 5 |
//============================================================================ |
//============================================================================ |
| 6 |
#include "PacketUser.h" |
#include "PacketUser.h" |
| 33 |
extern char* db_pwd; |
extern char* db_pwd; |
| 34 |
extern char* connection; |
extern char* connection; |
| 35 |
|
|
| 36 |
|
//per tenere conto reset obt |
| 37 |
|
extern unsigned long int max_pkt_obt; |
| 38 |
|
|
| 39 |
|
|
| 40 |
PacketUser PacketUser::instance; |
PacketUser PacketUser::instance; |
| 41 |
|
|
| 42 |
int PacketUser::numDiscontinity=1; |
int PacketUser::numDiscontinity=1; |
| 99 |
boot_number=0; |
boot_number=0; |
| 100 |
} |
} |
| 101 |
|
|
| 102 |
|
|
| 103 |
//Put the packet in a root file. Create a new ROOT file for each group of packets |
//Put the packet in a root file. Create a new ROOT file for each group of packets |
| 104 |
void PacketUser::usePKT(char*& headerPkt, char*& pamPkt, long int length, bool isCons, bool isPKTGood, const PacketType* type, |
void PacketUser::usePKT(char*& headerPkt, char*& pamPkt, long int length, bool isCons, bool isPKTGood, const PacketType* type, |
| 105 |
unsigned long int counter, unsigned long int obt) |
unsigned long int counter, unsigned long int obt) |
| 106 |
{ |
{ |
| 107 |
//If the packet type was not recognised before |
//If the packet type was not recognised before |
| 108 |
if(!type){return;} |
if(!type){return;} |
| 109 |
|
|
|
|
|
|
/* //zzzzzz marco per debug mi salvo il pacchetto vardump |
|
|
if(type==PacketType::VarDump) |
|
|
{ |
|
|
long int dataLength = length - 2; //the block of data |
|
|
int b_offset = 4; |
|
|
while (b_offset < dataLength){ |
|
|
boot_number = (((UINT32)pamPkt[1+b_offset]<<24)&0xFF000000) + (((UINT32)pamPkt[2+b_offset]<<16)&0x00FF0000) + (((UINT32)pamPkt[3+b_offset]<<8)&0x0000FF00) + (((UINT32)pamPkt[4+b_offset])&0x000000FF); |
|
|
cout<<"IN "<<numPKTSaved<<" boot_number "<<boot_number<<" al b_offset "<<b_offset<<" di "<<dataLength<<endl; |
|
|
|
|
|
b_offset = b_offset + 5; |
|
|
} |
|
|
|
|
|
cout<<"IN "<<numPKTSaved<<" FINAL boot_number "<<boot_number<<endl; |
|
|
savePKT_file(headerPkt,pamPkt,length,false,"vardump"); |
|
|
numPKTSaved++; |
|
|
} |
|
|
return; |
|
|
*/ |
|
|
|
|
|
|
|
| 110 |
//in order to start ... |
//in order to start ... |
| 111 |
if(numPKT==0) |
if(numPKT==0) |
| 112 |
{ |
{ |
|
//marco_new_31: metto qui se voglio avere come in origine apertura Connessione all'inizio e chiusura alla fine |
|
|
//marco_new_01 |
|
| 113 |
if(single_connection){ |
if(single_connection){ |
| 114 |
OpenDBConnection(NULL); |
OpenDBConnection(NULL); |
| 115 |
} |
} |
| 122 |
if((!isCons)&&(numPKT!=0)) |
if((!isCons)&&(numPKT!=0)) |
| 123 |
{ |
{ |
| 124 |
setReal_Time(); |
setReal_Time(); |
| 125 |
//closing the group in file rootfilename |
//closing the group in file rootfilename |
| 126 |
FinishGroup(rootfilename); |
FinishGroup(rootfilename); |
| 127 |
|
|
| 128 |
//numDiscontinity++; |
//se gia' e' cambiato download non cambio numdisco |
| 129 |
//se gia' e' cambiato download nn cambio numdisco |
if(!is_new_route){numDiscontinity++;} |
| 130 |
if(!is_new_route) numDiscontinity++; |
|
|
|
|
| 131 |
//the current pkt will be placed in a new group: rootfilename |
//the current pkt will be placed in a new group: rootfilename |
| 132 |
setInit(counter,obt); |
setInit(counter,obt); |
| 133 |
StartGroup(); |
StartGroup(); |
| 148 |
ret = 10 if the packet is good but comes from a cadre with VRL problems |
ret = 10 if the packet is good but comes from a cadre with VRL problems |
| 149 |
*/ |
*/ |
| 150 |
|
|
| 151 |
//here we know if the packet comes from one or more corrupted cadres |
//here we also know if the packet comes from one or more corrupted cadres |
|
//if(!isPKTGood){bad_pkt++;} |
|
| 152 |
if((!isPKTGood)&&(!ret)){ret=10;} |
if((!isPKTGood)&&(!ret)){ret=10;} |
|
|
|
| 153 |
switch (ret) |
switch (ret) |
| 154 |
{ |
{ |
| 155 |
case 0: {numPKTSaved++; break;} |
case 0: {numPKTSaved++; break;} |
| 181 |
// if((ret==0)||(ret==10))//I want to use only good packet |
// if((ret==0)||(ret==10))//I want to use only good packet |
| 182 |
if(ret>=0)//I want to use only accepted packet |
if(ret>=0)//I want to use only accepted packet |
| 183 |
{ |
{ |
| 184 |
setTimeSync(pamPkt, length, type);//marco_new: here I retrieve also the boot_number if packet type is vardump |
setTimeSync(pamPkt, length, type);//here I retrieve also the boot_number if packet type is vardump |
| 185 |
} |
} |
| 186 |
|
|
| 187 |
//just to be sure ... |
//just to be sure ... |
| 188 |
if(pamPkt){delete[] pamPkt; pamPkt = NULL;} |
if(pamPkt){delete[] pamPkt; pamPkt = NULL;} |
|
//just to be sure ... |
|
| 189 |
if(headerPkt){delete[] headerPkt; headerPkt = NULL;} |
if(headerPkt){delete[] headerPkt; headerPkt = NULL;} |
| 190 |
|
|
| 191 |
numPKT++; |
numPKT++; |
| 217 |
//starts a new root file |
//starts a new root file |
| 218 |
void PacketUser::StartGroup() |
void PacketUser::StartGroup() |
| 219 |
{ |
{ |
| 220 |
pRun = new PamelaRun(rootfilename, outDir , multiFile, compression); |
pRun = new PamelaRun(rootfilename, outDir, multiFile, compression); |
|
//marco_new: aggiunta estensione .root |
|
| 221 |
strcat(rootfilename,".root"); |
strcat(rootfilename,".root"); |
| 222 |
reader->Init(pRun); |
reader->Init(pRun); |
| 223 |
stringstream oss; |
stringstream oss; |
| 236 |
|
|
| 237 |
|
|
| 238 |
|
|
| 239 |
//retrieve obt_time_sync and last_time_sync_info from packet if type has special values |
//retrieve obt_time_sync and last_time_sync_info from packet if type has special values and BOOT_NUMBER |
| 240 |
void PacketUser::setTimeSync(char* packet, long int pktLength, const PacketType* type) |
void PacketUser::setTimeSync(char* packet, long int pktLength, const PacketType* type) |
| 241 |
{ |
{ |
| 242 |
//do nothing |
//do nothing |
| 247 |
} |
} |
| 248 |
|
|
| 249 |
//TODO: usare anche MCMD ... NOTA: questo da sempre errore ret != 0 |
//TODO: usare anche MCMD ... NOTA: questo da sempre errore ret != 0 |
| 250 |
//In RunHeader e RunTrailer sono in secondi(?), controllare se aggiungo altri tipi di paccheti se invece sono in secondi |
//In RunHeader e RunTrailer sono in secondi(?), controllare se aggiungo altri tipi di paccheti se invece sono in secondi |
| 251 |
|
// devo ricalcolare tutto non per ogni gruppetto (ROOT file) ma solo se cambia download |
| 252 |
|
//When I found a new download I need to reset all values |
|
// devo ricalcolare tutto non per ogni gruppetto (ROOT file) ma solo se cambia download |
|
|
|
|
|
//When I found a new download I need to reset all values |
|
| 253 |
if(is_new_route) |
if(is_new_route) |
| 254 |
{ |
{ |
| 255 |
//reset |
//reset |
| 256 |
is_new_route=false; |
is_new_route=false; |
| 257 |
obt_time_sync=0; last_time_sync_info=0; |
obt_time_sync=0; last_time_sync_info=0; |
| 258 |
boot_number=0; |
boot_number=0; |
| 301 |
//Boot Number |
//Boot Number |
| 302 |
void PacketUser::setBootNumber(char* packet, long int pktLength, const PacketType* type) |
void PacketUser::setBootNumber(char* packet, long int pktLength, const PacketType* type) |
| 303 |
{ |
{ |
| 304 |
//se gia calcolato esco: lo calcolo una volta per download e per continuit� |
//se gia calcolato esco: lo calcolo una volta per download e per continuita' |
| 305 |
if(boot_number) return; |
if(boot_number) return; |
| 306 |
//todo: controlla se algo giusto: preso da VarDumpReader.cpp |
|
|
//mmm e' sbagliatissimo cambiare !!! |
|
| 307 |
if(type==PacketType::VarDump) |
if(type==PacketType::VarDump) |
| 308 |
{ |
{ |
| 309 |
|
int b_offset = 34;//4+5*6 |
| 310 |
|
boot_number = (((UINT32)packet[1+b_offset]<<24)&0xFF000000) + (((UINT32)packet[2+b_offset]<<16)&0x00FF0000) + (((UINT32)packet[3+b_offset]<<8)&0x0000FF00) + (((UINT32)packet[4+b_offset])&0x000000FF); |
| 311 |
|
|
| 312 |
|
/* |
| 313 |
long int dataLength = pktLength - 2; //the block of data |
long int dataLength = pktLength - 2; //the block of data |
| 314 |
int b_offset = 4; |
int b_offset = 4; |
| 315 |
while (b_offset < dataLength){ |
while (b_offset < dataLength){ |
| 316 |
boot_number = (((UINT32)packet[1+b_offset]<<24)&0xFF000000) + (((UINT32)packet[2+b_offset]<<16)&0x00FF0000) + (((UINT32)packet[3+b_offset]<<8)&0x0000FF00) + (((UINT32)packet[4+b_offset])&0x000000FF); |
boot_number = (((UINT32)packet[1+b_offset]<<24)&0xFF000000) + (((UINT32)packet[2+b_offset]<<16)&0x00FF0000) + (((UINT32)packet[3+b_offset]<<8)&0x0000FF00) + (((UINT32)packet[4+b_offset])&0x000000FF); |
| 317 |
b_offset = b_offset + 5; |
b_offset = b_offset + 5; |
| 318 |
} |
} |
| 319 |
|
*/ |
| 320 |
stringstream oss; |
stringstream oss; |
| 321 |
oss.str()=""; |
oss.str()=""; |
| 322 |
oss<<"In download: "<<download<<" boot_number: "<<boot_number<<" using Packet Type: "<<type->GetName().c_str(); |
oss<<"In download: "<<download<<" boot_number: "<<boot_number<<" using Packet Type: "<<type->GetName().c_str(); |
| 334 |
void PacketUser::setReal_Time() |
void PacketUser::setReal_Time() |
| 335 |
{ |
{ |
| 336 |
if((obt_time_sync)||(last_time_sync_info)) |
if((obt_time_sync)||(last_time_sync_info)) |
| 337 |
{ |
{ |
| 338 |
|
|
| 339 |
real_time_init=(obt_init/1000-obt_time_sync)+last_time_sync_info; |
real_time_init=(obt_init/1000-obt_time_sync)+last_time_sync_info; |
| 340 |
real_time_last=(obt_last/1000-obt_time_sync)+last_time_sync_info; |
//se obt si e' resettato |
| 341 |
|
if(obt_last<obt_init) |
| 342 |
|
{ |
| 343 |
|
real_time_last=(max_pkt_obt/1000+ obt_last/1000-obt_time_sync)+last_time_sync_info; |
| 344 |
|
stringstream oss; |
| 345 |
|
oss.str()=""; |
| 346 |
|
oss<<"obt_last("<<obt_last<<") < obt_init("<<obt_init<<"). It is due to Pamela Reset. Adding max_pkt_obt("<<max_pkt_obt<<") to obt_last in order to compute real_time_last"; |
| 347 |
|
string msg = oss.str(); |
| 348 |
|
mainLogUtil->logWarning(msg); |
| 349 |
|
} |
| 350 |
|
else |
| 351 |
|
real_time_last=(obt_last/1000-obt_time_sync)+last_time_sync_info; |
| 352 |
real_time_init+=timeOffset; |
real_time_init+=timeOffset; |
| 353 |
real_time_last+=timeOffset; |
real_time_last+=timeOffset; |
| 354 |
} |
|
| 355 |
|
|
| 356 |
|
} |
| 357 |
} |
} |
| 358 |
|
|
| 359 |
//timeOffset |
//timeOffset |
| 364 |
|
|
| 365 |
//if(!table){table=Table_GL_RESURS_OFFSET} |
//if(!table){table=Table_GL_RESURS_OFFSET} |
| 366 |
|
|
|
//marco_new_31:metto qui se voglio aprire e chiudere Connessione solo quando serve |
|
|
//marco_new_01 |
|
| 367 |
if(!single_connection){ |
if(!single_connection){ |
| 368 |
OpenDBConnection(table);//Nota qui ho deciso di lockare solo questa tabella e non tutte |
OpenDBConnection(table);//Nota qui ho deciso di lockare solo questa tabella e non tutte |
| 369 |
} |
} |
| 370 |
|
|
| 371 |
UInt_t t0 = 0; //toffset |
UInt_t t0 = 0;//toffset |
|
|
|
| 372 |
stringstream oss; |
stringstream oss; |
| 373 |
oss.str(""); |
oss.str(""); |
| 374 |
oss << "SELECT YEAR(OFFSET_DATE),MONTH(OFFSET_DATE),DAY(OFFSET_DATE),HOUR(OFFSET_DATE),MINUTE(OFFSET_DATE),SECOND(OFFSET_DATE),ID FROM "<< table <<" 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 "<< table <<" WHERE SPECIAL_FILE='" |
| 419 |
if(res){delete res; res = NULL;} |
if(res){delete res; res = NULL;} |
| 420 |
if(row){delete row; row = NULL;} |
if(row){delete row; row = NULL;} |
| 421 |
|
|
|
//marco_new_31:metto qui se voglio aprire e chiudere Connessione solo quando serve |
|
|
//marco_new_01 |
|
| 422 |
if(!single_connection){ |
if(!single_connection){ |
| 423 |
CloseDBConnection(); |
CloseDBConnection(); |
| 424 |
} |
} |
| 432 |
setReal_Time(); |
setReal_Time(); |
| 433 |
FinishGroup(rootfilename); |
FinishGroup(rootfilename); |
| 434 |
mainLogUtil->logAll("######################### Closed the last group ############################"); |
mainLogUtil->logAll("######################### Closed the last group ############################"); |
|
|
|
|
//marco_new_31:metto qui se voglio avere come in origine apertura Connessione all'inizio e chiusura alla fine |
|
|
//marco_new_01 |
|
| 435 |
if(single_connection){ |
if(single_connection){ |
| 436 |
CloseDBConnection(); |
CloseDBConnection(); |
| 437 |
} |
} |
| 459 |
oss.str()=""; |
oss.str()=""; |
| 460 |
|
|
| 461 |
//TODO: check when I don't want to log in DB informations |
//TODO: check when I don't want to log in DB informations |
|
|
|
| 462 |
// se non ho salvato nessun pacchetto |
// se non ho salvato nessun pacchetto |
| 463 |
if(numPKTSaved==0){ |
if(numPKTSaved==0){ |
| 464 |
stringstream err; |
stringstream err; |
| 480 |
// return; //TODO: decidi se nn vuoi affatto usarlo o addirittura salvarlo tra i BAD??? |
// return; //TODO: decidi se nn vuoi affatto usarlo o addirittura salvarlo tra i BAD??? |
| 481 |
} |
} |
| 482 |
|
|
|
//marco_new_31:metto qui se voglio aprire e chiudere Connessione solo quando serve |
|
|
//marco_new_01 |
|
| 483 |
if(!single_connection){ |
if(!single_connection){ |
| 484 |
OpenDBConnection(NULL);//Nota qui ho deciso di lockare tutte le tabelle |
OpenDBConnection(NULL);//Nota qui ho deciso di lockare tutte le tabelle |
| 485 |
} |
} |
| 511 |
msg = oss.str(); |
msg = oss.str(); |
| 512 |
mainLogUtil->logError(msg); |
mainLogUtil->logError(msg); |
| 513 |
} |
} |
| 514 |
|
|
|
//marco_new_31:metto qui se voglio aprire e chiudere Connessione solo quando serve |
|
|
//marco_new_01 |
|
| 515 |
if(!single_connection){ |
if(!single_connection){ |
| 516 |
CloseDBConnection(); |
CloseDBConnection(); |
| 517 |
} |
} |
| 535 |
msg = oss.str(); |
msg = oss.str(); |
| 536 |
mainLogUtil->logInfo(msg); |
mainLogUtil->logInfo(msg); |
| 537 |
|
|
|
//TODO : work on this .... |
|
| 538 |
if(tryMerge){ |
if(tryMerge){ |
| 539 |
merge_ROOTfiles(); |
merge_ROOTfiles(); |
| 540 |
} |
} |
| 546 |
mainLogUtil->logError(msg); |
mainLogUtil->logError(msg); |
| 547 |
} |
} |
| 548 |
|
|
|
//marco_new_31:metto qui se voglio apriree chiudere Connessione solo quando serve |
|
|
//marco_new_01 |
|
| 549 |
if(!single_connection){ |
if(!single_connection){ |
| 550 |
CloseDBConnection(); |
CloseDBConnection(); |
| 551 |
} |
} |
| 553 |
}//pRun |
}//pRun |
| 554 |
} |
} |
| 555 |
|
|
|
|
|
| 556 |
//save in Table_ROOT_Good or in Table_ROOT_Bad |
//save in Table_ROOT_Good or in Table_ROOT_Bad |
| 557 |
bool PacketUser::saveROOT_DB(char* table_name, char* folder_name, char* file_name, |
bool PacketUser::saveROOT_DB(char* table_name, char* folder_name, char* file_name, |
| 558 |
unsigned long int pkt_number_in, unsigned long int pkt_number_fin, |
unsigned long int pkt_number_in, unsigned long int pkt_number_fin, |
| 572 |
<< mtime_init << "','" << mtime_last << "','" |
<< mtime_init << "','" << mtime_last << "','" |
| 573 |
<< mboot_num << "','" |
<< mboot_num << "','" |
| 574 |
<< time_offset << "','" |
<< time_offset << "','" |
| 575 |
<< bad_pkt <<"','" << bad_pkt_read <<"','"<< bad_pkt_CalRead <<"','"<< numPKTSaved<<"','" |
<< bad_pkt <<"','" << bad_pkt_read <<"','"<< bad_pkt_CalRead <<"','"<< num_PKT_Saved<<"','" |
| 576 |
<< nome_input <<"'," |
<< nome_input <<"'," |
| 577 |
<<"NULL"<< |
<<"NULL"<< |
| 578 |
")"; |
")"; |
| 593 |
return false; |
return false; |
| 594 |
} |
} |
| 595 |
|
|
|
//marco_new: si pu� ottimizzare ... |
|
| 596 |
//the ID of the current ROOT file in table Table_ROOT_Good |
//the ID of the current ROOT file in table Table_ROOT_Good |
| 597 |
my_id = select_maxIDN_DB(table_name); |
my_id = select_maxIDN_DB(table_name); |
| 598 |
// cout<<"DBG: my_id = "<<my_id<<endl; |
// cout<<"DBG: my_id = "<<my_id<<endl; |
| 604 |
/*###########################################################################################################*/ |
/*###########################################################################################################*/ |
| 605 |
/********************************** MERGING *************************************************/ |
/********************************** MERGING *************************************************/ |
| 606 |
/*###########################################################################################################*/ |
/*###########################################################################################################*/ |
| 607 |
// Merge ROOT files: found other ROOT files in the same temporal ranges |
// Merge ROOT files: find other ROOT files in the same temporal ranges |
| 608 |
// it finds ROOT files that covers particular temporal range of interest and save this info in DB |
// it finds ROOT files that covers particular temporal range of interest and save this info in DB |
| 609 |
/**********************************************************************************************/ |
/**********************************************************************************************/ |
| 610 |
//try to merge current ROOT file with files in DB |
//try to merge current ROOT file with files in DB |
| 611 |
bool PacketUser::merge_ROOTfiles() |
bool PacketUser::merge_ROOTfiles() |
| 612 |
{ |
{ |
| 613 |
mainLogUtil->logInfo("Trying merging ROOT files"); |
stringstream log; |
| 614 |
|
log.str(""); |
| 615 |
|
string slog; |
| 616 |
|
|
| 617 |
//marco_new: controlla |
mainLogUtil->logInfo("Trying merging ROOT files"); |
| 618 |
double percentage=(double)(bad_pkt+bad_pkt_EventReader+bad_pkt_CalibReader)/numPKTSaved; |
double percentage=(double)(bad_pkt+bad_pkt_EventReader+bad_pkt_CalibReader)/numPKTSaved; |
| 619 |
|
|
| 620 |
TSQLResult* res=NULL; |
TSQLResult* res=NULL; |
| 621 |
TSQLRow* row =NULL; |
TSQLRow* row =NULL; |
| 622 |
|
//numero di ROOT files trovati sul DB che hanno relaz di tipo dato |
| 623 |
|
unsigned int num_rows=0; |
| 624 |
|
|
| 625 |
|
//Record su DB: |
| 626 |
|
unsigned int idN = 0; |
| 627 |
|
unsigned int root_id_db=0; |
| 628 |
|
unsigned long int pkt_num_in_db=0; |
| 629 |
|
unsigned long int pkt_num_fin_db=0; |
| 630 |
|
unsigned long int pkt_obt_in_db=0; |
| 631 |
|
unsigned long int pkt_obt_fin_db=0; |
| 632 |
|
unsigned long int time_in_db=0; |
| 633 |
|
unsigned long int time_fin_db=0; |
| 634 |
|
unsigned int boot_num_db=0; |
| 635 |
|
double perc=0; |
| 636 |
|
|
| 637 |
//marco_new: non considero mai caso di continuit�(mio finale=DB iniz o viceversa), non mi interessa |
|
| 638 |
|
//marco_new: non considero mai caso di continuita'(mio finale=DB iniz o viceversa), non mi interessa |
| 639 |
//marco_new: after e before contengono anche smaller ma con un bordo comune |
//marco_new: after e before contengono anche smaller ma con un bordo comune |
| 640 |
for(int relaz=AFTER; relaz<=BIGGER; relaz++) |
for(int relaz=AFTER; relaz<=BIGGER; relaz++) |
| 641 |
{ |
{ |
|
//marco_new: controlla tutto |
|
| 642 |
//marco_new: esci se sono arrivato a zero |
//marco_new: esci se sono arrivato a zero |
| 643 |
if(real_time_last==real_time_init){ |
if(real_time_last==real_time_init) |
| 644 |
|
{ |
| 645 |
|
log.str(""); |
| 646 |
|
log<<"Current File Lenght=0; real_time_last=real_time_init= "<<real_time_last; |
| 647 |
|
slog=log.str(); |
| 648 |
|
mainLogUtil->logAll(slog); |
| 649 |
mainLogUtil->logInfo("Finish merging ROOT files"); |
mainLogUtil->logInfo("Finish merging ROOT files"); |
| 650 |
if(res){delete res; res = NULL;} |
if(res){delete res; res = NULL;} |
| 651 |
if(row){delete row; row = NULL;} |
if(row){delete row; row = NULL;} |
| 652 |
return true; |
return true; |
| 653 |
} |
} |
| 654 |
|
|
| 655 |
res = Select_merging(Table_ROOT_Merging, real_time_init, real_time_last, (type_Rel_ROOT)relaz); |
num_rows=0; |
| 656 |
|
res = Select_merging(Table_ROOT_Merging, real_time_init, real_time_last, (type_Rel_ROOT)relaz); |
| 657 |
|
|
|
unsigned int num_rows=0; |
|
| 658 |
if (!res) |
if (!res) |
| 659 |
{ |
{ |
| 660 |
mainLogUtil->logError("DB_ERROR: Unable to find ROOT files to be merged RES=null"); |
mainLogUtil->logError("DB_ERROR: Unable to find ROOT files to be merged RES=null"); |
| 662 |
} |
} |
| 663 |
|
|
| 664 |
num_rows=res->GetRowCount(); |
num_rows=res->GetRowCount(); |
| 665 |
// cout<<"MMMMM trovati num_rows "<< num_rows<< " per relaz= "<<relaz; |
log.str(""); |
| 666 |
|
log<<"Found "<<num_rows<<" ROOT file in DB with relation of kind = "<<relaz; |
| 667 |
|
slog=log.str(); |
| 668 |
|
mainLogUtil->logAll(slog); |
| 669 |
|
|
| 670 |
if(num_rows>0) |
if(num_rows>0) |
| 671 |
{ |
{ |
| 672 |
for(unsigned int i=0; i<num_rows; i++) |
for(unsigned int i=0; i<num_rows; i++) |
| 673 |
{ |
{ |
| 674 |
row=res->Next(); |
row=res->Next(); |
| 675 |
if (!row) |
if (!row) |
| 676 |
{ |
{ |
| 677 |
mainLogUtil->logError("DB_ERROR: Unable to find ROOT files to be merged. ROW=null"); |
mainLogUtil->logError("DB_ERROR: Unable to find ROOT files to be merged. ROW=null"); |
| 678 |
if(res){delete res; res = NULL;} |
if(res){delete res; res = NULL;} |
| 679 |
return false; |
return false; |
| 680 |
} |
} |
| 681 |
|
|
| 682 |
|
//Leggi Record dal DB: |
| 683 |
//TODO ricavare tutte le info che servono |
idN=atoll(row->GetField(0)); |
| 684 |
unsigned int idN = 0; |
root_id_db=atoll(row->GetField(1)); |
| 685 |
idN=atoi(row->GetField(0)); |
pkt_num_in_db=atoll(row->GetField(2)); |
| 686 |
|
pkt_num_fin_db=atoll(row->GetField(3)); |
| 687 |
double perc =0; |
pkt_obt_in_db=atoll(row->GetField(4)); |
| 688 |
//marco_new: |
pkt_obt_fin_db=atoll(row->GetField(5)); |
| 689 |
|
time_in_db=atoll(row->GetField(6)); |
| 690 |
|
time_fin_db=atoll(row->GetField(7)); |
| 691 |
|
boot_num_db=atoll(row->GetField(8)); |
| 692 |
perc=atof(row->GetField(9)); |
perc=atof(row->GetField(9)); |
| 693 |
//unsigned long int M_pkt_number_in, M_pkt_number_fin, M_obt_in, M_obt_fin, M_mtime_init, M_mtime_last; |
|
| 694 |
if(perc>percentage){ |
log.str(""); |
| 695 |
|
log<<"*** ROOT file found in DB has idN= "<<idN<<" root_id_db= "<<root_id_db; |
| 696 |
|
log<<" pkt_num_in_db= "<<pkt_num_in_db<<" pkt_num_fin_db= "<<pkt_num_fin_db<<" pkt_obt_in_db= "<<pkt_obt_in_db<<" pkt_obt_fin_db= "<<pkt_obt_fin_db; |
| 697 |
|
log<<" time_in_db= "<<time_in_db<<" time_fin_db= "<<time_fin_db<<" boot_num_db= "<<boot_num_db<<" perc= "<<perc<<" ***"; |
| 698 |
|
log<<"\n*** Current ROOT file has pkt_number_init= "<<pkt_number_init<<" obt_init= "<<obt_init<<" real_time_init= "<<real_time_init; |
| 699 |
|
log<<" pkt_number_last= "<<pkt_number_last<<" obt_last= "<<obt_last<<" real_time_last= "<<real_time_last<<" ***"; |
| 700 |
|
slog=log.str(); |
| 701 |
|
mainLogUtil->logAll(slog); |
| 702 |
|
if(perc>percentage) |
| 703 |
|
{ |
| 704 |
mainLogUtil->logInfo("Current ROOT file is better than the one in DB"); |
mainLogUtil->logInfo("Current ROOT file is better than the one in DB"); |
| 705 |
//modifica DB |
//modifica DB |
| 706 |
updateMergeROOT_DB(Table_ROOT_Merging, |
updateMergeROOT_DB(Table_ROOT_Merging, |
| 707 |
atoi(row->GetField(1)), atoi(row->GetField(2)), |
root_id_db, |
| 708 |
atoi(row->GetField(3)), atoi(row->GetField(4)), |
pkt_num_in_db, pkt_num_fin_db, |
| 709 |
atoi(row->GetField(5)), atoi(row->GetField(6)), |
pkt_obt_in_db, pkt_obt_fin_db, |
| 710 |
atoi(row->GetField(7)), atoi(row->GetField(8)), |
time_in_db, time_fin_db, |
| 711 |
perc, |
boot_num_db, |
| 712 |
idN,(type_Rel_ROOT)relaz); |
perc, |
| 713 |
|
idN,(type_Rel_ROOT)relaz); |
| 714 |
} |
} |
| 715 |
else{ |
else |
| 716 |
mainLogUtil->logInfo("Found ROOT files in DB better than current ROOT file"); |
{ |
| 717 |
|
mainLogUtil->logInfo("Found ROOT file in DB is better than current ROOT file"); |
| 718 |
if(relaz == AFTER){ |
if(relaz == AFTER) |
| 719 |
|
{ |
| 720 |
mainLogUtil->logInfo("Relaz:AFTER = Changing Init values of the Current ROOT file"); |
mainLogUtil->logInfo("Relaz:AFTER = Changing Init values of the Current ROOT file"); |
| 721 |
pkt_number_init= atoi(row->GetField(3)); |
pkt_number_init = pkt_num_fin_db; |
| 722 |
obt_init= atoi(row->GetField(5)); |
obt_init = pkt_obt_fin_db; |
| 723 |
real_time_init= atoi(row->GetField(7)); |
real_time_init = time_fin_db; |
| 724 |
|
log.str(""); |
| 725 |
|
log<<"\n*** Current ROOT file becomes: pkt_number_init= "<<pkt_number_init<<" obt_init= "<<obt_init<<" real_time_init= "<<real_time_init; |
| 726 |
|
log<<" pkt_number_last= "<<pkt_number_last<<" obt_last= "<<obt_last<<" real_time_last= "<<real_time_last<<" ***"; |
| 727 |
|
slog=log.str(); |
| 728 |
|
mainLogUtil->logAll(slog); |
| 729 |
} |
} |
| 730 |
else if(relaz == BEFORE){ |
else if(relaz == BEFORE) |
| 731 |
mainLogUtil->logInfo("Relaz:BEFORE = Changing Last values of the Current ROOT file"); |
{ |
| 732 |
pkt_number_last= atoi(row->GetField(2)); |
mainLogUtil->logInfo("Relaz:BEFORE = Changing Last values of the Current ROOT file"); |
| 733 |
obt_last= atoi(row->GetField(4)); |
pkt_number_last = pkt_num_in_db; |
| 734 |
real_time_last= atoi(row->GetField(6)); |
obt_last = pkt_obt_in_db; |
| 735 |
|
real_time_last = time_in_db; |
| 736 |
|
|
| 737 |
|
log.str(""); |
| 738 |
|
log<<"\n*** Current ROOT file becomes: pkt_number_init= "<<pkt_number_init<<" obt_init= "<<obt_init<<" real_time_init= "<<real_time_init; |
| 739 |
|
log<<" pkt_number_last= "<<pkt_number_last<<" obt_last= "<<obt_last<<" real_time_last= "<<real_time_last<<" ***"; |
| 740 |
|
slog=log.str(); |
| 741 |
|
mainLogUtil->logAll(slog); |
| 742 |
} |
} |
| 743 |
else if(relaz == SMALLER) |
else if(relaz == SMALLER) |
| 744 |
{ |
{ |
| 745 |
//non devo proprio salvarlo ed esco ... |
//non devo proprio salvarlo ed esco ... |
| 746 |
mainLogUtil->logInfo("Relaz:SMALLER = Nothing to save"); |
mainLogUtil->logInfo("Relaz:SMALLER = Nothing to save"); |
| 747 |
mainLogUtil->logInfo("Finish merging ROOT files"); |
mainLogUtil->logInfo("\nFinish merging ROOT files"); |
| 748 |
if(res){delete res; res = NULL;} |
if(res){delete res; res = NULL;} |
| 749 |
if(row){delete row; row = NULL;} |
if(row){delete row; row = NULL;} |
| 750 |
return true; |
return true; |
| 751 |
} |
} |
| 752 |
else if(relaz == BIGGER)//spezzettamento |
else if(relaz == BIGGER)//spezzettamento |
| 753 |
{ |
{ |
| 754 |
mainLogUtil->logInfo("Relaz:BIGGER = (1st part) Saving the first part of the Current ROOT file"); |
mainLogUtil->logInfo("Relaz:BIGGER = (1st part) Saving the first part of the Current ROOT file"); |
| 755 |
saveMergeROOT_DB(Table_ROOT_Merging, my_id, |
saveMergeROOT_DB(Table_ROOT_Merging, my_id, |
| 756 |
pkt_number_init, atoi(row->GetField(2)), |
pkt_number_init, pkt_num_in_db, |
| 757 |
obt_init, atoi(row->GetField(4)), |
obt_init, pkt_obt_in_db, |
| 758 |
real_time_init, atoi(row->GetField(6)), |
real_time_init, time_in_db, |
| 759 |
boot_number, |
boot_number, |
| 760 |
percentage); |
percentage); |
| 761 |
|
|
| 762 |
mainLogUtil->logInfo("Relaz:BIGGER = (2nd part)Changing Init values of the Current ROOT file"); |
mainLogUtil->logInfo("Relaz:BIGGER = (2nd part)Changing Init values of the Current ROOT file"); |
| 763 |
pkt_number_init= atoi(row->GetField(3)); |
pkt_number_init = pkt_num_fin_db; |
| 764 |
obt_init= atoi(row->GetField(5)); |
obt_init= pkt_obt_fin_db; |
| 765 |
real_time_init= atoi(row->GetField(7)); |
real_time_init= time_fin_db; |
| 766 |
} |
|
| 767 |
} |
log.str(""); |
| 768 |
|
log<<"\n*** Current ROOT file becomes: pkt_number_init= "<<pkt_number_init<<" obt_init= "<<obt_init<<" real_time_init= "<<real_time_init; |
| 769 |
|
log<<" pkt_number_last= "<<pkt_number_last<<" obt_last= "<<obt_last<<" real_time_last= "<<real_time_last<<" ***"; |
| 770 |
|
slog=log.str(); |
| 771 |
|
mainLogUtil->logAll(slog); |
| 772 |
|
}//if relaz |
| 773 |
|
}//if perc |
| 774 |
}//for num_rows |
}//for num_rows |
| 775 |
} |
}//if num_rows |
|
else{ |
|
|
//marco_new: |
|
|
mainLogUtil->logInfo("Found 0 ROOT files in DB that can be merged with current ROOT file"); |
|
| 776 |
|
|
|
} |
|
|
|
|
|
//marco_new:??? |
|
| 777 |
if(res){delete res; res = NULL;} |
if(res){delete res; res = NULL;} |
| 778 |
if(row){delete row; row = NULL;} |
if(row){delete row; row = NULL;} |
| 779 |
}//for |
|
| 780 |
|
}//for relaz |
| 781 |
|
|
| 782 |
mainLogUtil->logInfo("Saving Current ROOT file"); |
mainLogUtil->logInfo("Saving Current ROOT file"); |
| 783 |
saveMergeROOT_DB(Table_ROOT_Merging, my_id, |
saveMergeROOT_DB(Table_ROOT_Merging, my_id, |
| 787 |
boot_number, |
boot_number, |
| 788 |
percentage); |
percentage); |
| 789 |
|
|
|
|
|
| 790 |
mainLogUtil->logInfo("Finish merging ROOT files"); |
mainLogUtil->logInfo("Finish merging ROOT files"); |
| 791 |
return true; |
return true; |
| 792 |
|
|
| 793 |
} |
} |
| 794 |
|
|
| 795 |
//unsigned int root_id, percentage non le devo modificare |
//unsigned int root_id, percentage non le devo modificare |
| 801 |
unsigned long int mboot_num, |
unsigned long int mboot_num, |
| 802 |
double bad_perc, |
double bad_perc, |
| 803 |
unsigned int ID_record, type_Rel_ROOT type_rel){ |
unsigned int ID_record, type_Rel_ROOT type_rel){ |
|
stringstream oss; |
|
|
oss.str(""); |
|
| 804 |
|
|
| 805 |
|
stringstream oss; |
| 806 |
|
oss.str(""); |
| 807 |
|
|
| 808 |
if(type_rel == AFTER){ |
if(type_rel == AFTER){ |
| 809 |
mainLogUtil->logInfo("Relaz:AFTER = Updating Last values of the DB ROOT file"); |
mainLogUtil->logInfo("Relaz:AFTER = Updating Last values of the DB ROOT file"); |
| 810 |
//marco_new:tolti tutti gli apici che qui non devono essere |
//marco_new:tolti tutti gli apici che qui non devono essere |
| 812 |
<< " SET PKT_NUMBER_FINAL ="<< pkt_number_init |
<< " SET PKT_NUMBER_FINAL ="<< pkt_number_init |
| 813 |
<<", PKT_OBT_FINAL ="<< obt_init |
<<", PKT_OBT_FINAL ="<< obt_init |
| 814 |
<<", REAL_TIME_LAST ="<< real_time_init<<" WHERE ID_N ="<< ID_record <<";"; |
<<", REAL_TIME_LAST ="<< real_time_init<<" WHERE ID_N ="<< ID_record <<";"; |
| 815 |
|
|
| 816 |
} |
} |
| 817 |
else if(type_rel == BEFORE){ |
else if(type_rel == BEFORE){ |
| 818 |
mainLogUtil->logInfo("Relaz:BEFORE = Updating Init values of the DB ROOT file"); |
mainLogUtil->logInfo("Relaz:BEFORE = Updating Init values of the DB ROOT file"); |
| 819 |
oss << "UPDATE "<< table_name |
oss << "UPDATE "<< table_name |
| 820 |
<< " SET PKT_NUMBER_INIT ="<< pkt_number_last |
<< " SET PKT_NUMBER_INIT ="<< pkt_number_last |
| 821 |
<<", PKT_OBT_INIT ="<< obt_last |
<<", PKT_OBT_INIT ="<< obt_last |
| 829 |
<< " SET PKT_NUMBER_FINAL="<< pkt_number_init |
<< " SET PKT_NUMBER_FINAL="<< pkt_number_init |
| 830 |
<<", PKT_OBT_FINAL ="<< obt_init |
<<", PKT_OBT_FINAL ="<< obt_init |
| 831 |
<<", REAL_TIME_LAST ="<< real_time_init<<" WHERE ID_N ="<< ID_record<<";"; |
<<", REAL_TIME_LAST ="<< real_time_init<<" WHERE ID_N ="<< ID_record<<";"; |
|
|
|
|
mainLogUtil->logInfo("Relaz:SMALLER = (2nd part) Saving the second part of the DB ROOT file"); |
|
| 832 |
|
|
| 833 |
saveMergeROOT_DB(table_name, root_id, |
mainLogUtil->logInfo("Relaz:SMALLER = (2nd part) Saving the second part of the DB ROOT file"); |
| 834 |
pkt_number_last, pkt_number_fin, |
|
| 835 |
obt_last, obt_fin, |
saveMergeROOT_DB(table_name, root_id, |
| 836 |
real_time_last, mtime_last, |
pkt_number_last, pkt_number_fin, |
| 837 |
mboot_num, |
obt_last, obt_fin, |
| 838 |
bad_perc); |
real_time_last, mtime_last, |
| 839 |
|
mboot_num, |
| 840 |
|
bad_perc); |
| 841 |
} |
} |
| 842 |
else if(type_rel == BIGGER){ |
else if(type_rel == BIGGER){ |
| 843 |
//marco_new: ok anche se coincidenti etc |
//marco_new: ok anche se coincidenti etc |
| 844 |
oss << "DELETE FROM "<< table_name <<" WHERE ID_N ="<< ID_record<<";"; |
oss << "DELETE FROM "<< table_name <<" WHERE ID_N ="<< ID_record<<";"; |
| 845 |
mainLogUtil->logInfo("Rimosso record in Tabella merging"); |
mainLogUtil->logInfo("Record deleted from merging table"); |
| 846 |
} |
} |
| 847 |
else |
else |
| 848 |
return false; |
return false; |
| 849 |
|
|
|
|
|
|
|
|
| 850 |
string msg = oss.str(); |
string msg = oss.str(); |
| 851 |
mainLogUtil->logInfo(msg); |
mainLogUtil->logInfo(msg); |
| 852 |
|
|
| 867 |
return true; |
return true; |
| 868 |
} |
} |
| 869 |
|
|
| 870 |
//marco_new: check here |
//cerca eventuali ROOT files in DB che possono venire mergiati |
| 871 |
|
//marco_new bordi: messo in after a before casi in cui smaller con un bordo in comune |
| 872 |
|
//marco_new bordi: messo in bigger casi con bordi in comune; tra questi anche caso particolare di coincidente |
| 873 |
|
//marco_new bordi: smaller resta solo caso in cui DB e' piu largo sia a dx che a sx |
| 874 |
TSQLResult* PacketUser::Select_merging(char* table_name, unsigned long int mtime_init, unsigned long int mtime_last, type_Rel_ROOT type_rel) |
TSQLResult* PacketUser::Select_merging(char* table_name, unsigned long int mtime_init, unsigned long int mtime_last, type_Rel_ROOT type_rel) |
| 875 |
{ |
{ |
|
|
|
|
// unsigned int idN=0; |
|
| 876 |
TSQLResult* res=NULL; |
TSQLResult* res=NULL; |
| 877 |
stringstream query; |
stringstream query; |
| 878 |
query.str(""); |
query.str(""); |
| 879 |
|
|
|
//marco_new bordi: messo in after a before casi in cui smaller con un bordo in comune |
|
|
//marco_new bordi: messo in bigger casi con bordi in comune; tra questi anche caso particolare di coincidente |
|
|
//marco_new bordi: smaller resta solo caso in cui DB � piu largo sia a dx che a sx |
|
| 880 |
if(type_rel == AFTER) |
if(type_rel == AFTER) |
| 881 |
query<<"select * from "<<table_name<<" where REAL_TIME_LAST > "<< mtime_init <<" and REAL_TIME_LAST <= "<< mtime_last <<" and REAL_TIME_INIT < "<< mtime_init; |
query<<"select * from "<<table_name<<" where REAL_TIME_LAST > "<< mtime_init <<" and REAL_TIME_LAST <= "<< mtime_last <<" and REAL_TIME_INIT < "<< mtime_init; |
| 882 |
else if(type_rel == BEFORE) |
else if(type_rel == BEFORE) |
| 889 |
return 0; |
return 0; |
| 890 |
|
|
| 891 |
query<< " order by REAL_TIME_INIT ASC";//marco_new: inutile |
query<< " order by REAL_TIME_INIT ASC";//marco_new: inutile |
| 892 |
|
//se volessi mettere un filtro sulla qualita' |
| 893 |
// 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" ; |
|
|
|
|
|
|
| 894 |
string msg = query.str(); |
string msg = query.str(); |
| 895 |
mainLogUtil->logAll(msg); |
mainLogUtil->logAll(msg); |
| 896 |
|
res= sqlServer->Query(query.str().c_str()); |
|
res= sqlServer->Query(query.str().c_str()); |
|
|
|
|
| 897 |
stringstream oss1; |
stringstream oss1; |
| 898 |
oss1.str()=""; |
oss1.str()=""; |
| 899 |
string msg1; |
string msg1; |
| 900 |
|
|
| 901 |
if (!res) |
if (!res) |
| 902 |
{ |
{ |
| 928 |
|
|
| 929 |
string msg = oss.str(); |
string msg = oss.str(); |
| 930 |
mainLogUtil->logAll(msg); |
mainLogUtil->logAll(msg); |
| 931 |
|
|
| 932 |
|
|
| 933 |
//marco_new: controlla |
//marco_new: controlla |
| 934 |
//marco_new: esci se sono arrivato a zero |
//marco_new: esci se sono arrivato a zero |
| 941 |
return true; |
return true; |
| 942 |
} |
} |
| 943 |
|
|
|
|
|
| 944 |
stringstream oss1; |
stringstream oss1; |
| 945 |
oss1.str()=""; |
oss1.str()=""; |
| 946 |
string msg1; |
string msg1; |
| 971 |
stringstream oss; |
stringstream oss; |
| 972 |
oss.str(""); |
oss.str(""); |
| 973 |
oss<<"select max(ID_N) from "<<table_name; |
oss<<"select max(ID_N) from "<<table_name; |
| 974 |
string msg = oss.str(); |
// string msg = oss.str(); |
| 975 |
mainLogUtil->logAll(msg); |
// mainLogUtil->logAll(msg); |
| 976 |
res= sqlServer->Query(oss.str().c_str()); |
res= sqlServer->Query(oss.str().c_str()); |
| 977 |
|
|
| 978 |
stringstream oss1; |
stringstream oss1; |
| 1000 |
idN=atoi(row->GetField(0)); |
idN=atoi(row->GetField(0)); |
| 1001 |
if(row){delete row; row = NULL;} |
if(row){delete row; row = NULL;} |
| 1002 |
if(res){delete res; res = NULL;} |
if(res){delete res; res = NULL;} |
| 1003 |
|
|
| 1004 |
|
oss<<". idN = "<<idN; |
| 1005 |
|
string msg = oss.str(); |
| 1006 |
|
mainLogUtil->logAll(msg); |
| 1007 |
|
|
| 1008 |
return idN; |
return idN; |
| 1009 |
} |
} |
| 1010 |
|
|
| 1042 |
} |
} |
| 1043 |
|
|
| 1044 |
if(res){delete res; res = NULL;} |
if(res){delete res; res = NULL;} |
| 1045 |
mainLogUtil->logAll("######################### TABLES LOCKED ############################"); |
mainLogUtil->logAll("TABLES LOCKED"); |
| 1046 |
return 0; |
return 0; |
| 1047 |
} |
} |
| 1048 |
|
|
| 1076 |
} |
} |
| 1077 |
|
|
| 1078 |
if(res){delete res; res = NULL;} |
if(res){delete res; res = NULL;} |
| 1079 |
mainLogUtil->logAll("######################### TABLES UNLOCKED ############################"); |
mainLogUtil->logAll("TABLES UNLOCKED"); |
| 1080 |
|
|
| 1081 |
return 0; |
return 0; |
| 1082 |
} |
} |
| 1084 |
/*********************************************************/ |
/*********************************************************/ |
| 1085 |
//marco_new_31 |
//marco_new_31 |
| 1086 |
void PacketUser::OpenDBConnection(char* tableTobeLocked){ |
void PacketUser::OpenDBConnection(char* tableTobeLocked){ |
|
mainLogUtil->logAll("######################### OpenDBConnection ############################"); |
|
| 1087 |
if(do_cont_check){ |
if(do_cont_check){ |
| 1088 |
//controllo che non sia gi� aperta |
//controllo che non sia gia' aperta |
| 1089 |
if(!sqlServer){ |
if(!sqlServer){ |
| 1090 |
sqlServer = TSQLServer::Connect(connection,db_user,db_pwd); |
sqlServer = TSQLServer::Connect(connection,db_user,db_pwd); |
| 1091 |
if ((!sqlServer)||(!(sqlServer->IsConnected()))){cout<<"Can not connect with MYSQL sever"<<endl;} |
if ((!sqlServer)||(!(sqlServer->IsConnected()))){cout<<"Can not connect with MYSQL sever"<<endl;} |
| 1092 |
|
mainLogUtil->logAll("Connected to DB"); |
| 1093 |
//marco_new: blocca tutte le tabelle |
//blocca le tabelle |
| 1094 |
LockTables(tableTobeLocked); |
LockTables(tableTobeLocked); |
|
mainLogUtil->logAll("######################### OpenDBConnection OK ############################"); |
|
| 1095 |
} |
} |
| 1096 |
} |
} |
| 1097 |
|
|
| 1099 |
|
|
| 1100 |
//marco_new_31 |
//marco_new_31 |
| 1101 |
void PacketUser::CloseDBConnection(){ |
void PacketUser::CloseDBConnection(){ |
|
mainLogUtil->logAll("######################### CloseDBConnection ############################"); |
|
| 1102 |
if(do_cont_check){ |
if(do_cont_check){ |
| 1103 |
//controllo che ce ne sia una aperta |
//controllo che ce ne sia una aperta |
| 1104 |
if(sqlServer && sqlServer->IsConnected()){ |
if(sqlServer && sqlServer->IsConnected()){ |
| 1105 |
//marco_new: sblocca tutte le tabelle |
//marco_new: sblocca tutte le tabelle |
| 1106 |
UnLockTables(); |
UnLockTables(); |
| 1107 |
sqlServer->Close(); |
sqlServer->Close(); |
| 1108 |
|
delete sqlServer; |
|
//marco_new_01: ?? |
|
|
delete sqlServer; |
|
|
|
|
| 1109 |
sqlServer=NULL; |
sqlServer=NULL; |
| 1110 |
mainLogUtil->logAll("######################### CloseDBConnection OK ############################"); |
mainLogUtil->logAll("Closed Connection to DB"); |
| 1111 |
} |
} |
| 1112 |
} |
} |
| 1113 |
} |
} |