#include "KM3NeTDBClient.h" #include #include using namespace std; using namespace KM3NeT; using namespace KM3NeT::DB; int main(int argc, char *argv[]) { if (argc != 3 && argc != 2) { cout << endl << "usage: ex2 " << endl; cout << " OR" << endl; cout << "ex2 " << endl; return -1; } try { auto client = (argc == 2) ? Client::Create(Server::Default, argv[1]) : Client::Create(Server::Default, argv[1], argv[2]); cout << endl << "opening connection as user " << client->User(); auto &rs = client->StreamDS(); unsigned i; cout << endl << rs.FieldCount() << " fields found." << endl; for (i = 0; i < rs.FieldCount(); i++) { cout << rs.FieldName(i) << " "; } while (rs.Next()) { cout << endl; for (i = 0; i < rs.FieldCount(); i++) { cout << "\"" << rs.GetString(i) << "\" "; } } rs.Close(); } catch (DBException &x) { cout << endl << x.what() << endl; } return 0; }