#include <OnlineDB/EcalCondDB/interface/RunDat.h>
Public Member Functions | |
int | getNumEvents () const |
std::string | getTable () |
RunDat () | |
void | setNumEvents (int num) |
~RunDat () | |
Private Member Functions | |
void | fetchData (std::map< EcalLogicID, RunDat > *fillMap, RunIOV *iov) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeDB (const EcalLogicID *ecid, const RunDat *item, RunIOV *iov) throw (std::runtime_error) |
Private Attributes | |
int | m_numEvents |
Friends | |
class | EcalCondDBInterface |
Definition at line 11 of file RunDat.h.
RunDat::RunDat | ( | ) |
Definition at line 11 of file RunDat.cc.
References IDBObject::m_conn, IDBObject::m_env, m_numEvents, IDataItem::m_writeStmt, and NULL.
00012 { 00013 m_env = NULL; 00014 m_conn = NULL; 00015 m_writeStmt = NULL; 00016 m_numEvents = 0; 00017 }
void RunDat::fetchData | ( | std::map< EcalLogicID, RunDat > * | fillMap, | |
RunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
int RunDat::getNumEvents | ( | ) | const [inline] |
std::string RunDat::getTable | ( | ) | [inline, virtual] |
void RunDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IDataItem.
Definition at line 27 of file RunDat.cc.
References IDBObject::checkConnection(), e, IDBObject::m_conn, and IDataItem::m_writeStmt.
00029 { 00030 this->checkConnection(); 00031 00032 try { 00033 m_writeStmt = m_conn->createStatement(); 00034 m_writeStmt->setSQL("INSERT INTO run_dat (iov_id, logic_id, " 00035 "num_events) " 00036 "VALUES (:iov_id, :logic_id, " 00037 ":num_events)"); 00038 } catch (SQLException &e) { 00039 throw(runtime_error("RunDat::prepareWrite(): "+e.getMessage())); 00040 } 00041 }
Definition at line 20 of file RunDat.h.
References m_numEvents.
Referenced by EcalEndcapMonitorClient::endRunDb(), and EcalBarrelMonitorClient::endRunDb().
00020 { m_numEvents = num; }
void RunDat::writeDB | ( | const EcalLogicID * | ecid, | |
const RunDat * | item, | |||
RunIOV * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 45 of file RunDat.cc.
References IDBObject::checkConnection(), IDataItem::checkPrepare(), e, and IDataItem::m_writeStmt.
00047 { 00048 this->checkConnection(); 00049 this->checkPrepare(); 00050 00051 int iovID = iov->fetchID(); 00052 if (!iovID) { throw(runtime_error("RunDat::writeDB: IOV not in DB")); } 00053 00054 int logicID = ecid->getLogicID(); 00055 if (!logicID) { throw(runtime_error("RunDat::writeDB: Bad EcalLogicID")); } 00056 00057 try { 00058 m_writeStmt->setInt(1, iovID); 00059 m_writeStmt->setInt(2, logicID); 00060 m_writeStmt->setInt(3, item->getNumEvents()); 00061 00062 m_writeStmt->executeUpdate(); 00063 } catch (SQLException &e) { 00064 throw(runtime_error("RunDat::writeDB(): "+e.getMessage())); 00065 } 00066 }
friend class EcalCondDBInterface [friend] |
int RunDat::m_numEvents [private] |