CMS 3D CMS Logo

Functions | Variables

revisionDML Namespace Reference

Functions

def addEntry
def addRevision
def bookNewEntry
def bookNewRevision
def branchInfoByName
def branchType
def createBranch
def dataRevisionsOfEntry
def entryInBranch
def latestDataRevisionOfEntry
def revisionsInBranch
def revisionsInBranchName
def revisionsInTag

Variables

tuple databranchinfo = (branchid,'DATA')
tuple datainfo = createBranch(schema,'DATA','TRUNK',comment='hold data')
tuple entryinfo = (revision_id,entry_id,str(runnum),data_id)
tuple hltentryid = entryInBranch(schema,nameDealer.hltdataTableName(),str(runnum),'DATA')
tuple latestrevision = latestDataRevisionOfEntry(schema,nameDealer.lumidataTableName(),lumientry_id,revlist)
tuple lumientry_id = entryInBranch(schema,nameDealer.lumidataTableName(),'1211','DATA')
tuple lumientryid = entryInBranch(schema,nameDealer.lumidataTableName(),str(runnum),'DATA')
string myconstr = 'sqlite_file:test.db'
tuple norminfo = createBranch(schema,'NORM','TRUNK',comment='hold normalization factor')
tuple revisioninfo = bookNewRevision( schema,nameDealer.lumidataTableName() )
tuple revlist = revisionsInBranchName(schema,'DATA')
tuple schema = session.nominalSchema()
tuple session = svc.openSession(isReadOnly=False,cpp2sqltype=[('unsigned int','NUMBER(10)'),('unsigned long long','NUMBER(20)')])
tuple svc = sessionManager.sessionManager(myconstr,debugON=False)
tuple tables = lumidbDDL.createTables(schema)
tuple trgentryid = entryInBranch(schema,nameDealer.trgdataTableName(),str(runnum),'DATA')
tuple trunkinfo = createBranch(schema,'TRUNK',None,comment='main')

Function Documentation

def revisionDML::addEntry (   schema,
  datatableName,
  entryinfo,
  branchinfo 
)
input:
    entryinfo (revision_id(0),entry_id(1),entry_name(2),data_id(3))
    branchinfo (branch_id,branch_name)
1.allocate and insert a new revision into the revisions table
2.allocate and insert a new entry into the entry table with the new revision
3.inset into data_rev table with new data_id ,revision)id mapping

insert into revisions(revision_id,branch_id,branch_name,comment,ctime) values()
insert into datatablename_entries (entry_id,revision_id) values()
insert into datatablename_rev(data_id,revision_id) values()

Definition at line 340 of file revisionDML.py.

Referenced by CalibrationInterface< CategoryT, CalibDataT >::addCategoryDefinition(), TAPD::addEntry(), TMom::addEntry(), EcalMatacqAnalyzer::endJob(), and AlgorithmCalibration< T, CO >::readCategories().

00341                                                        :
00342     '''
00343     input:
00344         entryinfo (revision_id(0),entry_id(1),entry_name(2),data_id(3))
00345         branchinfo (branch_id,branch_name)
00346     1.allocate and insert a new revision into the revisions table
00347     2.allocate and insert a new entry into the entry table with the new revision
00348     3.inset into data_rev table with new data_id ,revision)id mapping
00349     
00350     insert into revisions(revision_id,branch_id,branch_name,comment,ctime) values()
00351     insert into datatablename_entries (entry_id,revision_id) values()
00352     insert into datatablename_rev(data_id,revision_id) values()
00353     '''
00354     try:
00355         revisiontableName=nameDealer.revisionTableName()
00356         entrytableName=nameDealer.entryTableName(datatableName)
00357         revtableName=nameDealer.revmapTableName(datatableName)
00358         
00359         db=dbUtil.dbUtil(schema)
00360         tabrowDefDict={}
00361         tabrowDefDict['REVISION_ID']='unsigned long long'
00362         tabrowDefDict['BRANCH_ID']='unsigned long long'
00363         tabrowDefDict['BRANCH_NAME']='string'
00364         tabrowDefDict['CTIME']='time stamp'
00365         tabrowValueDict={}
00366         tabrowValueDict['REVISION_ID']=entryinfo[0]
00367         tabrowValueDict['BRANCH_ID']=branchinfo[0]
00368         tabrowValueDict['BRANCH_NAME']=branchinfo[1]
00369         tabrowValueDict['CTIME']=coral.TimeStamp()
00370         db.insertOneRow(revisiontableName,tabrowDefDict,tabrowValueDict)
00371         
00372         tabrowDefDict={}
00373         tabrowDefDict['REVISION_ID']='unsigned long long'
00374         tabrowDefDict['ENTRY_ID']='unsigned long long'    
00375         tabrowDefDict['NAME']='string'
00376         
00377         tabrowValueDict={}
00378         tabrowValueDict['REVISION_ID']=entryinfo[0]
00379         tabrowValueDict['ENTRY_ID']=entryinfo[1]
00380         tabrowValueDict['NAME']=entryinfo[2]
00381         db.insertOneRow(entrytableName,tabrowDefDict,tabrowValueDict)
00382     
00383         tabrowDefDict={}
00384         tabrowDefDict['REVISION_ID']='unsigned long long'
00385         tabrowDefDict['DATA_ID']='unsigned long long'
00386         tabrowValueDict={}
00387         tabrowValueDict['REVISION_ID']=entryinfo[0]
00388         tabrowValueDict['DATA_ID']=entryinfo[3]
00389         db.insertOneRow(revtableName,tabrowDefDict,tabrowValueDict)
00390     except:
00391         raise
    
