Jpp
18.6.0-rc.1
the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
software
JDB
getUserID.cc
Go to the documentation of this file.
1
#include <iostream>
2
#include <iomanip>
3
4
#include "dbclient/KM3NeTDBClient.h"
5
6
#include "
JDB/JDB.hh
"
7
#include "
JDB/JPersons.hh
"
8
#include "
JDB/JSelector.hh
"
9
#include "
JDB/JDBToolkit.hh
"
10
11
#include "
Jeep/JParser.hh
"
12
#include "
Jeep/JMessage.hh
"
13
14
15
/**
16
* \file
17
*
18
* Auxiliary program to get user ID corresponding to given user login.
19
* \author bjung, mdejong
20
*/
21
int
main
(
int
argc,
char
**argv)
22
{
23
using namespace
std;
24
using namespace
JPP;
25
26
JServer server;
27
string
usr;
28
string
pwd;
29
string
cookie;
30
string
login;
31
int
debug
;
32
33
try
{
34
35
JParser<>
zap(
"Auxiliary program to get login ID corresponding to given user login."
);
36
37
zap[
's'
] =
make_field
(server) =
getServernames
();
38
zap[
'u'
] =
make_field
(usr) =
""
;
39
zap[
'!'
] =
make_field
(pwd) =
""
;
40
zap[
'C'
] =
make_field
(cookie) =
""
;
41
zap[
'L'
] =
make_field
(login) =
""
;
42
zap[
'd'
] =
make_field
(
debug
) = 1;
43
44
zap(argc, argv);
45
}
46
catch
(
const
exception &error) {
47
FATAL
(error.what() << endl);
48
}
49
50
51
try
{
52
53
JDB::reset
(usr, pwd, cookie);
54
55
JSelector selector = getSelector<JPersons>(login.empty() ? JDB::get()->User() : login);
56
ResultSet& rs =
getResultSet
(getTable<JPersons>(), selector);
57
58
JPersons personalia;
59
rs >> personalia;
60
61
cout << personalia.OID << endl;
62
}
63
catch
(
const
exception& error) {
64
FATAL
(error.what() << endl);
65
}
66
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1711
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JPersons.hh
JDBToolkit.hh
JSelector.hh
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:2158
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JTOOLS::reset
void reset(T &value)
Reset value.
Definition:
JToolsToolkit.hh:219
JParser.hh
Utility class to parse command line options.
JDATABASE::getResultSet
ResultSet & getResultSet(const std::string &query)
Get result set.
Definition:
JDB.hh:436
JDATABASE::getServernames
std::vector< JServer > getServernames()
Get list of names of available database servers.
Definition:
JDB.hh:106
JDB.hh
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
Generated by
1.8.5