当前位置: 首页>>代码示例>>Python>>正文


Python CommonUtils.commentTableName方法代码示例

本文整理汇总了Python中CommonUtils.commentTableName方法的典型用法代码示例。如果您正苦于以下问题:Python CommonUtils.commentTableName方法的具体用法?Python CommonUtils.commentTableName怎么用?Python CommonUtils.commentTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CommonUtils的用法示例。


在下文中一共展示了CommonUtils.commentTableName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getCommentsForTable

# 需要导入模块: import CommonUtils [as 别名]
# 或者: from CommonUtils import commentTableName [as 别名]
 def getCommentsForTable( self, tableName ):
     """get all comments for given table
     result=[(entryid,comment)]
     """
     transaction=self.__session.transaction()
     result=[]
     
     try:
         transaction.start(True)
         schema = self.__session.nominalSchema()
         query = schema.tableHandle(CommonUtils.commentTableName()).newQuery()
         condition='tablename = :tablename'
         conditionbindDict=coral.AttributeList()
         conditionbindDict.extend('tablename','string')
         conditionbindDict['tablename'].setData(tableName)
         query.addToOutputList('entryid')
         query.addToOutputList('comment')
         query.setCondition(condition,conditionbindDict)
         cursor=query.execute()
         while cursor.next():
             comment=cursor.currentRow()['comment'].data()
             entryid=cursor.currentRow()['entryid'].data()
             result.append((entryid,comment))  
         cursor.close()
         transaction.commit()
         del query
         return result
     except Exception, e:
         transaction.rollback()
         raise Exception, str(e)
开发者ID:HeinerTholen,项目名称:cmssw,代码行数:32,代码来源:entryComment.py

示例2: getCommentForId

# 需要导入模块: import CommonUtils [as 别名]
# 或者: from CommonUtils import commentTableName [as 别名]
 def getCommentForId( self, tableName, entryid ):
     """get comment for given id in given table
     """
     transaction=self.__session.transaction()
     comment=''
     try:
         transaction.start(True)
         schema = self.__session.nominalSchema()
         query = schema.tableHandle(CommonUtils.commentTableName()).newQuery()
         condition='entryid = :entryid AND tablename = :tablename'
         conditionbindDict=coral.AttributeList()
         conditionbindDict.extend('entryid','unsigned long')
         conditionbindDict.extend('tablename','string')
         conditionbindDict['entryid'].setData(entryid)
         conditionbindDict['tablename'].setData(tableName)
         query.addToOutputList('comment')
         query.setCondition(condition,conditionbindDict)
         cursor=query.execute()
         if cursor.next():
             comment=cursor.currentRow()['comment'].data()
             cursor.close()
         transaction.commit()
         del query
         return comment
     except Exception, e:
         transaction.rollback()
         raise Exception, str(e)
开发者ID:HeinerTholen,项目名称:cmssw,代码行数:29,代码来源:entryComment.py

示例3: createEntryCommentTable

# 需要导入模块: import CommonUtils [as 别名]
# 或者: from CommonUtils import commentTableName [as 别名]
 def createEntryCommentTable(self):
     """Create entry comment able.Existing table will be deleted.
     """
     try:
        transaction=self.__session.transaction()
        transaction.start()
        schema = self.__session.nominalSchema()
        schema.dropIfExistsTable(CommonUtils.commentTableName())
        description = coral.TableDescription()
        description.setName(CommonUtils.commentTableName())
        for columnName, columnType in self.__entryCommentTableColumns.items():
            description.insertColumn(columnName,columnType)
        for columnName in self.__entryCommentTableNotNullColumns:
            description.setNotNullConstraint(columnName,True)
        description.setPrimaryKey(self.__entryCommentTablePK)
        tablehandle=schema.createTable(description)
        tablehandle.privilegeManager().grantToPublic(coral.privilege_Select)
        transaction.commit()
     except Exception, e:
        transaction.rollback() 
        raise Exception, str(e)
开发者ID:HeinerTholen,项目名称:cmssw,代码行数:23,代码来源:entryComment.py

示例4: existCommentTable

# 需要导入模块: import CommonUtils [as 别名]
# 或者: from CommonUtils import commentTableName [as 别名]
 def existCommentTable(self):
     """Check if entry comment table exists
     """
     try:
         transaction=self.__session.transaction()
         transaction.start(True)
         schema = self.__session.nominalSchema()
         result=schema.existsTable(CommonUtils.commentTableName())
         transaction.commit()
         #print result
     except Exception, er:
         transaction.rollback()
         raise Exception, str(er)
开发者ID:HeinerTholen,项目名称:cmssw,代码行数:15,代码来源:entryComment.py

示例5: bulkinsertComments