def revisionDML::addRevision (   schema,
  datatableName,
  revisioninfo,
  branchinfo 
)
1.insert a new revision into the revisions table
2.insert into data_id, revision_id pair to  datatable_revmap
insert into revisions(revision_id,branch_id,branch_name,ctime) values()
insert into datatable_rev(data_id,revision_id) values())
input:
     revisioninfo (revision_id(0),data_id(1))
     branchinfo  (branch_id(0),branch_name(1))

Definition at line 392 of file revisionDML.py.

00393                                                              :
00394     '''
00395     1.insert a new revision into the revisions table
00396     2.insert into data_id, revision_id pair to  datatable_revmap
00397     insert into revisions(revision_id,branch_id,branch_name,ctime) values()
00398     insert into datatable_rev(data_id,revision_id) values())
00399     input:
00400          revisioninfo (revision_id(0),data_id(1))
00401          branchinfo  (branch_id(0),branch_name(1))
00402     '''
00403     try:
00404         revisiontableName=nameDealer.revisionTableName()
00405         revtableName=nameDealer.revmapTableName(datatableName)
00406         
00407         db=dbUtil.dbUtil(schema)
00408         tabrowDefDict={}
00409         tabrowDefDict['REVISION_ID']='unsigned long long'
00410         tabrowDefDict['BRANCH_ID']='unsigned long long'
00411         tabrowDefDict['BRANCH_NAME']='string'
00412         tabrowDefDict['CTIME']='time stamp'
00413 
00414         tabrowValueDict={}
00415         tabrowValueDict['REVISION_ID']=revisioninfo[0]
00416         tabrowValueDict['BRANCH_ID']=branchinfo[0]
00417         tabrowValueDict['BRANCH_NAME']=branchinfo[1]
00418         tabrowValueDict['CTIME']=coral.TimeStamp()
00419         
00420         db.insertOneRow(revisiontableName,tabrowDefDict,tabrowValueDict)
00421         
00422         tabrowDefDict={}
00423         tabrowDefDict['REVISION_ID']='unsigned long long'
00424         tabrowDefDict['DATA_ID']='unsigned long long'
00425         tabrowValueDict={}
00426         tabrowValueDict['REVISION_ID']=revisioninfo[0]
00427         tabrowValueDict['DATA_ID']=revisioninfo[1]
00428         db.insertOneRow(revtableName,tabrowDefDict,tabrowValueDict)
00429     except:
        raise    
def revisionDML::bookNewEntry (   schema,
  datatableName 
)
allocate new revision_id,entry_id,data_id

Definition at line 314 of file revisionDML.py.

00315                                       :
00316     '''
00317     allocate new revision_id,entry_id,data_id
00318     '''
00319     try:
00320         entrytableName=nameDealer.entryTableName(datatableName)
00321         iddealer=idDealer.idDealer(schema)
00322         revision_id=iddealer.generateNextIDForTable( nameDealer.revisionTableName() )
00323         data_id=iddealer.generateNextIDForTable( datatableName)
00324         entry_id=iddealer.generateNextIDForTable( nameDealer.entryTableName(datatableName) )
00325         return (revision_id,entry_id,data_id)
00326     except:
00327         raise
    
