Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

DbiResultPtr< T > Class Template Reference

Concept Templated class of pointers to Result objects. ResultPtr objects are lightweight and provide type safe access to a specific table. Purpose ResultPtrs are the primary application interface to the Dbi. Users instantiate ResultPtrs with the information necessary define a table query and then interrogate the object for the results. More...

#include <DbiResultPtr.h>

List of all members.

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 DbiResultKeyGetKey () const
UInt_t GetNumRows () const
const DbiResultGetResult () const
Int_t GetResultID () const
const T * GetRow (UInt_t rowNum) const
const T * GetRowByIndex (UInt_t index) const
const DbiValidityRecGetValidityRec (const DbiTableRow *row=0) const
DbiTableProxyTableProxy () 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

DbiTableProxyGetTableProxy ()
DbiTableProxyGetTableProxy (const string &tableName)

Private Member Functions

void Disconnect ()
void SetContext (const DbiValidityRec &vrec)
Bool_t ApplyAbortTest ()
DbiResultPtroperator= (const DbiResultPtr &)

Private Attributes

Dbi::AbortTest fAbortTest
 Test which if failed triggers abort.
DbiTableProxyfTableProxy
 Proxy for associated database table.
const DbiResultfResult
 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
DbiTableProxyfgTableProxy = 0


Detailed Description

template<class T>
class DbiResultPtr< T >

Concept Templated class of pointers to Result objects. ResultPtr objects are lightweight and provide type safe access to a specific table. Purpose ResultPtrs are the primary application interface to the Dbi. Users instantiate ResultPtrs with the information necessary define a table query and then interrogate the object for the results.

Id
DbiResultPtr.h,v 1.34 2006/08/08 10:51:32 west Exp

DatabaseInterface

Contact: n.west1@physics.ox.ac.uk

Definition at line 43 of file DbiResultPtr.h.


Constructor & Destructor Documentation

template<class T>
DbiResultPtr< T >::DbiResultPtr  ) 
 

Definition at line 36 of file DbiResultPtr.tpl.

References LEA_CTOR, and MSG.

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 }
//.....................................................................

template<class T>
DbiResultPtr< T >::DbiResultPtr const DbiResultPtr< T > &  that  ) 
 

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 }

template<class T>
DbiResultPtr< T >::DbiResultPtr const VldContext vc,
Dbi::Task  task = Dbi::kDefaultTask,
Dbi::AbortTest  abortTest = Dbi::kTableMissing,
Bool_t  findFullTimeWindow = true
 

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 }

template<class T>
DbiResultPtr< T >::DbiResultPtr const string &  tableName,
const VldContext vc,
Dbi::Task  task = Dbi::kDefaultTask,
Dbi::AbortTest  abortTest = Dbi::kTableMissing,
Bool_t  findFullTimeWindow = true
 

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 }
//.....................................................................

template<class T>
DbiResultPtr< T >::DbiResultPtr const string &  tableName,
const DbiSqlContext context,
const Dbi::Task task = Dbi::kAnyTask,
const string &  data = "",
const string &  fillOpts = "",
Dbi::AbortTest  abortTest = Dbi::kTableMissing
 

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 }

template<class T>
DbiResultPtr< T >::DbiResultPtr const string &  tableName,
const DbiValidityRec vrec,
Dbi::AbortTest  abortTest = Dbi::kTableMissing
 

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 }
//.....................................................................

template<class T>
DbiResultPtr< T >::DbiResultPtr const string &  tableName,
UInt_t  seqNo,
UInt_t  dbNo,
Dbi::AbortTest  abortTest = Dbi::kTableMissing
 

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 }

template<class T>
DbiResultPtr< T >::~DbiResultPtr  )  [virtual]
 

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 }


Member Function Documentation

template<class T>
Bool_t DbiResultPtr< T >::ApplyAbortTest  )  [private]
 

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 }

template<class T>
void DbiResultPtr< T >::Disconnect  )  [private]
 

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 }

template<class T>
const DbiResultKey * DbiResultPtr< T >::GetKey  )  const
 

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 }

