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

DbmJob.cc

Go to the documentation of this file.
00001 #include <string>
00002 
00003 #include "TString.h"
00004 #include "TSystem.h"
00005 
00006 #include "DatabaseInterface/DbiCascader.h"
00007 #include "DatabaseInterface/DbiTableProxyRegistry.h"
00008 #include "DatabaseInterface/DbiTimerManager.h"
00009 #include "DatabaseMaintenance/DbmModule.h"
00010 #include "DatabaseMaintenance/DbmValidate.h"
00011 #include "JobControl/JobCommand.h" 
00012 #include "JobControl/JobCEnv.h"
00013 
00014 int main(int argc, char** argv) {
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 }
00058 

Generated on Mon Feb 15 11:06:35 2010 for loon by  doxygen 1.3.9.1