def revisionDML::bookNewRevision (   schema,
  datatableName 
)
allocate new revision_id,data_id

Definition at line 328 of file revisionDML.py.

00329                                          :
00330     '''
00331     allocate new revision_id,data_id
00332     '''
00333     try:
00334         iddealer=idDealer.idDealer(schema)
00335         revision_id=iddealer.generateNextIDForTable( nameDealer.revisionTableName() )
00336         data_id=iddealer.generateNextIDForTable(datatableName)
00337         return (revision_id,data_id)
00338     except:
00339         raise
     
def revisionDML::branchInfoByName (   schema,
  branchName 
)
select (revision_id,branch_id) from revisions where name=:branchName

Definition at line 280 of file revisionDML.py.

00281                                        :
00282     '''
00283     select (revision_id,branch_id) from revisions where name=:branchName
00284     '''
00285     try:
00286          qHandle=schema.newQuery()
00287          qHandle.addToTableList( nameDealer.revisionTableName() )
00288          qHandle.addToOutputList('REVISION_ID','revision_id')
00289          qHandle.addToOutputList('BRANCH_ID','branch_id')
00290          qCondition=coral.AttributeList()
00291          qCondition.extend('name','string')
00292          qCondition['name'].setData(branchName)
00293          qResult=coral.AttributeList()
00294          qResult.extend('revision_id','unsigned long long')
00295          qResult.extend('branch_id','unsigned long long')
00296          qHandle.defineOutput(qResult)
00297          qHandle.setCondition('NAME=:name',qCondition)
00298          cursor=qHandle.execute()
00299          revision_id=None
00300          branch_id=None
00301          while cursor.next():
00302              revision_id=cursor.currentRow()['revision_id'].data()
00303              branch_id=cursor.currentRow()['branch_id'].data()
00304          del qHandle
00305          return (revision_id,branch_id)
00306     except Exception,e :
00307         raise RuntimeError(' revisionDML.branchInfoByName: '+str(e))
00308     
00309 
00310 #=======================================================
00311 #
00312 #   INSERT requires in update transaction
00313 #
#=======================================================
def revisionDML::branchType (   schema,
  name 
)
output: tag,branch
the difference between tag and branch: tag is an empty branch
select count(revision_id) from revisions where branch_name=:name
if >0: is real branch
else: is tag

Definition at line 110 of file revisionDML.py.

Referenced by edm::PoolOutputModule::beginJob(), PFTauDiscriminants::DiscriminantBase< int >::branchTree(), edm::RootOutputFile::fillBranches(), edm::PoolOutputModule::fillSelectedItemList(), edm::RootOutputFile::finishEndFile(), edm::PrincipalGetAdapter::getBranchDescription(), edm::ProductRegistry::productProduced(), edm::PoolOutputModule::respondToOpenInputFile(), edm::RootOutputFile::RootOutputFile(), and edm::ProductRegistry::setProductProduced().