template<class T>
UInt_t DbiResultPtr< T >::GetNumRows  )  const
 

Definition at line 538 of file DbiResultPtr.tpl.

References DbiResultPtr< T >::fResult, DbiResult::GetNumRows(), and DbiTableProxyRegistry::IsActive().

Referenced by RateSummary::Ana(), NueDisplayModule::Ana(), CountPot::Ana(), DbiResultPtr< T >::ApplyAbortTest(), BDLivePlot::BDLivePlot(), GeoGeometry::BuildDetector(), Plexus::BuildLedMaps(), Plexus::BuildPinDiodeMap(), Plexus::BuildPixelMaps(), GeoGeometry::BuildPlanePairVolumes(), LIPatternFinderFancy::BuildPlexMaps(), Plexus::BuildReadoutMap(), UgliScintPlnNode::BuildStrips(), UgliGeometry::BuildStripShapes(), GeoGeometry::BuildStripVolumes(), PulserTimeCalScheme::CalibrateByMuon(), PulserTimeCalScheme::CalibrateByPulser(), CalDrift::CalibratedPH(), PulserTimeCalScheme::CalibrateShield(), CheckGC::checklin(), CoilTools::CoilCurrentLimits(), PulserTimePlotter::CreateGraph(), MadPIDAnalysis::CreatePAN(), DbiConfigStream::DbiConfigStream(), StripAttenCalScheme::DecalAttenCorrected(), QuadLinearityCalScheme::DecalLinearity(), MIPCalScheme::DecalMIP(), StripToStripCalScheme::DecalStripToStrip(), TimeCalScheme::DecalTime(), VaLinearityCalScheme::DecalVALinearity(), PhotonStatSummarizer::DoesTableExist(), VaLinearityCalScheme::DoReset(), TimeCalScheme::DoReset(), TemperatureCalScheme::DoReset(), StripToStripCalScheme::DoReset(), StripAttenCalScheme::DoReset(), QuadLinearityCalScheme::DoReset(), PulserTimeCalScheme::DoReset(), PulserSigLinCalScheme::DoReset(), PulserDriftCalScheme::DoReset(), PmtDriftCalScheme::DoReset(), PEGainCalScheme::DoReset(), PEGainAggCalScheme::DoReset(), MuonDriftCalScheme::DoReset(), MIPCalScheme::DoReset(), DumpFilterChannels(), CountPot::EndJob(), HvStatusFinder::ExtendedQuery(), PulserGainFit::FarMeans(), CountPot::FillMBPOT(), NtpSRModule::FillNtpDetStatus(), SpillTimeFinder::FindBestRows(), SpillTimeFinder::FindClosestEntries(), SpillServerMonFinder::FindClosestEntries(), FitNdNonlinQuad(), StripAttenCalScheme::GetAttenCorrected(), TimeCalScheme::GetCalibratedTime(), PulserDBModule::GetCurrentFromDB(), UgliDbiTables::GetDbiGeometry(), PulserSigLinCalScheme::GetDriftPinDiodeValue(), PulserDriftCalScheme::GetDriftPinDiodeValue(), CoilTools::GetLast(), QuadLinearityCalScheme::GetLinearized(), VaLinearityCalScheme::GetLinearizedVA(), PlexVetoShieldHack::GetMdlPlaneCoverage(), PlexVetoShieldHack::GetMdlPlaneView(), MIPCalScheme::GetMIP(), MadTVAnalysis::GetNDCoilCurrent(), UgliDbiTables::GetNumSteelRows(), PulserGainFit::GetPinData(), PEGainCalScheme::GetRow(), PEGainAggCalScheme::GetRow(), StripToStripCalScheme::GetStripToStripCorrected(), TemperatureCalScheme::GetTemperature(), PhotonStatSummarizer::LoadDataFromDB(), HvStatusFinder::LocalQuery(), CoilTools::LocalQuery(), DbmModule::LogEntry(), PlexVetoShieldHack::LookForMuxMdl(), FabPlnInstallLookup::LookForOddEntries(), PlexVetoShieldHack::LookForSingleMdl(), main(), AlgFilterDigitList::MakeBadChannelMapDB(), PulserDBModule::MergeBack(), PulserDBModule::MergeForward(), FabPlnInstallLookup::NextInstall(), Plotter::Plotter(), FabPlnInstallLookup::Print(), LIPlexMaps::PrintDbPinDiodeInfo(), PrintTimeCal(), DbmModule::Query(), FillSpillServerMon::ReadFromDatabase(), FillHvFromSingles::ReadFromDatabase(), FillFarRunQuality::ReadFromDatabase(), RangeLookupTable::Rebuild(), PhotonLookupTable::Rebuild(), SimPmtM64CrosstalkTable::RebuildCache(), VtxModule::Reco(), UberModuleLite::Reco(), UberModule::Reco(), NueModule::Reco(), PlexVetoShieldHack::RenumberMdlToMux(), PlexVetoShieldHack::RenumberMuxToMdl(), PhotonDefaultModel::Reset(), AlgFilterChannels::RunAlg(), AlgCalDetPID::RunAlg(), PulserGainFit::RunNearFarFits(), PulserGainFit::RunPinFits(), NueAnalysisCuts::SetNtpInfoObjects(), MBSpillAccessor::TableSearch(), BDSpillAccessor::TableSearch(), PlotPeds::Update(), PlotAllPedsImp::Update(), FabPlnInstallLookup::WhereIsScintMdl(), FabPlnInstallLookup::WhereIsSteelSlab(), and WriteTableToCSVFile().

