30{
   33 
   35  string          usr;
   36  string          pwd;
   37  string          cookie;
   38  string          detid;
   39  TRegexp         regexp(".");
   41  JSelector       selection;
   42  string          option;
   44 
   45  try {
   46 
   47    JParser<> zap(
"Example program to print run related data from data base.");
 
   48    
   57    zap[
'O'] = 
make_field(option,     
"print UNIX time as TTimeStamp::AsString(<option>)") = 
"";
 
   59 
   60    zap(argc, argv);
   61  }
   62  catch(const exception &error) {
   63    FATAL(error.what() << endl);
 
   64  }
   65 
   66 
   67  if (format.empty()) {
   68    format = getColumns<JRuns>();
   69  }
   70 
   71  try {
   72 
   73    JDB::reset(usr, pwd, cookie);
   74 
   75    const int id = getDetector<int>(detid);
   76 
   78 
   79    ResultSet& rs = 
getResultSet(getTable<JRuns>(), selection);
 
   80 
   81    for (
JRuns parameters; selection >> parameters && rs >> parameters; ) {
 
   82 
   83      if (TString(parameters.RUNSETUPNAME.c_str()).Contains(regexp)) {
   84 
   85        for (vector<string>::const_iterator i = format.begin(); i != format.end(); ++i) {
   86 
   87          if      (option != "" && *i == "UNIXJOBSTART")
   88            cout << ' ' << TTimeStamp((time_t) (parameters.UNIXJOBSTART /1000)).AsString(option.c_str());
   89          else if (option != "" && *i == "UNIXJOBEND")
   90            cout << ' ' << TTimeStamp((time_t) (parameters.UNIXJOBEND   /1000)).AsString(option.c_str());
   91          else
   92            JRootPrinter::print(cout, parameters, *i);
   93        }
   94 
   95        cout << endl;
   96      }
   97    }
   98  }
   99  catch(const exception& error) {
  100    FATAL(error.what() << endl);
 
  101  }
  102}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
Utility class to parse command line options.
 
ResultSet & getResultSet(const std::string &query)
Get result set.
 
std::vector< JServer > getServernames()
Get list of names of available database servers.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
Wrapper class for server name.
 
Template definition for getting table specific selector.
 
Auxiliary data structure for streaming of STL containers.
 
Empty structure for specification of parser element that is initialised (i.e. does not require input)...