| 1 |
//============================================================================ |
//============================================================================ |
| 2 |
// $Id: PacketUser.cpp,v 1.12 2009/12/30 14:49:51 mocchiut Exp $ |
// $Id: PacketUser.cpp,v 1.15 2010/01/15 14:31:17 mocchiut Exp $ |
| 3 |
// Description : |
// Description : |
| 4 |
//============================================================================ |
//============================================================================ |
| 5 |
#include "PacketUser.h" |
#include "PacketUser.h" |
| 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; |
| 647 |
} |
} |
| 648 |
|
|
| 649 |
CleanDisk(); |
CleanDisk(); |
| 650 |
if (!single_connection) { |
// if (!single_connection) { |
| 651 |
CloseDBConnection(); |
// CloseDBConnection(); |
| 652 |
} |
// } |
| 653 |
return; |
// return; // commented here... |
| 654 |
|
|
| 655 |
}; |
}; |
| 656 |
} |
} |
| 657 |
|
|
| 658 |
if ( real_time_init || real_time_last) { |
if ( real_time_init || real_time_last) { |
| 659 |
//saves info in DB in table Table_ROOT |
//saves info in DB in table Table_ROOT |
| 660 |
if (boot_number == 0) |
if (boot_number == 0) |
| 661 |
boot_number = boot_number_prevvalue; |
boot_number = boot_number_prevvalue; |
|
|
|
|
if (saveROOT_DB( |
|
|
Table_ROOT_Good, |
|
|
outDir, // here outDir is good, no expand EMI |
|
|
filename, pkt_number_init, pkt_number_last, obt_init, obt_last, obt_time_sync, last_time_sync_info, |
|
|
real_time_init, real_time_last, boot_number, timeOffset, bad_pkt, bad_pkt_EventReader, bad_pkt_CalibReader, |
|
|
numPKTSaved, fni, time_is_estimated) == true) { |
|
|
oss.str() = ""; |
|
|
oss << "Saved information regarding file: " << filename << " in table " << Table_ROOT_Good << " id= " << my_id; |
|
|
msg = oss.str(); |
|
|
mainLogUtil->logInfo(msg); |
|
| 662 |
|
|
| 663 |
if (tryMerge) { |
if (saveROOT_DB( |
| 664 |
merge_ROOTfiles(); |
Table_ROOT_Good, |
| 665 |
} |
outDir, // here outDir is good, no expand EMI |
| 666 |
} else { |
filename, pkt_number_init, pkt_number_last, obt_init, obt_last, obt_time_sync, last_time_sync_info, |
| 667 |
|
real_time_init, real_time_last, boot_number, timeOffset, bad_pkt, bad_pkt_EventReader, bad_pkt_CalibReader, |
| 668 |
|
numPKTSaved, fni, time_is_estimated) == true) { |
| 669 |
|
oss.str() = ""; |
| 670 |
|
oss << "Saved information regarding file: " << filename << " in table " << Table_ROOT_Good << " id= " << my_id; |
| 671 |
|
msg = oss.str(); |
| 672 |
|
mainLogUtil->logInfo(msg); |
| 673 |
|
|
| 674 |
|
if (tryMerge) { |
| 675 |
|
merge_ROOTfiles(); |
| 676 |
|
} |
| 677 |
|
} else { |
| 678 |
oss.str() = ""; |
oss.str() = ""; |
| 679 |
oss << "Problem storing information in DB regarding file: " << filename; |
oss << "Problem storing information in DB regarding file: " << filename; |
| 680 |
msg = oss.str(); |
msg = oss.str(); |
| 681 |
mainLogUtil->logError(msg); |
mainLogUtil->logError(msg); |
| 682 |
} |
} |
| 683 |
}; |
}; |
| 684 |
|
|
| 685 |
// if dbinfo is not empty than |
// if dbinfo is not empty than |
| 1461 |
if (do_cont_check) { |
if (do_cont_check) { |
| 1462 |
//controllo che non sia gia' aperta |
//controllo che non sia gia' aperta |
| 1463 |
if (!sqlServer) { |
if (!sqlServer) { |
| 1464 |
sqlServer = TSQLServer::Connect(connection, db_user, db_pwd); |
sqlServer = TSQLServer::Connect(pelosconnection, db_user, db_pwd); |
| 1465 |
if ((!sqlServer) || (!(sqlServer->IsConnected()))) { |
if ((!sqlServer) || (!(sqlServer->IsConnected()))) { |
| 1466 |
cout << "Can not connect with MYSQL sever" << endl; |
cout << "Can not connect with MYSQL sever" << endl; |
| 1467 |
} |
} |