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,
"cms_orcoff_prod");
17 std::cout <<
"Connection to mapping DB is done." << std::endl;
25 env->terminateConnection (
con);
26 oracle::occi::Environment::terminateEnvironment (
env);
31 oracle::occi::Statement *stmt =
con->createStatement();
33 stmt->setSQL(
"begin cms_emu_cern.cscmap.chamberid_crate(:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19, :20); end;");
35 stmt->setInt (1, chamberid);
36 stmt->registerOutParam (2, oracle::occi::OCCISTRING, 10);
37 stmt->registerOutParam (3, oracle::occi::OCCIINT);
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 stmt->registerOutParam (9, oracle::occi::OCCIINT);
44 stmt->registerOutParam (10, oracle::occi::OCCISTRING, 10);
45 stmt->registerOutParam (11, oracle::occi::OCCIINT);
46 stmt->registerOutParam (12, oracle::occi::OCCIINT);
47 stmt->registerOutParam (13, oracle::occi::OCCIINT);
48 stmt->registerOutParam (14, oracle::occi::OCCIINT);
49 stmt->registerOutParam (15, oracle::occi::OCCIINT);
50 stmt->registerOutParam (16, oracle::occi::OCCIINT);
51 stmt->registerOutParam (17, oracle::occi::OCCIINT);
52 stmt->registerOutParam (18, oracle::occi::OCCIINT);
53 stmt->registerOutParam (19, oracle::occi::OCCIINT);
54 stmt->registerOutParam (20, oracle::occi::OCCIINT);
61 int rest = (chamberid - chamber*10)/1000;
63 rest = (rest -
ring)/10;
74 item->
strips = stmt->getInt(11);
75 item->
anodes = stmt->getInt(12);
77 item->
crateid = stmt->getInt(3);
78 item->
sector = stmt->getInt(8);
80 item->
dmb = stmt->getInt(5);
81 item->
cscid = stmt->getInt(7);
83 stmt->setSQL(
"begin cms_emu_cern.ddumap.chamberid_ddu(:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19); end;");
85 stmt->setInt (1, chamberid);
86 stmt->registerOutParam (2, oracle::occi::OCCIINT);
87 stmt->registerOutParam (3, oracle::occi::OCCIINT);
88 stmt->registerOutParam (4, oracle::occi::OCCIINT);
89 stmt->registerOutParam (5, oracle::occi::OCCIINT);
90 stmt->registerOutParam (6, oracle::occi::OCCISTRING, 10);
91 stmt->registerOutParam (7, oracle::occi::OCCIINT);
92 stmt->registerOutParam (8, oracle::occi::OCCIINT);
93 stmt->registerOutParam (9, oracle::occi::OCCIINT);
94 stmt->registerOutParam (10, oracle::occi::OCCISTRING, 10);
95 stmt->registerOutParam (11, oracle::occi::OCCIINT);
96 stmt->registerOutParam (12, oracle::occi::OCCISTRING, 10);
97 stmt->registerOutParam (13, oracle::occi::OCCIINT);
98 stmt->registerOutParam (14, oracle::occi::OCCISTRING, 10);
99 stmt->registerOutParam (15, oracle::occi::OCCIINT);
100 stmt->registerOutParam (16, oracle::occi::OCCIINT);
101 stmt->registerOutParam (17, oracle::occi::OCCIINT);
102 stmt->registerOutParam (18, oracle::occi::OCCIINT);
103 stmt->registerOutParam (19, oracle::occi::OCCIINT);
107 item->
ddu = stmt->getInt(2);
109 item->
slink = stmt->getInt(7);
113 item->
dcc_fifo = stmt->getString(6);
118 con->terminateStatement (stmt);
123 oracle::occi::Statement *stmt =
con->createStatement();
125 stmt->setSQL(
"begin cms_emu_cern.cscmap.crateid_chamber(:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17); end;");
127 stmt->setInt (1, crate);
128 stmt->setInt (2, dmb);
129 stmt->registerOutParam (3, oracle::occi::OCCISTRING, 10);
130 stmt->registerOutParam (4, oracle::occi::OCCIINT);
131 stmt->registerOutParam (5, oracle::occi::OCCIINT);
132 stmt->registerOutParam (6, oracle::occi::OCCIINT);
133 stmt->registerOutParam (7, oracle::occi::OCCIINT);
134 stmt->registerOutParam (8, oracle::occi::OCCIINT);
135 stmt->registerOutParam (9, oracle::occi::OCCIINT);
136 stmt->registerOutParam (10, oracle::occi::OCCIINT);
137 stmt->registerOutParam (11, oracle::occi::OCCISTRING, 10);
138 stmt->registerOutParam (12, oracle::occi::OCCIINT);
139 stmt->registerOutParam (13, oracle::occi::OCCIINT);
140 stmt->registerOutParam (14, oracle::occi::OCCIINT);
141 stmt->registerOutParam (15, oracle::occi::OCCIINT);
142 stmt->registerOutParam (16, oracle::occi::OCCIINT);
143 stmt->registerOutParam (17, oracle::occi::OCCIINT);
150 int chamber = chamberid/10%100;
151 int rest = (chamberid - chamber*10)/1000;
153 rest = (rest -
ring)/10;
164 item->
strips = stmt->getInt(12);
165 item->
anodes = stmt->getInt(13);
167 item->
crateid = stmt->getInt(9);
168 item->
sector = stmt->getInt(7);
171 item->
cscid = stmt->getInt(5);
173 stmt->setSQL(
"begin cms_emu_cern.ddumap.chamberid_ddu(:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19); end;");
175 stmt->setInt (1, chamberid);
176 stmt->registerOutParam (2, oracle::occi::OCCIINT);
177 stmt->registerOutParam (3, oracle::occi::OCCIINT);
178 stmt->registerOutParam (4, oracle::occi::OCCIINT);
179 stmt->registerOutParam (5, oracle::occi::OCCIINT);
180 stmt->registerOutParam (6, oracle::occi::OCCISTRING, 10);
181 stmt->registerOutParam (7, oracle::occi::OCCIINT);
182 stmt->registerOutParam (8, oracle::occi::OCCIINT);
183 stmt->registerOutParam (9, oracle::occi::OCCIINT);
184 stmt->registerOutParam (10, oracle::occi::OCCISTRING, 10);
185 stmt->registerOutParam (11, oracle::occi::OCCIINT);
186 stmt->registerOutParam (12, oracle::occi::OCCISTRING, 10);
187 stmt->registerOutParam (13, oracle::occi::OCCIINT);
188 stmt->registerOutParam (14, oracle::occi::OCCISTRING, 10);
189 stmt->registerOutParam (15, oracle::occi::OCCIINT);
190 stmt->registerOutParam (16, oracle::occi::OCCIINT);
191 stmt->registerOutParam (17, oracle::occi::OCCIINT);
192 stmt->registerOutParam (18, oracle::occi::OCCIINT);
193 stmt->registerOutParam (19, oracle::occi::OCCIINT);
197 item->
ddu = stmt->getInt(2);
199 item->
slink = stmt->getInt(7);
203 item->
dcc_fifo = stmt->getString(6);
208 con->terminateStatement (stmt);
213 oracle::occi::Statement *stmt =
con->createStatement();
215 stmt->setSQL(
"begin cms_emu_cern.ddumap.ddu_chamber(:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19); end;");
217 stmt->setInt (1, rui);
218 stmt->setInt (2, ddu_input);
219 stmt->registerOutParam (3, oracle::occi::OCCIINT);
220 stmt->registerOutParam (4, oracle::occi::OCCIINT);
221 stmt->registerOutParam (5, oracle::occi::OCCISTRING, 10);
222 stmt->registerOutParam (6, oracle::occi::OCCIINT);
223 stmt->registerOutParam (7, oracle::occi::OCCIINT);
224 stmt->registerOutParam (8, oracle::occi::OCCIINT);
225 stmt->registerOutParam (9, oracle::occi::OCCISTRING, 10);
226 stmt->registerOutParam (10, oracle::occi::OCCIINT);
227 stmt->registerOutParam (11, oracle::occi::OCCISTRING, 10);
228 stmt->registerOutParam (12, oracle::occi::OCCIINT);
229 stmt->registerOutParam (13, oracle::occi::OCCISTRING, 10);
230 stmt->registerOutParam (14, oracle::occi::OCCIINT);
231 stmt->registerOutParam (15, oracle::occi::OCCIINT);
232 stmt->registerOutParam (16, oracle::occi::OCCIINT);
233 stmt->registerOutParam (17, oracle::occi::OCCIINT);
234 stmt->registerOutParam (18, oracle::occi::OCCIINT);
235 stmt->registerOutParam (19, oracle::occi::OCCIINT);
241 item->
slink = stmt->getInt(6);
245 item->
dcc_fifo = stmt->getString(5);
249 int chamberid = stmt->getInt(14);
251 stmt->setSQL(
"begin cms_emu_cern.cscmap.chamberid_crate(:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19, :20); end;");
253 stmt->setInt (1, chamberid);
254 stmt->registerOutParam (2, oracle::occi::OCCISTRING, 10);
255 stmt->registerOutParam (3, oracle::occi::OCCIINT);
256 stmt->registerOutParam (4, oracle::occi::OCCIINT);
257 stmt->registerOutParam (5, oracle::occi::OCCIINT);
258 stmt->registerOutParam (6, oracle::occi::OCCIINT);
259 stmt->registerOutParam (7, oracle::occi::OCCIINT);
260 stmt->registerOutParam (8, oracle::occi::OCCIINT);
261 stmt->registerOutParam (9, oracle::occi::OCCIINT);
262 stmt->registerOutParam (10, oracle::occi::OCCISTRING, 10);
263 stmt->registerOutParam (11, oracle::occi::OCCIINT);
264 stmt->registerOutParam (12, oracle::occi::OCCIINT);
265 stmt->registerOutParam (13, oracle::occi::OCCIINT);
266 stmt->registerOutParam (14, oracle::occi::OCCIINT);
267 stmt->registerOutParam (15, oracle::occi::OCCIINT);
268 stmt->registerOutParam (16, oracle::occi::OCCIINT);
269 stmt->registerOutParam (17, oracle::occi::OCCIINT);
270 stmt->registerOutParam (18, oracle::occi::OCCIINT);
271 stmt->registerOutParam (19, oracle::occi::OCCIINT);
272 stmt->registerOutParam (20, oracle::occi::OCCIINT);
278 int chamber = chamberid/10%100;
279 int rest = (chamberid - chamber*10)/1000;
281 rest = (rest -
ring)/10;
292 item->
strips = stmt->getInt(11);
293 item->
anodes = stmt->getInt(12);
295 item->
crateid = stmt->getInt(3);
296 item->
sector = stmt->getInt(8);
298 item->
dmb = stmt->getInt(5);
299 item->
cscid = stmt->getInt(7);
303 con->terminateStatement (stmt);
void ruiddu(int rui, int ddu_input, CSCMapItem::MapItem *item)
void chamber(int chamberid, CSCMapItem::MapItem *item)
oracle::occi::SQLException SQLException
oracle::occi::Connection * con
oracle::occi::Environment * env
void cratedmb(int crate, int dmb, CSCMapItem::MapItem *item)