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;
24 env->terminateConnection (
con);
25 oracle::occi::Environment::terminateEnvironment (
env);
29 int *chamber_num,
int *sector,
int *first_strip_index,
30 int *strips_per_layer,
int *chamber_index)
32 oracle::occi::Statement *stmt =
con->createStatement();
33 stmt->setSQL(
"begin cscmap.chamber0(:1, :2, :3, :4, :5, :6, :7, :8); end;");
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);
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);
53 con->terminateStatement (stmt);
57 int *chamber_num,
int *sector,
int *first_strip_index,
58 int *strips_per_layer,
int *chamber_index)
60 oracle::occi::Statement *stmt =
con->createStatement();
61 stmt->setSQL(
"begin cscmap.chamber(:1, :2, :3, :4, :5, :6, :7, :8); end;");
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);
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);
81 con->terminateStatement (stmt);
85 int *sector,
int *chamber_num,
int *crate0,
86 int *first_strip_index,
int *strips_per_layer,
89 oracle::occi::Statement *stmt =
con->createStatement();
90 stmt->setSQL(
"begin cscmap.crate0_proc(:1, :2, :3, :4, :5, :6, :7, :8, :9); end;");
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);
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);
113 con->terminateStatement (stmt);
oracle::occi::Environment * env
oracle::occi::SQLException SQLException
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)
oracle::occi::Connection * con
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)