#include <DbiValRecSet.h>
Public Member Functions | |
| DbiValRecSet (const string &tableName, UInt_t dbNo, UInt_t seqNo=0) | |
| virtual | ~DbiValRecSet () |
| UInt_t | GetDbNo () const |
| UInt_t | GetNumRows () const |
| const string | GetTableName () const |
| const DbiValidityRec * | GetTableRow (UInt_t rowNum) const |
| const DbiValidityRec * | GetTableRowBySeqNo (UInt_t seqNo) const |
Private Attributes | |
| UInt_t | fDbNo |
| DbiResult * | fResult |
| Result holding table of DbiValidityRec. | |
| map< UInt_t, const DbiValidityRec * > | fSeqNoToRec |
DatabaseInterface
Contact: n.west1@physics.ox.ac.uk
Definition at line 30 of file DbiValRecSet.h.
|
||||||||||||||||
|
Definition at line 28 of file DbiValRecSet.cxx. References DbiTableProxy::GetDBProxy(), DbiTableProxyRegistry::GetTableProxy(), DbiTableProxyRegistry::Instance(), LEA_CTOR, MSG, and DbiDBProxy::QueryAllValidities(). 00028 : 00029 fDbNo(dbNo), 00030 fResult(0) 00031 { 00032 // 00033 // 00034 // Purpose: Constructor 00035 // 00036 // Arguments: 00037 // tableName in Table Name whose DbiValidityRecs are required. 00038 // dbNo in Database number in the cascade. 00039 // seqNo in Just this SEQNO if >0 or all if 0 [default: 0] 00040 // 00041 // Return: n/a 00042 // 00043 // Contact: N. West 00044 // 00045 // Specification:- 00046 // ============= 00047 // 00048 // o For the required table in the required database, load every 00049 // DbiValidityRec into DbiResult. 00050 00051 00052 // Program Notes:- 00053 // ============= 00054 00055 // None. 00056 00057 LEA_CTOR //Leak Checker 00058 00059 MSG("Dbi", Msg::kVerbose) << "Creating DbiValRecSet" << endl; 00060 00061 // Get Db proxy for the table. 00062 DbiValidityRec pet; 00063 const DbiDBProxy& proxy = DbiTableProxyRegistry::Instance() 00064 .GetTableProxy(tableName,&pet) 00065 .GetDBProxy(); 00066 00067 // Collect up all validity records. 00068 DbiResultSet* rset = proxy.QueryAllValidities(dbNo,seqNo); 00069 fResult = new DbiResultNonAgg(rset,&pet,0,kFALSE); 00070 delete rset; 00071 00072 00073 }
|
|
|
Definition at line 78 of file DbiValRecSet.cxx. 00078 {
00079 //
00080 //
00081 // Purpose: Destructor
00082 //
00083 // Arguments:
00084 // None.
00085 //
00086 // Return: n/a
00087 //
00088 // Contact: N. West
00089 //
00090 // Specification:-
00091 // =============
00092 //
00093 // o Destroy RowStream.
00094
00095
00096 // Program Notes:-
00097 // =============
00098
00099 // None.
00100
00101 LEA_DTOR //Leak Checker
00102
00103 MSG("Dbi", Msg::kVerbose) << "Destroying DbiValRecSet" << endl;
00104 delete fResult;
00105
00106 }
|
|
|
Definition at line 40 of file DbiValRecSet.h. Referenced by DbmModule::BuildValRecSet(). 00040 { return fDbNo; }
|
|
|
Definition at line 110 of file DbiValRecSet.cxx. References fResult, and DbiResult::GetNumRows(). Referenced by DbmModule::BuildValRecSet(), DbmModule::ExportTable(), GetTableRowBySeqNo(), and DbmModule::GlobaliseSeqNo(). 00110 {
00111 //
00112 //
00113 // Purpose: Return the number of rows.
00114 //
00115 // Arguments: None.
00116 //
00117 // Return:
00118 //
00119 // Contact: N. West
00120 //
00121 // Specification:-
00122 // =============
00123 //
00124 // o Return the number of rows.
00125
00126 // Program Notes:-
00127 // =============
00128
00129 // None.
00130
00131 return fResult ? fResult->GetNumRows() : 0;
00132 }
|
|
|
Definition at line 136 of file DbiValRecSet.cxx. References fResult, and DbiResult::TableName(). Referenced by DbmModule::BuildValRecSet(). 00136 {
00137 //
00138 //
00139 // Purpose: Return the table name.
00140 //
00141 // Arguments: None.
00142 //
00143 // Return:
00144 //
00145 // Contact: N. West
00146 //
00147 // Specification:-
00148 // =============
00149 //
00150 // o Return the table name.
00151
00152 // Program Notes:-
00153 // =============
00154
00155 // None.
00156
00157 return fResult ? fResult->TableName() : "Unknown";
00158 }
|
|
|
Definition at line 162 of file DbiValRecSet.cxx. References fResult, and DbiResult::GetTableRow(). Referenced by DbmModule::ExportTable(), GetTableRowBySeqNo(), and DbmModule::GlobaliseSeqNo(). 00162 {
00163 //
00164 //
00165 // Purpose: Return DbiValidityRec at supplied row number.
00166 //
00167 // Arguments:
00168 // rowNum in Row number whose entry is required or 0 if none.
00169 //
00170 // Return:
00171 //
00172 // Contact: N. West
00173 //
00174 // Specification:-
00175 // =============
00176 //
00177 // o Return DbiValidityRec at supplied row number.
00178
00179 // Program Notes:-
00180 // =============
00181
00182 // None.
00183
00184 return fResult ?
00185 dynamic_cast<const DbiValidityRec*>(fResult->GetTableRow(rowNum))
00186 : 0;
00187 }
|
|
|
Definition at line 191 of file DbiValRecSet.cxx. References fSeqNoToRec, GetNumRows(), DbiValidityRec::GetSeqNo(), and GetTableRow(). Referenced by DbmModule::Import(). 00192 {
00193 //
00194 //
00195 // Purpose: Return DbiValidityRec having supplied SeqNo.
00196 //
00197 // Arguments:
00198 // seqNo in Sequence number of required entry or 0 if none.
00199 //
00200 // Return:
00201 //
00202 // Contact: N. West
00203 //
00204 // Specification:-
00205 // =============
00206 //
00207 // o Return DbiValidityRec at supplied row number.
00208
00209 // Program Notes:-
00210 // =============
00211
00212 // None.
00213
00214 UInt_t numRows = GetNumRows();
00215 if ( numRows == 0 ) return 0;
00216
00217 // Create look-up table if not yet built.
00218
00219 if ( fSeqNoToRec.size() == 0 ) {
00220 for ( UInt_t irow = 0; irow < numRows; ++irow) {
00221 const DbiValidityRec* vrec = GetTableRow(irow);
00222 fSeqNoToRec[vrec->GetSeqNo()] = vrec;
00223 }
00224 }
00225
00226 map<UInt_t,const DbiValidityRec*>::const_iterator itr = fSeqNoToRec.find(seqNo);
00227 return ( itr == fSeqNoToRec.end() ) ? 0 : itr->second;
00228
00229 }
|
|
|
Definition at line 53 of file DbiValRecSet.h. |
|
|
Result holding table of DbiValidityRec.
Definition at line 56 of file DbiValRecSet.h. Referenced by GetNumRows(), GetTableName(), and GetTableRow(). |
|
|
Lookup SeqNo -> DbiValidityRec lazy creation - see GetTableRowBySeqNo Definition at line 60 of file DbiValRecSet.h. Referenced by GetTableRowBySeqNo(). |
1.3.9.1