CMS 3D CMS Logo

Public Member Functions | Private Attributes

cscmap Class Reference

#include <CSCMap.h>

List of all members.

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 () throw (oracle::occi::SQLException)
 ~cscmap () throw (oracle::occi::SQLException)

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 ( ) throw (oracle::occi::SQLException)

Constructor for cscmap

Definition at line 7 of file CSCMap.cc.

References con, gather_cfg::cout, and env.

  {
    std::string db_user;
    std::string db_pass;
    env = oracle::occi::Environment::createEnvironment (oracle::occi::Environment::DEFAULT);
    char* c_user = ::getenv("CSCMAP_AUTH_USER");
    char* c_pass = ::getenv("CSCMAP_AUTH_PASSWORD");
    db_user=std::string(c_user);
    db_pass=std::string(c_pass);
    con = env->createConnection (db_user,db_pass,"devdb");
     std::cout << "Connection to mapping DB is done." << std::endl;
  }// end of constructor cscmap ()
cscmap::~cscmap ( ) throw (oracle::occi::SQLException)

Destructor for cscmap

Destructor for cscmap.

Definition at line 22 of file CSCMap.cc.

References con, and env.

  {
    env->terminateConnection (con);
    oracle::occi::Environment::terminateEnvironment (env);
  }  // end of ~cscmap ()

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.

  {
    oracle::occi::Statement *stmt = con->createStatement();
    stmt->setSQL("begin cscmap.crate0_proc(:1, :2, :3, :4, :5, :6, :7, :8, :9); end;");

    stmt->setString (1, chamber_id);
    stmt->registerOutParam (2, oracle::occi::OCCIINT);
    stmt->registerOutParam (3, oracle::occi::OCCIINT);
    stmt->registerOutParam (4, oracle::occi::OCCIINT);
    stmt->registerOutParam (5, oracle::occi::OCCIINT);
    stmt->registerOutParam (6, oracle::occi::OCCIINT);
    stmt->registerOutParam (7, oracle::occi::OCCIINT);
    stmt->registerOutParam (8, oracle::occi::OCCIINT);
    stmt->registerOutParam (9, oracle::occi::OCCIINT);

    stmt->execute(); //execute procedure

    *crate0 = stmt->getInt(2);
    *crate  = stmt->getInt(3);
    *dmb    = stmt->getInt(4);
    *sector = stmt->getInt(5);
    *chamber_num = stmt->getInt(6);
    *chamber_index = stmt->getInt(7);
    *first_strip_index = stmt->getInt(8);
    *strips_per_layer = stmt->getInt(9);

    con->terminateStatement (stmt);
  } //end of crate_chamber
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.

  {
    oracle::occi::Statement *stmt = con->createStatement();
    stmt->setSQL("begin cscmap.chamber0(:1, :2, :3, :4, :5, :6, :7, :8); end;");

    stmt->setInt (1, crate0);
    stmt->setInt (2, dmb);
    stmt->registerOutParam(3, oracle::occi::OCCISTRING, 10);
    stmt->registerOutParam (4, oracle::occi::OCCIINT);
    stmt->registerOutParam (5, oracle::occi::OCCIINT);
    stmt->registerOutParam (6, oracle::occi::OCCIINT);
    stmt->registerOutParam (7, oracle::occi::OCCIINT);
    stmt->registerOutParam (8, oracle::occi::OCCIINT);

    stmt->execute(); //execute procedure

    *chamber_id = stmt->getString(3);
    *chamber_num = stmt->getInt(4);
    *chamber_index = stmt->getInt(5);
    *first_strip_index = stmt->getInt(6);
    *strips_per_layer = stmt->getInt(7);
    *sector = stmt->getInt(8);

    con->terminateStatement (stmt);
  } //end of crate0_chamber
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.

  {
    oracle::occi::Statement *stmt = con->createStatement();
    stmt->setSQL("begin cscmap.chamber(:1, :2, :3, :4, :5, :6, :7, :8); end;");

    stmt->setInt (1, crate);
    stmt->setInt (2, dmb);
    stmt->registerOutParam(3, oracle::occi::OCCISTRING, 10);
    stmt->registerOutParam (4, oracle::occi::OCCIINT);
    stmt->registerOutParam (5, oracle::occi::OCCIINT);
    stmt->registerOutParam (6, oracle::occi::OCCIINT);
    stmt->registerOutParam (7, oracle::occi::OCCIINT);
    stmt->registerOutParam (8, oracle::occi::OCCIINT);

    stmt->execute(); //execute procedure

    *chamber_id = stmt->getString(3);
    *chamber_num = stmt->getInt(4);
    *chamber_index = stmt->getInt(5);
    *first_strip_index = stmt->getInt(6);
    *strips_per_layer = stmt->getInt(7);
    *sector = stmt->getInt(8);

    con->terminateStatement (stmt);
  } //end of crate_chamber

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().