00111                            :
00112     '''
00113     output: tag,branch
00114     the difference between tag and branch: tag is an empty branch
00115     select count(revision_id) from revisions where branch_name=:name
00116     if >0: is real branch
00117     else: is tag
00118     '''
00119     result='tag'
00120     try:
00121         qHandle=schema.newQuery()
00122         qHandle.addToTableList( nameDealer.revisionTableName() )
00123         qHandle.addToOutputList('count(REVISION_ID)','nchildren')
00124         qCondition=coral.AttributeList()
00125         qCondition.extend('branch_name','string')
00126         qCondition['branch_name'].setData(name)
00127         qResult=coral.AttributeList()
00128         qResult.extend('nchildren','unsigned int')
00129         qHandle.defineOutput(qResult)
00130         conditionStr='BRANCH_NAME=:branch_name'
00131         qHandle.setCondition(conditionStr,qCondition)
00132         cursor=qHandle.execute()
00133         while cursor.next():
00134             if cursor.currentRow()['nchildren'].data()>0:
00135                 result='branch'                
00136         del qHandle
00137         return result
00138     except :
00139         raise 
00140 #def revisionsInBranch(schema,branchid):
00141 #    '''
00142 #    returns all revision values in a branch/tag
00143 #    result=[revision_id]
00144 #    select r.revision_id from revisions r where r.branch_id=:branchid and r.revision_id not in (select distinct a.branch_id from revisions a where a.branch_id>:branchid)
00145 #    '''
00146 #    result=[]
00147 #    try:
00148 #        qHandle=schema.newQuery()
00149 #        subquery=qHandle.defineSubQuery('B')
00150 #        subquery.addToTableList( nameDealer.revisionTableName(),'a' )
00151 #        subquery.addToOutputList('distinct a.BRANCH_ID')
00152 #        subqueryCondition=coral.AttributeList()
00153 #        subqueryCondition.extend('branchid','unsigned long long')
00154 #        subqueryCondition['branchid'].setData(branchid)
00155 #        subquery.setCondition('a.BRANCH_ID>:branchid',subqueryCondition)
00156 #        
00157 #        qHandle.addToTableList( nameDealer.revisionTableName(),'r' )
00158 #        qHandle.addToTableList( 'B')
00159 #        qHandle.addToOutputList('r.REVISION_ID','revision_id')
00160 #        qCondition=coral.AttributeList()
00161 #        qCondition.extend('branchid','unsigned long long')
00162 #        qCondition['branchid'].setData(branchid)
00163 #        qResult=coral.AttributeList()
00164 #        qResult.extend('revision_id','unsigned long long')
00165 #        qHandle.defineOutput(qResult)
00166 #        conditionStr='r.BRANCH_ID=:branchid AND r.REVISION_ID NOT IN B'
00167 #        qHandle.setCondition(conditionStr,qCondition)
00168 #        cursor=qHandle.execute()
00169 #        while cursor.next():
00170 #            result.append(cursor.currentRow()['revision_id'].data())
00171 #        del qHandle
00172 #        return result
00173 #    except :
00174 #        raise 
    
def revisionDML::createBranch (   schema,
  name,
  parentname,
  comment = '' 
)
create a new branch/tag under given parentnode
insert into revisions(revision_id,branch_id,branch_name,name,comment,ctime) values()
return (revisionid,parentid,parentname)

Definition at line 430 of file revisionDML.py.

00431                                                    :
00432     '''
00433     create a new branch/tag under given parentnode
00434     insert into revisions(revision_id,branch_id,branch_name,name,comment,ctime) values()
00435     return (revisionid,parentid,parentname)
00436     '''
00437     try:
00438         parentid=None
00439         revisionid=0       
00440         if not parentname is None:
00441             qHandle=schema.newQuery()
00442             qHandle.addToTableList( nameDealer.revisionTableName() )
00443             qHandle.addToOutputList( 'REVISION_ID','revision_id' )
00444             qCondition=coral.AttributeList()
00445             qCondition.extend('parentname','string')
00446             qCondition['parentname'].setData(parentname)
00447             qResult=coral.AttributeList()
00448             qResult.extend('revision_id','unsigned long long')
00449             qHandle.defineOutput(qResult)
00450             qHandle.setCondition('NAME=:parentname',qCondition)
00451             cursor=qHandle.execute()
00452             while cursor.next():
00453                 parentid=cursor.currentRow()['revision_id'].data()
00454             del qHandle
00455         else:
00456             parentname='ROOT'
00457         iddealer=idDealer.idDealer(schema)
00458         revisionid=iddealer.generateNextIDForTable( nameDealer.revisionTableName() )
00459         db=dbUtil.dbUtil(schema)
00460         tabrowDefDict={}
00461         tabrowDefDict['REVISION_ID']='unsigned long long'
00462         tabrowDefDict['BRANCH_ID']='unsigned long long'
00463         tabrowDefDict['BRANCH_NAME']='string'
00464         tabrowDefDict['NAME']='string'
00465         tabrowDefDict['COMMENT']='string'
00466         tabrowDefDict['CTIME']='time stamp'
00467         tabrowValueDict={}
00468         tabrowValueDict['REVISION_ID']=revisionid
00469         tabrowValueDict['BRANCH_ID']=parentid
00470         tabrowValueDict['BRANCH_NAME']=parentname
00471         tabrowValueDict['NAME']=name
00472         tabrowValueDict['COMMENT']=comment
00473         tabrowValueDict['CTIME']=coral.TimeStamp()
00474         db.insertOneRow(nameDealer.revisionTableName(),tabrowDefDict, tabrowValueDict )
00475         return (revisionid,parentid,parentname)
00476     except:
00477         raise