00538                                          {
00539 //
00540 //
00541 //  Purpose:  Get number or rows in query.
00542 //
00543 //  Arguments: None.
00544 //    
00545 //
00546 //  Return:    Number of rows found in query, = 0 if no or failed query.
00547 //
00548 //  Contact:   N. West
00549 //
00550 //  Specification:-
00551 //  =============
00552 //
00553 //  o Return number of rows found in query, = 0 if no or failed query.
00554 
00555 
00556 //  Program Notes:-
00557 //  =============
00558 
00559 //  None.
00560 
00561   return ( fResult && DbiTableProxyRegistry::IsActive() ) 
00562           ? fResult->GetNumRows() : 0;
00563 
00564 }

template<class T>
const DbiResult* DbiResultPtr< T >::GetResult  )  const [inline]
 

Definition at line 79 of file DbiResultPtr.h.

00079 { return fResult; }

template<class T>
Int_t DbiResultPtr< T >::GetResultID  )  const
 

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 }

template<class T>
const T * DbiResultPtr< T >::GetRow UInt_t  rowNum  )  const
 

Definition at line 568 of file DbiResultPtr.tpl.

References DbiResultPtr< T >::fResult, DbiResult::GetTableRow(), and DbiTableProxyRegistry::IsActive().

Referenced by RateSummary::Ana(), NueDisplayModule::Ana(), CountPot::Ana(), BDLivePlot::BDLivePlot(), GeoGeometry::BuildDetector(), Plexus::BuildLedMaps(), Plexus::BuildPinDiodeMap(), Plexus::BuildPixelMaps(), GeoGeometry::BuildPlanePairVolumes(), LIPatternFinderFancy::BuildPlexMaps(), Plexus::BuildReadoutMap(), UgliScintPlnNode::BuildStrips(), UgliGeometry::BuildStripShapes(), GeoGeometry::BuildStripVolumes(), CalDrift::CalibratedPH(), CheckGC::checklin(), CoilTools::CoilCurrentLimits(), LIPlexMaps::CompareStripToStrip(), MadPIDAnalysis::CreatePAN(), DbiConfigStream::DbiConfigStream(), MIPCalScheme::DecalMIP(), MuonDriftCalScheme::DoReset(), DTFtest(), LIPlexMaps::DumpCalStripAtten(), LIPlexMaps::DumpCalStripToStrip(), DumpFilterChannels(), FileGap::DumpMissing(), CountPot::EndJob(), HvStatusFinder::ExtendedQuery(), PulserGainFit::FarMeans(), CountPot::FillMBPOT(), NtpSRModule::FillNtpDetStatus(), SpillTimeFinder::FindBestRows(), SpillServerMonFinder::FindClosestEntries(), FitNdNonlinQuad(), PulserDBModule::GetCurrentFromDB(), UgliDbiTables::GetDbiGeometry(), UgliDbiTables::GetDbiSteelPln(), FileGap::GetFileBounds(), CoilTools::GetLast(), PlexVetoShieldHack::GetMdlPlaneCoverage(), PlexVetoShieldHack::GetMdlPlaneView(), MIPCalScheme::GetMIP(), MadTVAnalysis::GetNDCoilCurrent(), PulserGainFit::GetPinData(), LIPlexMaps::GetRawPinLedMap(), LIPlexMaps::GetRawPinMap(), LIPlexMaps::GetRefAdcPinRatio(), TemperatureCalScheme::GetTemperature(), PhotonStatSummarizer::LoadDataFromDB(), HvStatusFinder::LocalQuery(), CoilTools::LocalQuery(), DbmLogFile::LogRec(), PlexVetoShieldHack::LookForMuxMdl(), FabPlnInstallLookup::LookForOddEntries(), PlexVetoShieldHack::LookForSingleMdl(), main(), AlgFilterDigitList::MakeBadChannelMapDB(), PulserDBModule::MergeBack(), PulserDBModule::MergeForward(), FabPlnInstallLookup::NextInstall(), FabPlnInstallLookup::Print(), LIPlexMaps::PrintDbPinDiodeInfo(), PrintTimeCal(), LIPlexMaps::RatioRawToRefDrift(), LIPlexMaps::ReadDbCalStripAtten(), LIPlexMaps::ReadDbCalStripToStrip(), LIPlexMaps::ReadDbGains(), LIPlexMaps::ReadDbPulserDrift(), LIPlexMaps::ReadDbPulserDriftPin(), LIPlexMaps::ReadDbPulserRawGain(), FillSpillServerMon::ReadFromDatabase(), FillHvFromSingles::ReadFromDatabase(), FillFarRunQuality::ReadFromDatabase(), RangeLookupTable::Rebuild(), PhotonLookupTable::Rebuild(), VtxModule::Reco(), UberModuleLite::Reco(), UberModule::Reco(), NueModule::Reco(), PlexVetoShieldHack::RenumberMdlToMux(), PlexVetoShieldHack::RenumberMuxToMdl(), PhotonDefaultModel::Reset(), AlgFilterChannels::RunAlg(), AlgCalDetPID::RunAlg(), PulserGainFit::RunNearFarFits(), PulserGainFit::RunPinFits(), BMSpillAna::SelectSpill(), NueAnalysisCuts::SetNtpInfoObjects(), BDSwicPedAccessor::SetSpillTime(), BDSwicMaskAccessor::SetSpillTime(), MBSpillAccessor::TableSearch(), BDSpillAccessor::TableSearch(), PlotPeds::Update(), PlotAllPedsImp::Update(), FabPlnInstallLookup::WhereIsScintMdl(), FabPlnInstallLookup::WhereIsSteelSlab(), and WriteTableToCSVFile().

