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;
44 return m_session->runInfoSchema().runInfoTable().getLastInserted(start, end);
50 const boost::posix_time::ptime&
start,
51 const boost::posix_time::ptime&
end) {
53 m_data->runBuffer.push_back(std::tie(runNumber, start, end));
57 const boost::posix_time::ptime&
start,
58 const boost::posix_time::ptime&
end) {
60 m_data->updateBuffer.push_back(std::tie(runNumber, start, end));
68 ret +=
m_data->runBuffer.size();
71 boost::posix_time::ptime& newRunStart = std::get<1>(
update);
72 boost::posix_time::ptime& newRunEnd = std::get<2>(
update);
73 boost::posix_time::ptime existingRunStart;
74 boost::posix_time::ptime existingRunEnd;
75 if (
m_session->runInfoSchema().runInfoTable().select(newRun, existingRunStart, existingRunEnd)) {
76 if (newRunStart != existingRunStart) {
77 std::stringstream
msg;
78 msg <<
"Attempt to update start time of existing run " << newRun;
81 if (existingRunEnd == newRunEnd) {
85 if (existingRunEnd != existingRunStart) {
86 std::stringstream
msg;
87 msg <<
"Attempt to update end time of existing run " << newRun;
91 m_session->runInfoSchema().runInfoTable().updateEnd(newRun, newRunEnd);
93 m_session->runInfoSchema().runInfoTable().insertOne(newRun, newRunStart, newRunEnd);
98 m_data->updateBuffer.clear();
106 if (!
m_session->isTransactionActive(
false))
void insert(cond::Time_t runNumber, const boost::posix_time::ptime &start, const boost::posix_time::ptime &end)
tuple 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()