35 Timestamp t_ok(
"2001-11-10 08:00");
36 Timestamp t_none(
"2000-09-08 10:00");
37 Timestamp t_late(
"2010-12-19");
39 Metadata::eRet ret =
lookup(
"TKR_DeadChan", t_ok,
40 Metadata::LEVELDev | Metadata::LEVELTest,
43 ret =
soonest(
"TKR_DeadChan", t_none, t_late,
44 Metadata::LEVELDev | Metadata::LEVELTest,
47 ret =
soonest(
"TKR_DeadChan", t_none, t_late,
48 Metadata::LEVELDev | Metadata::LEVELTest,
51 ret =
lookup(
"TKR_DeadChan", t_ok,
52 Metadata::LEVELProd | Metadata::LEVELDev,
"BTEM");
54 ret =
lookup(
"ACD_Eff", t_ok,
55 Metadata::LEVELProd | Metadata::LEVELDev,
57 ret =
lookup(
"TKR_HotChan", t_none, Metadata::LEVELDev,
115 unsigned int levelMask,
116 const std::string& inst) {
120 std::cout << std::endl;
121 std::cout <<
"lookup called with input " << std::endl;
122 std::cout <<
" calibType = " << ctype <<std::endl;
123 std::cout <<
" timestamp = " << ts.
getString() << std::endl;
124 std::cout <<
" levelMask = " << levelMask << std::endl;
125 std::cout <<
" instrument = " << inst << std::endl;
127 Metadata
meta(
"*",
"*",
"calib_test");
128 Metadata::eRet ret =
meta.findBest(&ser, ctype, ts, levelMask, inst);
130 if (ret != Metadata::RETOk) {
131 std::cout <<
"findBest failed with status" << (int) ret << std::endl;
134 std::cout <<
"Query succeeded; no rows found." << std::endl;
137 std::string fmtVersion;
139 std::string dataIdent;
141 ret =
meta.getReadInfo(ser, dataFmt, fmtVersion, dataIdent);
143 if (ret == Metadata::RETOk) {
144 gotIt(ser, dataFmt, fmtVersion, dataIdent);
148 std::cout <<
"Failed reading info for record #" << ser;
149 std::cout <<
" with code " << (int) ret << std::endl;
159 unsigned int levelMask,
160 const std::string& inst,
161 const std::string& flavor) {
166 std::cout << std::endl;
167 std::cout <<
"soonest called with input " << std::endl;
168 std::cout <<
" calibType = " << ctype <<std::endl;
169 std::cout <<
" update_start = " << update_start.
getString() << std::endl;
170 std::cout <<
" update_end = " << update_end.
getString() << std::endl;
171 std::cout <<
" levelMask = " << levelMask << std::endl;
172 std::cout <<
" instrument = " << inst << std::endl;
173 std::cout <<
" flavor = " << flavor << std::endl;
175 Metadata
meta(
"*",
"*",
"calib_test");
176 Metadata::eRet ret =
meta.findSoonAfter(&ser, ctype, &update_start,
177 &update_end, levelMask, inst, flavor);
179 if (ret != Metadata::RETOk) {
180 std::cout <<
"findSoonAfter failed with status" << (int) ret << std::endl;
183 std::cout <<
"Query succeeded; no rows found." << std::endl;
186 std::string fmtVersion;
188 std::string dataIdent;
190 ret =
meta.getReadInfo(ser, dataFmt, fmtVersion, dataIdent);
192 if (ret == Metadata::RETOk) {
193 gotIt(ser, dataFmt, fmtVersion, dataIdent);
197 std::cout <<
"Failed reading info for record #" << ser;
198 std::cout <<
" with code " << (int) ret << std::endl;