00568                                                     {
00569 //
00570 //
00571 //  Purpose: Return pointer to concrete Table Row object at given row.  
00572 //
00573 //  Arguments: 
00574 //    rowNum       in    Required row number
00575 //
00576 //  Return:        Pointer to concrete Table Row object at given row, 
00577 //                 =0 if none 
00578 //
00579 //  Contact:   N. West
00580 //
00581 //  Specification:-
00582 //  =============
00583 //
00584 //  o Return pointer to concrete Table Row object at given row or 
00585 //    0 if none.
00586 
00587 //  Program Notes:-
00588 //  =============
00589 
00590 // None.
00591 
00592   return ( fResult && DbiTableProxyRegistry::IsActive() ) ?
00593       dynamic_cast<const T*>(fResult->GetTableRow(rowNum))
00594     : 0;
00595 }

template<class T>
const T * DbiResultPtr< T >::GetRowByIndex UInt_t  index  )  const
 

Definition at line 599 of file DbiResultPtr.tpl.

References DbiResultPtr< T >::fResult, DbiResult::GetTableRowByIndex(), and DbiTableProxyRegistry::IsActive().

Referenced by MuCalFitterModule::Ana(), FitTrackMSListModule::Ana(), PulserSigLinCalScheme::ApplyBendyCalib(), Plotter::BasicPlot(), GeoScintMdlVolume::Build4Corners(), GeoGeometry::BuildDetector(), GeoScintMdlVolume::BuildHalfY(), GeoGeometry::BuildModules(), UgliGeometry::BuildNodes(), GeoGeometry::BuildPlanePairVolumes(), UgliScintPlnNode::BuildStrips(), GeoGeometry::BuildStrips(), PulserTimeCalScheme::CalibrateByJumps(), PulserTimeCalScheme::CalibrateByMuon(), PulserTimeCalScheme::CalibrateByPulser(), PulserTimeCalScheme::CalibrateShield(), UgliStripNode::ClearFiber(), PulserTimePlotter::CreateGraph(), StripAttenCalScheme::DecalAttenCorrected(), QuadLinearityCalScheme::DecalLinearity(), PulserLinearityCalScheme::DecalLinFar(), PulserLinearityCalScheme::DecalLinNear(), MIPCalScheme::DecalMIP(), StripToStripCalScheme::DecalStripToStrip(), TimeCalScheme::DecalTime(), VaLinearityCalScheme::DecalVALinearity(), MakeLin::DoCalc(), LIPlexMaps::DriftWithTime(), PulserGainFit::FarMeans(), FitNdNonlinQuad(), StripAttenCalScheme::GetAttenCorrected(), TimeCalScheme::GetCalibratedTime(), UgliDbiTables::GetDbiScintMdlById(), UgliDbiTables::GetDbiScintPlnByIndex(), UgliDbiTables::GetDbiSteelPlnByIndex(), UgliDbiTables::GetDbiStripById(), PmtDriftCalScheme::GetDrift(), PulserSigLinCalScheme::GetDriftFar(), PulserDriftCalScheme::GetDriftFar(), PulserSigLinCalScheme::GetDriftPinDiodeValue(), PulserDriftCalScheme::GetDriftPinDiodeValue(), PulserSigLinCalScheme::GetDriftPoint(), PulserDriftCalScheme::GetDriftPoint(), FabPlnInstallLookup::GetFabPlnInstall(), QuadLinearityCalScheme::GetLinearized(), VaLinearityCalScheme::GetLinearizedVA(), PulserLinearityCalScheme::GetLinFar(), PulserLinearityCalScheme::GetLinNear(), PulserLinearityCalScheme::GetMeanCorrection(), MIPCalScheme::GetMIP(), PulserTimeCalScheme::GetPulserCalibration(), PulserSigLinCalScheme::GetReferencePinDiodeValue(), SimPmtM16CrosstalkTable::GetRow(), PEGainCalScheme::GetRow(), PEGainAggCalScheme::GetRow(), StripToStripCalScheme::GetStripToStripCorrected(), PEGainCalScheme::GuessGainAndWidth(), PEGainAggCalScheme::GuessGainAndWidth(), main(), UgliGeometryReroot::MakeTempDbiPosInfo(), PulserDBModule::MergeBack(), UgliStripNode::PartialLength(), Plotter::Plot(), SimPmtM64CrosstalkTable::RebuildCache(), PulserGainFit::RunNearFarFits(), BfldCache::SetPlaneMapCache(), UgliScintMdlNode::UgliScintMdlNode(), UgliStripNode::UgliStripNode(), UgliStripNode::WlsBypass(), and UgliStripNode::WlsPigtail().

