DbiResultPtr< T > Class Template Reference

#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

static DbiTableProxyGetTableProxy ()
static 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

static std::map< string, DbiTableProxy * > fgNameToProxy
static DbiTableProxyfgTableProxy = 0


Detailed Description

template<class T>
class DbiResultPtr< T >

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

Definition at line 43 of file DbiResultPtr.h.


Constructor & Destructor Documentation

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

Definition at line 38 of file DbiResultPtr.tpl.

References Msg::kVerbose, LEA_CTOR, and MSG.

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

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

Definition at line 76 of file DbiResultPtr.tpl.

References DbiResult::Connect(), DbiResultPtr< T >::fResult, DbiResultPtr< T >::fTableProxy, Msg::kVerbose, 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 }

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 100 of file DbiResultPtr.tpl.

References DbiResultPtr< T >::fTableProxy, Msg::kVerbose, 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 }

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 150 of file DbiResultPtr.tpl.

References DbiResultPtr< T >::fTableProxy, Msg::kVerbose, 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 }
//.....................................................................

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 199 of file DbiResultPtr.tpl.

References DbiResultPtr< T >::fTableProxy, DbiString::GetString(), Msg::kVerbose, 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 }

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

Definition at line 254 of file DbiResultPtr.tpl.

References DbiResultPtr< T >::fTableProxy, Msg::kVerbose, 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 }
//.....................................................................

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

Definition at line 298 of file DbiResultPtr.tpl.

References DbiResultPtr< T >::fTableProxy, Msg::kVerbose, 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 }

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

Definition at line 345 of file DbiResultPtr.tpl.

References DbiResultPtr< T >::Disconnect(), Msg::kVerbose, 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 }


Member Function Documentation

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

Definition at line 377 of file DbiResultPtr.tpl.

References DbiResultPtr< T >::fAbortTest, DbiResultPtr< T >::fTableProxy, DbiTableProxy::GetTableName(), Dbi::kDataMissing, Dbi::kDisabled, Msg::kFatal, MSG, and DbiTableProxy::TableExists().

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 }

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

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 }

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

Definition at line 436 of file DbiResultPtr.tpl.

References DbiResultPtr< T >::fResult, DbiResultKey::GetEmptyKey(), and DbiResult::GetKey().

Referenced by PEGainCalScheme::DoReset(), PEGainAggCalScheme::DoReset(), 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 }

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

Definition at line 540 of file DbiResultPtr.tpl.

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

Referenced by RateSummary::Ana(), NueDisplayModule::Ana(), CountPot::Ana(), RunQualityFinder::BadReadoutErrorsLegacy(), 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(), 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(), McNormalizationFinder::GetEntry(), MCFilePOTInfoFinder::GetEntry(), FabPlnInstallLookup::GetFabSteelPlates(), CoilTools::GetLast(), QuadLinearityCalScheme::GetLinearized(), VaLinearityCalScheme::GetLinearizedVA(), PlexVetoShieldHack::GetMdlPlaneCoverage(), PlexVetoShieldHack::GetMdlPlaneView(), MIPCalScheme::GetMIP(), MadTVAnalysis::GetNDCoilCurrent(), UgliDbiTables::GetNumSteelRows(), SpillTimeFinder::GetOffsetKickerToNDNu(), SpillTimeFinder::GetOffsetNDNuToFDNu(), SpillTimeFinder::GetOffsetSgateToNDNu(), PulserGainFit::GetPinData(), PEGainCalScheme::GetRow(), PEGainAggCalScheme::GetRow(), DataUtil::GetRunNumber(), DataUtil::GetRunTimes(), StripToStripCalScheme::GetStripToStripCorrected(), TemperatureCalScheme::GetTemperature(), PhotonStatSummarizer::LoadDataFromDB(), HvStatusFinder::LocalQuery(), CoilTools::LocalQuery(), DbmModule::LogEntry(), PlexVetoShieldHack::LookForMuxMdl(), FabPlnInstallLookup::LookForOddEntries(), PlexVetoShieldHack::LookForSingleMdl(), main(), RunQualityUtil::MakeRunList(), PulserDBModule::MergeBack(), DcsRadonLevelFinder::NewQuery(), FabPlnInstallLookup::NextInstall(), Plotter::Plotter(), FabPlnInstallLookup::Print(), LIPlexMaps::PrintDbPinDiodeInfo(), PrintTimeCal(), RunQualityFinder::QueryDB(), FillSpillServerMon::ReadFromDatabase(), FillNearRunQuality::ReadFromDatabase(), FillHvFromSingles::ReadFromDatabase(), FillFarRunQuality::ReadFromDatabase(), RangeLookupTable::Rebuild(), PhotonLookupTable::Rebuild(), SimPmtM64CrosstalkTable::RebuildCache(), VtxModule::Reco(), UberModuleLite::Reco(), UberModule::Reco(), NueModule::Reco(), FarTimingFidFinder::RefreshQuery(), InfoChain::RemoveTemperatureEffects(), PlexVetoShieldHack::RenumberMdlToMux(), PlexVetoShieldHack::RenumberMuxToMdl(), PhotonDefaultModel::Reset(), AlgFilterChannels::RunAlg(), AlgCalDetPID::RunAlg(), PulserGainFit::RunNearFarFits(), PulserGainFit::RunPinFits(), NueAnalysisCuts::SetNtpInfoObjects(), MBSpillAccessor::TableSearch(), BDSpillAccessor::TableSearch(), InfoChain::TestDatabase(), PlotPeds::Update(), PlotAllPedsImp::Update(), FabPlnInstallLookup::WhereIsScintMdl(), FabPlnInstallLookup::WhereIsSteelSlab(), WriteTableToCSVFile(), and ScintCalTimePeriod::WriteToMINOSDbi().

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

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

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

