CMS 3D CMS Logo

Public Member Functions | Public Attributes

reference_db::ReferenceDB Class Reference

List of all members.

Public Member Functions

def __init__
def addRelease
def create
def deleteRelease
def drop
def listReleases
def read

Public Attributes

 conn

Detailed Description

Definition at line 23 of file reference_db.py.


Constructor & Destructor Documentation

def reference_db::ReferenceDB::__init__ (   self,
  connect 
)

Definition at line 24 of file reference_db.py.

00025                                :
00026         self.conn = connect


Member Function Documentation

def reference_db::ReferenceDB::addRelease (   self,
  release,
  arch,
  path 
)

Definition at line 54 of file reference_db.py.

00055                                               :
00056         curs = self.conn.cursor()
00057         relID = ExtractID(release)
00058         print "relID "+str(relID)
00059         sqlstr = "INSERT INTO VERSION_TABLE(ID, RELEASE, ARCH, PATH) VALUES(:rid, :rel, :arc, :pat)"
00060         curs.execute(sqlstr, rid = relID, rel = release, arc = arch, pat = path)
00061         self.conn.commit()
00062         print 'RELEASE ENTRY ADDED.'    

def reference_db::ReferenceDB::create (   self)

Definition at line 27 of file reference_db.py.

00028                       :
00029         curs = self.conn.cursor()
00030         sqlstr = "CREATE TABLE VERSION_TABLE (ID NUMBER, RELEASE VARCHAR2(50), ARCH VARCHAR2(30), PATH VARCHAR(255), CONSTRAINT PK_ID PRIMARY KEY(RELEASE, ARCH) )"
00031         curs.prepare(sqlstr)
00032         curs.execute(sqlstr)
        print 'REFERENCE RELEASE TABLE CREATED'
def reference_db::ReferenceDB::deleteRelease (   self,
  release,
  arch 
)

Definition at line 39 of file reference_db.py.

00040                                            :
00041         curs = self.conn.cursor()
00042         sqlstr = "DELETE FROM VERSION_TABLE WHERE RELEASE = :rel AND ARCH = :arc"
00043         curs.prepare(sqlstr)
00044         curs.execute(sqlstr, rel = release, arc = arch)
00045         self.conn.commit()
        print 'RELEASE ENTRY DELETED'
def reference_db::ReferenceDB::drop (   self)

Definition at line 33 of file reference_db.py.

00034                     :
00035         curs = self.conn.cursor()
00036         sqlstr = "DROP TABLE VERSION_TABLE"
00037         curs.prepare(sqlstr)
00038         curs.execute(sqlstr)
        print 'REFERENCE RELEASE TABLE DROPPED'
def reference_db::ReferenceDB::listReleases (   self,
  relID 
)

Definition at line 63 of file reference_db.py.

00064                                  :
00065         curs = self.conn.cursor()
00066         sqlstr = "SELECT RELEASE, ARCH, PATH FROM VERSION_TABLE WHERE ID < :rid"
00067         curs.prepare(sqlstr)
00068         curs.execute(sqlstr, rid = relID)
00069         l = []
00070         for row in curs:
00071             r = ( row[0], row[1], row[2] )
00072             l.append( r )
00073         return l
def reference_db::ReferenceDB::read (   self)

Definition at line 46 of file reference_db.py.

00047                     :
00048         curs = self.conn.cursor()
00049         sqlstr = "SELECT ID, RELEASE, ARCH, PATH FROM VERSION_TABLE ORDER BY ID, RELEASE, ARCH"
00050         curs.prepare(sqlstr)
00051         curs.execute(sqlstr)
00052         print 'ID     RELEASE     ARCH     PATH'
00053         for row in curs:
                print row

Member Data Documentation

Definition at line 24 of file reference_db.py.