00599                                                           {
00600 //
00601 //
00602 //  Purpose: Return pointer to concrete Table Row object at given index.
00603 //
00604 //  Arguments: 
00605 //    rowNum       in    Required index number.
00606 //
00607 //  Return:        Pointer to concrete Table Row object at given index, 
00608 //                 =0 if none 
00609 //
00610 //  Contact:   N. West
00611 //
00612 //  Specification:-
00613 //  =============
00614 //
00615 //  o Return pointer to concrete Table Row object at given index or 
00616 //    0 if none.
00617 
00618 //  Program Notes:-
00619 //  =============
00620 
00621 //  None.
00622 
00623   return ( fResult && DbiTableProxyRegistry::IsActive() ) ?
00624       dynamic_cast<const T*>(fResult->GetTableRowByIndex(index))
00625     : 0;
00626 }

template<class T>
DbiTableProxy & DbiResultPtr< T >::GetTableProxy const string &  tableName  )  [static]
 

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 }

template<class T>
DbiTableProxy & DbiResultPtr< T >::GetTableProxy  )  [static]
 

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 }

template<class T>
const DbiValidityRec * DbiResultPtr< T >::GetValidityRec const DbiTableRow row = 0  )  const
 

Definition at line 631 of file DbiResultPtr.tpl.

