7 successful_prepare(
int const rc,
14 <<
"Error in preparing statement for getting contributors.\n" 15 <<
"File: " << filename <<
'\n' 16 <<
"Preparation statement: " << statement <<
'\n';
20 successful_step(
int const rc,
24 if (rc == SQLITE_DONE)
27 <<
"Unexpected status from table read: " << sqlErrMsg <<
" (" << rc
29 <<
"File: " << filename <<
'\n';
33 successful_finalize(
int const rc,
40 <<
"Unexpected status from DB status cleanup: " << sqlErrMsg <<
" (" << rc
42 <<
"File: " << filename <<
'\n';
54 unsigned const rangeSetID,
59 return RangeSetInfo::invalid();
61 sqlite3_stmt* stmt{
nullptr};
65 auto rc = sqlite3_prepare_v2(db, run_ddl.c_str(), -1, &stmt,
nullptr);
66 successful_prepare(rc, filename, run_ddl);
68 rc = sqlite3_step(stmt);
69 auto const r =
static_cast<RunNumber_t>(sqlite3_column_int(stmt, 0));
70 rc = sqlite3_finalize(stmt);
71 successful_finalize(rc, sqlite3_errmsg(db), filename);
73 std::string const result_column_begin{compact ?
"min(begin)" :
"begin"};
74 std::string const result_column_end{compact ?
"max(end)" :
"end"};
75 std::string const maybe_suffix{compact ?
" GROUP BY SubRun" :
""};
77 "SELECT SubRun," + result_column_begin +
',' + result_column_end +
78 " FROM EventRanges WHERE rowid IN" 79 "(SELECT EventRangesID FROM " +
82 rc = sqlite3_prepare_v2(db, ddl.c_str(), -1, &stmt,
nullptr);
83 successful_prepare(rc, filename, ddl);
85 std::vector<EventRange> ranges;
86 while ((rc = sqlite3_step(stmt)) == SQLITE_ROW) {
87 ranges.emplace_back(sqlite3_column_int(stmt, 0),
88 sqlite3_column_int(stmt, 1),
89 sqlite3_column_int(stmt, 2));
91 successful_step(rc, sqlite3_errmsg(db), filename);
93 rc = sqlite3_finalize(stmt);
94 successful_finalize(rc, sqlite3_errmsg(db), filename);
103 return RangeSet::invalid();
112 unsigned const rangeSetID,
RangeSetInfo resolveRangeSetInfo(sqlite3 *, std::string const &filename, BranchType, unsigned RangeSetID, bool compact)
std::vector< EventRange > ranges
RangeSet resolveRangeSet(RangeSetInfo const &rs)
std::string const & BranchTypeToString(BranchType const bt)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::string to_string(ModuleType const mt)
IDNumber_t< Level::Run > RunNumber_t