19 for(
int i=0;
i<1024;
i++){
36 this->checkConnection();
39 m_writeStmt = m_conn->createStatement();
40 m_writeStmt->setSQL(
"INSERT INTO fe_lut_per_group_dat (lut_conf_id, group_id, " 41 " lut_id, lut_value ) " 42 "VALUES (:lut_conf_id, :group_id, " 43 ":lut_id, :lut_value )" );
44 }
catch (SQLException &
e) {
45 throw(std::runtime_error(
"FEConfigLUTGroupDat::prepareWrite(): "+e.getMessage()));
52 this->checkConnection();
55 int iconfID = iconf->fetchID();
57 cout<<
"iconf="<< iconfID << endl;
59 if (!iconfID) {
throw(std::runtime_error(
"FEConfigLUTGroupDat::writeArrayDB: ICONF not in DB")); }
63 int* iconfid_vec=
new int[nrows];
64 int*
xx=
new int[nrows];
65 int*
yy=
new int[nrows];
66 int*
zz=
new int[nrows];
69 ub2* iconf_len=
new ub2[nrows];
70 ub2* x_len=
new ub2[nrows];
71 ub2* y_len=
new ub2[nrows];
72 ub2* z_len=
new ub2[nrows];
78 iconfid_vec[
count]=iconfID;
79 int x=item->getLUTGroupId();
97 m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT,
sizeof(iconfid_vec[0]),iconf_len);
98 m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT,
sizeof(xx[0]), x_len );
99 m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT ,
sizeof(yy[0]), y_len );
100 m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT ,
sizeof(zz[0]), z_len );
102 m_writeStmt->executeArrayUpdate(nrows);
105 delete [] iconfid_vec;
118 }
catch (SQLException &
e) {
119 throw(std::runtime_error(
"FEConfigLUTGroupDat::writeArrayDB(): "+e.getMessage()));
127 this->checkConnection();
130 iconf->setConnection(m_env, m_conn);
131 int iconfID = iconf->fetchID();
133 throw(std::runtime_error(
"FEConfigLUTGroupDat::fetchData: ICONF not in DB"));
139 m_readStmt->setSQL(
"SELECT d.group_id, d.lut_id, d.lut_value " 140 "FROM fe_lut_per_group_dat d " 141 "WHERE lut_conf_id = :lut_conf_id order by d.group_id, d.lut_id ");
142 m_readStmt->setInt(1, iconfID);
143 ResultSet* rset = m_readStmt->executeQuery();
146 std::pair< EcalLogicID, FEConfigLUTGroupDat >
p;
154 while(rset->next()) {
156 int il=rset->getInt(2);
157 int ival=rset->getInt(3);
175 }
catch (SQLException &
e) {
176 throw(std::runtime_error(
"FEConfigLUTGroupDat::fetchData: "+e.getMessage()));
183 this->checkConnection();
184 this->checkPrepare();
186 int iconfID = iconf->fetchID();
187 if (!iconfID) {
throw(std::runtime_error(
"FEConfigLUTGroupDat::writeArrayDB: ICONF not in DB")); }
190 int nrows=
data->size()*1024;
192 int* iconfid_vec=
new int[nrows];
193 int*
xx=
new int[nrows];
194 int*
yy=
new int[nrows];
195 int*
zz=
new int[nrows];
199 ub2* iconf_len=
new ub2[nrows];
200 ub2* x_len=
new ub2[nrows];
201 ub2* y_len=
new ub2[nrows];
202 ub2* z_len=
new ub2[nrows];
207 typedef map< EcalLogicID, FEConfigLUTGroupDat >::const_iterator CI;
208 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
211 dataitem = &(
p->second);
215 for (
int i=0;
i<1024;
i++){
216 iconfid_vec[
count]=iconfID;
242 cout <<
"about to insert "<< iconfid_vec[
i]<<
" " <<xx[
i]<<
" "<< yy[
i]<<
" "<< zz[
i]<< endl;
244 cout <<
"about to insert "<< iconfid_vec[
i]<<
" " <<xx[
i]<<
" "<< yy[
i]<<
" "<< zz[
i]<< endl;
246 m_writeStmt->setDataBuffer(1, (dvoid*)iconfid_vec, OCCIINT,
sizeof(iconfid_vec[0]),iconf_len);
247 m_writeStmt->setDataBuffer(2, (dvoid*)xx, OCCIINT,
sizeof(xx[0]), x_len );
248 m_writeStmt->setDataBuffer(3, (dvoid*)yy, OCCIINT ,
sizeof(yy[0]), y_len );
249 m_writeStmt->setDataBuffer(4, (dvoid*)zz, OCCIINT ,
sizeof(zz[0]), z_len );
251 m_writeStmt->executeArrayUpdate(nrows);
254 delete [] iconfid_vec;
267 }
catch (SQLException &
e) {
268 throw(std::runtime_error(
"FEConfigLUTGroupDat::writeArrayDB(): "+e.getMessage()));
void prepareWrite() noexcept(false)
int getLUTGroupId() const
void setLUTGroupId(int x)
void writeArrayDB(const std::map< EcalLogicID, FEConfigLUTGroupDat > *data, FEConfigLUTInfo *iconf) noexcept(false)
void fetchData(std::map< EcalLogicID, FEConfigLUTGroupDat > *fillMap, FEConfigLUTInfo *iconf) noexcept(false)
void setLUTValue(int i, int x)
int getLUTValue(int i) const
void writeDB(const EcalLogicID *ecid, const FEConfigLUTGroupDat *item, FEConfigLUTInfo *iconf) noexcept(false)
char data[epos_bytes_allocation]