CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cscmap Class Reference

#include <CSCMap.h>

Public Member Functions

void chamber_crate (std::string chamber_id, int *crate, int *dmb, int *sector, int *chamber_num, int *crate0, int *first_strip_index, int *strips_per_layer, int *chamber_index)
 
void crate0_chamber (int crate0, int dmb, std::string *chamber_id, int *chamber_num, int *sector, int *first_strip_index, int *strips_per_layer, int *chamber_index)
 
void crate_chamber (int crate, int dmb, std::string *chamber_id, int *chamber_num, int *sector, int *first_strip_index, int *strips_per_layer, int *chamber_index)
 
 cscmap () noexcept(false)
 
 ~cscmap () noexcept(false)
 

Private Attributes

oracle::occi::Connection * con
 
oracle::occi::Environment * env
 

Detailed Description

Definition at line 8 of file CSCMap.h.

Constructor & Destructor Documentation

cscmap::cscmap ( )
noexcept

Constructor for cscmap

Definition at line 7 of file CSCMap.cc.

References con, gather_cfg::cout, SiStripPI::DEFAULT, env, and AlCaHLTBitMon_QueryRunRegistry::string.

8  {
9  std::string db_user;
10  std::string db_pass;
11  env = oracle::occi::Environment::createEnvironment (oracle::occi::Environment::DEFAULT);
12  char* c_user = ::getenv("CSCMAP_AUTH_USER");
13  char* c_pass = ::getenv("CSCMAP_AUTH_PASSWORD");
14  db_user=std::string(c_user);
15  db_pass=std::string(c_pass);
16  con = env->createConnection (db_user,db_pass,"devdb");
17  std::cout << "Connection to mapping DB is done." << std::endl;
18  }// end of constructor cscmap ()
oracle::occi::Environment * env
Definition: CSCMap.h:12
oracle::occi::Connection * con
Definition: CSCMap.h:13
cscmap::~cscmap ( )
noexcept

Destructor for cscmap

Destructor for cscmap.

Definition at line 22 of file CSCMap.cc.

References con, and env.

23  {
24  env->terminateConnection (con);
25  oracle::occi::Environment::terminateEnvironment (env);
26  } // end of ~cscmap ()
oracle::occi::Environment * env
Definition: CSCMap.h:12
oracle::occi::Connection * con
Definition: CSCMap.h:13

Member Function Documentation

void cscmap::chamber_crate ( std::string  chamber_id,
int *  crate,
int *  dmb,
int *  sector,
int *  chamber_num,
int *  crate0,
int *  first_strip_index,
int *  strips_per_layer,
int *  chamber_index 
)

Definition at line 84 of file CSCMap.cc.

References con.

88  {
89  oracle::occi::Statement *stmt = con->createStatement();
90  stmt->setSQL("begin cscmap.crate0_proc(:1, :2, :3, :4, :5, :6, :7, :8, :9); end;");
91 
92  stmt->setString (1, chamber_id);
93  stmt->registerOutParam (2, oracle::occi::OCCIINT);
94  stmt->registerOutParam (3, oracle::occi::OCCIINT);
95  stmt->registerOutParam (4, oracle::occi::OCCIINT);
96  stmt->registerOutParam (5, oracle::occi::OCCIINT);
97  stmt->registerOutParam (6, oracle::occi::OCCIINT);
98  stmt->registerOutParam (7, oracle::occi::OCCIINT);
99  stmt->registerOutParam (8, oracle::occi::OCCIINT);
100  stmt->registerOutParam (9, oracle::occi::OCCIINT);
101 
102  stmt->execute(); //execute procedure
103 
104  *crate0 = stmt->getInt(2);
105  *crate = stmt->getInt(3);
106  *dmb = stmt->getInt(4);
107  *sector = stmt->getInt(5);
108  *chamber_num = stmt->getInt(6);
109  *chamber_index = stmt->getInt(7);
110  *first_strip_index = stmt->getInt(8);
111  *strips_per_layer = stmt->getInt(9);
112 
113  con->terminateStatement (stmt);
114  } //end of crate_chamber
oracle::occi::Connection * con
Definition: CSCMap.h:13
void cscmap::crate0_chamber ( int  crate0,
int  dmb,
std::string *  chamber_id,
int *  chamber_num,
int *  sector,
int *  first_strip_index,
int *  strips_per_layer,
int *  chamber_index 
)

Definition at line 28 of file CSCMap.cc.

References con.

31  {
32  oracle::occi::Statement *stmt = con->createStatement();
33  stmt->setSQL("begin cscmap.chamber0(:1, :2, :3, :4, :5, :6, :7, :8); end;");
34 
35  stmt->setInt (1, crate0);
36  stmt->setInt (2, dmb);
37  stmt->registerOutParam(3, oracle::occi::OCCISTRING, 10);
38  stmt->registerOutParam (4, oracle::occi::OCCIINT);
39  stmt->registerOutParam (5, oracle::occi::OCCIINT);
40  stmt->registerOutParam (6, oracle::occi::OCCIINT);
41  stmt->registerOutParam (7, oracle::occi::OCCIINT);
42  stmt->registerOutParam (8, oracle::occi::OCCIINT);
43 
44  stmt->execute(); //execute procedure
45 
46  *chamber_id = stmt->getString(3);
47  *chamber_num = stmt->getInt(4);
48  *chamber_index = stmt->getInt(5);
49  *first_strip_index = stmt->getInt(6);
50  *strips_per_layer = stmt->getInt(7);
51  *sector = stmt->getInt(8);
52 
53  con->terminateStatement (stmt);
54  } //end of crate0_chamber
oracle::occi::Connection * con
Definition: CSCMap.h:13
void cscmap::crate_chamber ( int  crate,
int  dmb,
std::string *  chamber_id,
int *  chamber_num,
int *  sector,
int *  first_strip_index,
int *  strips_per_layer,
int *  chamber_index 
)

Definition at line 56 of file CSCMap.cc.

References con.

59  {
60  oracle::occi::Statement *stmt = con->createStatement();
61  stmt->setSQL("begin cscmap.chamber(:1, :2, :3, :4, :5, :6, :7, :8); end;");
62 
63  stmt->setInt (1, crate);
64  stmt->setInt (2, dmb);
65  stmt->registerOutParam(3, oracle::occi::OCCISTRING, 10);
66  stmt->registerOutParam (4, oracle::occi::OCCIINT);
67  stmt->registerOutParam (5, oracle::occi::OCCIINT);
68  stmt->registerOutParam (6, oracle::occi::OCCIINT);
69  stmt->registerOutParam (7, oracle::occi::OCCIINT);
70  stmt->registerOutParam (8, oracle::occi::OCCIINT);
71 
72  stmt->execute(); //execute procedure
73 
74  *chamber_id = stmt->getString(3);
75  *chamber_num = stmt->getInt(4);
76  *chamber_index = stmt->getInt(5);
77  *first_strip_index = stmt->getInt(6);
78  *strips_per_layer = stmt->getInt(7);
79  *sector = stmt->getInt(8);
80 
81  con->terminateStatement (stmt);
82  } //end of crate_chamber
oracle::occi::Connection * con
Definition: CSCMap.h:13

Member Data Documentation

oracle::occi::Connection* cscmap::con
private

Definition at line 13 of file CSCMap.h.

Referenced by chamber_crate(), crate0_chamber(), crate_chamber(), cscmap(), and ~cscmap().

oracle::occi::Environment* cscmap::env
private

Definition at line 12 of file CSCMap.h.

Referenced by cscmap(), and ~cscmap().