#include <DbiWriter.h>
Public Member Functions | |
| DbiWriter () | |
| DbiWriter (const VldRange &vr, Int_t aggNo, Dbi::Task task, VldTimeStamp creationDate, const std::string &dbName, const std::string &logComment="", const std::string &tableName="") | |
| DbiWriter (const VldRange &vr, Int_t aggNo, Dbi::Task task=0, VldTimeStamp creationDate=VldTimeStamp(0, 0), UInt_t dbNo=0, const std::string &logComment="", const std::string &tableName="") | |
| DbiWriter (const DbiValidityRec &vrec, const std::string &dbName, const std::string &logComment="") | |
| DbiWriter (const DbiValidityRec &vrec, UInt_t dbNo=0, const std::string &logComment="") | |
| virtual | ~DbiWriter () |
| DbiTableProxy & | TableProxy () const |
| Bool_t | IsOpen (Bool_t reportErrors=kTRUE) const |
| Open and ready to receive data. | |
| Bool_t | CanOutput (Bool_t reportErrors=kTRUE) const |
| Open and ready to receive/output data. | |
| void | SetDbNo (UInt_t dbNo) |
| void | SetDbName (const string &dbName) |
| void | SetLogComment (const std::string &reason) |
| void | SetRequireGlobalSeqno (Int_t requireGlobal) |
| void | SetOverlayCreationDate () |
| void | Abort () |
| Bool_t | Close (const char *fileSpec=0) |
| Bool_t | Open (const VldRange &vr, Int_t aggNo, Dbi::Task task, VldTimeStamp creationDate, const string &dbName, const std::string &logComment="") |
| Bool_t | Open (const VldRange &vr, Int_t aggNo, Dbi::Task task=0, VldTimeStamp creationDate=VldTimeStamp(), UInt_t dbNo=0, const std::string &logComment="") |
| Bool_t | Open (const DbiValidityRec &vrec, const string &dbName, const std::string &logComment="") |
| Bool_t | Open (const DbiValidityRec &vrec, UInt_t dbNo=0, const std::string &logComment="") |
| DbiWriter< T > & | operator<< (const T &row) |
Private Member Functions | |
| Bool_t | NeedsLogEntry () const |
| Bool_t | WritingToMaster () const |
| DbiWriter (const DbiWriter &) | |
| DbiWriter & | operator= (const DbiWriter &) |
| void | CompleteOpen (UInt_t dbNo=0, const std::string &logComment="") |
| void | Reset () |
Static Private Member Functions | |
| DbiTableProxy & | GetTableProxy () |
| DbiTableProxy & | GetTableProxy (const std::string &tableName) |
Private Attributes | |
| Int_t | fAggregateNo |
| Aggregate noumber for set. | |
| UInt_t | fDbNo |
| Database number in cascade. | |
| DbiSqlValPacket * | fPacket |
| The assembled record to be output. Never null. | |
| Int_t | fRequireGlobalSeqno |
| Controls SEQNO type (see DbiCascader::AllocateSeqNo). | |
| DbiTableProxy * | fTableProxy |
| Proxy to associated table. | |
| std::string | fTableName |
| Associated table name. | |
| Bool_t | fUseOverlayCreationDate |
| Use overlay creation date if true. | |
| DbiValidityRec * | fValidRec |
| Validity record. May be =0 if closed. | |
| DbiLogEntry | fLogEntry |
| Associated log entry (if any) for update. | |
DatabaseInterface
Contact: n.west1@physics.ox.ac.uk
Definition at line 45 of file DbiWriter.h.
|
|||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 128 of file DbiWriter.tpl. References DbiWriter< T >::fTableName, LEA_CTOR, MSG, and DbiWriter< T >::Open(). 00134 : 00135 fAggregateNo(aggNo), 00136 fPacket(new DbiSqlValPacket), 00137 fRequireGlobalSeqno(0), 00138 fTableProxy(&DbiWriter<T>::GetTableProxy(tableName)), 00139 fTableName(fTableProxy->GetTableName()), 00140 fUseOverlayCreationDate(creationDate == VldTimeStamp(0,0)), 00141 fValidRec(0), 00142 fLogEntry(fTableName,logComment,vr.GetDetectorMask(),vr.GetSimMask(),task) 00143 { 00144 // 00145 // Purpose: Constructor 00146 // 00147 // Arguments: 00148 // vr in Validity range of validity set. 00149 // aggNo in Aggregate number of validity set. 00150 // task in Task of validity set. 00151 // creationDate in Creation date of validity set. 00152 // dbName in Database name. 00153 // logComment in Reason for update. 00154 // tableName in Table name (default: "" - get table name from object type) 00155 // 00156 // Return: n/a 00157 // 00158 // Contact: N. West 00159 // 00160 // Specification:- 00161 // ============= 00162 // 00163 // o Create Writer. 00164 00165 00166 // Program Notes:- 00167 // ============= 00168 00169 // None. 00170 00171 LEA_CTOR //Leak Checker 00172 00173 MSG("Dbi", Msg::kVerbose) 00174 << "Creating DbiWriter for " << fTableName << endl; 00175 00176 Open(vr,aggNo,task,creationDate,dbName,logComment); 00177 00178 }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 72 of file DbiWriter.tpl. References DbiWriter< T >::fTableName, LEA_CTOR, MSG, and DbiWriter< T >::Open(). 00078 : 00079 fAggregateNo(aggNo), 00080 fDbNo(dbNo), 00081 fPacket(new DbiSqlValPacket), 00082 fRequireGlobalSeqno(0), 00083 fTableProxy(&DbiWriter<T>::GetTableProxy(tableName)), 00084 fTableName(fTableProxy->GetTableName()), 00085 fUseOverlayCreationDate(creationDate == VldTimeStamp(0,0)), 00086 fValidRec(0), 00087 fLogEntry(fTableName,logComment,vr.GetDetectorMask(),vr.GetSimMask(),task) 00088 { 00089 // 00090 // Purpose: Constructor 00091 // 00092 // Arguments: 00093 // vr in Validity range of validity set. 00094 // aggNo in Aggregate number of validity set. 00095 // task in Task of validity set. 00096 // creationDate in Creation date of validity set. 00097 // dbNo in Database number in cascade (starting at 0). 00098 // logComment in Reason for update. 00099 // tableName in Table name (default: "" - get table name from object type) 00100 // 00101 // Return: n/a 00102 // 00103 // Contact: N. West 00104 // 00105 // Specification:- 00106 // ============= 00107 // 00108 // o Create Writer. 00109 00110 00111 // Program Notes:- 00112 // ============= 00113 00114 // None. 00115 00116 LEA_CTOR //Leak Checker 00117 00118 MSG("Dbi", Msg::kVerbose) 00119 << "Creating DbiWriter for " << fTableName << endl; 00120 00121 Open(vr,aggNo,task,creationDate,dbNo,logComment); 00122 00123 }
|
|
||||||||||||||||||||
|
Definition at line 234 of file DbiWriter.tpl. References LEA_CTOR, MSG, and DbiWriter< T >::Open(). 00236 : 00237 fAggregateNo(0), 00238 00239 fPacket(new DbiSqlValPacket), 00240 fRequireGlobalSeqno(0), 00241 fTableProxy(0), 00242 fUseOverlayCreationDate(kFALSE), 00243 fValidRec(new DbiValidityRec(vrec)), 00244 fLogEntry(fTableName,logComment,vrec.GetVldRange().GetDetectorMask(), 00245 vrec.GetVldRange().GetSimMask(),vrec.GetTask()) 00246 { 00247 // 00248 // Purpose: Constructor 00249 // 00250 // Arguments: 00251 // vrec in Validity record for set. 00252 // MUST have an associated DbiTableProxy 00253 // dbName in Database name. 00254 // logComment in Reason for update. 00255 // 00256 // 00257 // Return: n/a 00258 // 00259 // Contact: N. West 00260 // 00261 // Specification:- 00262 // ============= 00263 // 00264 // o Create Writer. 00265 00266 00267 // Program Notes:- 00268 // ============= 00269 00270 // None. 00271 00272 LEA_CTOR //Leak Checker 00273 00274 T pet; 00275 MSG("Dbi", Msg::kVerbose) 00276 << "Creating DbiWriter for " << pet.GetName() << endl; 00277 00278 this->Open(vrec,dbName,logComment); 00279 00280 }
|
|
||||||||||||||||||||
|
Definition at line 183 of file DbiWriter.tpl. References LEA_CTOR, MSG, and DbiWriter< T >::Open(). 00185 : 00186 fAggregateNo(0), 00187 fDbNo(dbNo), 00188 fPacket(new DbiSqlValPacket), 00189 fRequireGlobalSeqno(0), 00190 fTableProxy(0), 00191 fUseOverlayCreationDate(kFALSE), 00192 fValidRec(new DbiValidityRec(vrec)), 00193 fLogEntry(fTableName,logComment,vrec.GetVldRange().GetDetectorMask(), 00194 vrec.GetVldRange().GetSimMask(),vrec.GetTask()) 00195 { 00196 // 00197 // Purpose: Constructor 00198 // 00199 // Arguments: 00200 // vrec in Validity record for set. 00201 // MUST have an associated DbiTableProxy 00202 // dbNo in Database number in cascade (starting at 0). 00203 // logComment in Reason for update. 00204 // 00205 // 00206 // Return: n/a 00207 // 00208 // Contact: N. West 00209 // 00210 // Specification:- 00211 // ============= 00212 // 00213 // o Create Writer. 00214 00215 00216 // Program Notes:- 00217 // ============= 00218 00219 // None. 00220 00221 LEA_CTOR //Leak Checker 00222 00223 T pet; 00224 MSG("Dbi", Msg::kVerbose) 00225 << "Creating DbiWriter for " << pet.GetName() << endl; 00226 00227 this->Open(vrec,dbNo,logComment); 00228 00229 }
|
|
|||||||||
|
Definition at line 285 of file DbiWriter.tpl. References DbiWriter< T >::fPacket, DbiWriter< T >::fValidRec, LEA_DTOR, MSG, and DbiWriter< T >::Reset(). 00285 {
00286 //
00287 //
00288 // Purpose: Destructor
00289
00290 LEA_DTOR //Leak Checker
00291
00292 MSG("Dbi", Msg::kVerbose) << "Destroying DbiWriter" << endl;
00293
00294 Reset();
00295 delete fPacket;
00296 fPacket = 0;
00297 delete fValidRec;
00298 fValidRec = 0;
00299
00300 }
|
|
||||||||||
|
|
|
|||||||||
|
Definition at line 94 of file DbiWriter.h. Referenced by DbiWriter< T >::operator<<(). 00094 { Reset(); }
|
|
||||||||||
|
Open and ready to receive/output data.
Definition at line 336 of file DbiWriter.tpl. References DbiWriter< T >::fLogEntry, DbiWriter< T >::fPacket, DbiWriter< T >::fTableName, DbiSqlValPacket::GetNumSqlStmts(), DbiSqlValPacket::GetStmt(), DbiLogEntry::HasReason(), DbiWriter< T >::IsOpen(), MSG, DbiWriter< T >::NeedsLogEntry(), and DbiSqlValPacket::Print(). Referenced by DbiWriter< T >::Close(), DetailedTimeCal(), load_better_mipcal(), load_mc_mipcal(), main(), LIPlexMaps::MakeCalAdcToPe(), LIPlexMaps::MakeCalMIPCalibration(), LIPlexMaps::MakeCalStripAtten(), LIPlexMaps::MakeCalStripToStrip(), LIPlexMaps::MakePlexStripEndToLed(), MakeTimeCal(), and DbiWriter< T >::Open(). 00336 {
00337 //
00338 //
00339 // Purpose: Return true if open and ready to receive/output data.
00340
00341 if ( ! this->IsOpen(reportErrors) ) return kFALSE;
00342
00343 if ( this->NeedsLogEntry() && ! fLogEntry.HasReason() ) {
00344 if ( reportErrors ) MSG("Dbi",Msg::kError)
00345 << "Cannot output validity set for table "
00346 << fTableName
00347 << ", writing to Master DB but no log comment has been supplied." << endl;
00348 return kFALSE;
00349 }
00350
00351 UInt_t nstmts = fPacket->GetNumSqlStmts();
00352
00353 if ( nstmts == 0 ) {
00354 // not even a VLD insert
00355 if ( reportErrors ) MSG("Dbi",Msg::kError)
00356 << "Cannot output validity set for table "
00357 << fTableName
00358 << ", no data has been written." << endl;
00359 return kFALSE;
00360 }
00361
00362 if ( nstmts == 1 ) {
00363 // if VLD insert present but no data rows, just issue a stern warning
00364 // as it may be intended to obscure now invalid data
00365 string stmt = fPacket->GetStmt(0);
00366 bool isvldentry =
00367 (stmt.find("INSERT INTO") != string::npos ) &&
00368 (stmt.find("VLD VALUES") != string::npos);
00369 if ( isvldentry ) {
00370 if ( reportErrors ) MSG("Dbi",Msg::kWarning)
00371 << "VLD entry but no data for "
00372 << fTableName << endl;
00373 }
00374 else {
00375 // this should never, ever happen ... but let's be paranoid
00376 if ( reportErrors ) {
00377 MSG("Dbi",Msg::kError)
00378 << "Cannot output validity set for table "
00379 << fTableName
00380 << ", (no VLD info) no data has been written." << endl;
00381 fPacket->Print();
00382 }
00383 return kFALSE;
00384 }
00385 }
00386
00387 return kTRUE;
00388 }
|
|
||||||||||
|
||||||||||||||||
|
Definition at line 467 of file DbiWriter.tpl. References DbiWriter< T >::fAggregateNo, DbiWriter< T >::fDbNo, DbiWriter< T >::fLogEntry, DbiWriter< T >::fPacket, DbiWriter< T >::fTableName, DbiWriter< T >::fTableProxy, DbiWriter< T >::fValidRec, DbiValidityRec::GetAggregateNo(), DbiValidityRec::GetCreationDate(), VldRange::GetDetectorMask(), VldRange::GetSimMask(), DbiTableProxy::GetTableName(), DbiValidityRec::GetTask(), DbiValidityRec::GetVldRange(), MSG, DbiLogEntry::Recreate(), DbiSqlValPacket::Recreate(), and DbiWriter< T >::Reset(). Referenced by DbiWriter< T >::Open(). 00468 {
00469 //
00470 //
00471 // Purpose: Complete the open process
00472 //
00473 // Arguments:
00474 // dbNo in Database number in cascade (starting at 0).
00475 // logComment in Reason for update.
00476 //
00477 //
00478 // Specification:-
00479 // =============
00480 //
00481 // o Complete reinitialisation for new I/O
00482
00483 // Program Notes:-
00484 // =============
00485
00486 // Assumes that fTableProxy, fUseOverlayCreationDate, fValidRec are
00487 // already initialised.
00488
00489
00490 fDbNo = dbNo;
00491 if ( (int) fDbNo < 0 ) {
00492 MSG("Dbi",Msg::kError) << "Bad database name/number selected. " << endl;
00493 this->Reset();
00494 return;
00495 }
00496
00497 fAggregateNo = fValidRec->GetAggregateNo();
00498 fTableName = fTableProxy->GetTableName(),
00499
00500 // Recreate validity packet.
00501 fPacket->Recreate(fTableName,
00502 fValidRec->GetVldRange(),
00503 fAggregateNo,
00504 fValidRec->GetTask(),
00505 fValidRec->GetCreationDate());
00506
00507 // Recreate log entry.
00508 const VldRange& vr = fValidRec->GetVldRange();
00509 fLogEntry.Recreate(fTableName,
00510 logComment,
00511 vr.GetDetectorMask(),
00512 vr.GetSimMask(),
00513 fValidRec->GetTask());
00514
00515 }
|
|
||||||||||
|
Definition at line 539 of file DbiWriter.tpl. References DbiResultPtr< T >::GetTableProxy(). 00540 {
00541 //
00542 //
00543 // Purpose: Private static function to find an alternative
00544 // associated DbiTableProxy.
00545 //
00546 // Arguments:
00547 // tableName in Alternative table name
00548 //
00549 // Return: Associated DbiTableProxy.
00550 //
00551 // Contact: N. West
00552 //
00553 // Specification:-
00554 // =============
00555 //
00556 // o Ask Registry for alternative Table Proxy and return it.
00557
00558 // As DbiResultPtr classes are in 1:1 correspondance with DbiWriter
00559 // classes, DbiWriter uses the static methods from DbiResultPtr
00560 // to find the associated DbiTableProxy.
00561
00562 return DbiResultPtr<T>::GetTableProxy(tableName);
00563
00564 }
|
|
|||||||||
|
Definition at line 520 of file DbiWriter.tpl. References DbiResultPtr< T >::GetTableProxy(). Referenced by DbiWriter< T >::Open(), and DbiWriter< T >::Reset(). 00520 {
00521 //
00522 //
00523 // Purpose: Private static function to find default associated
00524 // DbiTableProxy.
00525
00526 // Program Notes:-
00527 // =============
00528
00529 // As DbiResultPtr classes are in 1:1 correspondance with DbiWriter
00530 // classes, DbiWriter uses the static methods from DbiResultPtr
00531 // to find the associated DbiTableProxy.
00532
00533 return DbiResultPtr<T>::GetTableProxy();
00534 }
|
|
||||||||||
|
Open and ready to receive data.
Definition at line 568 of file DbiWriter.tpl. References DbiWriter< T >::fPacket, DbiWriter< T >::fTableName, DbiWriter< T >::fValidRec, DbiSqlValPacket::GetNumSqlStmts(), DbiTableProxyRegistry::IsActive(), and MSG. Referenced by DbiWriter< T >::CanOutput(), LIPlexMaps::MakeCalAdcToPe(), LIPlexMaps::MakeCalMIPCalibration(), LIPlexMaps::MakeCalStripAtten(), LIPlexMaps::MakeCalStripToStrip(), LIPlexMaps::MakePlexStripEndToLed(), DbiWriter< T >::operator<<(), PulserGainFit::RunNearFarFits(), and PulserGainFit::RunPinFits(). 00568 {
00569 //
00570 //
00571 // Purpose: Return true if open and ready to receive data.
00572
00573 if ( ! DbiTableProxyRegistry::IsActive() ) {
00574 if ( reportErrors ) MSG("Dbi",Msg::kError)
00575 << "Cannot use DbiWriter, the DBI has been shutdown." << endl;
00576 }
00577 else if ( !fValidRec
00578 || fPacket->GetNumSqlStmts() < 1 ) {
00579 if ( reportErrors ) MSG("Dbi",Msg::kError)
00580 << "Cannot do I/O on DbiWriter for "
00581 << fTableName
00582 <<", it is currently closed." << endl;
00583 }
00584 else return kTRUE;
00585
00586 return kFALSE;
00587
00588 }
|
|
|||||||||
|
Definition at line 592 of file DbiWriter.tpl. References DbiWriter< T >::fTableName, and DbiWriter< T >::WritingToMaster(). Referenced by DbiWriter< T >::CanOutput(), and DbiWriter< T >::Close(). 00592 {
00593 //
00594 //
00595 // Purpose: Return true if a log entry is required.
00596
00597 // Some tables are created automatically so don't require entries.
00598 string tableName(fTableName);
00599 if ( tableName.substr(0,7) == "BEAMMON"
00600 || tableName.substr(0,16) == "BFLDDBICOILSTATE"
00601 || tableName.substr(0,3) == "CAL"
00602 || tableName.substr(0,20) == "CANDDIGITBADCHANNELS"
00603 || tableName.substr(0,3) == "DBU"
00604 || tableName.substr(0,3) == "DCS"
00605 || tableName.substr(0,6) == "PULSER"
00606 || tableName.substr(0,9) == "SPILLTIME" ) return kFALSE;
00607
00608 // All other tables need entries if writing to a Master database.
00609
00610 return this->WritingToMaster();
00611
00612 }
|
|
||||||||||||||||||||
|
Definition at line 705 of file DbiWriter.tpl. References DbiWriter< T >::CanOutput(), DbiWriter< T >::Close(), DbiWriter< T >::CompleteOpen(), DbiWriter< T >::fTableProxy, DbiWriter< T >::fUseOverlayCreationDate, DbiWriter< T >::fValidRec, DbiValidityRec::GetCreationDate(), DbiTableProxy::GetTableName(), DbiValidityRec::GetTableProxy(), DbiWriter< T >::GetTableProxy(), DbiTableProxyRegistry::IsActive(), MSG, and DbiWriter< T >::Reset(). 00707 {
00708
00709 //
00710 // Purpose: Output any existing data and open new validity set.
00711 //
00712 // Arguments:
00713 // vrec in Validity record for set.
00714 // MUST have an associated DbiTableProxy
00715 // dbNo in Database number in cascade (starting at 0).
00716 // logComment in Reason for update.
00717 //
00718 //
00719 // Return: kTRUE if no errors detected.
00720 //
00721 // Contact: N. West
00722 //
00723 // Specification:-
00724 // =============
00725 //
00726 // o Output any existing data and open new validity set.
00727
00728
00729 // Program Notes:-
00730 // =============
00731
00732 // None.
00733
00734 bool ok = true;
00735
00736 if ( ! DbiTableProxyRegistry::IsActive() ) return kFALSE;
00737 if ( this->CanOutput(kFALSE) ) ok = Close();
00738
00739
00740 // Check that vrec is associated with the right table, but waive
00741 // test for DbiConfigSet so that it can be used with any.
00742 const DbiTableProxy& proxyDefault = DbiWriter<T>::GetTableProxy();
00743 const DbiTableProxy& proxyVrec = *vrec.GetTableProxy();
00744 if ( proxyDefault.GetTableName() != "DBICONFIGSET"
00745 && proxyVrec.GetTableName() != proxyDefault.GetTableName() ) {
00746 MSG("Dbi",Msg::kError)
00747 << "Unable to create DbiWriter from query:" << endl
00748 << vrec
00749 << " was filled by " << proxyVrec.GetTableName()
00750 << " not by " << proxyDefault.GetTableName() << endl;
00751 this->Reset();
00752 return false;
00753 }
00754 else {
00755 // Have to cast away const - DbiWriter needs a modifiable DbiTableProxy.
00756 fTableProxy = const_cast<DbiTableProxy*>(&proxyVrec);
00757 }
00758
00759 fUseOverlayCreationDate = vrec.GetCreationDate() == VldTimeStamp(0,0);
00760
00761 delete fValidRec;
00762 fValidRec = new DbiValidityRec(vrec);
00763
00764 // Complete opening.
00765 this->CompleteOpen(dbNo,logComment);
00766 return ok;
00767
00768 }
|
|
||||||||||||||||||||
|
Definition at line 773 of file DbiWriter.tpl. References DbiWriter< T >::fDbNo, DbiWriter< T >::Open(), and DbiWriter< T >::SetDbName(). 00775 {
00776
00777 //
00778 // Purpose: Output any existing data and open new validity set.
00779 //
00780 // Arguments:
00781 // vrec in Validity record for set.
00782 // MUST have an associated DbiTableProxy
00783 // dbName in Database name.
00784 // logComment in Reason for update.
00785 //
00786 //
00787 // Return: kTRUE if no errors detected.
00788
00789 this->SetDbName(dbName);
00790 return this->Open(vrec,
00791 fDbNo,
00792 logComment);
00793
00794 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 617 of file DbiWriter.tpl. References DbiWriter< T >::CanOutput(), DbiWriter< T >::Close(), DbiWriter< T >::CompleteOpen(), DbiWriter< T >::fTableName, DbiWriter< T >::fTableProxy, DbiWriter< T >::fUseOverlayCreationDate, DbiWriter< T >::fValidRec, DbiWriter< T >::GetTableProxy(), and DbiTableProxyRegistry::IsActive(). 00622 {
00623 //
00624 //
00625 // Purpose: Output any existing data and open new validity set.
00626 //
00627 // Arguments:
00628 // vr in Validity range of validity set.
00629 // aggNo in Aggregate number of validity set.
00630 // task in Task of validity set.
00631 // creationDate in Creation date of validity set.
00632 // dbNo in Database number in cascade (starting at 0).
00633 // logComment in Reason for update.
00634 //
00635 // Return: kTRUE if no errors detected.
00636 //
00637 // Contact: N. West
00638 //
00639 // Specification:-
00640 // =============
00641 //
00642 // o Output any existing data and open new validity set.
00643
00644 // Program Notes:-
00645 // =============
00646
00647 // None.
00648
00649 bool ok = true;
00650
00651 if ( ! DbiTableProxyRegistry::IsActive() ) return kFALSE;
00652 if ( this->CanOutput(kFALSE) ) ok = Close();
00653
00654 // Test for special creation date.
00655 fUseOverlayCreationDate = creationDate == VldTimeStamp(0,0);
00656
00657 // Create a validity record.
00658 delete fValidRec;
00659 fValidRec = new DbiValidityRec(vr,task,aggNo,0,0,kFALSE,creationDate);
00660
00661 // Get a proxy.
00662 fTableProxy = &DbiWriter<T>::GetTableProxy(fTableName);
00663
00664 // Complete opening.
00665 this->CompleteOpen(dbNo,logComment);
00666 return ok;
00667
00668 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 672 of file DbiWriter.tpl. References DbiWriter< T >::fDbNo, and DbiWriter< T >::SetDbName(). Referenced by DbiWriter< T >::DbiWriter(), DbiWriter< T >::Open(), PulserGainFit::RunNearFarFits(), PulserGainFit::RunPinFits(), and FitGC::WriteDB(). 00677 {
00678 //
00679 //
00680 // Purpose: Output any existing data and open new validity set.
00681 //
00682 // Arguments:
00683 // vr in Validity range of validity set.
00684 // aggNo in Aggregate number of validity set.
00685 // task in Task of validity set.
00686 // creationDate in Creation date of validity set.
00687 // dbName in Database name.
00688 // logComment in Reason for update.
00689 //
00690 // Return: kTRUE if no errors detected.
00691
00692 this->SetDbName(dbName);
00693 return this->Open(vr,
00694 aggNo,
00695 task,
00696 creationDate,
00697 fDbNo,
00698 logComment);
00699
00700 }
|
|
||||||||||
|
Definition at line 306 of file DbiWriter.tpl. References DbiWriter< T >::Abort(), DbiSqlValPacket::AddDataRow(), DbiWriter< T >::fAggregateNo, DbiWriter< T >::fPacket, DbiWriter< T >::fTableName, DbiWriter< T >::fTableProxy, DbiWriter< T >::fValidRec, DbiValidityRec::GetAggregateNo(), DbiWriter< T >::IsOpen(), and MSG. 00306 {
00307 //
00308 //
00309 // Purpose: Stream row into this DbiWriter.
00310
00311 if ( ! this->IsOpen() ) return *this;
00312
00313 Int_t AggNoRow = row.GetAggregateNo();
00314 if ( fAggregateNo != AggNoRow ) {
00315 MSG("Dbi",Msg::kError)
00316 << "Cannot store row data for table "
00317 << fTableName
00318 << ", current set has aggregate no.: " << fAggregateNo
00319 << ", but it has: " << AggNoRow
00320 << " \n closing DbiWriter" << endl;
00321 this->Abort();
00322 return *this;
00323 }
00324 if ( ! fPacket->AddDataRow(*fTableProxy,fValidRec,row) ) {
00325 MSG("Dbi",Msg::kError) << "Closing DbiWriter due to above error." << endl;
00326 this->Abort();
00327 }
00328
00329 return *this;
00330
00331 }
|
|
||||||||||
|
|
|
|||||||||
|
Definition at line 799 of file DbiWriter.tpl. References DbiSqlValPacket::Clear(), DbiWriter< T >::fAggregateNo, DbiWriter< T >::fDbNo, DbiWriter< T >::fPacket, DbiWriter< T >::fTableName, DbiWriter< T >::fTableProxy, DbiWriter< T >::fValidRec, DbiTableProxy::GetTableName(), and DbiWriter< T >::GetTableProxy(). Referenced by DbiWriter< T >::CompleteOpen(), DbiWriter< T >::Open(), and DbiWriter< T >::~DbiWriter(). 00799 {
00800 //
00801 //
00802 // Purpose: Clear out data and reset ready for any further I/O.
00803 //
00804 // Arguments: None.
00805 //
00806 // Return: None.
00807 //
00808 // Contact: N. West
00809 //
00810 // Specification:-
00811 // =============
00812 //
00813 // o Clear out data and reset ready for any further I/O.
00814
00815 // Program Notes:-
00816 // =============
00817
00818 // None.
00819
00820 fAggregateNo = 0;
00821 fDbNo = 0;
00822 fPacket->Clear();
00823 fTableProxy = &DbiWriter<T>::GetTableProxy();
00824 fTableName = fTableProxy->GetTableName();
00825
00826 delete fValidRec;
00827 fValidRec = 0;
00828
00829 }
|
|
||||||||||
|
Definition at line 833 of file DbiWriter.tpl. References DbiWriter< T >::fDbNo, DbiTableProxyRegistry::GetCascader(), DbiCascader::GetDbNo(), and DbiTableProxyRegistry::Instance(). Referenced by PulserGainFit::ConfigModified(), PulserDBModule::DoWriteGC(), DbiWriter< T >::Open(), and FitGC::WriteDB(). 00833 {
00834 //
00835 //
00836 // Purpose: Set Database entry by name. Default: entry 0.
00837
00838 if ( dbName == "" ) {
00839 fDbNo = 0;
00840 }
00841 else {
00842 fDbNo = DbiTableProxyRegistry::Instance().GetCascader().GetDbNo(dbName);
00843 }
00844 }
|
|
||||||||||
|
Definition at line 86 of file DbiWriter.h. 00086 { fDbNo = dbNo;}
|
|
||||||||||
|
Definition at line 849 of file DbiWriter.tpl. References DbiWriter< T >::fLogEntry, and DbiLogEntry::SetReason(). Referenced by BMWriteHadMuRelImp::BMWriteHadMuRelImp(). 00849 {
00850 //
00851 //
00852 // Purpose: Set log comment.
00853
00854 fLogEntry.SetReason(reason);
00855
00856 }
|
|
|||||||||
|
Definition at line 91 of file DbiWriter.h. Referenced by DbiConfigStream::Write(), and FitGC::WriteDB(). 00091 {fUseOverlayCreationDate = kTRUE;}
|
|
||||||||||
|
Definition at line 90 of file DbiWriter.h. Referenced by DbiConfigStream::Write(), and BMCutsFiller::Write(). 00090 {fRequireGlobalSeqno = requireGlobal;}
|
|
|||||||||
|
Definition at line 861 of file DbiWriter.tpl. Referenced by PulserDBModule::DoWriteGC(), UgliGeometryReroot::MakeTempDbiGeometry(), UgliGeometryReroot::MakeTempDbiPosInfo(), and UgliGeometryReroot::MakeTempDbiScintStruct(). 00861 {
00862 //
00863 //
00864 // Purpose: Return DbiTableProxy.
00865 //
00866
00867 assert( DbiTableProxyRegistry::IsActive() );
00868 return *fTableProxy;
00869 }
|
|
|||||||||
|
Definition at line 874 of file DbiWriter.tpl. References DbiWriter< T >::fDbNo, DbiWriter< T >::fTableName, DbiCascader::GetAuthorisingDbNo(), DbiTableProxyRegistry::GetCascader(), DbiTableProxyRegistry::Instance(), and DbiCascader::IsTemporaryTable(). Referenced by DbiWriter< T >::Close(), and DbiWriter< T >::NeedsLogEntry(). 00874 {
00875 //
00876 //
00877 // Purpose: Return true if writing permanent data to a Master Database.
00878
00879
00880 DbiCascader& cascader = DbiTableProxyRegistry::Instance().GetCascader();
00881 return ( fDbNo == (UInt_t) cascader.GetAuthorisingDbNo()
00882 && ! cascader.IsTemporaryTable(fTableName,fDbNo));
00883
00884 }
|
|
|||||
|
Aggregate noumber for set.
Definition at line 139 of file DbiWriter.h. Referenced by DbiWriter< T >::CompleteOpen(), DbiWriter< T >::operator<<(), and DbiWriter< T >::Reset(). |
|
|||||
|
Database number in cascade.
Definition at line 142 of file DbiWriter.h. Referenced by DbiWriter< T >::Close(), DbiWriter< T >::CompleteOpen(), DbiWriter< T >::Open(), DbiWriter< T >::Reset(), DbiWriter< T >::SetDbName(), and DbiWriter< T >::WritingToMaster(). |
|
|||||
|
Associated log entry (if any) for update.
Definition at line 163 of file DbiWriter.h. Referenced by DbiWriter< T >::CanOutput(), DbiWriter< T >::Close(), DbiWriter< T >::CompleteOpen(), and DbiWriter< T >::SetLogComment(). |
|
|||||
|
The assembled record to be output. Never null.
Definition at line 145 of file DbiWriter.h. Referenced by DbiWriter< T >::CanOutput(), DbiWriter< T >::Close(), DbiWriter< T >::CompleteOpen(), DbiWriter< T >::IsOpen(), DbiWriter< T >::operator<<(), DbiWriter< T >::Reset(), and DbiWriter< T >::~DbiWriter(). |
|
|||||
|
Controls SEQNO type (see DbiCascader::AllocateSeqNo).
Definition at line 148 of file DbiWriter.h. |
|
|||||
|
Associated table name.
Definition at line 154 of file DbiWriter.h. Referenced by DbiWriter< T >::CanOutput(), DbiWriter< T >::Close(), DbiWriter< T >::CompleteOpen(), DbiWriter< T >::DbiWriter(), DbiWriter< T >::IsOpen(), DbiWriter< T >::NeedsLogEntry(), DbiWriter< T >::Open(), DbiWriter< T >::operator<<(), DbiWriter< T >::Reset(), and DbiWriter< T >::WritingToMaster(). |
|
|||||
|
Proxy to associated table.
Definition at line 151 of file DbiWriter.h. Referenced by DbiWriter< T >::Close(), DbiWriter< T >::CompleteOpen(), DbiWriter< T >::Open(), DbiWriter< T >::operator<<(), and DbiWriter< T >::Reset(). |
|
|||||
|
Use overlay creation date if true.
Definition at line 157 of file DbiWriter.h. Referenced by DbiWriter< T >::Close(), and DbiWriter< T >::Open(). |
|
|||||
|
Validity record. May be =0 if closed.
Definition at line 160 of file DbiWriter.h. Referenced by DbiWriter< T >::Close(), DbiWriter< T >::CompleteOpen(), DbiWriter< T >::IsOpen(), DbiWriter< T >::Open(), DbiWriter< T >::operator<<(), DbiWriter< T >::Reset(), and DbiWriter< T >::~DbiWriter(). |
1.3.9.1