8 namespace persistency {
15 std::vector<std::tuple<cond::Time_t, boost::posix_time::ptime, boost::posix_time::ptime> >
runBuffer;
16 std::vector<std::tuple<cond::Time_t, boost::posix_time::ptime, boost::posix_time::ptime> >
updateBuffer;
43 return m_session->runInfoSchema().runInfoTable().getLastInserted();
49 const boost::posix_time::ptime&
start,
50 const boost::posix_time::ptime&
end) {
52 m_data->runBuffer.push_back(std::tie(runNumber, start, end));
56 const boost::posix_time::ptime&
start,
57 const boost::posix_time::ptime&
end) {
59 m_data->updateBuffer.push_back(std::tie(runNumber, start, end));
67 ret +=
m_data->runBuffer.size();
70 boost::posix_time::ptime& newRunStart = std::get<1>(
update);
71 boost::posix_time::ptime& newRunEnd = std::get<2>(
update);
72 boost::posix_time::ptime existingRunStart;
73 boost::posix_time::ptime existingRunEnd;
74 if (
m_session->runInfoSchema().runInfoTable().select(newRun, existingRunStart, existingRunEnd)) {
75 if (newRunStart != existingRunStart) {
76 std::stringstream
msg;
77 msg <<
"Attempt to update start time of existing run " << newRun;
80 if (existingRunEnd == newRunEnd) {
84 if (existingRunEnd != existingRunStart) {
85 std::stringstream
msg;
86 msg <<
"Attempt to update end time of existing run " << newRun;
90 m_session->runInfoSchema().runInfoTable().updateEnd(newRun, newRunEnd);
92 m_session->runInfoSchema().runInfoTable().insertOne(newRun, newRunStart, newRunEnd);
97 m_data->updateBuffer.clear();
105 if (!
m_session->isTransactionActive(
false))
void insert(cond::Time_t runNumber, const boost::posix_time::ptime &start, const boost::posix_time::ptime &end)
ret
prodAgent to be discontinued
void insertNew(cond::Time_t runNumber, const boost::posix_time::ptime &start, const boost::posix_time::ptime &end)
RunInfoEditor & operator=(const RunInfoEditor &rhs)
std::vector< std::tuple< cond::Time_t, boost::posix_time::ptime, boost::posix_time::ptime > > runBuffer
std::vector< std::tuple< cond::Time_t, boost::posix_time::ptime, boost::posix_time::ptime > > updateBuffer
unsigned long long Time_t
void checkTransaction(const std::string &ctx)
std::shared_ptr< RunInfoEditorData > m_data
std::shared_ptr< SessionImpl > m_session
void throwException(const std::string &message, const std::string &methodName)
cond::Time_t getLastInserted()