5 #include "dbclient/KM3NeTDBClient.h"
19 static const std::string help_t =
"help";
29 int main(
int argc,
char **argv)
48 JParser<> zap(
"Auxiliary program to print data from data base.");
56 zap[
'A'] =
make_field(api,
"API, possible values X.Y.Z[/help] ('apiv2') or \"\" ('streamds')") =
"";
64 catch(
const exception &error) {
65 FATAL(error.what() << endl);
76 for (
unsigned int i = 0; i != rs.FieldCount(); ++i) {
77 cout << (i != 0 ? csv :
"") << setw(width) << left << rs.FieldName(i) << flush;
82 for (
unsigned int i = 0; i != rs.FieldCount(); ++i) {
83 cout << (i != 0 ? csv :
"") << setw(width) << left << rs.GetString(i) << flush;
94 istringstream is(api);
103 if (is.peek() == EOF)
104 *(JDB::get()->APIv2Select(version.toString().c_str(), query.c_str(), selection)) >> js;
105 else if (is.get() ==
'/' && is >> buffer && buffer == help_t)
106 *(JDB::get()->APIv2Help(version.toString().c_str(), (query !=
"" ? query.c_str() :
"all/h"))) >> js;
108 FATAL(
"Error reading API version <" << api <<
">." << endl);
110 printer(cout, js, key);
114 FATAL(
"Error reading API version <" << api <<
">." << endl);
118 catch(
const exception& error) {
119 FATAL(error.what() << endl);
General purpose messaging.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int main(int argc, char **argv)
Auxiliary class for specifying selection of database data.
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.
Auxiliary class for version identifier.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary data structure to print (part of) JSon data.