References DbiResultPtr< T >::fResult, DbiResult::GetValidityRec(), and DbiTableProxyRegistry::IsActive().

Referenced by CountPot::Ana(), BfldCache::BfldCache(), Plexus::BuildLedMaps(), Plexus::BuildPinDiodeMap(), Plexus::BuildPixelMaps(), Plexus::BuildReadoutMap(), UgliGeometry::BuildStripShapes(), UgliGeometry::BuildVldRange(), GeoGeometry::BuildVldRange(), CheckGC::checklin(), CoilTools::CoilCurrentLimits(), PulserTimePlotter::CreateGraph(), SpillTimeFinder::DataIsAvailable(), SpillServerMonFinder::DataIsAvailable(), DbiConfigStream::DbiConfigStream(), PulserDBModule::DeleteGC(), PhotonStatSummarizer::DoesTableExist(), MuonDriftCalScheme::DoReset(), LIPlexMaps::DriftWithTime(), DTFtest(), dump_peds(), CountPot::EndJob(), HvStatusFinder::ExtendedQuery(), CountPot::FillMBPOT(), SpillTimeFinder::FindClosestEntries(), SpillServerMonFinder::FindClosestEntries(), Summarizer::FindNextContext(), FitNdNonlinQuad(), CoilTools::GetLast(), LIPlexMaps::GetRefAdcPinRatio(), HvStatusFinder::LocalQuery(), CoilTools::LocalQuery(), DbmModule::LogEntry(), main(), PlotPeds::Next(), PlotAllPeds::Next(), FabPlnInstallLookup::NextInstall(), PlotAllPeds::Prev(), PrintTimeCal(), DbmModule::Query(), SimPmtM64CrosstalkTable::Reset(), RangeLookupTable::Reset(), PhotonLookupTable::Reset(), AlgCalDetPID::RunAlg(), PulserGainFit::RunNearFarFits(), PulserGainFit::RunPinFits(), MBSpillAccessor::SeekClosest(), BDSpillAccessor::SeekClosest(), BDSwicPedAccessor::SetSpillTime(), PlotPeds::Update(), WriteTableToCSVFile(), and PulserDBModule::WriteTempGC().

00632                                                             {
00633 //
00634 //
00635 //  Purpose:  Return associated DbiValidityRec (if any).
00636 //
00637 //  Contact:   N. West
00638 
00639   return ( fResult && DbiTableProxyRegistry::IsActive() )
00640       ? &(fResult->GetValidityRec(row)) : 0 ;
00641  
00642 }

template<class T>
UInt_t DbiResultPtr< T >::NewQuery UInt_t  seqNo,
UInt_t  dbNo
 

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 }

template<class T>
UInt_t DbiResultPtr< T >::NewQuery const DbiValidityRec vrec  ) 
 

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 }

template<class T>
UInt_t DbiResultPtr< T >::NewQuery const DbiSqlContext context,
const Dbi::Task task = 0,
const string &  data = "",
const string &  fillOpts = ""
 

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 }

