DbmJob.cc File Reference

#include <string>
#include "TString.h"
#include "TSystem.h"
#include "DatabaseInterface/DbiCascader.h"
#include "DatabaseInterface/DbiTableProxyRegistry.h"
#include "DatabaseInterface/DbiTimerManager.h"
#include "DatabaseMaintenance/DbmModule.h"
#include "DatabaseMaintenance/DbmValidate.h"
#include "JobControl/JobCommand.h"
#include "JobControl/JobCEnv.h"

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 14 of file DbmJob.cc.

References MuELoss::e, DbiTimerManager::Enable(), DbiTableProxyRegistry::GetCascader(), DbiCascader::GetNumDb(), DbiTimerManager::gTimerManager, DbmModule::HandleCommand(), DbiTableProxyRegistry::Instance(), JobCEnv::Instance(), JobCEnv::IsBatch(), and DbiCascader::SetPermanent().

00014                                 {
00015 
00016 // Create a job environment, so that user can specify DB cascade
00017 // using the -d -u -p options.
00018   JobCEnv& e = JobCEnv::Instance(argc, argv);
00019 // Silly statement just to stop compiler complaining that e unused!
00020   e.IsBatch();
00021 
00022 // Switch off the DBI timer.
00023   DbiTimerManager::gTimerManager.Enable(false);
00024 
00025 // Force all connections to be permanent.
00026   DbiCascader& cascader =  DbiTableProxyRegistry::Instance().GetCascader();
00027   Int_t dbNo = cascader.GetNumDb();
00028   while ( --dbNo >= 0 ) cascader.SetPermanent(dbNo);
00029 
00030   //  Dbi::SetLogLevel(0);
00031 
00032   DbmModule module;
00033   cout << "Database Maintenance Utility version  V00-04-00\n\n" 
00034        << "Enter command, type Help for help: " << endl;
00035   string line;
00036   while ( 1 ) {
00037     cout << "Dbm: ";
00038     getline(cin,line);
00039     // Remove leading blanks.
00040     while ( line.size() > 0 && line[0] == ' ' ) line.erase(0,1);
00041     // Process if there is anything left!
00042     if ( line.size() > 0 ) {
00043       TString cmd = line.c_str();
00044       cmd.ToLower();
00045       if ( cmd == "quit" ) break;
00046       if ( cmd == "validate" ) {
00047         DbmValidate v(&module);
00048       }
00049       else {
00050         JobCommand jcmd(line.c_str());
00051         module.HandleCommand(&jcmd);
00052       }
00053     }
00054   }
00055   return 0;
00056 
00057 }


Generated on 15 Jul 2018 for loon by  doxygen 1.6.1