Definition at line 570 of file DbiResultPtr.tpl.

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

Referenced by RateSummary::Ana(), NueDisplayModule::Ana(), CountPot::Ana(), RunQualityFinder::BadReadoutErrorsLegacy(), 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(), MIPCalScheme::DecalMIP(), MuonDriftCalScheme::DoReset(), DTFtest(), LIPlexMaps::DumpCalStripAtten(), LIPlexMaps::DumpCalStripToStrip(), DumpFilterChannels(), LIPlexMaps::DumpGains(), FileGap::DumpMissing(), CountPot::EndJob(), HvStatusFinder::ExtendedQuery(), CountPot::FillMBPOT(), NtpSRModule::FillNtpDetStatus(), SpillTimeFinder::FindBestRows(), SpillServerMonFinder::FindClosestEntries(), FitNdNonlinQuad(), PulserDBModule::GetCurrentFromDB(), UgliDbiTables::GetDbiGeometry(), UgliDbiTables::GetDbiSteelPln(), McNormalizationFinder::GetEntry(), MCFilePOTInfoFinder::GetEntry(), FabPlnInstallLookup::GetFabSteelPlates(), FileGap::GetFileBounds(), LIPlexMaps::GetGainMap(), CoilTools::GetLast(), PlexVetoShieldHack::GetMdlPlaneCoverage(), PlexVetoShieldHack::GetMdlPlaneView(), MIPCalScheme::GetMIP(), MadTVAnalysis::GetNDCoilCurrent(), SpillTimeFinder::GetOffsetKickerToNDNu(), SpillTimeFinder::GetOffsetNDNuToFDNu(), SpillTimeFinder::GetOffsetSgateToNDNu(), PulserGainFit::GetPinData(), BfldCanvasSlice::GetPlaneMap(), LIPlexMaps::GetRawPinLedMap(), LIPlexMaps::GetRawPinMap(), LIPlexMaps::GetRefAdcPinRatio(), DataUtil::GetRunNumber(), DataUtil::GetRunTimes(), TemperatureCalScheme::GetTemperature(), PhotonStatSummarizer::LoadDataFromDB(), HvStatusFinder::LocalQuery(), CoilTools::LocalQuery(), DbmLogFile::LogRec(), PlexVetoShieldHack::LookForMuxMdl(), FabPlnInstallLookup::LookForOddEntries(), PlexVetoShieldHack::LookForSingleMdl(), main(), RunQualityUtil::MakeRunList(), DcsRadonLevelFinder::NewQuery(), FabPlnInstallLookup::NextInstall(), FabPlnInstallLookup::Print(), LIPlexMaps::PrintDbPinDiodeInfo(), PrintTimeCal(), RunQualityFinder::QueryDB(), LIPlexMaps::RatioRawToRefDrift(), LIPlexMaps::ReadDbCalStripAtten(), LIPlexMaps::ReadDbCalStripToStrip(), LIPlexMaps::ReadDbGainAverage(), LIPlexMaps::ReadDbGains(), LIPlexMaps::ReadDbPulserDrift(), LIPlexMaps::ReadDbPulserDriftPin(), LIPlexMaps::ReadDbPulserRawGain(), FillSpillServerMon::ReadFromDatabase(), FillNearRunQuality::ReadFromDatabase(), FillHvFromSingles::ReadFromDatabase(), FillFarRunQuality::ReadFromDatabase(), RangeLookupTable::Rebuild(), PhotonLookupTable::Rebuild(), VtxModule::Reco(), UberModuleLite::Reco(), UberModule::Reco(), ParticleFinder::Reco(), NueModule::Reco(), FarTimingFidFinder::RefreshQuery(), InfoChain::RemoveTemperatureEffects(), PlexVetoShieldHack::RenumberMdlToMux(), PlexVetoShieldHack::RenumberMuxToMdl(), PhotonDefaultModel::Reset(), AlgFilterChannels::RunAlg(), AlgCalDetPID::RunAlg(), PulserGainFit::RunPinFits(), BMSpillAna::SelectSpill(), NueAnalysisCuts::SetNtpInfoObjects(), BDSwicPedAccessor::SetSpillTime(), BDSwicMaskAccessor::SetSpillTime(), MBSpillAccessor::TableSearch(), BDSpillAccessor::TableSearch(), InfoChain::TestDatabase(), PlotPeds::Update(), PlotAllPedsImp::Update(), FabPlnInstallLookup::WhereIsScintMdl(), FabPlnInstallLookup::WhereIsSteelSlab(), WriteTableToCSVFile(), and ScintCalTimePeriod::WriteToMINOSDbi().

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

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