def revisionDML::dataRevisionsOfEntry (   schema,
  datatableName,
  entry,
  revrange 
)
all data version of the given entry whose revision falls in branch revision range
select d.data_id,r.revision_id from datatable d, datarevmaptable r where d.entry_id(or name )=:entry and d.data_id=r.data_id
input: if isinstance(entry,str): d.entry_name=:entry ; else d.entry_id=:entry
output: [data_id]

Definition at line 229 of file revisionDML.py.

00230                                                              :
00231     '''
00232     all data version of the given entry whose revision falls in branch revision range
00233     select d.data_id,r.revision_id from datatable d, datarevmaptable r where d.entry_id(or name )=:entry and d.data_id=r.data_id
00234     input: if isinstance(entry,str): d.entry_name=:entry ; else d.entry_id=:entry
00235     output: [data_id]
00236     '''
00237     qHandle=schema.newQuery()
00238     try:
00239         result=[]
00240         byname=False
00241         if isinstance(entry,str):
00242             byname=True
00243         qHandle.addToTableList( datatableName,'d' )
00244         qHandle.addToTableList( nameDealer.revmapTableName(datatableName), 'r')
00245         qHandle.addToOutputList('d.DATA_ID','data_id')
00246         qHandle.addToOutputList('r.REVISION_ID','revision_id')
00247         qCondition=coral.AttributeList()
00248         qConditionStr='d.DATA_ID=r.DATA_ID and '
00249         if byname:
00250             qCondition.extend('entry_name','string')
00251             qCondition['entry_name'].setData(entry)
00252             qConditionStr+='d.ENTRY_NAME=:entry_name'
00253         else:
00254             qCondition.extend('entry_id','unsigned long long')
00255             qCondition['entry_id'].setData(entry)
00256             qConditionStr+='d.ENTRY_ID=:entry_id'
00257         qResult=coral.AttributeList()
00258         qResult.extend('data_id','unsigned long long')
00259         qResult.extend('revision_id','unsigned long long')
00260         qHandle.defineOutput(qResult)
00261         qHandle.setCondition(qConditionStr,qCondition)
00262         cursor=qHandle.execute()
00263         while cursor.next():
00264             data_id=cursor.currentRow()['data_id'].data()
00265             revision_id=cursor.currentRow()['revision_id'].data()
00266             if revision_id in revrange:
00267                 result.append(data_id)
00268         return result
00269     except :
00270         del qHandle
00271         raise

def revisionDML::entryInBranch (   schema,
  datatableName,
  entryname,
  branch 
)
whether an entry(by name) already exists in the given branch
select e.entry_id from entrytable e,revisiontable r where r.revision_id=e.revision_id and e.name=:entryname and r.branch_name=branchname/branch_id
input:
    if isinstance(branch,str):byname
    else: byid
output:entry_id/None

Definition at line 186 of file revisionDML.py.

00187                                                         :
00188     '''
00189     whether an entry(by name) already exists in the given branch
00190     select e.entry_id from entrytable e,revisiontable r where r.revision_id=e.revision_id and e.name=:entryname and r.branch_name=branchname/branch_id
00191     input:
00192         if isinstance(branch,str):byname
00193         else: byid
00194     output:entry_id/None
00195     '''
00196     try:
00197         result=None
00198         byname=False
00199         if isinstance(branch,str):
00200             byname=True
00201         qHandle=schema.newQuery()
00202         qHandle.addToTableList( nameDealer.entryTableName(datatableName),'e' )
00203         qHandle.addToTableList( nameDealer.revisionTableName(),'r' )
00204         qHandle.addToOutputList('e.ENTRY_ID','entry_id')
00205         qCondition=coral.AttributeList()
00206         qCondition.extend('entryname','string')
00207         qCondition['entryname'].setData(entryname)
00208         qConditionStr='r.REVISION_ID=e.REVISION_ID and e.NAME=:entryname and '
00209         if byname:
00210             qCondition.extend('branch_name','string')
00211             qCondition['branch_name'].setData(branch)
00212             qConditionStr+='r.BRANCH_NAME=:branch_name'
00213         else:
00214             qCondition.extend('branch_id','unsigned long long')
00215             qCondition['branch_id'].setData(branch)
00216             qConditionStr+='r.BRANCH_ID=:branch_id'
00217         qResult=coral.AttributeList()
00218         qResult.extend('entry_id','unsigned long long')
00219         qHandle.defineOutput(qResult)
00220         qHandle.setCondition(qConditionStr,qCondition)
00221         cursor=qHandle.execute()
00222         while cursor.next():
00223             entry_id=cursor.currentRow()['entry_id'].data()
00224             result=entry_id
00225         del qHandle
00226         return result
00227     except :
00228         raise 

