CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
IODConfig Class Referenceabstract

#include <IODConfig.h>

Inheritance diagram for IODConfig:
IDBObject FEConfigBadStripDat FEConfigBadStripInfo FEConfigBadTTDat FEConfigBadTTInfo FEConfigBadXTDat FEConfigBadXTInfo FEConfigFgrInfo FEConfigLinInfo FEConfigLUTInfo FEConfigMainInfo FEConfigPedInfo FEConfigSlidingInfo FEConfigSpikeInfo FEConfigTimingInfo FEConfigWeightInfo ODBadTTDat ODBadTTInfo ODBadXTDat ODBadXTInfo ODCCSConfig ODCCSCycle ODCond2ConfInfo ODDCCConfig ODDCCCycle ODDCUConfig ODDCUCycle ODDelaysDat ODEcalCycle ODFEDAQConfig ODFEDelaysInfo ODFEPedestalOffsetInfo ODFEWeightsInfo ODGolBiasCurrentDat ODGolBiasCurrentInfo ODJBH4Config ODJBH4Cycle ODLaserConfig ODLaserCycle ODLTCConfig ODLTCCycle ODLTSConfig ODLTSCycle ODPedestalOffsetsDat ODRunConfigCycleInfo ODRunConfigInfo ODRunConfigSeqInfo ODScanConfig ODScanCycle ODSRPConfig ODSRPCycle ODTCCConfig ODTCCCycle ODTCCEEConfig ODTCCEECycle ODTowersToByPassDat ODTowersToByPassInfo ODTTCciConfig ODTTCciCycle ODTTCFConfig ODTTCFCycle ODVfeToRejectDat ODVfeToRejectInfo ODWeightsDat ODWeightsSamplesDat

Public Types

typedef oracle::occi::Clob Clob
 
typedef oracle::occi::SQLException SQLException
 
typedef oracle::occi::Statement Statement
 
typedef oracle::occi::Stream Stream
 

Public Member Functions

std::string getConfigTag ()
 
virtual std::string getTable ()=0
 
void setConfigTag (std::string x)
 
- Public Member Functions inherited from IDBObject
oracle::occi::Connection * getConn () const
 
oracle::occi::Environment * getEnv () const
 
void setConnection (oracle::occi::Environment *env, oracle::occi::Connection *conn)
 
virtual ~IDBObject ()
 

Public Attributes

std::string m_config_tag
 

Protected Member Functions

void checkPrepare () noexcept(false)
 
void createReadStatement () noexcept(false)
 
void populateClob (Clob &clob, std::string fname, unsigned int bufsize) noexcept(false)
 
virtual void prepareWrite () noexcept(false)=0
 
unsigned char * readClob (Clob &clob, int size) noexcept(false)
 
void setPrefetchRowCount (int ncount) noexcept(false)
 
void terminateReadStatement () noexcept(false)
 
void terminateWriteStatement () noexcept(false)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const noexcept(false)
 

Protected Attributes

Statementm_readStmt
 
Statementm_writeStmt
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Additional Inherited Members

- Static Public Attributes inherited from IDBObject
static int const ECALDB_NROWS =1024
 

Detailed Description

Abstract interface for data in the conditions DB

Definition at line 19 of file IODConfig.h.

Member Typedef Documentation

typedef oracle::occi::Clob IODConfig::Clob

Definition at line 25 of file IODConfig.h.

typedef oracle::occi::SQLException IODConfig::SQLException

Definition at line 22 of file IODConfig.h.

typedef oracle::occi::Statement IODConfig::Statement

Definition at line 23 of file IODConfig.h.

typedef oracle::occi::Stream IODConfig::Stream

Definition at line 24 of file IODConfig.h.

Member Function Documentation

void IODConfig::checkPrepare ( )
inlineprotectednoexcept

Definition at line 39 of file IODConfig.h.

References NULL.

40  {
41  if (m_writeStmt == NULL) {
42  throw(std::runtime_error("Write statement not prepared"));
43  }
44  }
Statement * m_writeStmt
Definition: IODConfig.h:36
#define NULL
Definition: scimark2.h:8
void IODConfig::createReadStatement ( )
inlineprotectednoexcept

Definition at line 56 of file IODConfig.h.

References IDBObject::m_conn.

57  {
58  m_readStmt=m_conn->createStatement();
59  }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
Statement * m_readStmt
Definition: IODConfig.h:37
std::string IODConfig::getConfigTag ( )
inline

Definition at line 32 of file IODConfig.h.

References m_config_tag.

32 {return m_config_tag;}
std::string m_config_tag
Definition: IODConfig.h:27
virtual std::string IODConfig::getTable ( )
pure virtual
void IODConfig::populateClob ( Clob clob,
std::string  fname,
unsigned int  bufsize 
)
inlineprotectednoexcept

Definition at line 83 of file IODConfig.h.

References edmScanValgrind::buffer, gather_cfg::cout, MillePedeFileConverter_cfg::e, end, FrontierConditions_GlobalTag_cff::file, alignmentValidation::fname, recoMuon::in, findQualityFiles::size, and AlCaHLTBitMon_QueryRunRegistry::string.

