Go to the documentation of this file.00001 #include "OnlineDB/CSCCondDB/interface/CSCCableRead.h"
00002 #include <cstdlib>
00003
00007 csccableread::csccableread () throw (oracle::occi::SQLException)
00008 {
00009 std::string db_user;
00010 std::string db_pass;
00011 env = oracle::occi::Environment::createEnvironment (oracle::occi::Environment::DEFAULT);
00012 char* c_user = ::getenv("CSCMAP_AUTH_USER");
00013 char* c_pass = ::getenv("CSCMAP_AUTH_PASSWORD");
00014 db_user=std::string(c_user);
00015 db_pass=std::string(c_pass);
00016 con = env->createConnection (db_user,db_pass,"cms_orcoff_prod");
00017 std::cout << "Connection to cable DB is done." << std::endl;
00018 }
00022 csccableread::~csccableread () throw (oracle::occi::SQLException)
00023 {
00024 env->terminateConnection (con);
00025 oracle::occi::Environment::terminateEnvironment (env);
00026 }
00027
00028 void csccableread::cable_read (int chamber_index, std::string *chamber_label,
00029 float *cfeb_length, std::string *cfeb_rev, float *alct_length,
00030 std::string *alct_rev, float *cfeb_tmb_skew_delay, float *cfeb_timing_corr)
00031 {
00032 oracle::occi::Statement *stmt = con->createStatement();
00033 stmt->setSQL("begin cms_emu_cern.cable_read.cable(:1, :2, :3, :4, :5, :6, :7, :8); end;");
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 stmt->setInt (1, chamber_index);
00056 stmt->registerOutParam(2, oracle::occi::OCCISTRING, 9);
00057 stmt->registerOutParam(3, oracle::occi::OCCIFLOAT);
00058 stmt->registerOutParam(4, oracle::occi::OCCISTRING, 1);
00059 stmt->registerOutParam(5, oracle::occi::OCCIFLOAT);
00060 stmt->registerOutParam(6, oracle::occi::OCCISTRING, 1);
00061 stmt->registerOutParam(7, oracle::occi::OCCIFLOAT);
00062 stmt->registerOutParam(8, oracle::occi::OCCIFLOAT);
00063
00064 stmt->execute();
00065
00066 *chamber_label = stmt->getString(2);
00067 *cfeb_length = stmt->getFloat(3);
00068 *cfeb_rev = stmt->getString(4);
00069 *alct_length = stmt->getFloat(5);
00070 *alct_rev = stmt->getString(6);
00071 *cfeb_tmb_skew_delay = stmt->getFloat(7);
00072 *cfeb_timing_corr = stmt->getFloat(8);
00073
00074 con->terminateStatement (stmt);
00075 }