def revisionDML::latestDataRevisionOfEntry (   schema,
  datatableName,
  entry,
  revrange 
)
return max(data_id) of all datarevisionofEntry

Definition at line 272 of file revisionDML.py.

00273                                                                   :
00274     '''
00275     return max(data_id) of all datarevisionofEntry
00276     '''
00277     result=dataRevisionsOfEntry(schema,datatableName,entry,revrange)
00278     if result and len(result)!=0: return max(result)
00279     return None
    
def revisionDML::revisionsInBranch (   schema,
  branchid 
)
returns all revision values in a branch
result=[revision_id]
select distinct branch_id from revisions where branch_id>:branchid;
select revision_id from revisions where branch_id=:branchid ;
if the branchid matches and the revisionid is not in the branchid collection,not 0, then this revision is in the branch
require also revisionid>branchid

Definition at line 59 of file revisionDML.py.

00060                                       :
00061     '''
00062     returns all revision values in a branch
00063     result=[revision_id]
00064     select distinct branch_id from revisions where branch_id>:branchid;
00065     select revision_id from revisions where branch_id=:branchid ;
00066     if the branchid matches and the revisionid is not in the branchid collection,not 0, then this revision is in the branch
00067     require also revisionid>branchid
00068     '''
00069     result=[]
00070     qHandle=schema.newQuery()
00071     try:
00072         nextbranches=[]
00073         qHandle.addToTableList( nameDealer.revisionTableName() )
00074         qHandle.addToOutputList('distinct BRANCH_ID','branch_id')
00075         qCondition=coral.AttributeList()
00076         qCondition.extend('branchid','unsigned long long')
00077         qCondition['branchid'].setData(branchid)
00078         qResult=coral.AttributeList()
00079         qResult.extend('branch_id','unsigned long long')
00080         qHandle.defineOutput(qResult)
00081         qHandle.setCondition('BRANCH_ID>:branchid',qCondition)
00082         cursor=qHandle.execute()
00083         while cursor.next():
00084             nextbranches.append(cursor.currentRow()['branch_id'].data())
00085         del qHandle
00086         candidates=[]
00087         conditionStr='BRANCH_ID=:branchid and REVISION_ID!=0'
00088         qHandle=schema.newQuery()
00089         qHandle.addToTableList( nameDealer.revisionTableName() )
00090         qHandle.addToOutputList('REVISION_ID','revision_id')
00091         qCondition=coral.AttributeList()
00092         qCondition.extend('branchid','unsigned long long')
00093         qCondition['branchid'].setData(branchid)
00094         qResult=coral.AttributeList()
00095         qResult.extend('revision_id','unsigned long long')
00096         qHandle.defineOutput(qResult)
00097         qHandle.setCondition(conditionStr,qCondition)
00098         cursor=qHandle.execute()
00099         while cursor.next():
00100             candidates.append(cursor.currentRow()['revision_id'].data())
00101         del qHandle
00102         for c in candidates:
00103             if c in nextbranches:
00104                 continue
00105             result.append(c)
00106         return result
00107     except:
00108         if qHandle: del qHandle
00109         raise

def revisionDML::revisionsInBranchName (   schema,
  branchname 
)
returns all revisions in a branch/tag by name

Definition at line 175 of file revisionDML.py.

00176                                             :
00177     '''
00178     returns all revisions in a branch/tag by name
00179     '''
00180     result=[]
00181     try:
00182         (revision_id,branch_id)=branchInfoByName(schema,branchname)
00183         result=revisionsInBranch(schema,revision_id)
00184         return result
00185     except :
        raise 
def revisionDML::revisionsInTag (   schema,
  tagrevisionid,
  branchid 
)
returns all revisions before tag in selected branch
select revision_id from revisions where revision_id!=0 and revision_id<tagrevisionid and branch_id=:branchid
result=[revision_id]

Definition at line 10 of file revisionDML.py.