Definition at line 601 of file DbiResultPtr.tpl.

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

Referenced by 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(), 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(), FabPlnInstallLookup::GetFabSteelPlates(), 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(), RunQualityFinder::QueryDB(), SimPmtM64CrosstalkTable::RebuildCache(), BfldCache::SetPlaneMapCache(), UgliScintMdlNode::UgliScintMdlNode(), UgliStripNode::UgliStripNode(), UgliStripNode::WlsBypass(), and UgliStripNode::WlsPigtail().

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

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

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 }

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

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 }

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

Definition at line 633 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(), 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(), LIPlexMaps::ReadDbGainAverage(), FarTimingFidFinder::RefreshQuery(), SimPmtM64CrosstalkTable::Reset(), RangeLookupTable::Reset(), PhotonLookupTable::Reset(), AlgCalDetPID::RunAlg(), PulserGainFit::RunNearFarFits(), PulserGainFit::RunPinFits(), MBSpillAccessor::SeekClosest(), BDSpillAccessor::SeekClosest(), BDSwicPedAccessor::SetSpillTime(), PlotPeds::Update(), WriteTableToCSVFile(), and PulserDBModule::WriteTempGC().

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

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

Definition at line 876 of file DbiResultPtr.tpl.

References DbiResult::Connect(), DbiResultPtr< T >::Disconnect(), DbiResultPtr< T >::fResult, DbiResultPtr< T >::fTableProxy, DbiResult::GetNumRows(), DbiTableProxy::GetTableName(), DbiResult::GetValidityRec(), DbiTimerManager::gTimerManager, DbiTableProxyRegistry::IsActive(), Msg::kFatal, Msg::kSynopsis, 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 }

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

Definition at line 822 of file DbiResultPtr.tpl.

References DbiResult::Connect(), DbiResultPtr< T >::Disconnect(), DbiResultPtr< T >::fResult, DbiResultPtr< T >::fTableProxy, DbiResult::GetNumRows(), DbiTableProxy::GetTableName(), DbiTimerManager::gTimerManager, DbiTableProxyRegistry::IsActive(), Msg::kFatal, Msg::kSynopsis, 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 }

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 757 of file DbiResultPtr.tpl.