template<class T>
UInt_t DbiResultPtr< T >::NewQuery VldContext  vc,
Dbi::Task  task = 0,
Bool_t  findFullTimeWindow = true
 

Definition at line 695 of file DbiResultPtr.tpl.

References DbiResultPtr< T >::ApplyAbortTest(), VldContext::AsString(), DbiResult::Connect(), DbiResultPtr< T >::Disconnect(), DbiResultPtr< T >::fDetType, DbiResultPtr< T >::fResult, DbiResultPtr< T >::fSimType, DbiResultPtr< T >::fTableProxy, VldContext::GetDetector(), DbiResult::GetNumRows(), VldContext::GetSimFlag(), DbiTableProxy::GetTableName(), DbiTableProxyRegistry::IsActive(), MSG, DbiTableProxy::Query(), DbiTimerManager::RecBegin(), and DbiTimerManager::RecEnd().

Referenced by MuCalFitterModule::Ana(), FitTrackMSListModule::Ana(), CountPot::Ana(), BDLivePlot::BDLivePlot(), LIPlexMaps::CompareStripToStrip(), PulserTimePlotter::CreateGraph(), SpillTimeFinder::DataIsAvailable(), SpillServerMonFinder::DataIsAvailable(), DbiResultPtr< T >::DbiResultPtr(), VaLinearityCalScheme::DoReset(), TimeCalScheme::DoReset(), TemperatureCalScheme::DoReset(), StripToStripCalScheme::DoReset(), StripAttenCalScheme::DoReset(), QuadLinearityCalScheme::DoReset(), PulserTimeCalScheme::DoReset(), PulserSigLinCalScheme::DoReset(), PulserLinearityCalScheme::DoReset(), PulserDriftCalScheme::DoReset(), PmtDriftCalScheme::DoReset(), PEGainCalScheme::DoReset(), PEGainAggCalScheme::DoReset(), MuonDriftCalScheme::DoReset(), MIPCalScheme::DoReset(), LIPlexMaps::DriftWithTime(), dump_peds(), LIPlexMaps::DumpCalStripAtten(), LIPlexMaps::DumpCalStripToStrip(), FileGap::DumpMissing(), CountPot::EndJob(), HvStatusFinder::ExtendedQuery(), CountPot::FillMBPOT(), SpillTimeFinder::FindClosestEntries(), SpillServerMonFinder::FindClosestEntries(), PulserDBModule::GetCurrentFromDB(), FileGap::GetFileBounds(), LIPlexMaps::GetRawPinLedMap(), LIPlexMaps::GetRawPinMap(), LIPlexMaps::GetRefAdcPinRatio(), PhotonStatSummarizer::LoadDataFromDB(), FabPlnInstallLookup::NextInstall(), DbiResultPtr< T >::NextQuery(), LIPlexMaps::RatioRawToRefDrift(), LIPlexMaps::ReadDbCalStripAtten(), LIPlexMaps::ReadDbCalStripToStrip(), LIPlexMaps::ReadDbGains(), LIPlexMaps::ReadDbPulserDrift(), LIPlexMaps::ReadDbPulserDriftPin(), LIPlexMaps::ReadDbPulserRawGain(), SimPmtM64CrosstalkTable::Reset(), SimPmtM16CrosstalkTable::Reset(), RangeLookupTable::Reset(), PhotonLookupTable::Reset(), PulserGainFit::RunNearFarFits(), PulserGainFit::RunPinFits(), MBSpillAccessor::SeekClosest(), BDSpillAccessor::SeekClosest(), BMSpillAna::SelectSpill(), BDSwicPedAccessor::SetSpillTime(), BDSwicMaskAccessor::SetSpillTime(), PlotPeds::Start(), and PlotAllPeds::Start().