00011                                                  :
00012     '''
00013     returns all revisions before tag in selected branch
00014     select revision_id from revisions where revision_id!=0 and revision_id<tagrevisionid and branch_id=:branchid
00015     result=[revision_id]
00016     '''
00017     result=[]
00018     qHandle=schema.newQuery()
00019     try:
00020         nextbranches=[]
00021         qHandle.addToTableList( nameDealer.revisionTableName() )
00022         qHandle.addToOutputList('distinct BRANCH_ID','branch_id')
00023         qCondition=coral.AttributeList()
00024         qCondition.extend('branchid','unsigned long long')
00025         qCondition['branchid'].setData(branchid)
00026         qResult=coral.AttributeList()
00027         qResult.extend('branch_id','unsigned long long')
00028         qHandle.defineOutput(qResult)
00029         qHandle.setCondition('BRANCH_ID>:branchid',qCondition)
00030         cursor=qHandle.execute()
00031         while cursor.next():
00032             nextbranches.append(cursor.currentRow()['branch_id'].data())
00033         del qHandle
00034         candidates=[]
00035         conditionStr='REVISION_ID!=0 and BRANCH_ID=:branchid and REVISION_ID<:tagrevisionid'
00036         qHandle=schema.newQuery()
00037         qHandle.addToTableList( nameDealer.revisionTableName() )
00038         qHandle.addToOutputList('REVISION_ID','revision_id')
00039         qCondition=coral.AttributeList()
00040         qCondition.extend('branchid','unsigned long long')
00041         qCondition.extend('tagrevisionid','unsigned long long')
00042         qCondition['branchid'].setData(branchid)
00043         qCondition['tagrevisionid'].setData(tagrevisionid)
00044         qResult=coral.AttributeList()
00045         qResult.extend('revision_id','unsigned long long')
00046         qHandle.defineOutput(qResult)
00047         qHandle.setCondition(conditionStr,qCondition)
00048         cursor=qHandle.execute()
00049         while cursor.next():
00050             candidates.append(cursor.currentRow()['revision_id'].data())
00051         del qHandle
00052         for c in candidates:
00053             if c in nextbranches:
00054                 continue
00055             result.append(c)
00056         return result
00057     except:
00058         if qHandle:del qHandle
        raise

Variable Documentation

tuple revisionDML::databranchinfo = (branchid,'DATA')

Definition at line 496 of file revisionDML.py.

tuple revisionDML::datainfo = createBranch(schema,'DATA','TRUNK',comment='hold data')

Definition at line 491 of file revisionDML.py.

tuple revisionDML::entryinfo = (revision_id,entry_id,str(runnum),data_id)

Definition at line 504 of file revisionDML.py.

tuple revisionDML::hltentryid = entryInBranch(schema,nameDealer.hltdataTableName(),str(runnum),'DATA')

Definition at line 501 of file revisionDML.py.

tuple revisionDML::latestrevision = latestDataRevisionOfEntry(schema,nameDealer.lumidataTableName(),lumientry_id,revlist)

Definition at line 538 of file revisionDML.py.

tuple revisionDML::lumientry_id = entryInBranch(schema,nameDealer.lumidataTableName(),'1211','DATA')

Definition at line 536 of file revisionDML.py.

tuple revisionDML::lumientryid = entryInBranch(schema,nameDealer.lumidataTableName(),str(runnum),'DATA')

Definition at line 499 of file revisionDML.py.

string revisionDML::myconstr = 'sqlite_file:test.db'

Definition at line 483 of file revisionDML.py.

tuple revisionDML::norminfo = createBranch(schema,'NORM','TRUNK',comment='hold normalization factor')

Definition at line 493 of file revisionDML.py.

tuple revisionDML::revisioninfo = bookNewRevision( schema,nameDealer.lumidataTableName() )

Definition at line 508 of file revisionDML.py.

tuple revisionDML::revlist = revisionsInBranchName(schema,'DATA')

Definition at line 534 of file revisionDML.py.

tuple revisionDML::schema = session.nominalSchema()

Definition at line 486 of file revisionDML.py.

tuple revisionDML::session = svc.openSession(isReadOnly=False,cpp2sqltype=[('unsigned int','NUMBER(10)'),('unsigned long long','NUMBER(20)')])

Definition at line 485 of file revisionDML.py.

Definition at line 484 of file revisionDML.py.

tuple revisionDML::tables = lumidbDDL.createTables(schema)

Definition at line 488 of file revisionDML.py.

tuple revisionDML::trgentryid = entryInBranch(schema,nameDealer.trgdataTableName(),str(runnum),'DATA')

Definition at line 500 of file revisionDML.py.

tuple revisionDML::trunkinfo = createBranch(schema,'TRUNK',None,comment='main')

Definition at line 489 of file revisionDML.py.