CMS 3D CMS Logo

Functions | Variables

common_db Namespace Reference

Functions

def createDBConnection
def extractLogin
def getDBConnectionParams
def getLogin

Variables

string AUTH_FILE = "authentication.xml"
string AUTH_PATH = "/afs/cern.ch/cms/DB/conddb/test/"
string DATABASE = "cms_orcoff_prep"
string USERNAME = "CMS_COND_REGRESSION"

Function Documentation

def common_db::createDBConnection ( )

Definition at line 32 of file common_db.py.

00033                         :
00034     coralConnStr, USERNAME, PASSWORD, AUTH_PATH = getDBConnectionParams()
00035     conn_string = str(USERNAME+"/"+PASSWORD+"@"+DATABASE)
00036     conn = cx_Oracle.connect(conn_string)
00037     return conn
        
def common_db::extractLogin (   login)

Definition at line 17 of file common_db.py.

00018                        :
00019         pattern = re.compile(r'value="([^"]+)')
00020         matching = pattern.search(login)
00021         version = 0
00022         if matching:
00023                 g = matching.groups()
                return g[0]
def common_db::getDBConnectionParams ( )

Definition at line 38 of file common_db.py.

00039                            :
00040     os.environ['TNS_ADMIN'] = "/afs/cern.ch/project/oracle/admin"
00041     coralConnStr = "oracle://"+DATABASE+"/"+USERNAME+""
00042     authFilePath = os.path.join(AUTH_PATH,AUTH_FILE)
00043     PASSWORD = getLogin(authFilePath, coralConnStr)
00044     return (coralConnStr,USERNAME,PASSWORD,AUTH_PATH)
00045 
def common_db::getLogin (   auth,
  connStr 
)

Definition at line 24 of file common_db.py.

00025                            :
00026         pfile = open(auth, "r")
00027         plist = pfile.readlines()
00028         for i in range (0, len(plist)):
00029                 if string.find(plist[i], '<connection name="'+connStr+'">') != -1:
00030                         PASSWORD = extractLogin(plist[i+2])
00031         return (PASSWORD)


Variable Documentation

string common_db::AUTH_FILE = "authentication.xml"

Definition at line 14 of file common_db.py.

string common_db::AUTH_PATH = "/afs/cern.ch/cms/DB/conddb/test/"

Definition at line 13 of file common_db.py.

string common_db::DATABASE = "cms_orcoff_prep"

Definition at line 10 of file common_db.py.

string common_db::USERNAME = "CMS_COND_REGRESSION"

Definition at line 11 of file common_db.py.