References 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(), DbiTimerManager::gTimerManager, DbiTableProxyRegistry::IsActive(), Msg::kFatal, Msg::kSynopsis, 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 }

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

Definition at line 697 of file DbiResultPtr.tpl.

References 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(), DbiTimerManager::gTimerManager, DbiTableProxyRegistry::IsActive(), Msg::kFatal, Msg::kSynopsis, MSG, DbiTableProxy::Query(), DbiTimerManager::RecBegin(), and DbiTimerManager::RecEnd().

Referenced by NueDisplayModule::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(), LIPlexMaps::DumpGains(), FileGap::DumpMissing(), CountPot::EndJob(), HvStatusFinder::ExtendedQuery(), CountPot::FillMBPOT(), SpillTimeFinder::FindClosestEntries(), SpillServerMonFinder::FindClosestEntries(), PulserDBModule::GetCurrentFromDB(), FileGap::GetFileBounds(), LIPlexMaps::GetGainMap(), SpillTimeFinder::GetOffsetKickerToNDNu(), SpillTimeFinder::GetOffsetNDNuToFDNu(), SpillTimeFinder::GetOffsetSgateToNDNu(), LIPlexMaps::GetRawPinLedMap(), LIPlexMaps::GetRawPinMap(), LIPlexMaps::GetRefAdcPinRatio(), DataUtil::GetRunNumber(), DataUtil::GetRunTimes(), PhotonStatSummarizer::LoadDataFromDB(), McNormalizationFinder::McNormalizationFinder(), DcsRadonLevelFinder::NewQuery(), FabPlnInstallLookup::NextInstall(), DbiResultPtr< T >::NextQuery(), RunQualityFinder::QueryDB(), LIPlexMaps::RatioRawToRefDrift(), LIPlexMaps::ReadDbCalStripAtten(), LIPlexMaps::ReadDbCalStripToStrip(), LIPlexMaps::ReadDbGainAverage(), LIPlexMaps::ReadDbGains(), LIPlexMaps::ReadDbPulserDrift(), LIPlexMaps::ReadDbPulserDriftPin(), LIPlexMaps::ReadDbPulserRawGain(), ParticleFinder::Reco(), NueModule::Reco(), FarTimingFidFinder::RefreshQuery(), SimPmtM64CrosstalkTable::Reset(), SimPmtM16CrosstalkTable::Reset(), RangeLookupTable::Reset(), PhotonLookupTable::Reset(), PulserGainFit::RunNearFarFits(), PulserGainFit::RunPinFits(), MBSpillAccessor::SeekClosest(), BDSpillAccessor::SeekClosest(), BMSpillAna::SelectSpill(), BDSwicPedAccessor::SetSpillTime(), BDSwicMaskAccessor::SetSpillTime(), PlotPeds::Start(), PlotAllPeds::Start(), and MCFilePOTInfoFinder::UpdateTask().

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

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

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::kSynopsis, MSG, and DbiResultPtr< T >::NewQuery().

Referenced by main(), 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 }

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

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

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 }

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

Definition at line 940 of file DbiResultPtr.tpl.

References DbiResultPtr< T >::fDetType, DbiResultPtr< T >::fSimType, VldRange::GetDetectorMask(), VldRange::GetSimMask(), DbiValidityRec::GetVldRange(), Detector::kCalDet, Detector::kCalib, SimFlag::kDaqFakeData, SimFlag::kData, Detector::kFar, Detector::kMapper, SimFlag::kMC, Detector::kNear, SimFlag::kReroot, Detector::kTestStand, SimFlag::kUnknown, and Detector::kUnknown.

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 }

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

Definition at line 984 of file DbiResultPtr.tpl.

References DbiResultPtr< T >::fTableProxy, and DbiTableProxyRegistry::IsActive().

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 }


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 133 of file DbiResultPtr.h.

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

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

Definition at line 135 of file DbiResultPtr.h.

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< PulserRawDriftF >::GetResult(), 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(), DbiResultPtr< T >::NewQuery(), and DbiResultPtr< T >::TableProxy().


The documentation for this class was generated from the following files:
Generated on Mon Nov 10 00:55:22 2014 for loon by  doxygen 1.4.7