| 48 |
* @param tsync file timesync. |
* @param tsync file timesync. |
| 49 |
* @param debug debug flag. |
* @param debug debug flag. |
| 50 |
*/ |
*/ |
| 51 |
PamelaDBOperations::PamelaDBOperations(TString host, TString user, TString password, TString filerawname, TString filerootname, UInt_t boot, UInt_t tsync, UInt_t obt0, Bool_t debug, Long64_t olderthan){ |
PamelaDBOperations::PamelaDBOperations(TString host, TString user, TString password, TString filerawname, TString filerootname, UInt_t boot, UInt_t tsync, UInt_t obt0, Bool_t debug){ |
| 52 |
// |
// |
| 53 |
// |
// |
| 54 |
SetConnection(host,user,password); |
SetConnection(host,user,password); |
| 67 |
if(INSERT_RAW)SetRawName(filerawname); |
if(INSERT_RAW)SetRawName(filerawname); |
| 68 |
// |
// |
| 69 |
INSERT_ROOT = !filerootname.IsNull(); |
INSERT_ROOT = !filerootname.IsNull(); |
| 70 |
if(INSERT_ROOT){ |
if( INSERT_ROOT ){ |
| 71 |
file = TFile::Open(this->GetRootName().Data()); |
file = TFile::Open(this->GetRootName().Data()); |
| 72 |
if ( !file ) INSERT_ROOT = false; |
// if ( !file ) INSERT_ROOT = false; |
| 73 |
}; |
}; |
| 74 |
// this->OpenFile(); |
// this->OpenFile(); |
| 75 |
// |
// |
| 76 |
this->SetID_RAW(0); |
this->SetID_RAW(0); |
| 77 |
this->SetID_ROOT(0); |
this->SetID_ROOT(0); |
| 78 |
|
|
| 79 |
VALIDATE = false; |
VALIDATE = false; |
|
clean_time = new TDatime(); |
|
|
if(olderthan >= 0){ |
|
|
VALIDATE = true; |
|
|
UInt_t timelim = 0; |
|
|
// timelim = now - olderthan |
|
|
timelim = (UInt_t)clean_time->Convert() - olderthan; |
|
|
clean_time->Set(timelim,false); |
|
|
}; |
|
| 80 |
|
|
| 81 |
// |
// |
| 82 |
}; |
}; |
| 83 |
|
|
| 84 |
/** |
/** |
| 95 |
// SETTERS |
// SETTERS |
| 96 |
// |
// |
| 97 |
|
|
| 98 |
|
// |
| 99 |
|
// must be out of the constructor in order to FORCE the validation of the latest runs in case you run the validation together with the latest file |
| 100 |
|
// |
| 101 |
|
void PamelaDBOperations::CheckValidate(Long64_t olderthan){ |
| 102 |
|
clean_time = new TDatime(); |
| 103 |
|
if(olderthan >= 0){ |
| 104 |
|
VALIDATE = true; |
| 105 |
|
UInt_t timelim = 0; |
| 106 |
|
timelim = (UInt_t)clean_time->Convert() - olderthan; |
| 107 |
|
clean_time->Set(timelim,false); |
| 108 |
|
}; |
| 109 |
|
}; |
| 110 |
|
|
| 111 |
/** |
/** |
| 112 |
* Open the DB connection |
* Open the DB connection |
| 113 |
* @param host hostname for the SQL connection. |
* @param host hostname for the SQL connection. |
| 656 |
// void PamelaDBOperations::OpenFile(){ |
// void PamelaDBOperations::OpenFile(){ |
| 657 |
// file = TFile::Open(this->GetRootName().Data()); |
// file = TFile::Open(this->GetRootName().Data()); |
| 658 |
// // |
// // |
| 659 |
// if ( !file ) throw -12; |
|
| 660 |
// }; |
void PamelaDBOperations::CheckFile(){ |
| 661 |
|
if ( !file ) throw -12; |
| 662 |
|
}; |
| 663 |
|
|
| 664 |
|
|
| 665 |
/** |
/** |