Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
getLocationID.cc File Reference

Auxiliary program to get location ID corresponding to given user login. More...

#include <iostream>
#include <iomanip>
#include "dbclient/KM3NeTDBClient.h"
#include "JDB/JDB.hh"
#include "JDB/JPersons.hh"
#include "JDB/JSelector.hh"
#include "JDB/JDBToolkit.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to get location ID corresponding to given user login.

Author
bjung

Definition in file getLocationID.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 21 of file getLocationID.cc.

22 {
23  using namespace std;
24  using namespace JPP;
25 
26  string usr;
27  string pwd;
28  string cookie;
29  string login;
30  int debug;
31 
32  try {
33 
34  JParser<> zap("Auxiliary program to get location ID corresponding to given user login.");
35 
36  zap['u'] = make_field(usr) = "";
37  zap['!'] = make_field(pwd) = "";
38  zap['C'] = make_field(cookie) = "";
39  zap['L'] = make_field(login) = "";
40  zap['d'] = make_field(debug) = 1;
41 
42  zap(argc, argv);
43  }
44  catch(const exception &error) {
45  FATAL(error.what() << endl);
46  }
47 
48 
49  try {
50 
51  JDB::reset(usr, pwd, cookie);
52 
53  JSelector selector = getSelector<JPersons>(login.empty() ? JDB::get()->User() : login);
54  ResultSet& rs = getResultSet(getTable<JPersons>(), selector);
55 
56  JPersons personalia;
57  rs >> personalia;
58 
59  cout << personalia.LOCATIONID << endl;
60  }
61  catch(const exception& error) {
62  FATAL(error.what() << endl);
63  }
64 }
Utility class to parse command line options.
Definition: JParser.hh:1500
T get(const JHead &header)
Get object from header.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
#define FATAL(A)
Definition: JMessage.hh:67
void reset(T &value)
Reset value.
ResultSet & getResultSet(const std::string &query)
Get result set.
Definition: JDB.hh:269