-
Notifications
You must be signed in to change notification settings - Fork 5
/
getcids.cc
65 lines (53 loc) · 1.2 KB
/
getcids.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* frontier client test main program to get cids
*
* Author: Sergey Kosyakov
*
* $Id$
*
* Copyright (c) 2009, FERMI NATIONAL ACCELERATOR LABORATORY
* All rights reserved.
*
* For details of the Fermitools (BSD) license see Fermilab-2009.txt or
* http://fermitools.fnal.gov/about/terms.html
*
*/
#include <frontier-cpp.h>
#include <iostream>
#include <stdexcept>
int main(int argc, char **argv)
{
if(argc!=3)
{
std::cout<<"Usage: "<<argv[0]<<" server_url object_name"<<'\n';
exit(1);
}
try
{
frontier::init();
frontier::CDFDataSource ds(argv[1]);
//ds.setReload(1);
frontier::Request req("frontier_get_cid_list","1",frontier::BLOB,"table_name",argv[2]);
std::vector<const frontier::Request*> vrq;
vrq.insert(vrq.end(),&req);
ds.getData(vrq);
ds.setCurrentLoad(1);
int nrec=ds.getRecNum();
std::cout<<"Got "<<nrec<<" records back."<<'\n';
for(int i=0;i<nrec;i++)
{
long cid=ds.getLongLong();
std::cout<<cid<<'\n';
}
}
catch(std::exception& e)
{
std::cout << "Error: " << e.what() << "\n";
exit(1);
}
catch(...)
{
std::cout << "Unknown exception\n";
exit(1);
}
}