7 #include "RelationalAccess/ITransaction.h" 9 #include "RelationalAccess/ConnectionService.h" 10 #include "RelationalAccess/ISessionProxy.h" 11 #include <boost/date_time/posix_time/posix_time_io.hpp> 16 namespace persistency {
26 explicit Table(coral::ISchema& schema) : m_schema(schema) {}
29 const boost::posix_time::ptime&
start,
30 const boost::posix_time::ptime& end,
35 insertInTable(m_schema,
tname, dataToInsert.
get());
50 m_connectionString(
""),
61 dispatcher->unsubscribe();
71 if (!
m_log.str().empty())
73 m_startTime = boost::posix_time::microsec_clock::universal_time();
82 m_endTime = boost::posix_time::microsec_clock::universal_time();
85 log(
"END_JOB") <<
": return code:" << retCode;
92 boost::posix_time::time_facet* facet =
new boost::posix_time::time_facet();
93 facet->format(format_s);
95 timestamp.imbue(std::locale(std::locale::classic(), facet));
101 auto now = boost::posix_time::microsec_clock::universal_time();
105 auto now = boost::posix_time::microsec_clock::universal_time();
111 if (!
m_log.str().empty()) {
121 if (!
m_log.str().empty()) {
123 throwException(
"Connection string for destination database has not been provided.",
"Logger::saveOnDb");
125 coral::ConnectionService connServ;
126 std::unique_ptr<coral::ISessionProxy> coralSession(
128 coralSession->transaction().start(
false);
132 coralSession->transaction().commit();
134 coralSession->transaction().rollback();
std::string m_connectionString
list jobName
Initialize all the variables.
EchoedLogStream< edm::LogWarning > logWarning()
#define conddb_column(...)
Table(coral::ISchema &schema)
EchoedLogStream< edm::LogError > logError()
boost::posix_time::ptime m_endTime
std::string print_timestamp(const boost::posix_time::ptime &t, const char *format_s="%Y-%m-%d %H:%M:%S.%f")
void subscribeCoralMessages(const std::weak_ptr< MsgDispatcher > &dispatcher)
coral::ISchema & m_schema
boost::posix_time::ptime m_startTime
std::string get_timestamp_for_filename()
const coral::AttributeList & get() const
std::string get_timestamp()
std::iostream & log(const std::string &tag)
std::weak_ptr< MsgDispatcher > m_dispatcher
EchoedLogStream< edm::LogDebug_ > logDebug()
void insert(const std::string &jobName, const boost::posix_time::ptime &start, const boost::posix_time::ptime &end, int retCode, const std::string &log)
std::string tname(const std::string &tableName, const std::string &schemaVersion)
void setDbDestination(const std::string &connectionString)
static constexpr const char *const COND_WRITER_ROLE
EchoedLogStream< edm::LogInfo > logInfo()
void throwException(const std::string &message, const std::string &methodName)
#define conddb_table(NAME)