# 需要导入模块: import CommonUtils [as 别名]
# 或者: from CommonUtils import commentTableName [as 别名]
 def bulkinsertComments( self, tableName,bulkinput):
     """bulk insert comments for a given table
     bulkinput [{'entryid':unsigned long, 'tablename':string,'comment':string}]
     """
     transaction=self.__session.transaction()
     try:
         transaction.start(False)
         schema = self.__session.nominalSchema()
         dbop=DBImpl.DBImpl(schema)
         dbop.bulkInsert(CommonUtils.commentTableName(),self.__entryCommentTableColumns,bulkinput)
         transaction.commit()  
     except Exception, e:
         transaction.rollback()
         raise Exception, str(e)    
开发者ID:HeinerTholen,项目名称:cmssw,代码行数:16,代码来源:entryComment.py

示例6: insertComment

# 需要导入模块: import CommonUtils [as 别名]
# 或者: from CommonUtils import commentTableName [as 别名]
 def insertComment( self, tablename, entryid,comment ):
     """insert comment on the given entry of given table
     """
     transaction=self.__session.transaction()
     try:
         transaction.start(False)
         tabrowValueDict={'entryid':entryid,'tablename':tablename,'comment':comment}
         schema = self.__session.nominalSchema()
         dbop=DBImpl.DBImpl(schema)
         dbop.insertOneRow(CommonUtils.commentTableName(),self.__entryCommentTableColumns,tabrowValueDict)
         transaction.commit()
     except Exception, e:
         transaction.rollback()
         raise Exception, str(e)
开发者ID:HeinerTholen,项目名称:cmssw,代码行数:16,代码来源:entryComment.py

示例7: clearAllEntriesForTable

# 需要导入模块: import CommonUtils [as 别名]
# 或者: from CommonUtils import commentTableName [as 别名]
 def clearAllEntriesForTable( self, tablename ):
     """delete all entries related with given table
     """
     transaction=self.__session.transaction()
     try:
         transaction.start(False)
         dbop=DBImpl.DBImpl(self.__session.nominalSchema())
         condition='tablename = :tablename'
         conditionbindDict=coral.AttributeList()
         conditionbindDict.extend('tablename','string')
         conditionbindDict['tablename'].setData(tablename)
         dbop.deleteRows(CommonUtils.commentTableName(),condition,conditionbindDict)
         transaction.commit()
     except Exception, e:
         transaction.rollback()
         raise Exception, str(e)
开发者ID:HeinerTholen,项目名称:cmssw,代码行数:18,代码来源:entryComment.py

示例8: deleteCommentForId

# 需要导入模块: import CommonUtils [as 别名]
# 或者: from CommonUtils import commentTableName [as 别名]
 def deleteCommentForId( self, tablename, entryid):
     """delete selected comment entry 
     """
     transaction=self.__session.transaction()
     try:
         transaction.start(False)
         dbop=DBImpl.DBImpl(self.__session.nominalSchema())
         condition='tablename = :tablename AND entryid = :entryid'
         conditionbindDict=coral.AttributeList()
         conditionbindDict.extend('tablename','string')
         conditionbindDict.extend('entryid','unsigned long')
         conditionbindDict['tablename'].setData(tablename)
         conditionbindDict['entryid'].setData(entryid)
         dbop.deleteRows(CommonUtils.commentTableName(),condition,conditionbindDict)
         transaction.commit()
     except Exception, e:
         transaction.rollback()
         raise Exception, str(e)
开发者ID:HeinerTholen,项目名称:cmssw,代码行数:20,代码来源:entryComment.py

示例9: replaceId

# 需要导入模块: import CommonUtils [as 别名]
# 或者: from CommonUtils import commentTableName [as 别名]
 def replaceId( self, tableName, oldentryid, newentryid ):
     """replace entryid in given table
     """
     transaction=self.__session.transaction()
     try:
         transaction.start(False)
         editor = self.__session.nominalSchema().tableHandle(CommonUtils.commentTableName()).dataEditor()
         inputData = coral.AttributeList()
         inputData.extend('newentryid','unsigned long')
         inputData.extend('oldentryid','unsigned long')
         inputData.extend('tablename','string')
         inputData['newentryid'].setData(newentryid)
         inputData['oldentryid'].setData(oldentryid)
         inputData['tablename'].setData(tableName)
         editor.updateRows( "entryid = :newentryid", "entryid = :oldentryid AND tablename = :tablename", inputData )
         transaction.commit()
     except Exception, e:
         transaction.rollback()
         raise Exception, str(e)
开发者ID:HeinerTholen,项目名称:cmssw,代码行数:21,代码来源:entryComment.py

示例10: copyTrees

