CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 () throw (std::runtime_error)
 
void createReadStatement () throw (std::runtime_error)
 
void populateClob (Clob &clob, std::string fname, unsigned int bufsize) throw (std::runtime_error)
 
virtual void prepareWrite ()=0 throw (std::runtime_error)
 
unsigned char * readClob (Clob &clob, int size) throw (std::runtime_error)
 
void setPrefetchRowCount (int ncount) throw (std::runtime_error)
 
void terminateReadStatement () throw (std::runtime_error)
 
void terminateWriteStatement () throw (std::runtime_error)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const throw (std::runtime_error)
 

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 ( )
throw (std::runtime_error
)
inlineprotected

Definition at line 39 of file IODConfig.h.

References m_writeStmt, and NULL.

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

Definition at line 58 of file IODConfig.h.

References IDBObject::m_conn, and m_readStmt.

60  {
61  m_readStmt=m_conn->createStatement();
62  }
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 
)
throw (std::runtime_error
)
inlineprotected

Definition at line 88 of file IODConfig.h.

References gather_cfg::cout, alignCSCRings::e, end, mergeVDriftHistosByStation::file, recoMuon::in, findQualityFiles::size, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 160 of file IODConfig.h.

References gather_cfg::cout, alignCSCRings::e, i, and findQualityFiles::size.

162 {
163 
164  try{
165  Stream *instream = clob.getStream (1,0);
166  unsigned char *buffer= new unsigned char[size];
167  int buf=0;
168  memset (buffer, buf, size);
169 
170  instream->readBuffer ((char*)buffer, size);
171  std::cout << "remember to delete the char* at the end of the program ";
172  for (int i = 0; i < size; ++i)
173  std::cout << (char) buffer[i];
174  std::cout << std::endl;
175 
176 
177  clob.closeStream (instream);
178 
179  return buffer;
180 
181  }catch (SQLException &e) {
182  throw(std::runtime_error("readClob(): "+e.getMessage()));
183  }
184 
185 }
int i
Definition: DBlmapReader.cc:9
oracle::occi::Stream Stream
Definition: IODConfig.h:24
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
tuple cout
Definition: gather_cfg.py:145
tuple size
Write out results.
void IODConfig::setConfigTag ( std::string  x)
inline

Definition at line 31 of file IODConfig.h.

References m_config_tag, and x.

31 {m_config_tag=x;}
std::string m_config_tag
Definition: IODConfig.h:27
void IODConfig::setPrefetchRowCount ( int  ncount)
throw (std::runtime_error
)
inlineprotected

Definition at line 64 of file IODConfig.h.

References m_readStmt.

66  {
67  m_readStmt->setPrefetchRowCount(ncount);
68  }
Statement * m_readStmt
Definition: IODConfig.h:37
void IODConfig::terminateReadStatement ( )
throw (std::runtime_error
)
inlineprotected

Definition at line 70 of file IODConfig.h.

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

72  {
73  if (m_readStmt != NULL) {
74  m_conn->terminateStatement(m_readStmt);
75  } else {
76  std::cout << "Warning from IDataItem: statement was aleady closed"<< std::endl;
77  }
78  }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
#define NULL
Definition: scimark2.h:8
Statement * m_readStmt
Definition: IODConfig.h:37
tuple cout
Definition: gather_cfg.py:145
void IODConfig::terminateWriteStatement ( )
throw (std::runtime_error
)
inlineprotected

Definition at line 47 of file IODConfig.h.

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

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

Member Data Documentation

std::string IODConfig::m_config_tag

Definition at line 27 of file IODConfig.h.

Referenced by getConfigTag(), and setConfigTag().

Statement* IODConfig::m_readStmt
protected

Definition at line 37 of file IODConfig.h.

Referenced by createReadStatement(), setPrefetchRowCount(), and terminateReadStatement().

Statement* IODConfig::m_writeStmt
protected

Definition at line 36 of file IODConfig.h.

Referenced by checkPrepare(), and terminateWriteStatement().