98 std::vector<Assertion::Operator *> conditions;
99 conditions.reserve(6);
102 FIELDTYPEold, FIELDTYPElit);
105 FIELDTYPEold, FIELDTYPElit);
108 FIELDTYPEold, FIELDTYPElit);
111 FIELDTYPEold, FIELDTYPElit);
114 FIELDTYPEold, FIELDTYPElit);
118 FIELDTYPElit, FIELDTYPEold);
120 conditions.push_back(&calibTypeOp);
121 conditions.push_back(&instOp);
122 conditions.push_back(&flavorOp);
123 conditions.push_back(&levelOp);
124 conditions.push_back(&vstartOp);
125 conditions.push_back(&completeOp);
132 results = m_conn->
select(m_table, m_selects, m_orderBy, whereClause);
135 std::cerr << ex.
getMsg() << std::endl;
141 std::cerr <<
"Error making query " << std::endl;
147 std::vector<SelectInfo> info;
148 unsigned nFound = results->
getNRows();
151 std::cout <<
"No calibrations found for calib_type '" << calibtype
159 std::vector<std::string> fields;
163 unsigned retCode = 0;
166 std::cout << std::endl
167 <<
"Checking for valid timestamps, vstart < vend .. "
169 for (iRow = 0; iRow < nFound; iRow++) {
170 results->
getRow(fields, iRow);
173 Timestamp vstart = Timestamp(fields[1]);
174 Timestamp vend = Timestamp(fields[2]);
175 info.push_back(
SelectInfo(ser, vstart, vend));
177 if (vend.getClibTime() < vstart.getClibTime() ) {
178 std::cerr <<
"vend < vstart for " << info.back();
184 std::cerr <<
"Bad vstart or vend in row " << ser << std::endl;
190 if (!ok)
return retCode;
193 std::cout << std::endl <<
"Checking for vends monotonic.. " << std::endl;
194 for (iRow = 0; iRow < nFound - 1; iRow++) {
195 if (info[iRow].m_vend.getClibTime() > info[iRow+1].m_vend.getClibTime()) {
196 std::cerr <<
"Validity interval for row with serial #"
197 << info[iRow+1].m_ser
198 <<
" completely contained in interval for row with serial #"
199 << info[iRow].m_ser << std::endl;
200 std::cerr << info[iRow];
201 std::cerr << info[iRow+1] << std::endl;
206 if (!ok)
return retCode;
209 std::cout << std::endl <<
"Checking for gaps.. " << std::endl;
210 for (iRow = 0; iRow < nFound - 1; iRow++) {
211 if (info[iRow].m_vend < info[iRow+1].m_vstart) {
212 std::cerr <<
"Validity interval gap between calibrations with serial #"
213 << info[iRow].m_ser <<
" and #" << info[iRow+1].m_ser
215 std::cerr << info[iRow];
216 std::cerr << info[iRow+1] << std::endl;
222 std::cout << std::endl <<
"Checking for overlaps.. " << std::endl;
223 for (iRow = 0; iRow < nFound - 1; iRow++) {
224 if ((info[iRow].m_vend).getClibTime() >
225 (info[iRow+1].m_vstart).getClibTime() + m_overlap) {
226 std::cerr <<
"Unacceptable overlap between serial #" << info[iRow].m_ser
227 <<
" and #" << info[iRow+1].m_ser << std::endl;
228 std::cerr << info[iRow];
229 std::cerr << info[iRow+1] << std::endl;
231 if (!retCode) retCode = 4;
Coverage(calibUtil::Metadata *meta, const std::string &instr, const std::string &flavor, const std::string &level, const facilities::Timestamp &ts)
virtual ResultHandle * select(const std::string &tableName, const StringVector &getCols, const StringVector &orderCols, const Assertion *where=0, int rowLimit=0, int rowOffset=0)=0