#include "KM3NeTDBClient.h" #include #include #include using namespace std; using namespace KM3NeT; using namespace KM3NeT::DB; int main(int argc, char *argv[]) { if (argc != 7) { cout << endl << "usage: ex5 " << endl; return -1; } try { auto client = Client::Create(Server::Default, argv[5], argv[6]); std::vector sellist; Selector::RelOp const *pRO = nullptr; if (strcmp(argv[3], "=") == 0) pRO = &Selector::RelOp::Equal; else if (strcmp(argv[3], "!=") == 0 || strcmp(argv[3], "<>") == 0) pRO = &Selector::RelOp::Different; else if (strcmp(argv[3], "<") == 0) pRO = &Selector::RelOp::Less; else if (strcmp(argv[3], "<=") == 0) pRO = &Selector::RelOp::LessEqual; else if (strcmp(argv[3], ">") == 0) pRO = &Selector::RelOp::Greater; else if (strcmp(argv[3], ">=") == 0) pRO = &Selector::RelOp::GreaterEqual; else throw DBException("Unknown relational operator", __LINE__); Selector s(argv[2], argv[4], *pRO); sellist.push_back(s); auto js = client->APIv2Select("2.1.0", argv[1], sellist); cout << endl << js->str() << endl; } catch (DBException &x) { cout << endl << x.what() << endl; } return 0; }