#include <OnlineDB/EcalCondDB/interface/ODDelaysDat.h>
Public Member Functions | |
int | getFedId () const |
int | getId () const |
int | getSMId () const |
std::string | getTable () |
int | getTimeOffset () const |
int | getTTId () const |
ODDelaysDat () | |
void | setFedId (int dac) |
void | setId (int dac) |
void | setSMId (int dac) |
void | setTimeOffset (int dac) |
void | setTTId (int dac) |
~ODDelaysDat () | |
Private Member Functions | |
void | fetchData (std::vector< ODDelaysDat > *fillMap, ODFEDelaysInfo *iov) throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeArrayDB (const std::vector< ODDelaysDat > data, ODFEDelaysInfo *iov) throw (std::runtime_error) |
void | writeDB (const ODDelaysDat *item, ODFEDelaysInfo *iov) throw (std::runtime_error) |
Private Attributes | |
int | m_fed |
int | m_ID |
int | m_sm |
int | m_t1 |
int | m_tt |
Friends | |
class | EcalCondDBInterface |
Definition at line 10 of file ODDelaysDat.h.
ODDelaysDat::ODDelaysDat | ( | ) |
Definition at line 10 of file ODDelaysDat.cc.
References IDBObject::m_conn, IDBObject::m_env, m_fed, IODConfig::m_readStmt, m_sm, m_t1, m_tt, IODConfig::m_writeStmt, and NULL.
00011 { 00012 m_env = NULL; 00013 m_conn = NULL; 00014 m_writeStmt = NULL; 00015 m_readStmt = NULL; 00016 00017 m_sm = 0; 00018 m_fed = 0; 00019 m_tt = 0; 00020 m_t1 = 0; 00021 00022 }
ODDelaysDat::~ODDelaysDat | ( | ) |
void ODDelaysDat::fetchData | ( | std::vector< ODDelaysDat > * | fillMap, | |
ODFEDelaysInfo * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 68 of file ODDelaysDat.cc.
References IDBObject::checkConnection(), e, getTable(), IDBObject::m_conn, IDBObject::m_env, IODConfig::m_readStmt, p, setFedId(), setSMId(), setTimeOffset(), and setTTId().
00070 { 00071 this->checkConnection(); 00072 00073 iov->setConnection(m_env, m_conn); 00074 int iovID = iov->fetchID(); 00075 if (!iovID) { 00076 // throw(runtime_error("ODDelaysDat::writeDB: IOV not in DB")); 00077 return; 00078 } 00079 00080 try { 00081 m_readStmt->setSQL("SELECT * FROM " + getTable() + "WHERE rec_id = :rec_id order by sm_id, fed_id, tt_id "); 00082 m_readStmt->setInt(1, iovID); 00083 ResultSet* rset = m_readStmt->executeQuery(); 00084 00085 // std::vector< ODDelaysDat > p; 00086 ODDelaysDat dat; 00087 while(rset->next()) { 00088 // dat.setId( rset->getInt(1) ); 00089 dat.setSMId( rset->getInt(2) ); 00090 dat.setFedId( rset->getInt(3) ); 00091 dat.setTTId( rset->getInt(4) ); 00092 dat.setTimeOffset( rset->getInt(5) ); 00093 00094 p->push_back( dat); 00095 00096 } 00097 } catch (SQLException &e) { 00098 throw(runtime_error("ODDelaysDat::fetchData(): "+e.getMessage())); 00099 } 00100 }
int ODDelaysDat::getFedId | ( | ) | const [inline] |
Definition at line 26 of file ODDelaysDat.h.
References m_fed.
Referenced by writeArrayDB().
00026 { return m_fed; }
int ODDelaysDat::getId | ( | ) | const [inline] |
int ODDelaysDat::getSMId | ( | ) | const [inline] |
Definition at line 23 of file ODDelaysDat.h.
References m_sm.
Referenced by writeArrayDB().
00023 { return m_sm; }
std::string ODDelaysDat::getTable | ( | ) | [inline, virtual] |
Implements IODConfig.
Definition at line 17 of file ODDelaysDat.h.
Referenced by fetchData(), and prepareWrite().
int ODDelaysDat::getTimeOffset | ( | ) | const [inline] |
Definition at line 33 of file ODDelaysDat.h.
References m_t1.
Referenced by writeArrayDB().
00033 { return m_t1; }
int ODDelaysDat::getTTId | ( | ) | const [inline] |
Definition at line 29 of file ODDelaysDat.h.
References m_tt.
Referenced by writeArrayDB().
00029 { return m_tt; }
void ODDelaysDat::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IODConfig.
Definition at line 32 of file ODDelaysDat.cc.
References IDBObject::checkConnection(), e, getTable(), IDBObject::m_conn, and IODConfig::m_writeStmt.
00034 { 00035 this->checkConnection(); 00036 00037 try { 00038 m_writeStmt = m_conn->createStatement(); 00039 m_writeStmt->setSQL("INSERT INTO "+getTable()+" (rec_id, sm_id, fed_id, tt_id, time_offset ) " 00040 "VALUES (:1, :2, :3, :4, :5 )"); 00041 } catch (SQLException &e) { 00042 throw(runtime_error("ODDelaysDat::prepareWrite(): "+e.getMessage())); 00043 } 00044 }
Definition at line 25 of file ODDelaysDat.h.
References m_fed.
Referenced by fetchData().
00025 { m_fed = dac; }
Definition at line 22 of file ODDelaysDat.h.
References m_sm.
Referenced by fetchData().
00022 { m_sm = dac; }
Definition at line 32 of file ODDelaysDat.h.
References m_t1.
Referenced by fetchData().
00032 { m_t1 = dac; }
Definition at line 28 of file ODDelaysDat.h.
References m_tt.
Referenced by fetchData().
00028 { m_tt = dac; }
void ODDelaysDat::writeArrayDB | ( | const std::vector< ODDelaysDat > | data, | |
ODFEDelaysInfo * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 104 of file ODDelaysDat.cc.
References IDBObject::checkConnection(), count, data, e, getFedId(), getSMId(), getTimeOffset(), getTTId(), IODConfig::m_writeStmt, and st.
00106 { 00107 this->checkConnection(); 00108 00109 int iovID = iov->fetchID(); 00110 if (!iovID) { throw(runtime_error("ODDelays::writeArrayDB: ODFEDelaysInfo not in DB")); } 00111 00112 00113 int nrows=data.size(); 00114 int* ids= new int[nrows]; 00115 int* xx= new int[nrows]; 00116 int* yy= new int[nrows]; 00117 int* zz= new int[nrows]; 00118 int* st= new int[nrows]; 00119 00120 00121 00122 ub2* ids_len= new ub2[nrows]; 00123 ub2* x_len= new ub2[nrows]; 00124 ub2* y_len= new ub2[nrows]; 00125 ub2* z_len= new ub2[nrows]; 00126 ub2* st_len= new ub2[nrows]; 00127 00128 00129 ODDelaysDat dataitem; 00130 00131 00132 for (int count = 0; count != data.size(); count++) { 00133 dataitem=data[count]; 00134 ids[count]=iovID; 00135 xx[count]=dataitem.getSMId(); 00136 yy[count]=dataitem.getFedId(); 00137 zz[count]=dataitem.getTTId(); 00138 st[count]=dataitem.getTimeOffset(); 00139 00140 00141 ids_len[count]=sizeof(ids[count]); 00142 x_len[count]=sizeof(xx[count]); 00143 y_len[count]=sizeof(yy[count]); 00144 z_len[count]=sizeof(zz[count]); 00145 st_len[count]=sizeof(st[count]); 00146 00147 } 00148 00149 00150 try { 00151 m_writeStmt->setDataBuffer(1, (dvoid*)ids, OCCIINT, sizeof(ids[0]),ids_len); 00152 m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT , sizeof(xx[0]), x_len ); 00153 m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT , sizeof(yy[0]), y_len ); 00154 m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT , sizeof(zz[0]), z_len ); 00155 m_writeStmt->setDataBuffer(5, (dvoid*)st, OCCIINT , sizeof(st[0]), st_len ); 00156 00157 m_writeStmt->executeArrayUpdate(nrows); 00158 00159 delete [] ids; 00160 delete [] xx; 00161 delete [] yy; 00162 delete [] zz; 00163 delete [] st; 00164 00165 delete [] ids_len; 00166 delete [] x_len; 00167 delete [] y_len; 00168 delete [] z_len; 00169 delete [] st_len; 00170 00171 } catch (SQLException &e) { 00172 throw(runtime_error("ODDelaysDat::writeArrayDB(): "+e.getMessage())); 00173 } 00174 }
void ODDelaysDat::writeDB | ( | const ODDelaysDat * | item, | |
ODFEDelaysInfo * | iov | |||
) | throw (std::runtime_error) [private] |
Definition at line 48 of file ODDelaysDat.cc.
References IDBObject::checkConnection(), e, and IODConfig::m_writeStmt.
00050 { 00051 this->checkConnection(); 00052 00053 try { 00054 m_writeStmt->setInt(1, item->getId()); 00055 m_writeStmt->setInt(2, item->getSMId()); 00056 m_writeStmt->setInt(3, item->getFedId() ); 00057 m_writeStmt->setInt(4, item->getTTId() ); 00058 m_writeStmt->setInt(5, item->getTimeOffset() ); 00059 00060 m_writeStmt->executeUpdate(); 00061 } catch (SQLException &e) { 00062 throw(runtime_error("ODDelaysDat::writeDB(): "+e.getMessage())); 00063 } 00064 }
friend class EcalCondDBInterface [friend] |
int ODDelaysDat::m_fed [private] |
Definition at line 51 of file ODDelaysDat.h.
Referenced by getFedId(), ODDelaysDat(), and setFedId().
int ODDelaysDat::m_ID [private] |
int ODDelaysDat::m_sm [private] |
int ODDelaysDat::m_t1 [private] |
Definition at line 53 of file ODDelaysDat.h.
Referenced by getTimeOffset(), ODDelaysDat(), and setTimeOffset().
int ODDelaysDat::m_tt [private] |