84 {
85 
86  try{
87  // Uses stream here
88  std::cout << "Populating the Clob using writeBuffer(Stream) method" << std::endl;
89  std::cout<<"we are here0"<<std::endl;
90 
91  char *file = (char *)fname.c_str();
92  std::cout<<"we are here0.5 file is:"<<fname<<std::endl;
93 
94  std::ifstream inFile;
95  inFile.open(file,std::ios::in);
96  if (!inFile)
97  {
98  std::cout << fname <<" file not found\n";
99  inFile.close();
100 
101  std::string fname2="/nfshome0/ecaldev/francesca/null_file.txt";
102  inFile.open((char*)fname2.c_str(),std::ios::in);
103 
104 
105 
106  }
107  if(bufsize==0){
108 
109 
110  inFile.seekg( 0,std::ios::end );
111  bufsize = inFile.tellg();
112  std::cout <<" bufsize ="<<bufsize<< std::endl;
113  // set file pointer to start again
114  inFile.seekg( 0,std::ios::beg );
115 
116  }
117 
118  char *buffer = new char[bufsize + 1];
119 
120 
121  std::cout<<"we are here1"<<std::endl;
122  unsigned int size;
123  Stream *strm=clob.getStream();
124  std::cout<<"we are here2"<<std::endl;
125  // while(inFile)
126  // {
127  int buf=0;
128  memset (buffer, buf, bufsize + 1);
129  inFile.read(buffer,bufsize);
130  std::cout<<"we are here2.5"<<std::endl;
131 
132  strm->writeBuffer(buffer,strlen(buffer));
133  std::cout<<"we are here2.6"<<std::endl;
134 
135  //}
136  std::cout<<"we are here3"<<std::endl;
137  strcpy(buffer," ");
138  size=strlen(buffer);
139  strm->writeLastBuffer(buffer,size);
140  clob.closeStream(strm);
141  inFile.close();
142  std::cout<<"we are here4"<<std::endl;
143  delete[] buffer;
144 
145 
146  }catch (SQLException &e) {
147  throw(std::runtime_error("populateClob(): "+e.getMessage()));
148  }
149 
150  std::cout << "Populating the Clob - Success" << std::endl;
151 }
size
Write out results.
oracle::occi::Stream Stream
Definition: IODConfig.h:24
#define end
Definition: vmac.h:37
string fname
main script
oracle::occi::SQLException SQLException
Definition: IODConfig.h:22
virtual void IODConfig::prepareWrite ( )
protectedpure virtualnoexcept
unsigned char* IODConfig::readClob ( Clob clob,
int  size 
)
inlineprotectednoexcept

Definition at line 154 of file IODConfig.h.

References edmScanValgrind::buffer, gather_cfg::cout, MillePedeFileConverter_cfg::e, mps_fire::i, and findQualityFiles::size.

155 {
156 
157  try{
158  Stream *instream = clob.getStream (1,0);
159  unsigned char *buffer= new unsigned char[size];
160  int buf=0;
161  memset (buffer, buf, size);
162 
163  instream->readBuffer ((char*)buffer, size);
164  std::cout << "remember to delete the char* at the end of the program ";
165  for (int i = 0; i < size; ++i)
166  std::cout << (char) buffer[i];
167  std::cout << std::endl;
168 
169 
170  clob.closeStream (instream);
171 
172  return buffer;
173 
174  }catch (SQLException &e) {
175  throw(std::runtime_error("readClob(): "+e.getMessage()));
176  }
177 
178 }
size
Write out results.
oracle::occi::Stream Stream
Definition: IODConfig.h:24
oracle::occi::SQLException SQLException
Definition: IODConfig.h:22
void IODConfig::setConfigTag ( std::string  x)
inline
void IODConfig::setPrefetchRowCount ( int  ncount)
inlineprotectednoexcept

Definition at line 61 of file IODConfig.h.

62  {
63  m_readStmt->setPrefetchRowCount(ncount);
64  }
Statement * m_readStmt
Definition: IODConfig.h:37
void IODConfig::terminateReadStatement ( )
inlineprotectednoexcept

Definition at line 66 of file IODConfig.h.

References gather_cfg::cout, IDBObject::m_conn, noexcept, NULL, and prepareWrite().

67  {
68  if (m_readStmt != NULL) {
69  m_conn->terminateStatement(m_readStmt);
70  } else {
71  std::cout << "Warning from IDataItem: statement was aleady closed"<< std::endl;
72  }
73  }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
#define NULL
Definition: scimark2.h:8
Statement * m_readStmt
Definition: IODConfig.h:37
void IODConfig::terminateWriteStatement ( )
inlineprotectednoexcept

Definition at line 46 of file IODConfig.h.

References gather_cfg::cout, IDBObject::m_conn, and NULL.

47  {
48  if (m_writeStmt != NULL) {
49  m_conn->terminateStatement(m_writeStmt);
50  } else {
51  std::cout << "Warning from IDataItem: statement was aleady closed"<< std::endl;
52  }
53  }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
Statement * m_writeStmt
Definition: IODConfig.h:36
#define NULL
Definition: scimark2.h:8

Member Data Documentation

std::string IODConfig::m_config_tag

Definition at line 27 of file IODConfig.h.

Referenced by getConfigTag().

Statement* IODConfig::m_readStmt
protected

Definition at line 37 of file IODConfig.h.

Statement* IODConfig::m_writeStmt
protected

Definition at line 36 of file IODConfig.h.