#include <MODCCSHFDat.h>
|
typedef oracle::occi::Clob | Clob |
|
Definition at line 19 of file MODCCSHFDat.h.
MODCCSHFDat::MODCCSHFDat |
( |
| ) |
|
Definition at line 17 of file MODCCSHFDat.cc.
References NULL.
oracle::occi::Environment * m_env
oracle::occi::Statement * m_writeStmt
oracle::occi::Connection * m_conn
oracle::occi::Statement * m_readStmt
MODCCSHFDat::~MODCCSHFDat |
( |
| ) |
|
Definition at line 142 of file MODCCSHFDat.cc.
References alignCSCRings::e, o2o::iov, and AlCaHLTBitMon_ParallelJobs::p.
157 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
159 "FROM channelview cv JOIN OD_CCS_HF_dat d "
160 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
161 "WHERE d.iov_id = :iov_id");
165 std::pair< EcalLogicID, MODCCSHFDat >
p;
167 while(rset->next()) {
181 throw(std::runtime_error(
"MODCCSHFDat::fetchData(): "+e.getMessage()));
oracle::occi::Environment * m_env
oracle::occi::Connection * m_conn
oracle::occi::SQLException SQLException
oracle::occi::Statement * m_readStmt
oracle::occi::ResultSet ResultSet
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
void checkConnection() const
unsigned char* MODCCSHFDat::getClob |
( |
| ) |
const |
|
inline |
std::string MODCCSHFDat::getFile |
( |
| ) |
const |
|
inline |
unsigned int MODCCSHFDat::getSize |
( |
| ) |
const |
|
inline |
std::string MODCCSHFDat::getTable |
( |
| ) |
|
|
inlinevirtual |
int MODCCSHFDat::getTest |
( |
| ) |
const |
|
inline |
void MODCCSHFDat::populateClob |
( |
Clob & |
clob, |
|
|
std::string |
fname, |
|
|
unsigned int |
clob_size |
|
) |
| |
throw | ( | std::runtime_error |
| ) | | |
|
private |
Definition at line 258 of file MODCCSHFDat.cc.
References gather_cfg::cout, alignCSCRings::e, end, mergeVDriftHistosByStation::file, alignmentValidation::fname, recoMuon::in, findQualityFiles::size, and AlCaHLTBitMon_QueryRunRegistry::string.
264 cout <<
"Populating the Clob using writeBuffer(Stream) method" << endl;
278 inFile.open((
char*)fname2.c_str(),
ios::in);
287 clob_size = inFile.tellg();
288 std::cout <<
" bufsize ="<<clob_size<< std::endl;
290 inFile.seekg( 0,ios::beg );
294 char *buffer =
new char[clob_size + 1];
299 Stream *strm=clob.getStream();
304 memset (buffer, buf, clob_size + 1);
305 inFile.read(buffer,clob_size);
308 strm->writeBuffer(buffer,strlen(buffer));
315 strm->writeLastBuffer(buffer,size);
316 clob.closeStream(strm);
323 throw(std::runtime_error(
"populateClob(): "+e.getMessage()));
326 cout <<
"Populating the Clob - Success" << endl;
oracle::occi::SQLException SQLException
RecoEventOutputModuleForFU< RecoEventWriterForFU > Stream
tuple size
Write out results.
void MODCCSHFDat::prepareWrite |
( |
| ) |
|
throw | ( | std::runtime_error |
| ) | | |
|
privatevirtual |
Implements IDataItem.
Definition at line 61 of file MODCCSHFDat.cc.
References alignCSCRings::e.
68 m_writeStmt->setSQL(
"INSERT INTO OD_CCS_HF_dat (iov_id, logic_id, "
70 "VALUES (:iov_id, :logic_id, "
75 throw(std::runtime_error(
"MODCCSHFDat::prepareWrite(): "+e.getMessage()));
oracle::occi::Statement * m_writeStmt
oracle::occi::Connection * m_conn
oracle::occi::SQLException SQLException
void checkConnection() const
unsigned char * MODCCSHFDat::readClob |
( |
Clob & |
clob, |
|
|
int |
size |
|
) |
| |
throw | ( | std::runtime_error |
| ) | | |
|
private |
Definition at line 330 of file MODCCSHFDat.cc.
References gather_cfg::cout, alignCSCRings::e, i, and findQualityFiles::size.
335 Stream *instream = clob.getStream (1,0);
336 unsigned char *buffer=
new unsigned char[
size];
338 memset (buffer, buf,
size);
340 instream->readBuffer ((
char*)buffer,
size);
341 cout <<
"remember to delete the char* at the end of the program ";
343 cout << (
char) buffer[
i];
347 clob.closeStream (instream);
352 throw(std::runtime_error(
"readClob(): "+e.getMessage()));
oracle::occi::SQLException SQLException
RecoEventOutputModuleForFU< RecoEventWriterForFU > Stream
tuple size
Write out results.
void MODCCSHFDat::setClob |
( |
unsigned char * |
x | ) |
|
|
inline |
void MODCCSHFDat::setFile |
( |
std::string |
x | ) |
|
void MODCCSHFDat::setSize |
( |
unsigned int |
id | ) |
|
|
inline |
void MODCCSHFDat::setTest |
( |
int |
id | ) |
|
|
inline |
Definition at line 185 of file MODCCSHFDat.cc.
References prof2calltree::count, data, alignCSCRings::e, EcalLogicID::getLogicID(), o2o::iov, AlCaHLTBitMon_ParallelJobs::p, and x.
192 if (!iovID) {
throw(std::runtime_error(
"MODCCSHFDat::writeArrayDB: IOV not in DB")); }
195 int nrows=
data->size();
196 int* ids=
new int[nrows];
197 int* iovid_vec=
new int[nrows];
198 int* xx=
new int[nrows];
200 ub2* ids_len=
new ub2[nrows];
201 ub2* iov_len=
new ub2[nrows];
202 ub2* x_len=
new ub2[nrows];
207 typedef map< EcalLogicID, MODCCSHFDat >::const_iterator CI;
208 for (CI
p =
data->begin();
p !=
data->end(); ++
p) {
209 channel = &(
p->first);
211 if (!logicID) {
throw(std::runtime_error(
"MODCCSHFDat::writeArrayDB: Bad EcalLogicID")); }
213 iovid_vec[
count]=iovID;
234 m_writeStmt->setDataBuffer(1, (dvoid*)iovid_vec, OCCIINT,
sizeof(iovid_vec[0]),iov_len);
235 m_writeStmt->setDataBuffer(2, (dvoid*)ids, OCCIINT,
sizeof(ids[0]), ids_len );
236 m_writeStmt->setDataBuffer(3, (dvoid*)xx, OCCIINT ,
sizeof(xx[0]), x_len );
252 throw(std::runtime_error(
"MonPedestalsDat::writeArrayDB(): "+e.getMessage()));
oracle::occi::Statement * m_writeStmt
oracle::occi::SQLException SQLException
char data[epos_bytes_allocation]
void checkConnection() const
Definition at line 81 of file MODCCSHFDat.cc.
References gather_cfg::cout, alignCSCRings::e, alignmentValidation::fname, o2o::iov, and AlCaHLTBitMon_QueryRunRegistry::string.
91 if (!iovID) {
throw(std::runtime_error(
"MODCCSHFDat::writeDB: IOV not in DB")); }
94 if (!logicID) {
throw(std::runtime_error(
"MODCCSHFDat::writeDB: Bad EcalLogicID")); }
97 std::cout <<
"Going to read CCS file: " << fname << endl;
106 oracle::occi::Clob clob(
m_conn);
112 std::cout<<
"empty CCS Clob inserted into DB" <<std::endl;
116 m_writeStmt->setSQL (
"SELECT CCS_LOG FROM OD_CCS_HF_DAT WHERE"
117 " iov_ID=:1 and logic_ID=:2 FOR UPDATE");
122 oracle::occi::Clob clob2 = rset->getClob (1);
123 cout <<
"Opening the clob in read write mode" << endl;
125 unsigned int clob_size=item->
getSize();
129 int clobLength=clob2.length ();
130 cout <<
"Length of the clob is: " << clobLength << endl;
136 throw(std::runtime_error(
"MODCCSHFDat::writeDB(): "+e.getMessage()));
std::string getFile() const
oracle::occi::Statement * m_writeStmt
oracle::occi::Connection * m_conn
oracle::occi::SQLException SQLException
oracle::occi::ResultSet ResultSet
unsigned int getSize() const
void checkConnection() const
void populateClob(Clob &clob, std::string fname, unsigned int clob_size)
unsigned char* MODCCSHFDat::m_clob |
|
private |
std::string MODCCSHFDat::m_file |
|
private |
unsigned int MODCCSHFDat::m_size |
|
private |