# 需要导入模块: import CommonUtils [as 别名]
# 或者: from CommonUtils import commentTableName [as 别名]
    def copyTrees( self, treenames ):
        """copy tree from an external source.
	Merge inventory if existing in the destination
        """
	allleafs=[]
        for treename in treenames:
            t=TagTree.tagTree(self.__sourcesession,treename)
            allleafs.append(t.getAllLeaves())
	#create a unique tag list
	merged={}
	for s in allleafs:
	  for x in s:
	    merged[x.tagid]=1
        sourceinv=tagInventory.tagInventory(self.__sourcesession)
        sourcetags=sourceinv.getAllEntries()
        entries=[]
        for i in merged.keys():
            for n in sourcetags:
                if n.tagid==i:
                    entry={}
                    entry['tagid']=i
                    entry['tagname']=n.tagname
                    entry['pfn']=n.pfn
                    entry['recordname']=n.recordname
                    entry['objectname']=n.objectname
                    entry['labelname']=n.labelname
                    entries.append(entry)
        inv=tagInventory.tagInventory(self.__destsession)
	tagiddict=inv.bulkInsertEntries(entries)
        dest_transaction=self.__destsession.transaction()
        source_transaction=self.__sourcesession.transaction()
        #copy table contents
	try:
	  for treename in treenames:
              desttree=TagTree.tagTree(self.__destsession,treename)
              desttree.createTagTreeTable()
	      dest_transaction.start(False)
	      source_transaction.start(True)
	      #copy tree tables
	      data=coral.AttributeList()
	      dest_editor=self.__destsession.nominalSchema().tableHandle(CommonUtils.treeTableName(treename)).dataEditor()
	      source_query=self.__sourcesession.nominalSchema().tableHandle(CommonUtils.treeTableName(treename)).newQuery()
	      conditionData=coral.AttributeList()
	      source_query.setCondition('',conditionData)
	      source_query.setRowCacheSize(self.__rowcachesize)
              dest_editor.rowBuffer(data)
	      source_query.defineOutput(data)
	      bulkOperation=dest_editor.bulkInsert(data,self.__rowcachesize)
	      cursor=source_query.execute()
              while cursor.next():
	          bulkOperation.processNextIteration()
	      bulkOperation.flush()
	      del bulkOperation
	      del source_query
	      #copy id tables
              iddata=coral.AttributeList()
	      dest_editor=self.__destsession.nominalSchema().tableHandle(CommonUtils.treeIDTableName(treename)).dataEditor()
	      source_query=self.__sourcesession.nominalSchema().tableHandle(CommonUtils.treeIDTableName(treename)).newQuery()
	      conditionData=coral.AttributeList()
	      source_query.setCondition('',conditionData)
	      source_query.setRowCacheSize(self.__rowcachesize)
              dest_editor.rowBuffer(iddata)
	      source_query.defineOutput(iddata)
	      bulkOperation=dest_editor.bulkInsert(iddata,self.__rowcachesize)
	      cursor=source_query.execute()
              while cursor.next():
	          bulkOperation.processNextIteration()
	      bulkOperation.flush()
	      del bulkOperation
	      del source_query
              #copy comment tables if exist
              if self.__sourcesession.nominalSchema().existsTable(CommonUtils.commentTableName()):
                  data=coral.AttributeList()
                  dest_editor=self.__destsession.nominalSchema().tableHandle(CommonUtils.commentTableName()).dataEditor()
                  source_query=self.__sourcesession.nominalSchema().tableHandle(CommonUtils.commentTableName()).newQuery()
                  conditionData=coral.AttributeList()
                  source_query.setCondition('tablename = :tablename',conditionData)
                  conditionData.extend('tablename','string')
                  conditionData['tablename'].setData(CommonUtils.treeTableName(treename))
                  source_query.setRowCacheSize(self.__rowcachesize)
                  dest_editor.rowBuffer(data)
                  source_query.defineOutput(data)
                  bulkOperation=dest_editor.bulkInsert(data,self.__rowcachesize)
                  cursor=source_query.execute()
                  while cursor.next():
                      bulkOperation.processNextIteration()
                  bulkOperation.flush()
                  del bulkOperation
                  del source_query
              
	      source_transaction.commit()
	      dest_transaction.commit()
	      #fix leaf node links
	      desttree.replaceLeafLinks(tagiddict)
        except Exception, e:
            source_transaction.rollback()
            dest_transaction.rollback()
            raise Exception, str(e)
开发者ID:HeinerTholen,项目名称:cmssw,代码行数:100,代码来源:DBCopy.py

示例11: copyInventory

