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