CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/OnlineDB/CSCCondDB/src/CSCCableRead.cc

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   }// end of constructor csccableread ()
00022   csccableread::~csccableread () throw (oracle::occi::SQLException)
00023   {
00024     env->terminateConnection (con);
00025     oracle::occi::Environment::terminateEnvironment (env);
00026   }  // end of ~csccableread ()
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 //    stmt->setInt (1, chamber_index);
00036 //    stmt->registerOutParam(2, oracle::occi::OCCISTRING, 9);
00037 //    stmt->registerOutParam(3, oracle::occi::OCCIINT);
00038 //    stmt->registerOutParam(4, oracle::occi::OCCISTRING, 1);
00039 //    stmt->registerOutParam(5, oracle::occi::OCCIINT);
00040 //    stmt->registerOutParam(6, oracle::occi::OCCISTRING, 1);
00041 //    stmt->registerOutParam(7, oracle::occi::OCCIINT);
00042 //    stmt->registerOutParam(8, oracle::occi::OCCIINT);
00043 //
00044 //    stmt->execute(); //execute procedure
00045 //
00046 //    *chamber_label = stmt->getString(2);
00047 //    *cfeb_length = stmt->getInt(3);
00048 //    *cfeb_rev = stmt->getString(4);
00049 //    *alct_length = stmt->getInt(5);
00050 //    *alct_rev = stmt->getString(6);
00051 //    *cfeb_tmb_skew_delay = stmt->getInt(7);
00052 //    *cfeb_timing_corr = stmt->getInt(8);
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(); //execute procedure
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   } //end of cable_read