# 需要导入模块: import CommonUtils [as 别名]
# 或者: from CommonUtils import commentTableName [as 别名]
    def copyInventory( self ):
        """copy entire inventory. The original inventory in the source db will be wiped.
	"""
        inv=tagInventory.tagInventory(self.__destsession)
        inv.createInventoryTable()
        dest_transaction=self.__destsession.transaction()
        source_transaction=self.__sourcesession.transaction()
        try:
	    dest_transaction.start(False)
            #copy inventory table
            data=coral.AttributeList()
            my_editor=self.__destsession.nominalSchema().tableHandle(CommonUtils.inventoryTableName()).dataEditor()
            source_transaction.start(True)
            source_query=self.__sourcesession.nominalSchema().tableHandle(CommonUtils.inventoryTableName()).newQuery()
            conditionData=coral.AttributeList()
            source_query.setCondition('',conditionData)
            source_query.setRowCacheSize(self.__rowcachesize)
            my_editor.rowBuffer(data)
            source_query.defineOutput(data)
            bulkOperation=my_editor.bulkInsert(data,self.__rowcachesize)
            cursor=source_query.execute()
            while (cursor.next() ):
                bulkOperation.processNextIteration()
            bulkOperation.flush()
            del bulkOperation
            del source_query

            #copy inventory id table
            source_query=self.__sourcesession.nominalSchema().tableHandle(CommonUtils.inventoryIDTableName()).newQuery()
            my_ideditor=self.__destsession.nominalSchema().tableHandle(CommonUtils.inventoryIDTableName()).dataEditor()
            iddata=coral.AttributeList()            
            source_query.setCondition('',conditionData)
            source_query.setRowCacheSize(self.__rowcachesize)
            my_ideditor.rowBuffer(iddata)
            source_query.defineOutput(iddata)
            bulkOperation=my_ideditor.bulkInsert(iddata,self.__rowcachesize)
            cursor=source_query.execute()
            while cursor.next():
                bulkOperation.processNextIteration()
            bulkOperation.flush()
            del bulkOperation
            del source_query

            #copy comment table if exists
            if self.__sourcesession.nominalSchema().existsTable(CommonUtils.commentTableName()):
                source_query=self.__sourcesession.nominalSchema().tableHandle(CommonUtils.commentTableName()).newQuery()
                my_commenteditor=self.__destsession.nominalSchema().tableHandle(CommonUtils.commentTableName()).dataEditor()
                commentdata=coral.AttributeList()
                qcondition=coral.AttributeList()
                qcondition.extend('tablename','string')
                qcondition['tablename'].setData(CommonUtils.commentTableName())
                source_query.setCondition('tablename = :tablename',qcondition)
                source_query.setRowCacheSize(self.__rowcachesize)
                my_commenteditor.rowBuffer(commentdata)
                source_query.defineOutput(commentdata)
                bulkOperation=my_commenteditor.bulkInsert(commentdata,self.__rowcachesize)
                cursor=source_query.execute()
                while cursor.next():
                    bulkOperation.processNextIteration()
                bulkOperation.flush()
                del bulkOperation
                del source_query
            
            source_transaction.commit()
            dest_transaction.commit()
        except Exception, e:
            source_transaction.rollback()
            dest_transaction.rollback()
            raise Exception, str(e)
开发者ID:HeinerTholen,项目名称:cmssw,代码行数:71,代码来源:DBCopy.py

示例12: str

# 需要导入模块: import CommonUtils [as 别名]
# 或者: from CommonUtils import commentTableName [as 别名]
	except Exception, e:
	   source_transaction.rollback()
	   raise Exception, str(e)
	try:
	   i = tablelist.index(CommonUtils.inventoryTableName())
	   alltablelist.append(CommonUtils.inventoryTableName())
	except ValueError:
	   raise 'Error: '+CommonUtils.inventoryTableName()+' does not exist in the source'
	try:
	   i = tablelist.index(CommonUtils.inventoryIDTableName())
	   alltablelist.append(CommonUtils.inventoryIDTableName())
	except ValueError:
	   raise 'Error: '+CommonUtils.inventoryIDTableName()+' does not exist'

	try:
	   i = tablelist.index(CommonUtils.commentTableName())
	   alltablelist.append(CommonUtils.commentTableName())
	except ValueError:
           pass
	
	for tablename in tablelist:
	   posbeg=tablename.find('TAGTREE_TABLE_')
	   if posbeg != -1:
	      treename=tablename[posbeg+len('TAGTREE_TABLE_'):]
              trees.append(treename)
        for tree in trees:
            try:
              tablelist.index(CommonUtils.treeIDTableName(tree))
            except ValueError:
              print 'non-existing id table for tree ',tree  
              continue
开发者ID:HeinerTholen,项目名称:cmssw,代码行数:33,代码来源:DBCopy.py


注:本文中的CommonUtils.commentTableName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。