00697                                                             {
00698 //
00699 //
00700 //  Purpose:  Apply new query.
00701 //
00702 //  Arguments: 
00703 //    vc           in    The Validity Context of the new query
00704 //    task         in    The task of the new query
00705 //    findFullTimeWindow
00706 //                 in    Attempt to find full validity of query 
00707 //                        i.e. beyond Dbi::GetTimeGate
00708 //
00709 //
00710 //  Return:    The number of rows retrieved by query.  =0 if error.
00711 //
00712 //  Contact:   N. West
00713 //
00714 //  Specification:-
00715 //  =============
00716 //
00717 //  o Disconnect any previous results and apply new query to
00718 //    associated database table
00719 
00720 //  Program Notes:-
00721 //  =============
00722 
00723 //  None.
00724 
00725   if ( ! DbiTableProxyRegistry::IsActive() ) {
00726     fResult = 0;
00727     return 0;
00728   }
00729   fDetType = vc.GetDetector();
00730   fSimType = vc.GetSimFlag();
00731 
00732   MSG("Dbi",Msg::kSynopsis)  << "\n\nStarting context query: " 
00733                              << vc  << " task " << task << "\n" << endl;
00734 
00735   DbiTimerManager::gTimerManager.RecBegin(fTableProxy.GetTableName(), sizeof(T));
00736   Disconnect();
00737   fResult = fTableProxy.Query(vc,task,findFullTimeWindow);
00738   fResult->Connect();
00739   DbiTimerManager::gTimerManager.RecEnd(fResult->GetNumRows());
00740 
00741   if ( this->ApplyAbortTest() ) {
00742     MSG("Dbi",Msg::kFatal) << "while applying validity context query for "
00743                            << vc.AsString() << " with task " << task << endl;
00744     abort();
00745   }
00746   MSG("Dbi",Msg::kSynopsis)  << "\nCompleted context query: " 
00747                              << vc  << " task " << task 
00748                              << " Found:  " << fResult->GetNumRows() << " rows\n" << endl;
00749   return fResult->GetNumRows();
00750 
00751 }

template<class T>
UInt_t DbiResultPtr< T >::NextQuery Bool_t  forwards = kTRUE  ) 
 

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 }

template<class T>
DbiResultPtr& DbiResultPtr< T >::operator= const DbiResultPtr< T > &   )  [private]
 

template<class T>
Bool_t DbiResultPtr< T >::ResultsFromDb  )  const
 

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 }

template<class T>
void DbiResultPtr< T >::SetContext const DbiValidityRec vrec  )  [private]
 

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 }

template<class T>
DbiTableProxy & DbiResultPtr< T >::TableProxy  )  const
 

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 }


Member Data Documentation

template<class T>
Dbi::AbortTest DbiResultPtr< T >::fAbortTest [private]
 

Test which if failed triggers abort.

Definition at line 115 of file DbiResultPtr.h.

Referenced by DbiResultPtr< T >::ApplyAbortTest().

template<class T>
Detector::Detector_t DbiResultPtr< T >::fDetType [private]
 

from query context.

Definition at line 127 of file DbiResultPtr.h.

Referenced by DbiResultPtr< T >::NewQuery(), DbiResultPtr< T >::NextQuery(), and DbiResultPtr< T >::SetContext().

template<class T>
DbiTableProxy * DbiResultPtr< T >::fgNameToProxy [static, private]
 

Definition at line 22 of file DbiResultPtr.tpl.

Referenced by DbiResultPtr< T >::GetTableProxy().

template<class T>
DbiTableProxy * DbiResultPtr< T >::fgTableProxy = 0 [static, private]
 

Definition at line 25 of file DbiResultPtr.tpl.

Referenced by DbiResultPtr< T >::GetTableProxy().

template<class T>
const DbiResult* DbiResultPtr< T >::fResult [private]
 

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().

template<class T>
SimFlag::SimFlag_t DbiResultPtr< T >::fSimType [private]
 

from query context.

Definition at line 130 of file DbiResultPtr.h.

Referenced by DbiResultPtr< T >::NewQuery(), DbiResultPtr< T >::NextQuery(), and DbiResultPtr< T >::SetContext().

template<class T>
DbiTableProxy& DbiResultPtr< T >::fTableProxy [private]
 

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().


The documentation for this class was generated from the following files:
Generated on Fri Mar 28 15:58:34 2008 for loon by  doxygen 1.3.9.1