#include <DbiResultPtr.h>
Public Member Functions | |
| DbiResultPtr () | |
| DbiResultPtr (const DbiResultPtr &that) | |
| DbiResultPtr (const VldContext &vc, Dbi::Task task=Dbi::kDefaultTask, Dbi::AbortTest abortTest=Dbi::kTableMissing, Bool_t findFullTimeWindow=true) | |
| DbiResultPtr (const string &tableName, const VldContext &vc, Dbi::Task task=Dbi::kDefaultTask, Dbi::AbortTest abortTest=Dbi::kTableMissing, Bool_t findFullTimeWindow=true) | |
| DbiResultPtr (const string &tableName, const DbiSqlContext &context, const Dbi::Task &task=Dbi::kAnyTask, const string &data="", const string &fillOpts="", Dbi::AbortTest abortTest=Dbi::kTableMissing) | |
| DbiResultPtr (const string &tableName, const DbiValidityRec &vrec, Dbi::AbortTest abortTest=Dbi::kTableMissing) | |
| DbiResultPtr (const string &tableName, UInt_t seqNo, UInt_t dbNo, Dbi::AbortTest abortTest=Dbi::kTableMissing) | |
| virtual | ~DbiResultPtr () |
| const DbiResultKey * | GetKey () const |
| UInt_t | GetNumRows () const |
| const DbiResult * | GetResult () const |
| Int_t | GetResultID () const |
| const T * | GetRow (UInt_t rowNum) const |
| const T * | GetRowByIndex (UInt_t index) const |
| const DbiValidityRec * | GetValidityRec (const DbiTableRow *row=0) const |
| DbiTableProxy & | TableProxy () const |
| Bool_t | ResultsFromDb () const |
| UInt_t | NextQuery (Bool_t forwards=kTRUE) |
| UInt_t | NewQuery (VldContext vc, Dbi::Task task=0, Bool_t findFullTimeWindow=true) |
| UInt_t | NewQuery (const DbiSqlContext &context, const Dbi::Task &task=0, const string &data="", const string &fillOpts="") |
| UInt_t | NewQuery (const DbiValidityRec &vrec) |
| UInt_t | NewQuery (UInt_t seqNo, UInt_t dbNo) |
Static Public Member Functions | |
| DbiTableProxy & | GetTableProxy () |
| DbiTableProxy & | GetTableProxy (const string &tableName) |
Private Member Functions | |
| void | Disconnect () |
| void | SetContext (const DbiValidityRec &vrec) |
| Bool_t | ApplyAbortTest () |
| DbiResultPtr & | operator= (const DbiResultPtr &) |
Private Attributes | |
| Dbi::AbortTest | fAbortTest |
| Test which if failed triggers abort. | |
| DbiTableProxy & | fTableProxy |
| Proxy for associated database table. | |
| const DbiResult * | fResult |
| Pointer to query result. May be zero! | |
| Detector::Detector_t | fDetType |
| from query context. | |
| SimFlag::SimFlag_t | fSimType |
| from query context. | |
Static Private Attributes | |
| std::map< string, DbiTableProxy * > | fgNameToProxy |
| DbiTableProxy * | fgTableProxy = 0 |
DatabaseInterface
Contact: n.west1@physics.ox.ac.uk
Definition at line 43 of file DbiResultPtr.h.
|
|||||||||
|
Definition at line 36 of file DbiResultPtr.tpl. 00036 : 00037 fAbortTest(Dbi::kDisabled), 00038 fTableProxy(DbiResultPtr<T>::GetTableProxy()), 00039 fResult(0), 00040 fDetType(Detector::kUnknown), 00041 fSimType(SimFlag::kUnknown ) 00042 { 00043 // 00044 // 00045 // Purpose: Default constructor 00046 // 00047 // Arguments: None 00048 // 00049 // Return: n/a 00050 // 00051 // Contact: N. West 00052 // 00053 // Specification:- 00054 // ============= 00055 // 00056 // o Create ResultPtr. 00057 00058 00059 // Program Notes:- 00060 // ============= 00061 00062 // None. 00063 00064 LEA_CTOR //Leak Checker 00065 00066 T pet; 00067 MSG("Dbi", Msg::kVerbose) 00068 << "Creating DbiResultPtr for " << pet.GetName() 00069 << " Table Proxy at " << &fTableProxy << endl; 00070 } //.....................................................................
|
|
||||||||||
|
Definition at line 74 of file DbiResultPtr.tpl. References DbiResult::Connect(), DbiResultPtr< T >::fResult, DbiResultPtr< T >::fTableProxy, LEA_CTOR, and MSG. 00074 : 00075 fAbortTest(that.fAbortTest), 00076 fTableProxy(that.fTableProxy), 00077 fResult(that.fResult), 00078 fDetType(that.fDetType), 00079 fSimType(that.fSimType) 00080 { 00081 // 00082 // 00083 // Purpose: Copy constructor 00084 00085 LEA_CTOR //Leak Checker 00086 00087 T pet; 00088 MSG("Dbi", Msg::kVerbose) 00089 << "Creating copy DbiResultPtr for " << pet.GetName() 00090 << " Table Proxy at " << &fTableProxy << endl; 00091 if ( fResult ) fResult->Connect(); 00092 00093 }
|
|
||||||||||||||||||||||||
|
Definition at line 98 of file DbiResultPtr.tpl. References DbiResultPtr< T >::fTableProxy, LEA_CTOR, MSG, and DbiResultPtr< T >::NewQuery(). 00101 : 00102 fAbortTest(abortTest), 00103 fTableProxy(DbiResultPtr<T>::GetTableProxy()), 00104 fResult(0), 00105 fDetType(vc.GetDetector()), 00106 fSimType(vc.GetSimFlag()) 00107 { 00108 // 00109 // 00110 // Purpose: Construct and apply context specific query to default table. 00111 // 00112 // Arguments: 00113 // vc in The Validity Context of the new query 00114 // task in The task of the new query 00115 // abortTest in Test which if failed triggers abort. 00116 // findFullTimeWindow 00117 // in Attempt to find full validity of query 00118 // i.e. beyond Dbi::GetTimeGate 00119 // 00120 // Return: n/a 00121 // 00122 // Contact: N. West 00123 // 00124 // Specification:- 00125 // ============= 00126 // 00127 // o Create ResultPtr. 00128 00129 00130 // Program Notes:- 00131 // ============= 00132 00133 // None. 00134 00135 LEA_CTOR //Leak Checker 00136 00137 T pet; 00138 MSG("Dbi", Msg::kVerbose) << "Creating DbiResultPtr for " 00139 << pet.GetName() << " Table Proxy at " 00140 << &fTableProxy << endl; 00141 NewQuery(vc, task, findFullTimeWindow); 00142 00143 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 148 of file DbiResultPtr.tpl. References DbiResultPtr< T >::fTableProxy, LEA_CTOR, MSG, and DbiResultPtr< T >::NewQuery(). 00152 : 00153 fAbortTest(abortTest), 00154 fTableProxy(DbiResultPtr<T>::GetTableProxy(tableName)), 00155 fResult(0), 00156 fDetType(vc.GetDetector()), 00157 fSimType(vc.GetSimFlag()) 00158 { 00159 // 00160 // 00161 // Purpose: Construct and apply context specific query to alternative table. 00162 // 00163 // Arguments: 00164 // tableName in Name of table to use. 00165 // vc in The Validity Context of the new query 00166 // task in The task of the new query 00167 // abortTest in Test which if failed triggers abort. 00168 // findFullTimeWindow 00169 // in Attempt to find full validity of query 00170 // i.e. beyond Dbi::GetTimeGate 00171 // Return: n/a 00172 // 00173 // Contact: N. West 00174 // 00175 // Specification:- 00176 // ============= 00177 // 00178 // o Create ResultPtr. 00179 00180 00181 // Program Notes:- 00182 // ============= 00183 00184 // None. 00185 00186 LEA_CTOR //Leak Checker 00187 00188 MSG("Dbi", Msg::kVerbose) << "Creating DbiResultPtr for " 00189 << tableName << " Table Proxy at " 00190 << &fTableProxy << endl; 00191 NewQuery(vc, task, findFullTimeWindow); 00192 00193 } //.....................................................................
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 197 of file DbiResultPtr.tpl. References DbiResultPtr< T >::fTableProxy, DbiString::GetString(), LEA_CTOR, MSG, and DbiResultPtr< T >::NewQuery(). 00202 : 00203 fAbortTest(abortTest), 00204 fTableProxy(DbiResultPtr<T>::GetTableProxy(tableName)), 00205 fResult(0), 00206 fDetType(context.GetDetector()), 00207 fSimType(context.GetSimFlag()) 00208 { 00209 // 00210 // 00211 // Purpose: Apply an extended context query to alternative table. 00212 // 00213 // Arguments: 00214 // tableName in Name of table to use. 00215 // context in The Validity Context (see DbiSqlContext) 00216 // task in The task of the query. Default: Dbi::kAnyTask, 00217 // data in Optional SQL extension to secondary query. Default: "". 00218 // fillOpts in Optional fill options (available to DbiTableRow) 00219 // Default: "". 00220 // abortTest in Test which if failed triggers abort. 00221 // 00222 // Return: n/a 00223 // 00224 // Contact: N. West 00225 // 00226 // Specification:- 00227 // ============= 00228 // 00229 // o Create ResultPtr. 00230 00231 00232 // Program Notes:- 00233 // ============= 00234 00235 // None. 00236 00237 LEA_CTOR //Leak Checker 00238 00239 T pet; 00240 MSG("Dbi", Msg::kVerbose) << "Creating DbiResultPtr for " 00241 << tableName << " Table Proxy at " 00242 << &fTableProxy << endl 00243 << "Extended context " << context.GetString() << endl; 00244 00245 NewQuery(context,task,data,fillOpts); 00246 00247 }
|
|
||||||||||||||||||||
|
Definition at line 252 of file DbiResultPtr.tpl. References DbiResultPtr< T >::fTableProxy, LEA_CTOR, MSG, DbiResultPtr< T >::NewQuery(), and DbiResultPtr< T >::SetContext(). 00254 : 00255 fAbortTest(abortTest), 00256 fTableProxy(DbiResultPtr<T>::GetTableProxy(tableName)), 00257 fResult(0) 00258 { 00259 // 00260 // 00261 // Purpose: Apply context specific query to alternative table. 00262 // 00263 // Arguments: 00264 // tableName in Name of table to use. 00265 // vrec in The validity record that satisfies the query. 00266 // abortTest in Test which if failed triggers abort. 00267 // 00268 // Return: n/a 00269 // 00270 // Contact: N. West 00271 // 00272 // Specification:- 00273 // ============= 00274 // 00275 // o Create ResultPtr. 00276 00277 00278 // Program Notes:- 00279 // ============= 00280 00281 // None. 00282 00283 LEA_CTOR //Leak Checker 00284 00285 this->SetContext(vrec); 00286 T pet; 00287 MSG("Dbi", Msg::kVerbose) << "Creating DbiResultPtr for " 00288 << tableName << " Table Proxy at " 00289 << &fTableProxy << endl; 00290 NewQuery(vrec); 00291 00292 } //.....................................................................
|
|
||||||||||||||||||||||||
|
Definition at line 296 of file DbiResultPtr.tpl. References DbiResultPtr< T >::fTableProxy, LEA_CTOR, MSG, and DbiResultPtr< T >::NewQuery(). 00299 : 00300 fAbortTest(abortTest), 00301 fTableProxy(DbiResultPtr<T>::GetTableProxy(tableName)), 00302 fResult(0) 00303 { 00304 // 00305 // 00306 // Purpose: Apply context specific query to alternative table. 00307 // 00308 // Arguments: 00309 // tableName in Name of table to use. 00310 // seqno in The SEQNO of validity record that satisfies the query. 00311 // dbNo in The database number holding the validity record 00312 // abortTest in Test which if failed triggers abort. 00313 // 00314 // Return: n/a 00315 // 00316 // Contact: N. West 00317 // 00318 // Specification:- 00319 // ============= 00320 // 00321 // o Create ResultPtr. 00322 00323 00324 // Program Notes:- 00325 // ============= 00326 00327 // None. 00328 00329 LEA_CTOR //Leak Checker 00330 00331 00332 T pet; 00333 MSG("Dbi", Msg::kVerbose) << "Creating DbiResultPtr for " 00334 << tableName << " Table Proxy at " 00335 << &fTableProxy << endl; 00336 NewQuery(seqNo,dbNo); 00337 00338 }
|
|
|||||||||
|
Definition at line 343 of file DbiResultPtr.tpl. References DbiResultPtr< T >::Disconnect(), LEA_DTOR, and MSG. 00343 {
00344 //
00345 //
00346 // Purpose: Destructor
00347 //
00348 // Arguments:
00349 // None.
00350 //
00351 // Return: n/a
00352 //
00353 // Contact: N. West
00354 //
00355 // Specification:-
00356 // =============
00357 //
00358 // o Disconnect any associated Results and destroy DbiResultPtr.
00359
00360
00361 // Program Notes:-
00362 // =============
00363
00364 // None.
00365
00366 LEA_DTOR //Leak Checker
00367
00368 MSG("Dbi", Msg::kVerbose) << "Destroying DbiResultPtr" << endl;
00369 Disconnect();
00370
00371 }
|
|
|||||||||
|
Definition at line 375 of file DbiResultPtr.tpl. References DbiResultPtr< T >::fAbortTest, DbiResultPtr< T >::fTableProxy, DbiResultPtr< T >::GetNumRows(), DbiTableProxy::GetTableName(), MSG, and DbiTableProxy::TableExists(). Referenced by DbiResultPtr< T >::NewQuery(). 00375 {
00376 //
00377 //
00378 // Purpose: Apply abort test and return true if must abort.
00379
00380 if ( fAbortTest == Dbi::kDisabled
00381 || this->GetNumRows() > 0 ) return kFALSE;
00382
00383 bool tableExists = fTableProxy.TableExists();
00384
00385 if ( ! tableExists ) {
00386 MSG("Dbi",Msg::kFatal) << "Fatal error: table "
00387 << fTableProxy.GetTableName() << " does not exist"
00388 << endl;
00389 return kTRUE;
00390 }
00391 if ( fAbortTest == Dbi::kDataMissing) {
00392 MSG("Dbi",Msg::kFatal) << "Fatal error: no data found in existing table "
00393 << fTableProxy.GetTableName() << endl;
00394 return kTRUE;
00395 }
00396
00397 return kFALSE;
00398 }
|
|
|||||||||
|
Definition at line 403 of file DbiResultPtr.tpl. References DbiResult::Disconnect(), DbiResultPtr< T >::fResult, and DbiTableProxyRegistry::IsActive(). Referenced by DbiResultPtr< T >::NewQuery(), and DbiResultPtr< T >::~DbiResultPtr(). 00403 {
00404 //
00405 //
00406 // Purpose: Disconnect previous results.
00407 //
00408 // Arguments: None.
00409 //
00410 // Return: None.
00411 //
00412 // Contact: N. West
00413 //
00414 // Specification:-
00415 // =============
00416 //
00417 // o Disconnect any previous results.
00418
00419 // Program Notes:-
00420 // =============
00421
00422 // The Disconnect message is sent to DbiResult so that DbiCache
00423 // knows when its DbiResult objects are free of clients.
00424
00425 if ( fResult && DbiTableProxyRegistry::IsActive() ) {
00426 fResult->Disconnect();
00427 }
00428 fResult = 0;
00429
00430 }
|
|
|||||||||
|
Definition at line 434 of file DbiResultPtr.tpl. References DbiResultPtr< T >::fResult, DbiResultKey::GetEmptyKey(), and DbiResult::GetKey(). Referenced by PEGainCalScheme::DoReset(), PEGainAggCalScheme::DoReset(), DbmModule::Query(), MBSpillAccessor::SeekClosest(), BDSpillAccessor::SeekClosest(), and BDSwicMaskAccessor::SetSpillTime(). 00434 {
00435 //
00436 //
00437 // Purpose: Return associated result key or an empty one if none exists.
00438 //
00439
00440 return fResult ? fResult->GetKey() : DbiResultKey::GetEmptyKey();
00441
00442 }
|
|
|||||||||
|
|||||||||
|
Definition at line 79 of file DbiResultPtr.h. 00079 { return fResult; }
|
|
|||||||||
|
Definition at line 446 of file DbiResultPtr.tpl. References DbiResultPtr< T >::fResult, and DbiResult::GetID(). Referenced by BMSpillAna::SelectSpill(). 00446 {
00447 //
00448 //
00449 // Purpose: Return the ID of the current DbiResult.
00450 //
00451 return fResult ? fResult->GetID() : 0;
00452
00453 }
|
|
||||||||||
|
||||||||||
|
||||||||||
|
Definition at line 493 of file DbiResultPtr.tpl. References DbiResultPtr< T >::fgNameToProxy, DbiTableProxyRegistry::GetTableProxy(), DbiResultPtr< T >::GetTableProxy(), and DbiTableProxyRegistry::Instance(). 00493 {
00494 //
00495 //
00496 // Purpose: Private static function to find an alternative
00497 // associated DbiTableProxy.
00498 //
00499 // Arguments:
00500 // tableName in Alternative table name
00501 //
00502 // Return: Associated DbiTableProxy.
00503 //
00504 // Contact: N. West
00505 //
00506 // Specification:-
00507 // =============
00508 //
00509 // o Ask Registry for alternative Table Proxy and return it.
00510
00511 // Program Notes:-
00512 // =============
00513
00514 // This function creates an example Table Row object which
00515 // DbiTableProxy can copy and then use to make futher copies when
00516 // processing Result Sets.
00517
00518
00519 // Check for request for default table.
00520 if ( tableName == "" ) return DbiResultPtr::GetTableProxy();
00521
00522 // See if we have seen this name before.
00523 map<string,DbiTableProxy*>::const_iterator itr
00524 = fgNameToProxy.find(tableName);
00525 if ( itr != fgNameToProxy.end() ) return *( (*itr).second );
00526
00527 // No, so ask the Registry for it and save it for next time.
00528 T pet;
00529 DbiTableProxy* proxy = &DbiTableProxyRegistry::Instance()
00530 .GetTableProxy(tableName,&pet);
00531 fgNameToProxy[tableName] = proxy;
00532 return *proxy;
00533 }
|
|
|||||||||
|
Definition at line 457 of file DbiResultPtr.tpl. References DbiResultPtr< T >::fgTableProxy, DbiTableProxyRegistry::GetTableProxy(), and DbiTableProxyRegistry::Instance(). Referenced by DTFtest(), DbiWriter< T >::GetTableProxy(), and DbiResultPtr< T >::GetTableProxy(). 00457 {
00458 //
00459 //
00460 // Purpose: Private static function to find default associated
00461 // DbiTableProxy.
00462 //
00463 // Arguments: None.
00464 //
00465 //
00466 // Return: Associated DbiTableProxy.
00467 //
00468 // Contact: N. West
00469 //
00470 // Specification:-
00471 // =============
00472 //
00473 // o Ask Registry for default Table Proxy and return it.
00474
00475 // Program Notes:-
00476 // =============
00477
00478 // This function creates an example Table Row object which
00479 // DbiTableProxy can copy and then use to make futher copies when
00480 // processing Result Sets.
00481
00482 if ( ! fgTableProxy ) {
00483 T pet;
00484 fgTableProxy = &DbiTableProxyRegistry::Instance()
00485 .GetTableProxy(pet.GetName(),&pet);
00486 }
00487 return *fgTableProxy;
00488 }
|
|
||||||||||
|
||||||||||||||||
|
Definition at line 874 of file DbiResultPtr.tpl. References DbiResultPtr< T >::ApplyAbortTest(), DbiResult::Connect(), DbiResultPtr< T >::Disconnect(), DbiResultPtr< T >::fResult, DbiResultPtr< T >::fTableProxy, DbiResult::GetNumRows(), DbiTableProxy::GetTableName(), DbiResult::GetValidityRec(), DbiTableProxyRegistry::IsActive(), MSG, DbiTableProxy::Query(), DbiTimerManager::RecBegin(), DbiTimerManager::RecEnd(), and DbiResultPtr< T >::SetContext(). 00874 {
00875 //
00876 //
00877 // Purpose: Apply new query.
00878 // seqno in The SEQNO of validity record that satisfies the query.
00879 // dbNo in The database number holding the validity record
00880 //
00881 // Arguments:
00882 //
00883 //
00884 // Return: The number of rows retrieved by query. =0 if error.
00885 //
00886 // Contact: N. West
00887 //
00888 // Specification:-
00889 // =============
00890 //
00891 // o Disconnect any previous results and apply new query to
00892 // associated database table
00893
00894 // Program Notes:-
00895 // =============
00896
00897 // None.
00898
00899 if ( ! DbiTableProxyRegistry::IsActive() ) {
00900 fResult = 0;
00901 return 0;
00902 }
00903 MSG("Dbi",Msg::kSynopsis) << "\n\nStarting SeqNo query: "
00904 << seqNo << "\n" << endl;
00905 DbiTimerManager::gTimerManager.RecBegin(fTableProxy.GetTableName(), sizeof(T));
00906 Disconnect();
00907 fResult = fTableProxy.Query(seqNo,dbNo);
00908 fResult->Connect();
00909 DbiTimerManager::gTimerManager.RecEnd(fResult->GetNumRows());
00910 if ( this->ApplyAbortTest() ) {
00911 MSG("Dbi",Msg::kFatal) << "while applying SEQNO query for "
00912 << seqNo << " on database " << dbNo << endl;
00913 abort();
00914 }
00915 this->SetContext(fResult->GetValidityRec());
00916 MSG("Dbi",Msg::kSynopsis) << "\n\nCompleted SeqNo query: "
00917 << seqNo
00918 << " Found: " << fResult->GetNumRows() << " rows\n" << endl;
00919 return fResult->GetNumRows();
00920
00921 }
|
|
||||||||||
|
Definition at line 820 of file DbiResultPtr.tpl. References DbiResultPtr< T >::ApplyAbortTest(), DbiResult::Connect(), DbiResultPtr< T >::Disconnect(), DbiResultPtr< T >::fResult, DbiResultPtr< T >::fTableProxy, DbiResult::GetNumRows(), DbiTableProxy::GetTableName(), DbiTableProxyRegistry::IsActive(), MSG, DbiTableProxy::Query(), DbiTimerManager::RecBegin(), DbiTimerManager::RecEnd(), and DbiResultPtr< T >::SetContext(). 00820 {
00821 //
00822 //
00823 // Purpose: Apply new query.
00824 //
00825 // Arguments:
00826 // vrec in The validity record that satisfies the query.
00827 //
00828 //
00829 // Return: The number of rows retrieved by query. =0 if error.
00830 //
00831 // Contact: N. West
00832 //
00833 // Specification:-
00834 // =============
00835 //
00836 // o Disconnect any previous results and apply new query to
00837 // associated database table
00838
00839 // Program Notes:-
00840 // =============
00841
00842 // None.
00843
00844 if ( ! DbiTableProxyRegistry::IsActive() ) {
00845 fResult = 0;
00846 return 0;
00847 }
00848 MSG("Dbi",Msg::kSynopsis) << "\n\nStarting DbiValidityRec query: "
00849 << vrec << "\n" << endl;
00850
00851 this->SetContext(vrec);
00852 DbiTimerManager::gTimerManager.RecBegin(fTableProxy.GetTableName(), sizeof(T));
00853 Disconnect();
00854
00855 // Play safe and don't allow result to be used; it's validity may not
00856 // have been trimmed by neighbouring records.
00857 fResult = fTableProxy.Query(vrec,kFALSE);
00858 fResult->Connect();
00859 DbiTimerManager::gTimerManager.RecEnd(fResult->GetNumRows());
00860 if ( this->ApplyAbortTest() ) {
00861 MSG("Dbi",Msg::kFatal) << "while applying validity rec query for "
00862 << vrec << endl;
00863 abort();
00864 }
00865 MSG("Dbi",Msg::kSynopsis) << "\n\nCompletedDbiValidityRec query: "
00866 << vrec
00867 << " Found: " << fResult->GetNumRows() << " rows\n" << endl;
00868 return fResult->GetNumRows();
00869
00870 }
|
|
||||||||||||||||||||||||
|
Definition at line 755 of file DbiResultPtr.tpl. References DbiResultPtr< T >::ApplyAbortTest(), DbiString::c_str(), DbiResult::Connect(), DbiResultPtr< T >::Disconnect(), DbiResultPtr< T >::fDetType, DbiResultPtr< T >::fResult, DbiResultPtr< T >::fSimType, DbiResultPtr< T >::fTableProxy, DbiSqlContext::GetDetector(), DbiResult::GetNumRows(), DbiSqlContext::GetSimFlag(), DbiString::GetString(), DbiTableProxy::GetTableName(), DbiTableProxyRegistry::IsActive(), MSG, DbiTableProxy::Query(), DbiTimerManager::RecBegin(), and DbiTimerManager::RecEnd(). 00758 {
00759 //
00760 //
00761 // Purpose: Apply new query.
00762 //
00763 // Arguments:
00764 // context in The Validity Context (see DbiSqlContext)
00765 // task in The task of the query. Default: 0
00766 // data in Optional SQL extension to secondary query. Default: "".
00767 // fillOpts in Optional fill options (available to DbiTableRow)
00768 //
00769 //
00770 // Return: The number of rows retrieved by query. =0 if error.
00771 //
00772 // Contact: N. West
00773 //
00774 // Specification:-
00775 // =============
00776 //
00777 // o Disconnect any previous results and apply new query to
00778 // associated database table
00779
00780 // Program Notes:-
00781 // =============
00782
00783 // None.
00784
00785 if ( ! DbiTableProxyRegistry::IsActive() ) {
00786 fResult = 0;
00787 return 0;
00788 }
00789 fDetType = context.GetDetector();
00790 fSimType = context.GetSimFlag();
00791
00792 MSG("Dbi",Msg::kSynopsis) << "\n\nStarting extended context query: "
00793 << context.GetString() << " task " << task
00794 << " data " << data << " fillOpts " << fillOpts << "\n" <<endl;
00795
00796 DbiTimerManager::gTimerManager.RecBegin(fTableProxy.GetTableName(), sizeof(T));
00797 Disconnect();
00798 fResult = fTableProxy.Query(context.GetString(),task,data,fillOpts);
00799 fResult->Connect();
00800 DbiTimerManager::gTimerManager.RecEnd(fResult->GetNumRows());
00801 if ( this->ApplyAbortTest() ) {
00802 MSG("Dbi",Msg::kFatal) << "while applying extended context query for "
00803 << context.c_str()<< " with task " << task
00804 << " secondary query SQL: " << data
00805 << " and fill options: " << fillOpts << endl;
00806 abort();
00807 }
00808
00809 MSG("Dbi",Msg::kSynopsis) << "\n\nCompleted extended context query: "
00810 << context.GetString() << " task " << task
00811 << " data " << data << " fillOpts" << fillOpts
00812 << " Found: " << fResult->GetNumRows() << " rows\n" << endl;
00813
00814 return fResult->GetNumRows();
00815
00816 }
|
|
||||||||||||||||||||
|
||||||||||
|
Definition at line 647 of file DbiResultPtr.tpl. References DbiResultPtr< T >::fDetType, DbiResultPtr< T >::fResult, DbiResultPtr< T >::fSimType, DbiResult::GetNumRows(), VldTimeStamp::GetSec(), DbiValidityRec::GetTask(), VldRange::GetTimeEnd(), VldRange::GetTimeStart(), DbiResult::GetValidityRec(), DbiValidityRec::GetVldRange(), MSG, and DbiResultPtr< T >::NewQuery(). Referenced by main(), PulserDBModule::MergeForward(), PlotPeds::Next(), PlotAllPeds::Next(), PlotAllPeds::Prev(), and BDSwicPedAccessor::SetSpillTime(). 00647 {
00648 //
00649 //
00650 // Purpose: Get next validity range for previous query.
00651 //
00652 // Arguments:
00653 // forwards in true to step direction forwards (default)
00654 //
00655 // Contact: N. West
00656 //
00657 // Specification:-
00658 // =============
00659 //
00660 // o Take the validity range of the current query and step across
00661 // the boundary to the adjacent range.
00662
00663
00664 // Door stops.
00665 static VldTimeStamp startOfTime(0,0);
00666 static VldTimeStamp endOfTime(0x7FFFFFFF,0);
00667
00668 if ( ! fResult ) return 0;
00669
00670 MSG("Dbi",Msg::kSynopsis) << "\n\nStarting next query: direction "
00671 << ( forwards ? "forwards" : "backwards" ) << "\n" << endl;
00672
00673 const DbiValidityRec& vrec = fResult->GetValidityRec();
00674 const VldRange& vrnge = vrec.GetVldRange();
00675
00676 // If we are heading towards the final boundary, just return the same query.
00677 if ( forwards && vrnge.GetTimeEnd() == endOfTime ) return fResult->GetNumRows();
00678 if ( ! forwards && vrnge.GetTimeStart() == startOfTime ) return fResult->GetNumRows();
00679
00680 // Step across boundary and construct new context.
00681 // The end time limit is exclusive, so stepping to the end
00682 // does cross the boundary
00683 time_t ts = forwards ? vrnge.GetTimeEnd().GetSec()
00684 : vrnge.GetTimeStart().GetSec() - 1;
00685 VldContext vc(fDetType,fSimType,VldTimeStamp(ts,0));
00686
00687 return this->NewQuery(vc,vrec.GetTask(), true);
00688
00689 }
|
|
||||||||||
|
|
|
|||||||||
|
Definition at line 926 of file DbiResultPtr.tpl. References DbiResultPtr< T >::fResult, and DbiResult::ResultsFromDb(). 00926 {
00927 //
00928 //
00929 // Purpose: Return true if at least part of result comes directly from
00930 // database (as opposed to memory or level 2 disk cache).
00931
00932 return fResult ? fResult->ResultsFromDb() : kFALSE;
00933
00934 }
|
|
||||||||||
|
Definition at line 938 of file DbiResultPtr.tpl. References DbiResultPtr< T >::fDetType, DbiResultPtr< T >::fSimType, VldRange::GetDetectorMask(), VldRange::GetSimMask(), and DbiValidityRec::GetVldRange(). Referenced by DbiResultPtr< T >::DbiResultPtr(), and DbiResultPtr< T >::NewQuery(). 00938 {
00939 //
00940 //
00941 // Purpose: Attempt to construct context detector type and sim flag
00942 //
00943 // Arguments:
00944 // vrec in DbiValidityRec from which to construct context
00945 //
00946 //
00947 // Contact: N. West
00948 //
00949
00950 // Program Notes:-
00951 // =============
00952
00953 // Queries that step to an adjacent validity range need a detector
00954 // type and simulation flag from which to construct a context. However
00955 // queries can be made using a DbiValidityRec and then only a VldRange
00956 // is known so all we can do is choose representative values from
00957 // its detector and simulation masks.
00958
00959 const VldRange& vrng = vrec.GetVldRange();
00960 Int_t detMask = vrng.GetDetectorMask();
00961 Int_t simMask = vrng.GetSimMask();
00962
00963 fDetType = Detector::kUnknown;
00964 if ( detMask & Detector::kFar ) fDetType = Detector::kFar;
00965 else if ( detMask & Detector::kNear) fDetType = Detector::kNear;
00966 else if ( detMask & Detector::kCalDet) fDetType = Detector::kCalDet;
00967 else if ( detMask & Detector::kCalib) fDetType = Detector::kCalib;
00968 else if ( detMask & Detector::kTestStand) fDetType = Detector::kTestStand;
00969 else if ( detMask & Detector::kMapper) fDetType = Detector::kMapper;
00970
00971 fSimType = SimFlag::kUnknown;
00972 if ( simMask & SimFlag::kData) fSimType = SimFlag::kData;
00973 else if ( simMask & SimFlag::kMC) fSimType = SimFlag::kMC;
00974 else if ( simMask & SimFlag::kReroot) fSimType = SimFlag::kReroot;
00975 else if ( simMask & SimFlag::kDaqFakeData) fSimType = SimFlag::kDaqFakeData;
00976
00977 }
|
|
|||||||||
|
Definition at line 982 of file DbiResultPtr.tpl. Referenced by Plexus::BuildLedMaps(), Plexus::BuildPinDiodeMap(), Plexus::BuildPixelMaps(), Plexus::BuildReadoutMap(), UgliGeometry::ClearDbiCache(), and PulserDBModule::DeleteGC(). 00982 {
00983 //
00984 //
00985 // Purpose: Return associated DbiTableProxy (if any).
00986 //
00987 // Contact: N. West
00988
00989 assert( DbiTableProxyRegistry::IsActive() );
00990 return fTableProxy;
00991 }
|
|
|||||
|
Test which if failed triggers abort.
Definition at line 115 of file DbiResultPtr.h. Referenced by DbiResultPtr< T >::ApplyAbortTest(). |
|
|||||
|
from query context.
Definition at line 127 of file DbiResultPtr.h. Referenced by DbiResultPtr< T >::NewQuery(), DbiResultPtr< T >::NextQuery(), and DbiResultPtr< T >::SetContext(). |
|
|||||
|
Definition at line 22 of file DbiResultPtr.tpl. Referenced by DbiResultPtr< T >::GetTableProxy(). |
|
|||||
|
Definition at line 25 of file DbiResultPtr.tpl. Referenced by DbiResultPtr< T >::GetTableProxy(). |
|
|||||
|
Pointer to query result. May be zero!
Definition at line 124 of file DbiResultPtr.h. Referenced by DbiResultPtr< T >::DbiResultPtr(), DbiResultPtr< T >::Disconnect(), DbiResultPtr< T >::GetKey(), DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetResultID(), DbiResultPtr< T >::GetRow(), DbiResultPtr< T >::GetRowByIndex(), DbiResultPtr< T >::GetValidityRec(), DbiResultPtr< T >::NewQuery(), DbiResultPtr< T >::NextQuery(), and DbiResultPtr< T >::ResultsFromDb(). |
|
|||||
|
from query context.
Definition at line 130 of file DbiResultPtr.h. Referenced by DbiResultPtr< T >::NewQuery(), DbiResultPtr< T >::NextQuery(), and DbiResultPtr< T >::SetContext(). |
|
|||||
|
Proxy for associated database table.
Definition at line 118 of file DbiResultPtr.h. Referenced by DbiResultPtr< T >::ApplyAbortTest(), DbiResultPtr< T >::DbiResultPtr(), and DbiResultPtr< T >::NewQuery(). |
1.3.9.1