#include <DbiTableProxyRegistry.h>
Inheritance diagram for DbiTableProxyRegistry:

Public Member Functions | |
| void | ShowStatistics () const |
| void | Config () |
| void | ClearRollbackDates () |
| void | ClearSimFlagAssociation () |
| DbiCascader & | GetCascader () |
| DbiTableProxy & | GetTableProxy (const std::string &tableName, const DbiTableRow *tableRow) |
| Bool_t | HasRowCounter (const std::string &tableName) |
| void | PurgeCaches () |
| void | RefreshMetaData (const std::string &tableName) |
| void | SetSqlCondition (const std::string &sql="") |
Static Public Member Functions | |
| static DbiTableProxyRegistry & | Instance () |
| static Bool_t | IsActive () |
Protected Member Functions | |
| DbiTableProxyRegistry () | |
| virtual | ~DbiTableProxyRegistry () |
Private Member Functions | |
| void | SetConfigFromEnvironment () |
| DbiTableProxyRegistry (const DbiTableProxyRegistry &) | |
| DbiTableProxyRegistry & | operator= (const DbiTableProxyRegistry &) |
| void | ApplySqlCondition () const |
| void | ApplySqlCondition (DbiTableProxy *proxy) const |
Private Attributes | |
| DbiCascader * | fCascader |
| Cascader. | |
| std::string | fSqlCondition |
| Default optional condition. | |
| std::map< std::string, DbiTableProxy * > | fTPmap |
| TableName::RowName -> TableProxy. | |
| DbiRollbackDates | fRollbackDates |
| Rollback dates for each table. | |
| DbiSimFlagAssociation | fSimFlagAss |
| Lists of SimFlag associations. | |
Static Private Attributes | |
| static DbiTableProxyRegistry * | fgInstance = 0 |
| Holds only instance. | |
Friends | |
| class | DbiValidate |
| class | Cleaner |
Classes | |
| struct | Cleaner |
Definition at line 38 of file DbiTableProxyRegistry.h.
| DbiTableProxyRegistry::DbiTableProxyRegistry | ( | ) | [protected] |
Definition at line 39 of file DbiTableProxyRegistry.cxx.
References Msg::kVerbose, LEA_CTOR, MSG, SetConfigFromEnvironment(), and DbiServices::SetRecord().
Referenced by Instance().
00039 : 00040 fCascader(0) 00041 { 00042 // 00043 // 00044 // Purpose: Constructor 00045 // 00046 // Arguments: None. 00047 // 00048 // Return: n/a 00049 // 00050 // Contact: N. West 00051 // 00052 // Specification:- 00053 // ============= 00054 // 00055 // o Create factory 00056 00057 // Program Notes:- 00058 // ============= 00059 00060 // None. 00061 00062 LEA_CTOR //Leak Checker 00063 00064 // Create cascader for database access. 00065 00066 fCascader = new DbiCascader; 00067 00068 // Get any environment configuration. 00069 00070 this->SetConfigFromEnvironment(); 00071 00072 // Create a DbiRecord to record a summary of all DbiResults in memory 00073 // and register it as a service. 00074 DbiServices::SetRecord(new DbiRecord); 00075 00076 MSG("Dbi", Msg::kVerbose) << "Creating DbiTableProxyRegistry" 00077 << endl; 00078 00079 00080 }
| DbiTableProxyRegistry::~DbiTableProxyRegistry | ( | ) | [protected, virtual] |
Definition at line 84 of file DbiTableProxyRegistry.cxx.
References fCascader, fgInstance, fTPmap, DbiExceptionLog::GetGELog(), DbiServices::GetRecord(), Msg::kInfo, Msg::kVerbose, LEA_DTOR, MSG, DbiExceptionLog::Print(), DbiServices::SetRecord(), and DbiExceptionLog::Size().
00084 { 00085 // 00086 // 00087 // Purpose: Destructor 00088 // 00089 // Arguments: 00090 // None. 00091 // 00092 // Return: n/a 00093 // 00094 // Contact: N. West 00095 // 00096 // Specification:- 00097 // ============= 00098 // 00099 // o Destroy all DbiTableProxies if Shutdown required. 00100 00101 00102 LEA_DTOR //Leak Checker 00103 00104 if ( DbiExceptionLog::GetGELog().Size() ) { 00105 MSG("Dbi",Msg::kInfo) << "Database Global Exception Log contains " 00106 << DbiExceptionLog::GetGELog().Size() << " entries:-" << endl;; 00107 DbiExceptionLog::GetGELog().Print(); 00108 } 00109 00110 int shutdown = 0; 00111 if ( ! this->GetConfig().Get("Shutdown",shutdown) 00112 || shutdown == 0 ) { 00113 MSG("Dbi",Msg::kInfo) << "DatabaseInterface shutdown not requested" << endl; 00114 return; 00115 } 00116 00117 MSG("Dbi",Msg::kInfo) << "DatabaseInterface shutting down..." << endl; 00118 00119 // Destroy all owned objects. 00120 00121 for ( std::map<std::string,DbiTableProxy*>::iterator itr = fTPmap.begin(); 00122 itr != fTPmap.end(); 00123 ++itr) { 00124 DbiTableProxy* tp = (*itr).second; 00125 delete tp; 00126 } 00127 00128 delete fCascader; 00129 fCascader = 0; 00130 00131 delete DbiServices::GetRecord(); 00132 DbiServices::SetRecord(0); 00133 00134 MSG("Dbi", Msg::kVerbose) 00135 << "Destroying DbiTableProxyRegistry" << endl; 00136 00137 MSG("Dbi", Msg::kInfo) << "DatabaseInterface shutdown complete." << endl; 00138 DbiTableProxyRegistry::fgInstance = 0; 00139 00140 }
| DbiTableProxyRegistry::DbiTableProxyRegistry | ( | const DbiTableProxyRegistry & | ) | [private] |
| void DbiTableProxyRegistry::ApplySqlCondition | ( | DbiTableProxy * | proxy | ) | const [private] |
Definition at line 164 of file DbiTableProxyRegistry.cxx.
References fRollbackDates, fSqlCondition, DbiRollbackDates::GetDate(), DbiTableProxy::GetTableName(), DbiRollbackDates::GetType(), and DbiTableProxy::SetSqlCondition().
00164 { 00165 // 00166 // 00167 // Purpose: Apply Sql condition to specific DbiTableProxy. 00168 // 00169 // Arguments: 00170 // proxy in DbiTableProxy to which condition is to be applied. 00171 // 00172 // Contact: N. West 00173 // 00174 00175 string sqlFull = fSqlCondition; 00176 const string tableName(proxy->GetTableName()); 00177 const string& date = fRollbackDates.GetDate(tableName); 00178 if ( date.size() ) { 00179 if ( sqlFull.size() ) sqlFull += " and "; 00180 sqlFull += fRollbackDates.GetType(tableName); 00181 sqlFull += " < \'"; 00182 sqlFull += date; 00183 sqlFull += "\'"; 00184 } 00185 00186 proxy->SetSqlCondition(sqlFull); 00187 }
| void DbiTableProxyRegistry::ApplySqlCondition | ( | ) | const [private] |
Definition at line 144 of file DbiTableProxyRegistry.cxx.
References fTPmap.
Referenced by ClearRollbackDates(), Config(), GetTableProxy(), and SetSqlCondition().
00144 { 00145 // 00146 // 00147 // Purpose: Apply Sql condition to existing DbiTableProxys. 00148 // 00149 // Contact: N. West 00150 // 00151 // Specification:- 00152 // ============= 00153 // 00154 // o Apply global Sql condition, together with any prevailing rollback to 00155 // all existing DbiTableProxys. 00156 00157 std::map<std::string,DbiTableProxy*>::const_iterator itr = fTPmap.begin(); 00158 std::map<std::string,DbiTableProxy*>::const_iterator itrEnd = fTPmap.end(); 00159 for ( ; itr != itrEnd; ++itr) this->ApplySqlCondition(itr->second); 00160 }
| void DbiTableProxyRegistry::ClearRollbackDates | ( | ) |
Definition at line 191 of file DbiTableProxyRegistry.cxx.
References ApplySqlCondition(), DbiRollbackDates::Clear(), and fRollbackDates.
00191 { 00192 00193 fRollbackDates.Clear(); 00194 this->ApplySqlCondition(); 00195 }
| void DbiTableProxyRegistry::ClearSimFlagAssociation | ( | ) |
Definition at line 199 of file DbiTableProxyRegistry.cxx.
References DbiSimFlagAssociation::Clear(), and fSimFlagAss.
00199 { 00200 00201 fSimFlagAss.Clear(); 00202 }
| void DbiTableProxyRegistry::Config | ( | ) | [virtual] |
Implements CfgConfigurable.
Definition at line 205 of file DbiTableProxyRegistry.cxx.
References ApplySqlCondition(), DbiServices::fAsciiDBConectionsTemporary, fCascader, DbiServices::fOrderContextQuery, fRollbackDates, fSimFlagAss, Registry::Get(), CfgConfigurable::GetConfig(), DbiCascader::GetNumDb(), gSystem(), Msg::kFatal, Msg::kInfo, Msg::kWarning, MSG, reg, Registry::RemoveKey(), DbiRollbackDates::Set(), DbiSimFlagAssociation::Set(), DbiCascader::SetPermanent(), and DbiBinaryFile::SetWorkDir().
00205 { 00206 // 00207 // 00208 // Purpose: Reconfigure after internal registry update. 00209 // 00210 // Contact: N. West 00211 // 00212 // Specification:- 00213 // ============= 00214 // 00215 // o 00216 00217 // Program Notes:- 00218 // ============= 00219 00220 // None. 00221 00222 Registry& reg = this->GetConfig(); 00223 00224 //Load up SimFlag Associations and remove them from the Registry. 00225 fSimFlagAss.Set(reg); 00226 00227 //Load up Rollback dates and remove them from the Registry. 00228 fRollbackDates.Set(reg); 00229 00230 //Apply any rollback now in force. 00231 this->ApplySqlCondition(); 00232 00233 // If Level 2 cache enabled establish working directory 00234 // for DbiBinaryFile. 00235 const char* dir; 00236 if ( reg.Get("Level2Cache",dir) ) { 00237 // Expand any environmental variables. 00238 TString tmp(dir); 00239 // March 2004 ExpandPathName returns false even if it works, so test for failure 00240 // by looking for an unexpanded symbol. 00241 gSystem->ExpandPathName(tmp); 00242 if ( tmp.Contains("$" ) ) { 00243 dir = "./"; 00244 MSG("Dbi",Msg::kWarning) << "Directory name expansion failed, using " 00245 << dir << " instead" << endl; 00246 } 00247 else { 00248 dir = tmp.Data(); 00249 } 00250 00251 DbiBinaryFile::SetWorkDir(dir); 00252 MSG("Dbi",Msg::kInfo) << "DbiTableProxyRegistry: Setting L2 Cache to: " << dir << endl; 00253 } 00254 00255 // Check for request to make all cascade connections permanent 00256 // and remove from the Registry. 00257 00258 int connectionsPermanent = 0; 00259 if ( reg.Get("MakeConnectionsPermanent",connectionsPermanent) ) { 00260 reg.RemoveKey("MakeConnectionsPermanent"); 00261 Int_t dbNo =fCascader->GetNumDb(); 00262 if ( connectionsPermanent > 0 ) { 00263 while ( --dbNo >= 0 ) fCascader->SetPermanent(dbNo); 00264 MSG("Dbi",Msg::kInfo) << "Making all database connections permanent" << endl; 00265 // Inform DbiServices so that DbiConnection can check when opening new connections. 00266 DbiServices::fAsciiDBConectionsTemporary = false; 00267 } 00268 else { 00269 while ( --dbNo >= 0 ) fCascader->SetPermanent(dbNo,false); 00270 MSG("Dbi",Msg::kInfo) << "Forcing all connections, including ASCII DB, to be temporary" << endl; 00271 // Inform DbiServices so that DbiConnection can check when opening new connections. 00272 DbiServices::fAsciiDBConectionsTemporary = true; 00273 } 00274 } 00275 00276 // Check for request to order context queries and remove from the Registry. 00277 00278 int OrderContextQuery = 0; 00279 if ( reg.Get("OrderContextQuery",OrderContextQuery) ) { 00280 reg.RemoveKey("OrderContextQuery"); 00281 if ( OrderContextQuery ) { 00282 DbiServices::fOrderContextQuery = true; 00283 MSG("Dbi",Msg::kInfo) << "Forcing ordering of all context queries" << endl; 00284 } 00285 } 00286 00287 // Abort if Registry contains any unknown keys 00288 00289 const char* knownKeys[] = { "Level2Cache", 00290 "Shutdown" }; 00291 int numKnownKeys = sizeof(knownKeys)/sizeof(char*); 00292 bool hasUnknownKeys = false; 00293 00294 Registry::RegistryKey keyItr(&this->GetConfig()); 00295 while ( const char* foundKey = keyItr() ) { 00296 bool keyUnknown = true; 00297 for (int keyNum = 0; keyNum < numKnownKeys; ++keyNum ) { 00298 if ( ! strcmp(foundKey,knownKeys[keyNum]) ) keyUnknown = false; 00299 } 00300 if ( keyUnknown ) { 00301 MSG("Dbi",Msg::kFatal) 00302 << "Illegal registry item: " << foundKey << endl; 00303 hasUnknownKeys = true; 00304 } 00305 } 00306 00307 if ( hasUnknownKeys ) { 00308 MSG("Dbi",Msg::kFatal) << "Aborting due to illegal registry items." << endl; 00309 abort(); 00310 } 00311 }
| DbiCascader& DbiTableProxyRegistry::GetCascader | ( | ) | [inline] |
Definition at line 55 of file DbiTableProxyRegistry.h.
References fCascader.
Referenced by DbuDaqFileModule::BeginJob(), createSpillTables(), PhotonStatSummarizer::CreateTables(), DbmValidate::DbmValidate(), DetailedTimeCal(), DTFtest(), DbuDaqMonitorModule::InitTSQLConnection(), load_better_mipcal(), load_mc_mipcal(), LoadBeamMomentum(), LoadCERRange(), LoadCERTimeWin(), LoadOverlapWin(), LoadTOFRange(), DbmModule::LogEntry(), main(), MakeFilterChannelList(), UgliGeometryReroot::MakeTempDbiGeometry(), UgliGeometryReroot::MakeTempDbiPosInfo(), UgliGeometryReroot::MakeTempDbiScintStruct(), MakeTimeCal(), FillSpillServerMon::ReadFromDatabase(), FillNearRunQuality::ReadFromDatabase(), FillHvFromSingles::ReadFromDatabase(), FillFarRunQuality::ReadFromDatabase(), AutoPIDMaker::Reco(), DbiSqlValPacket::Recreate(), DbiWriter< T >::SetDbName(), DbiSqlValPacket::SetMetaData(), DbiLogEntry::SetServerName(), ShowStatistics(), DbiConfigStream::Write(), FillSpillServerMon::WriteToDatabase(), FillNearRunQuality::WriteToDatabase(), FillHvFromSingles::WriteToDatabase(), FillFarRunQuality::WriteToDatabase(), and DbiWriter< T >::WritingToMaster().
00055 { return *fCascader; }
| DbiTableProxy & DbiTableProxyRegistry::GetTableProxy | ( | const std::string & | tableName, | |
| const DbiTableRow * | tableRow | |||
| ) |
Definition at line 316 of file DbiTableProxyRegistry.cxx.
References ApplySqlCondition(), fCascader, fTPmap, DbiCascader::TableExists(), and UtilString::ToUpper().
Referenced by DbuDaqMonitorModule::CheckForRowCounterColumn(), DbiValRecSet::DbiValRecSet(), DbuDaqMonitorModule::GetCommentFieldName(), DbiResultPtr< T >::GetTableProxy(), HasRowCounter(), DbmModule::Import(), DbiSqlValPacket::Recreate(), DbiSqlValPacket::SetMetaData(), DbiSqlValPacket::Store(), and DbiLogEntry::Write().
00317 { 00318 // 00319 // 00320 // Purpose: Locate, or if necessary create, DbiTableProxy for 00321 // named table. 00322 // 00323 // Arguments: 00324 // tableNameReq in Name of table requested. 00325 // tableRow in Example of a Table Row object. 00326 // 00327 // Return: DbiTableProxy for table. 00328 // 00329 // Contact: N. West 00330 // 00331 // Specification:- 00332 // ============= 00333 // 00334 // o Locate, or if necessary create, DbiTableProxy for named table. 00335 // 00336 // o If creating apply prevailing SQL condition. 00337 00338 // Program Notes:- 00339 // ============= 00340 00341 // None. 00342 00343 // Assume upper case name if cannot find request. 00344 std::string tableName = tableNameReq; 00345 std::string vldSuffix = "Validity"; 00346 if ( ! fCascader->TableExists(tableName + vldSuffix ) ) { 00347 tableName = UtilString::ToUpper(tableName); 00348 vldSuffix = "VLD"; 00349 } 00350 std::string proxyName = tableName; 00351 00352 proxyName.append("::"); 00353 proxyName.append(tableRow->ClassName()); 00354 DbiTableProxy* qpp = fTPmap[proxyName]; 00355 if ( ! qpp ) { 00356 qpp = new DbiTableProxy(fCascader,tableName,vldSuffix,tableRow); 00357 this->ApplySqlCondition(qpp); 00358 fTPmap[proxyName] = qpp; 00359 } 00360 00361 return *qpp; 00362 00363 }
| Bool_t DbiTableProxyRegistry::HasRowCounter | ( | const std::string & | tableName | ) |
Definition at line 367 of file DbiTableProxyRegistry.cxx.
References DbiTableProxy::GetMetaData(), GetTableProxy(), and DbiTableMetaData::HasRowCounter().
00367 { 00368 // 00369 // 00370 // Purpose: Test to see if table has a ROW_COUNTER column. 00371 // 00372 // Arguments: 00373 // tableName in Name of table to be checked. 00374 // 00375 // Return: true of table has ROW_COUNTER. 00376 00377 // Program Notes:- 00378 // ============= 00379 00380 // This is a temporary method to help migration to main tables 00381 // with a primary key (SEQNO,ROW_COUNTER) by providing a simple 00382 // way for clients to detect if any specific table has migrated 00383 // and adapt accordingly. 00384 00385 // Once migration is complete, this method will be withdrawn as 00386 // it should not be needed and creates otherwise useless DbiTableProxys. 00387 00388 DbiConfigSet cfs; 00389 DbiTableProxy& tp = this->GetTableProxy(tableName,&cfs); 00390 return tp.GetMetaData().HasRowCounter(); 00391 00392 }
| DbiTableProxyRegistry & DbiTableProxyRegistry::Instance | ( | ) | [static] |
Definition at line 396 of file DbiTableProxyRegistry.cxx.
References DbiTableProxyRegistry(), and fgInstance.
Referenced by DbuDaqFileModule::BeginJob(), DbuDaqMonitorModule::CheckForRowCounterColumn(), DbmModule::CheckMemory(), createSpillTables(), DbiSqlValPacket::CreateTable(), PhotonStatSummarizer::CreateTables(), DbiValRecSet::DbiValRecSet(), DbmValidate::DbmValidate(), DetailedTimeCal(), DTFtest(), DbmModule::ExportTables(), RerootToTruthModule::Get(), HepevtModule::Get(), DbuDaqMonitorModule::GetCommentFieldName(), DbiResultPtr< T >::GetTableProxy(), DbmModule::Import(), DbuDaqMonitorModule::InitTSQLConnection(), load_better_mipcal(), load_mc_mipcal(), LoadBeamMomentum(), LoadCERRange(), LoadCERTimeWin(), LoadOverlapWin(), LoadTOFRange(), DbmModule::LogEntry(), main(), MakeFilterChannelList(), UgliGeometryReroot::MakeTempDbiGeometry(), UgliGeometryReroot::MakeTempDbiPosInfo(), UgliGeometryReroot::MakeTempDbiScintStruct(), MakeTimeCal(), FillSpillServerMon::ReadFromDatabase(), FillNearRunQuality::ReadFromDatabase(), FillHvFromSingles::ReadFromDatabase(), FillFarRunQuality::ReadFromDatabase(), AutoPIDMaker::Reco(), DbiSqlValPacket::Recreate(), DbiWriter< T >::SetDbName(), DbiSqlValPacket::SetMetaData(), DbiLogEntry::SetServerName(), DbiSqlValPacket::Store(), DbiLogEntry::Write(), DbiConfigStream::Write(), FillSpillServerMon::WriteToDatabase(), FillNearRunQuality::WriteToDatabase(), FillHvFromSingles::WriteToDatabase(), FillFarRunQuality::WriteToDatabase(), and DbiWriter< T >::WritingToMaster().
00396 { 00397 // 00398 // 00399 // Purpose: Locate, or create, DbiTableProxyRegistry singleton. 00400 // 00401 // Arguments: None. 00402 // 00403 // Return: DbiTableProxyRegistry singleton. 00404 // 00405 // Contact: N. West 00406 // 00407 // Specification:- 00408 // ============= 00409 // 00410 // o Locate, or if necessary create, DbiTableProxyRegistry singleton. 00411 00412 // Program Notes:- 00413 // ============= 00414 00415 // None. 00416 00417 if ( ! fgInstance ) { 00418 // Delete is handled by Cleaner class based on #include count 00419 fgInstance = new DbiTableProxyRegistry(); 00420 } 00421 return *fgInstance; 00422 00423 }
| static Bool_t DbiTableProxyRegistry::IsActive | ( | ) | [inline, static] |
Definition at line 50 of file DbiTableProxyRegistry.h.
References fgInstance.
Referenced by DbiResultPtr< T >::Disconnect(), DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetRow(), DbiResultPtr< T >::GetRowByIndex(), DbiResultPtr< T >::GetValidityRec(), DbiWriter< T >::IsOpen(), DbiResultPtr< T >::NewQuery(), DbiWriter< T >::Open(), DbiWriter< T >::TableProxy(), and DbiResultPtr< T >::TableProxy().
00050 { return fgInstance ? kTRUE: kFALSE; }
| DbiTableProxyRegistry& DbiTableProxyRegistry::operator= | ( | const DbiTableProxyRegistry & | ) | [private] |
| void DbiTableProxyRegistry::PurgeCaches | ( | ) |
Definition at line 427 of file DbiTableProxyRegistry.cxx.
References fTPmap.
Referenced by DbmModule::Import().
00427 { 00428 // 00429 // 00430 // Purpose: Purge all caches. 00431 // 00432 // Arguments: 00433 // None. 00434 // 00435 // Return: n/a 00436 // 00437 // Contact: N. West 00438 // 00439 // Specification:- 00440 // ============= 00441 // 00442 // o Purge all caches. 00443 00444 00445 // Program Notes:- 00446 // ============= 00447 00448 // None. 00449 00450 // Pruge all caches. 00451 00452 for ( std::map<std::string,DbiTableProxy*>::iterator itr = fTPmap.begin(); 00453 itr != fTPmap.end(); 00454 ++itr) { 00455 DbiTableProxy* tp = (*itr).second; 00456 tp->GetCache()->Purge(); 00457 } 00458 00459 }
| void DbiTableProxyRegistry::RefreshMetaData | ( | const std::string & | tableName | ) |
Definition at line 463 of file DbiTableProxyRegistry.cxx.
References fTPmap.
Referenced by DbiSqlValPacket::CreateTable().
00463 { 00464 // 00465 // 00466 // Purpose: Refresh meta data for specied table. 00467 // 00468 // Arguments: 00469 // tableName in Name of table to be refreshed. 00470 00471 00472 // Program Notes:- 00473 // ============= 00474 00475 // This method is currently only used by DbiSqlValPacket after 00476 // it has created a new table in the database. In such cases 00477 // the pre-existing corresponding DbiTableProxy has to be refreshed. 00478 00479 std::map<std::string,DbiTableProxy*>::iterator itr = fTPmap.begin(); 00480 std::map<std::string,DbiTableProxy*>::iterator itrEnd = fTPmap.end(); 00481 for ( ; itr != itrEnd; ++itr) { 00482 DbiTableProxy* table = (*itr).second; 00483 if ( table && table->GetTableName() == tableName ) table->RefreshMetaData(); 00484 } 00485 00486 }
| void DbiTableProxyRegistry::SetConfigFromEnvironment | ( | ) | [private] |
Definition at line 489 of file DbiTableProxyRegistry.cxx.
References gSystem(), Msg::kInfo, MSG, UtilString::StringTok(), and CfgConfigurable::Update().
Referenced by DbiTableProxyRegistry().
00489 { 00490 // 00491 // 00492 // Purpose: Set up configuration from ENV_DBI environmental variable 00493 // which consists of a semi-colon separated list of DBI 00494 // configuration requests. 00495 00496 const char* strENV_DBI = gSystem->Getenv("ENV_DBI"); 00497 if ( strENV_DBI == 0 || strlen(strENV_DBI) == 0 ) return; 00498 00499 MSG("Dbi",Msg::kInfo) << "\nConfiguring DatabaseInterface from the environmental " 00500 << "variable ENV_DBI:-\n " << strENV_DBI << endl; 00501 std::vector<std::string> configRequests; 00502 UtilString::StringTok(configRequests, strENV_DBI, ";"); 00503 00504 for (unsigned entry = 0; entry < configRequests.size(); ++entry ) 00505 this->Set(configRequests[entry].c_str()); 00506 this->Update(); 00507 }
| void DbiTableProxyRegistry::SetSqlCondition | ( | const std::string & | sql = "" |
) |
Definition at line 511 of file DbiTableProxyRegistry.cxx.
References ApplySqlCondition(), and fSqlCondition.
Referenced by DbmModule::ExportTables().
00511 { 00512 // 00513 // 00514 // Purpose: Record and apply global SQL condition. 00515 // 00516 // Arguments: 00517 // sql in SQL condition string (excluding where). 00518 // 00519 // See Program Notes. 00520 // Contact: N. West 00521 // 00522 // Specification:- 00523 // ============= 00524 // 00525 // o Record global SQL condition and apply to existing DbiTableProxys. 00526 00527 00528 // Program Notes:- 00529 // ============= 00530 00531 // The SQL condition must behave as a single expression as 00532 // additional conditions e.g. rollback, may be appended using 00533 // AND. This means that if the expression contains sub-expressions 00534 // combined using OR, then the entire expression should be enclosed 00535 // in parentheses. 00536 00537 00538 fSqlCondition = sql; 00539 this->ApplySqlCondition(); 00540 }
| void DbiTableProxyRegistry::ShowStatistics | ( | ) | const |
Definition at line 544 of file DbiTableProxyRegistry.cxx.
References fTPmap, GetCascader(), Msg::kInfo, MSG, and MSGSTREAM.
Referenced by DbmModule::CheckMemory().
00544 { 00545 // 00546 // 00547 // Purpose: Show total statistics. 00548 // 00549 // Contact: N. West 00550 00551 MsgStream msg = MSGSTREAM("Dbi",Msg::kInfo); 00552 msg << "\n\nCache statistics:-\n\n" 00553 << "Table Name " 00554 << " Current Maximum Total Total\n" 00555 << " " 00556 << " Size Size Adopted Reused" << endl; 00557 00558 // Loop over all owned objects. 00559 00560 for ( std::map<std::string,DbiTableProxy*>::const_iterator itr = fTPmap.begin(); 00561 itr != fTPmap.end(); 00562 ++itr) { 00563 const DbiTableProxy* tp = (*itr).second; 00564 std::string name = (*itr).first; 00565 if ( name.size() < 40 ) name.append(40-name.size(),' '); 00566 msg << name; 00567 // Only want to look at cache so by-pass constness. 00568 const_cast<DbiTableProxy*>(tp)->GetCache()->ShowStatistics(msg); 00569 msg << endl; 00570 } 00571 msg << "\n" << endl; 00572 00573 // Only want to look at cascader so by-pass constness. 00574 00575 MSG("Dbi",Msg::kInfo) << const_cast<DbiTableProxyRegistry*>(this)->GetCascader(); 00576 00577 00578 }
friend class Cleaner [friend] |
Definition at line 89 of file DbiTableProxyRegistry.h.
friend class DbiValidate [friend] |
Definition at line 41 of file DbiTableProxyRegistry.h.
DbiCascader* DbiTableProxyRegistry::fCascader [private] |
Cascader.
Definition at line 105 of file DbiTableProxyRegistry.h.
Referenced by Config(), GetCascader(), GetTableProxy(), and ~DbiTableProxyRegistry().
DbiTableProxyRegistry * DbiTableProxyRegistry::fgInstance = 0 [static, private] |
Holds only instance.
Definition at line 123 of file DbiTableProxyRegistry.h.
Referenced by Instance(), IsActive(), DbiTableProxyRegistry::Cleaner::~Cleaner(), and ~DbiTableProxyRegistry().
Rollback dates for each table.
Definition at line 116 of file DbiTableProxyRegistry.h.
Referenced by ApplySqlCondition(), ClearRollbackDates(), and Config().
Lists of SimFlag associations.
Definition at line 119 of file DbiTableProxyRegistry.h.
Referenced by ClearSimFlagAssociation(), and Config().
std::string DbiTableProxyRegistry::fSqlCondition [private] |
Default optional condition.
Definition at line 108 of file DbiTableProxyRegistry.h.
Referenced by ApplySqlCondition(), and SetSqlCondition().
std::map<std::string,DbiTableProxy*> DbiTableProxyRegistry::fTPmap [private] |
TableName::RowName -> TableProxy.
Definition at line 112 of file DbiTableProxyRegistry.h.
Referenced by ApplySqlCondition(), GetTableProxy(), PurgeCaches(), RefreshMetaData(), ShowStatistics(), and ~DbiTableProxyRegistry().
1.4.7